OLD | NEW |
| (Empty) |
1 // DO NOT EDIT! This test has been generated by tools/gentest.py. | |
2 // OffscreenCanvas test in a worker:2d.path.isPointInPath.winding | |
3 // Description:isPointInPath() uses the non-zero winding number rule | |
4 // Note: | |
5 | |
6 importScripts("/resources/testharness.js"); | |
7 importScripts("/common/canvas-tests.js"); | |
8 | |
9 var t = async_test("isPointInPath() uses the non-zero winding number rule"); | |
10 t.step(function() { | |
11 | |
12 var offscreenCanvas = new OffscreenCanvas(100, 50); | |
13 var ctx = offscreenCanvas.getContext('2d'); | |
14 | |
15 // Create a square ring, using opposite windings to make a hole in the centre | |
16 ctx.moveTo(0, 0); | |
17 ctx.lineTo(50, 0); | |
18 ctx.lineTo(50, 50); | |
19 ctx.lineTo(0, 50); | |
20 ctx.lineTo(0, 0); | |
21 ctx.lineTo(10, 10); | |
22 ctx.lineTo(10, 40); | |
23 ctx.lineTo(40, 40); | |
24 ctx.lineTo(40, 10); | |
25 ctx.lineTo(10, 10); | |
26 _assertSame(ctx.isPointInPath(5, 5), true, "ctx.isPointInPath(5, 5)", "true"); | |
27 _assertSame(ctx.isPointInPath(25, 5), true, "ctx.isPointInPath(25, 5)", "true"); | |
28 _assertSame(ctx.isPointInPath(45, 5), true, "ctx.isPointInPath(45, 5)", "true"); | |
29 _assertSame(ctx.isPointInPath(5, 25), true, "ctx.isPointInPath(5, 25)", "true"); | |
30 _assertSame(ctx.isPointInPath(25, 25), false, "ctx.isPointInPath(25, 25)", "fals
e"); | |
31 _assertSame(ctx.isPointInPath(45, 25), true, "ctx.isPointInPath(45, 25)", "true"
); | |
32 _assertSame(ctx.isPointInPath(5, 45), true, "ctx.isPointInPath(5, 45)", "true"); | |
33 _assertSame(ctx.isPointInPath(25, 45), true, "ctx.isPointInPath(25, 45)", "true"
); | |
34 _assertSame(ctx.isPointInPath(45, 45), true, "ctx.isPointInPath(45, 45)", "true"
); | |
35 | |
36 t.done(); | |
37 | |
38 }); | |
39 done(); | |
OLD | NEW |