OLD | NEW |
---|---|
(Empty) | |
1 <!DOCTYPE html> | |
2 <canvas id = 'dstCanvas' width='100' height='100'></canvas> | |
3 <script src="../../../resources/testharness.js"></script> | |
4 <script src="../../../resources/testharnessreport.js"></script> | |
5 <script> | |
6 | |
7 function testCanvasReset(ctx) { | |
8 var colorData = ctx.getImageData(50, 50, 1, 1).data; | |
Justin Novosad
2016/08/16 20:52:07
This test is going to crash. There is no 'getImage
zakerinasab
2016/08/17 20:39:28
Corrected.
| |
9 assert_equals(colorData[0], 0); | |
10 assert_equals(colorData[1], 0); | |
11 assert_equals(colorData[2], 0); | |
12 assert_equals(colorData[3], 0); | |
13 } | |
14 | |
15 function testCanvas_0f0(ctx) { | |
16 var colorData = ctx.getImageData(50, 50, 1, 1).data; | |
Justin Novosad
2016/08/16 20:52:07
Same here
zakerinasab
2016/08/17 20:39:28
Acknowledged.
| |
17 assert_equals(colorData[0], 0); | |
18 assert_equals(colorData[1], 255); | |
19 assert_equals(colorData[2], 0); | |
20 assert_equals(colorData[3], 255); | |
21 } | |
22 | |
23 function testNullParameterTransferFromImageBitmap(image) { | |
24 var dstCanvas = document.getElementById('dstCanvas'); | |
25 var dstCtx = dstCanvas.getContext('bitmaprenderer'); | |
26 dstCtx.transferFromImageBitmap(image); | |
27 testCanvas_0f0(ctx); | |
28 //Calling transferFromImageBitmap(null) must reset dstCtx | |
29 dstCtx.transferFromImageBitmap(null); | |
30 testCanvasReset(dstCtx); | |
31 } | |
32 | |
33 test(function() { | |
34 var canvas = document.createElement('canvas'); | |
35 canvas.width = canvas.height = 100; | |
36 var ctx = canvas.getContext('2d'); | |
37 testCanvasReset(ctx); | |
38 | |
39 ctx.fillStyle = '#0f0'; | |
40 ctx.fillRect(0, 0, 100, 100); | |
41 testCanvas_0f0(ctx); | |
42 | |
43 createImageBitmap(canvas).then(testNullParameterTransferFromImageBitmap); | |
Justin Novosad
2016/08/16 20:52:07
The test will end before testNullParameterTransfer
zakerinasab
2016/08/17 20:39:28
Acknowledged.
| |
44 }, 'testNullParameterTransferFromImageBitmap should not return any error'); | |
45 | |
46 </script> | |
OLD | NEW |