1 description("Test that setting various CanvasRenderingContext2D properties to invalid values has no effect.");
3 ctx = document.createElement('canvas').getContext('2d');
5 function trySettingMiterLimit(value) {
7 ctx.miterLimit = value;
11 function trySettingLineWidth(value) {
13 ctx.lineWidth = value;
17 function trySettingShadowBlur(value) {
19 ctx.shadowBlur = value;
20 return ctx.shadowBlur;
23 function trySettingShadowOffsetX(value) {
24 ctx.shadowOffsetX = 1.5;
25 ctx.shadowOffsetX = value;
26 return ctx.shadowOffsetX;
29 function trySettingShadowOffsetY(value) {
30 ctx.shadowOffsetY = 1.5;
31 ctx.shadowOffsetY = value;
32 return ctx.shadowOffsetY;
35 shouldBe("trySettingMiterLimit(1)", "1");
36 shouldBe("trySettingMiterLimit(0)", "1.5");
37 shouldBe("trySettingMiterLimit(-1)", "1.5");
38 shouldBe("trySettingMiterLimit(Infinity)", "1.5");
39 shouldBe("trySettingMiterLimit(-Infinity)", "1.5");
40 shouldBe("trySettingMiterLimit(NaN)", "1.5");
41 shouldBe("trySettingMiterLimit('string')", "1.5");
42 shouldBe("trySettingMiterLimit(true)", "1");
43 shouldBe("trySettingMiterLimit(false)", "1.5");
45 shouldBe("trySettingLineWidth(1)", "1");
46 shouldBe("trySettingLineWidth(0)", "1.5");
47 shouldBe("trySettingLineWidth(-1)", "1.5");
48 shouldBe("trySettingLineWidth(Infinity)", "1.5");
49 shouldBe("trySettingLineWidth(-Infinity)", "1.5");
50 shouldBe("trySettingLineWidth(NaN)", "1.5");
51 shouldBe("trySettingLineWidth('string')", "1.5");
52 shouldBe("trySettingLineWidth(true)", "1");
53 shouldBe("trySettingLineWidth(false)", "1.5");
55 shouldBe("trySettingShadowBlur(1)", "1");
56 shouldBe("trySettingShadowBlur(0)", "0");
57 shouldBe("trySettingShadowBlur(-1)", "1.5");
58 shouldBe("trySettingShadowBlur(Infinity)", "1.5");
59 shouldBe("trySettingShadowBlur(-Infinity)", "1.5");
60 shouldBe("trySettingShadowBlur(NaN)", "1.5");
61 shouldBe("trySettingShadowBlur('string')", "1.5");
62 shouldBe("trySettingShadowBlur(true)", "1");
63 shouldBe("trySettingShadowBlur(false)", "0");
65 shouldBe("trySettingShadowOffsetX(1)", "1");
66 shouldBe("trySettingShadowOffsetX(0)", "0");
67 shouldBe("trySettingShadowOffsetX(-1)", "-1");
68 shouldBe("trySettingShadowOffsetX(Infinity)", "1.5");
69 shouldBe("trySettingShadowOffsetX(-Infinity)", "1.5");
70 shouldBe("trySettingShadowOffsetX(NaN)", "1.5");
71 shouldBe("trySettingShadowOffsetX('string')", "1.5");
72 shouldBe("trySettingShadowOffsetX(true)", "1");
73 shouldBe("trySettingShadowOffsetX(false)", "0");
75 shouldBe("trySettingShadowOffsetY(1)", "1");
76 shouldBe("trySettingShadowOffsetY(0)", "0");
77 shouldBe("trySettingShadowOffsetY(-1)", "-1");
78 shouldBe("trySettingShadowOffsetY(Infinity)", "1.5");
79 shouldBe("trySettingShadowOffsetY(-Infinity)", "1.5");
80 shouldBe("trySettingShadowOffsetY(NaN)", "1.5");
81 shouldBe("trySettingShadowOffsetY('string')", "1.5");
82 shouldBe("trySettingShadowOffsetY(true)", "1");
83 shouldBe("trySettingShadowOffsetY(false)", "0");