1 description("Test for invalid input of webkitLineDash and webkitLineDashOffset");
3 var canvas = document.createElement('canvas');
4 document.body.appendChild(canvas);
5 canvas.setAttribute('width', '700');
6 canvas.setAttribute('height', '700');
7 var ctx = canvas.getContext('2d');
9 function trySettingLineDash(value) {
10 ctx.webkitLineDash = [1.5, 2.5];
11 ctx.webkitLineDash = value;
12 return ctx.webkitLineDash;
15 function trySettingLineDashOffset(value) {
16 ctx.webkitLineDashOffset = 1.5;
17 ctx.webkitLineDashOffset = value;
18 return ctx.webkitLineDashOffset;
21 shouldBe("trySettingLineDash([1, 2, 3])", "[1, 2, 3]");
22 shouldBe("trySettingLineDash([1, -1])", "[1.5, 2.5]");
23 shouldBe("trySettingLineDash([1, Infinity])", "[1.5, 2.5]");
24 shouldBe("trySettingLineDash([1, -Infinity])", "[1.5, 2.5]");
25 shouldBe("trySettingLineDash([1, NaN])", "[1.5, 2.5]");
26 shouldBe("trySettingLineDash([1, 'string'])", "[1.5, 2.5]");
28 shouldBe("trySettingLineDashOffset(0.5)", "0.5");
29 shouldBe("trySettingLineDashOffset(-0.5)", "-0.5");
30 shouldBe("trySettingLineDashOffset(Infinity)", "1.5");
31 shouldBe("trySettingLineDashOffset(-Infinity)", "1.5");
32 shouldBe("trySettingLineDashOffset(NaN)", "1.5");
33 shouldBe("trySettingLineDashOffset('string')", "1.5");