OLD | NEW |
| (Empty) |
1 <!DOCTYPE html> | |
2 <!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> | |
3 <title>OffscreenCanvas test: 2d.line.join.round</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.line.join.round</h1> | |
9 <p class="desc">lineJoin 'round' is rendered correctly</p> | |
10 | |
11 | |
12 <script> | |
13 var t = async_test("lineJoin 'round' is rendered correctly"); | |
14 t.step(function() { | |
15 | |
16 var offscreenCanvas = new OffscreenCanvas(100, 50); | |
17 var ctx = offscreenCanvas.getContext('2d'); | |
18 | |
19 ctx.fillStyle = '#0f0'; | |
20 ctx.fillRect(0, 0, 100, 50); | |
21 var tol = 1; // tolerance to avoid antialiasing artifacts | |
22 ctx.lineJoin = 'round'; | |
23 ctx.lineWidth = 20; | |
24 ctx.fillStyle = '#f00'; | |
25 ctx.strokeStyle = '#0f0'; | |
26 ctx.fillRect(10, 10, 20, 20); | |
27 ctx.fillRect(20, 20, 20, 20); | |
28 ctx.beginPath(); | |
29 ctx.moveTo(30, 20); | |
30 ctx.arc(30, 20, 10-tol, 0, 2*Math.PI, true); | |
31 ctx.fill(); | |
32 ctx.beginPath(); | |
33 ctx.moveTo(10, 20); | |
34 ctx.lineTo(30, 20); | |
35 ctx.lineTo(30, 40); | |
36 ctx.stroke(); | |
37 ctx.fillStyle = '#0f0'; | |
38 ctx.strokeStyle = '#f00'; | |
39 ctx.beginPath(); | |
40 ctx.moveTo(60, 20); | |
41 ctx.lineTo(80, 20); | |
42 ctx.lineTo(80, 40); | |
43 ctx.stroke(); | |
44 ctx.fillRect(60, 10, 20, 20); | |
45 ctx.fillRect(70, 20, 20, 20); | |
46 ctx.beginPath(); | |
47 ctx.moveTo(80, 20); | |
48 ctx.arc(80, 20, 10+tol, 0, 2*Math.PI, true); | |
49 ctx.fill(); | |
50 _assertPixel(offscreenCanvas, 36,14, 0,255,0,255, "36,14", "0,255,0,255"); | |
51 _assertPixel(offscreenCanvas, 36,13, 0,255,0,255, "36,13", "0,255,0,255"); | |
52 _assertPixel(offscreenCanvas, 37,13, 0,255,0,255, "37,13", "0,255,0,255"); | |
53 _assertPixel(offscreenCanvas, 38,13, 0,255,0,255, "38,13", "0,255,0,255"); | |
54 _assertPixel(offscreenCanvas, 38,12, 0,255,0,255, "38,12", "0,255,0,255"); | |
55 _assertPixel(offscreenCanvas, 86,14, 0,255,0,255, "86,14", "0,255,0,255"); | |
56 _assertPixel(offscreenCanvas, 86,13, 0,255,0,255, "86,13", "0,255,0,255"); | |
57 _assertPixel(offscreenCanvas, 87,13, 0,255,0,255, "87,13", "0,255,0,255"); | |
58 _assertPixel(offscreenCanvas, 88,13, 0,255,0,255, "88,13", "0,255,0,255"); | |
59 _assertPixel(offscreenCanvas, 88,12, 0,255,0,255, "88,12", "0,255,0,255"); | |
60 | |
61 t.done(); | |
62 | |
63 }); | |
64 </script> | |
OLD | NEW |