OLD | NEW |
| (Empty) |
1 // DO NOT EDIT! This test has been generated by tools/gentest.py. | |
2 // OffscreenCanvas test in a worker:2d.path.stroke.skew | |
3 // Description:Strokes lines are skewed by the current transformation matrix | |
4 // Note: | |
5 | |
6 importScripts("/resources/testharness.js"); | |
7 importScripts("/common/canvas-tests.js"); | |
8 | |
9 var t = async_test("Strokes lines are skewed by the current transformation matri
x"); | |
10 t.step(function() { | |
11 | |
12 var offscreenCanvas = new OffscreenCanvas(100, 50); | |
13 var ctx = offscreenCanvas.getContext('2d'); | |
14 | |
15 ctx.fillStyle = '#f00'; | |
16 ctx.fillRect(0, 0, 100, 50); | |
17 ctx.save(); | |
18 ctx.beginPath(); | |
19 ctx.moveTo(49, -50); | |
20 ctx.lineTo(201, -50); | |
21 ctx.rotate(Math.PI/4); | |
22 ctx.scale(1, 283); | |
23 ctx.strokeStyle = '#0f0'; | |
24 ctx.stroke(); | |
25 ctx.restore(); | |
26 ctx.save(); | |
27 ctx.beginPath(); | |
28 ctx.translate(-150, 0); | |
29 ctx.moveTo(49, -50); | |
30 ctx.lineTo(199, -50); | |
31 ctx.rotate(Math.PI/4); | |
32 ctx.scale(1, 142); | |
33 ctx.strokeStyle = '#f00'; | |
34 ctx.stroke(); | |
35 ctx.restore(); | |
36 ctx.save(); | |
37 ctx.beginPath(); | |
38 ctx.translate(-150, 0); | |
39 ctx.moveTo(49, -50); | |
40 ctx.lineTo(199, -50); | |
41 ctx.rotate(Math.PI/4); | |
42 ctx.scale(1, 142); | |
43 ctx.strokeStyle = '#f00'; | |
44 ctx.stroke(); | |
45 ctx.restore(); | |
46 _assertPixel(offscreenCanvas, 0,0, 0,255,0,255, "0,0", "0,255,0,255"); | |
47 _assertPixel(offscreenCanvas, 50,0, 0,255,0,255, "50,0", "0,255,0,255"); | |
48 _assertPixel(offscreenCanvas, 99,0, 0,255,0,255, "99,0", "0,255,0,255"); | |
49 _assertPixel(offscreenCanvas, 0,25, 0,255,0,255, "0,25", "0,255,0,255"); | |
50 _assertPixel(offscreenCanvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); | |
51 _assertPixel(offscreenCanvas, 99,25, 0,255,0,255, "99,25", "0,255,0,255"); | |
52 _assertPixel(offscreenCanvas, 0,49, 0,255,0,255, "0,49", "0,255,0,255"); | |
53 _assertPixel(offscreenCanvas, 50,49, 0,255,0,255, "50,49", "0,255,0,255"); | |
54 _assertPixel(offscreenCanvas, 99,49, 0,255,0,255, "99,49", "0,255,0,255"); | |
55 | |
56 t.done(); | |
57 | |
58 }); | |
59 done(); | |
OLD | NEW |