Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(176)

Side by Side Diff: third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-lineDash-invalid.js

Issue 2681423002: Use testharness.js instead of js-test.js in LayoutTests/fast/canvas tests. (Closed)
Patch Set: Adding exceptions to TestExpectations Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-lineDash.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 description("Test for invalid input of setLineDash, getLineDash and lineDashOffs et");
2
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');
8 var initialLineDash = [1.5, 2.5];
9 var initialLineDashOffset = 1.5;
10
11 function resetLineDash() {
12 ctx.setLineDash(initialLineDash);
13 ctx.lineDashOffset = initialLineDashOffset;
14 }
15
16 function trySettingLineDash(value) {
17 resetLineDash();
18 ctx.setLineDash(value);
19 return ctx.getLineDash();
20 }
21
22 function trySettingLineDashWithNoArgs() {
23 resetLineDash();
24 ctx.setLineDash();
25 return ctx.getLineDash();
26 }
27
28 function trySettingLineDashOffset(value) {
29 resetLineDash();
30 ctx.lineDashOffset = value;
31 return ctx.lineDashOffset;
32 }
33
34 shouldBe("trySettingLineDash([1, -1])", "initialLineDash");
35 shouldBe("trySettingLineDash([1, Infinity])", "initialLineDash");
36 shouldBe("trySettingLineDash([1, -Infinity])", "initialLineDash");
37 shouldBe("trySettingLineDash([1, NaN])", "initialLineDash");
38 shouldBe("trySettingLineDash([1, 'string'])", "initialLineDash");
39 shouldThrow("trySettingLineDashWithNoArgs()", '"TypeError: Failed to execute \'s etLineDash\' on \'CanvasRenderingContext2D\': 1 argument required, but only 0 pr esent."');
40
41 shouldBe("trySettingLineDashOffset(Infinity)", "initialLineDashOffset");
42 shouldBe("trySettingLineDashOffset(-Infinity)", "initialLineDashOffset");
43 shouldBe("trySettingLineDashOffset(NaN)", "initialLineDashOffset");
44 shouldBe("trySettingLineDashOffset('string')", "initialLineDashOffset");
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-lineDash.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698