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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/canvas/canvas-hit-regions-path2d-transform-test.html

Issue 2679193002: Use testharness.js instead of js-test.js in LayoutTests/fast/canvas tests. (Closed)
Patch Set: Addressing comments 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
OLDNEW
1 <!DOCTYPE html> 1 <script src="../../resources/testharness.js"></script>
2 <html> 2 <script src="../../resources/testharnessreport.js"></script>
3 <head>
4 <title>Canvas Hit Regions: path2d with transform test</title>
5 <script src="../../resources/js-test.js"></script>
6 </head>
7 <body> 3 <body>
8 <canvas id="canvas" width="400" height="400"></canvas> 4 <canvas id="canvas" width="400" height="400"></canvas>
9 <script src="./resources/canvas-hit-region-event.js"></script> 5 <script src="./resources/canvas-hit-region-event.js"></script>
10 <script> 6 <script>
7 test(function(t) {
11 8
12 var canvas = document.getElementById("canvas"); 9 var canvas = document.getElementById("canvas");
13 var context = canvas.getContext("2d"); 10 var context = canvas.getContext("2d");
14 var testSet = []; 11 var testSet = [];
15 12
16 function clickTests(message, tests) 13 function clickTests(message, tests)
17 { 14 {
18 testSet.push({
19 type : "debug",
20 message : message
21 });
22
23 for (var i = 0; i < tests.length; i++) 15 for (var i = 0; i < tests.length; i++)
24 testSet.push({ 16 testSet.push({
25 type : "shouldBe",
26 actual : clickCanvas(tests[i].x, tests[i].y), 17 actual : clickCanvas(tests[i].x, tests[i].y),
27 expected : tests[i].expected 18 expected : tests[i].expected
28 }); 19 });
29
30 testSet.push({
31 type : "debug",
32 message : ""
33 });
34 } 20 }
35 21
36 function createHitRegion(transformMethod, isRect) 22 function createHitRegion(transformMethod, isRect)
37 { 23 {
38 context.removeHitRegion("hit"); 24 context.removeHitRegion("hit");
39 context.save(); 25 context.save();
40 transformMethod(); 26 transformMethod();
41 context.addHitRegion({ 27 context.addHitRegion({
42 id : "hit", 28 id : "hit",
43 path : drawSomething(isRect) 29 path : drawSomething(isRect)
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 { x : 36, y : 12, expected : null }, 137 { x : 36, y : 12, expected : null },
152 { x : 40, y : 33, expected : null }, 138 { x : 40, y : 33, expected : null },
153 { x : 9, y : 31, expected : null }, 139 { x : 9, y : 31, expected : null },
154 { x : 18, y : 41, expected : "hit" }, 140 { x : 18, y : 41, expected : "hit" },
155 { x : 12, y : 25, expected : "hit" }, 141 { x : 12, y : 25, expected : "hit" },
156 { x : 25, y : 42, expected : null }, 142 { x : 25, y : 42, expected : null },
157 ]); 143 ]);
158 144
159 for (var i = 0; i < testSet.length; i++) { 145 for (var i = 0; i < testSet.length; i++) {
160 var test = testSet[i]; 146 var test = testSet[i];
161 147 window.region = test.expected;
162 if (test.type == "debug") { 148 assert_equals(region, test.actual);
163 debug(test.message);
164 }
165 else if (test.type == "shouldBe") {
166 window.region = test.expected;
167 if (test.expected == null)
168 shouldBe("region", String(test.actual));
169 else
170 shouldBe("region", "'" + test.actual + "'");
171 }
172 } 149 }
173 150
151 }, 'Canvas Hit Regions: path2d with transform test');
174 </script> 152 </script>
175 </body> 153 </body>
176 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698