Index: third_party/WebKit/LayoutTests/fast/canvas/imagebitmap/transferFromImageBitmap-nullability-harness.html |
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/imagebitmap/transferFromImageBitmap-nullability-harness.html b/third_party/WebKit/LayoutTests/fast/canvas/imagebitmap/transferFromImageBitmap-nullability-harness.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..a47b8c2604a20ad62ed096217c3c19f59f4ad210 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/fast/canvas/imagebitmap/transferFromImageBitmap-nullability-harness.html |
@@ -0,0 +1,56 @@ |
+<!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.
|
+<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.
|
+<canvas id = 'myCanvas' width='100' height='100'></canvas> |
+<script src="../../../resources/testharness.js"></script> |
+<script src="../../../resources/testharnessreport.js"></script> |
+<script> |
+ |
+function testCanvasReset(ctx) { |
+ var colorData = ctx.getImageData(50, 50, 1, 1).data; |
+ assert_equals(colorData[0], 0); |
+ assert_equals(colorData[1], 0); |
+ assert_equals(colorData[2], 0); |
+ assert_equals(colorData[3], 0); |
+} |
+ |
+function testCanvas_0f0(ctx) { |
+ var colorData = ctx.getImageData(50, 50, 1, 1).data; |
+ assert_equals(colorData[0], 0); |
+ assert_equals(colorData[1], 255); |
+ assert_equals(colorData[2], 0); |
+ assert_equals(colorData[3], 255); |
+} |
+ |
+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.
|
+ return createImageBitmap(ctx); |
+} |
+ |
+function testTransferFromImageBitmapNullability(image) { |
+ var dstCanvas = document.getElementById('dstCanvas'); |
+ var dstCtx = dstCanvas.getContext('bitmaprenderer'); |
+ dstCtx.transferFromImageBitmap(image); |
+ |
+ var myCanvas = document.getElementById('myCanvas'); |
+ var myCtx = myCanvas.getContext('2d'); |
+ myCtx.drawImage(image, 0, 0); |
+ //This should give the same results, but it doesn't. |
+ //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.
|
+ testCanvas_0f0(myCtx); |
+ |
+ //dstCtx.transferFromImageBitmap(null); |
+ //ctx.drawImage(dstCanvas, 0, 0); |
+ //testCanvasReset(ctx); |
+} |
+ |
+promise_test(function() { |
+ var canvas = document.createElement('canvas'); |
+ canvas.width = canvas.height = 100; |
+ var ctx = canvas.getContext('2d'); |
+ ctx.fillStyle = '#0f0'; |
+ ctx.fillRect(0, 0, 100, 100); |
+ testCanvas_0f0(ctx); |
+ |
+ return promiseCreateImage(canvas).then(testTransferFromImageBitmapNullability); |
+}, 'testNullParameterTransferFromImageBitmap should not return any error'); |
+ |
+</script> |