OLD | NEW |
---|---|
(Empty) | |
1 <!DOCTYPE html> | |
Justin Novosad
2016/08/18 15:27:27
the "-harness" in the filename is not great. The
zakerinasab
2016/08/24 15:31:11
Done.
| |
2 <canvas id = 'dstCanvas' width='100' height='100'></canvas> | |
Justin Novosad
2016/08/18 15:27:27
These canvases do not need to be in the HTML marku
zakerinasab
2016/08/24 15:31:10
Done.
| |
3 <canvas id = 'myCanvas' width='100' height='100'></canvas> | |
4 <script src="../../../resources/testharness.js"></script> | |
5 <script src="../../../resources/testharnessreport.js"></script> | |
6 <script> | |
7 | |
8 function testCanvasReset(ctx) { | |
9 var colorData = ctx.getImageData(50, 50, 1, 1).data; | |
10 assert_equals(colorData[0], 0); | |
11 assert_equals(colorData[1], 0); | |
12 assert_equals(colorData[2], 0); | |
13 assert_equals(colorData[3], 0); | |
14 } | |
15 | |
16 function testCanvas_0f0(ctx) { | |
17 var colorData = ctx.getImageData(50, 50, 1, 1).data; | |
18 assert_equals(colorData[0], 0); | |
19 assert_equals(colorData[1], 255); | |
20 assert_equals(colorData[2], 0); | |
21 assert_equals(colorData[3], 255); | |
22 } | |
23 | |
24 function promiseCreateImage(ctx) { | |
Justin Novosad
2016/08/18 15:27:27
This function is pointless. Just use createImageB
zakerinasab
2016/08/24 15:31:11
Done.
| |
25 return createImageBitmap(ctx); | |
26 } | |
27 | |
28 function testTransferFromImageBitmapNullability(image) { | |
29 var dstCanvas = document.getElementById('dstCanvas'); | |
30 var dstCtx = dstCanvas.getContext('bitmaprenderer'); | |
31 dstCtx.transferFromImageBitmap(image); | |
32 | |
33 var myCanvas = document.getElementById('myCanvas'); | |
34 var myCtx = myCanvas.getContext('2d'); | |
35 myCtx.drawImage(image, 0, 0); | |
36 //This should give the same results, but it doesn't. | |
37 //myCtx.drawImage(dstCanvas, 0, 0); | |
Justin Novosad
2016/08/18 15:27:27
Do not commit the test in this state. It looks li
zakerinasab
2016/08/24 15:31:10
Done.
| |
38 testCanvas_0f0(myCtx); | |
39 | |
40 //dstCtx.transferFromImageBitmap(null); | |
41 //ctx.drawImage(dstCanvas, 0, 0); | |
42 //testCanvasReset(ctx); | |
43 } | |
44 | |
45 promise_test(function() { | |
46 var canvas = document.createElement('canvas'); | |
47 canvas.width = canvas.height = 100; | |
48 var ctx = canvas.getContext('2d'); | |
49 ctx.fillStyle = '#0f0'; | |
50 ctx.fillRect(0, 0, 100, 100); | |
51 testCanvas_0f0(ctx); | |
52 | |
53 return promiseCreateImage(canvas).then(testTransferFromImageBitmapNullabilit y); | |
54 }, 'testNullParameterTransferFromImageBitmap should not return any error'); | |
55 | |
56 </script> | |
OLD | NEW |