OLD | NEW |
| (Empty) |
1 <!DOCTYPE html> | |
2 <!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> | |
3 <title>OffscreenCanvas test: 2d.imageData.put.dirty.outside</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.imageData.put.dirty.outside</h1> | |
9 <p class="desc">putImageData() handles dirty rectangles outside the canvas corre
ctly</p> | |
10 | |
11 | |
12 <script> | |
13 var t = async_test("putImageData() handles dirty rectangles outside the canvas c
orrectly"); | |
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 var imgdata = ctx.getImageData(0, 0, 100, 50); | |
22 ctx.fillStyle = '#0f0'; | |
23 ctx.fillRect(0, 0, 100, 50) | |
24 ctx.putImageData(imgdata, 100, 20, 20, 20, -20, -20); | |
25 ctx.putImageData(imgdata, 200, 200, 0, 0, 100, 50); | |
26 ctx.putImageData(imgdata, 40, 20, -30, -20, 30, 20); | |
27 ctx.putImageData(imgdata, -30, 20, 0, 0, 30, 20); | |
28 _assertPixelApprox(offscreenCanvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255",
2); | |
29 _assertPixelApprox(offscreenCanvas, 98,15, 0,255,0,255, "98,15", "0,255,0,255",
2); | |
30 _assertPixelApprox(offscreenCanvas, 98,25, 0,255,0,255, "98,25", "0,255,0,255",
2); | |
31 _assertPixelApprox(offscreenCanvas, 98,45, 0,255,0,255, "98,45", "0,255,0,255",
2); | |
32 _assertPixelApprox(offscreenCanvas, 1,5, 0,255,0,255, "1,5", "0,255,0,255", 2); | |
33 _assertPixelApprox(offscreenCanvas, 1,25, 0,255,0,255, "1,25", "0,255,0,255", 2)
; | |
34 _assertPixelApprox(offscreenCanvas, 1,45, 0,255,0,255, "1,45", "0,255,0,255", 2)
; | |
35 | |
36 t.done(); | |
37 | |
38 }); | |
39 </script> | |
OLD | NEW |