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.stroke.skew</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.stroke.skew</h1> | |
9 <p class="desc">Strokes lines are skewed by the current transformation matrix</p
> | |
10 | |
11 | |
12 <script> | |
13 var t = async_test("Strokes lines are skewed by the current transformation matri
x"); | |
14 t.step(function() { | |
15 | |
16 var offscreenCanvas = new OffscreenCanvas(100, 50); | |
17 var ctx = offscreenCanvas.getContext('2d'); | |
18 | |
19 ctx.fillStyle = '#f00'; | |
20 ctx.fillRect(0, 0, 100, 50); | |
21 ctx.save(); | |
22 ctx.beginPath(); | |
23 ctx.moveTo(49, -50); | |
24 ctx.lineTo(201, -50); | |
25 ctx.rotate(Math.PI/4); | |
26 ctx.scale(1, 283); | |
27 ctx.strokeStyle = '#0f0'; | |
28 ctx.stroke(); | |
29 ctx.restore(); | |
30 ctx.save(); | |
31 ctx.beginPath(); | |
32 ctx.translate(-150, 0); | |
33 ctx.moveTo(49, -50); | |
34 ctx.lineTo(199, -50); | |
35 ctx.rotate(Math.PI/4); | |
36 ctx.scale(1, 142); | |
37 ctx.strokeStyle = '#f00'; | |
38 ctx.stroke(); | |
39 ctx.restore(); | |
40 ctx.save(); | |
41 ctx.beginPath(); | |
42 ctx.translate(-150, 0); | |
43 ctx.moveTo(49, -50); | |
44 ctx.lineTo(199, -50); | |
45 ctx.rotate(Math.PI/4); | |
46 ctx.scale(1, 142); | |
47 ctx.strokeStyle = '#f00'; | |
48 ctx.stroke(); | |
49 ctx.restore(); | |
50 _assertPixel(offscreenCanvas, 0,0, 0,255,0,255, "0,0", "0,255,0,255"); | |
51 _assertPixel(offscreenCanvas, 50,0, 0,255,0,255, "50,0", "0,255,0,255"); | |
52 _assertPixel(offscreenCanvas, 99,0, 0,255,0,255, "99,0", "0,255,0,255"); | |
53 _assertPixel(offscreenCanvas, 0,25, 0,255,0,255, "0,25", "0,255,0,255"); | |
54 _assertPixel(offscreenCanvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255"); | |
55 _assertPixel(offscreenCanvas, 99,25, 0,255,0,255, "99,25", "0,255,0,255"); | |
56 _assertPixel(offscreenCanvas, 0,49, 0,255,0,255, "0,49", "0,255,0,255"); | |
57 _assertPixel(offscreenCanvas, 50,49, 0,255,0,255, "50,49", "0,255,0,255"); | |
58 _assertPixel(offscreenCanvas, 99,49, 0,255,0,255, "99,49", "0,255,0,255"); | |
59 | |
60 t.done(); | |
61 | |
62 }); | |
63 </script> | |
OLD | NEW |