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