Title: [223060] trunk/LayoutTests/imported/w3c
Revision
223060
Author
[email protected]
Date
2017-10-09 12:55:27 -0700 (Mon, 09 Oct 2017)

Log Message

Import WPT imagebitmap-renderingcontext
https://bugs.webkit.org/show_bug.cgi?id=177963

Reviewed by Sam Weinig.

* resources/import-expectations.json:
* web-platform-tests/imagebitmap-renderingcontext/bitmaprenderer-as-imagesource-expected.txt: Added.
* web-platform-tests/imagebitmap-renderingcontext/bitmaprenderer-as-imagesource.html: Added.
* web-platform-tests/imagebitmap-renderingcontext/context-creation-expected.txt: Added.
* web-platform-tests/imagebitmap-renderingcontext/context-creation-with-alpha-expected.txt: Added.
* web-platform-tests/imagebitmap-renderingcontext/context-creation-with-alpha.html: Added.
* web-platform-tests/imagebitmap-renderingcontext/context-creation.html: Added.
* web-platform-tests/imagebitmap-renderingcontext/context-preserves-canvas-expected.txt: Added.
* web-platform-tests/imagebitmap-renderingcontext/context-preserves-canvas.html: Added.
* web-platform-tests/imagebitmap-renderingcontext/tranferFromImageBitmap-null-expected.txt: Added.
* web-platform-tests/imagebitmap-renderingcontext/tranferFromImageBitmap-null.html: Added.
* web-platform-tests/imagebitmap-renderingcontext/transferFromImageBitmap-detached-expected.txt: Added.
* web-platform-tests/imagebitmap-renderingcontext/transferFromImageBitmap-detached.html: Added.
* web-platform-tests/imagebitmap-renderingcontext/w3c-import.log: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (223059 => 223060)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2017-10-09 19:32:31 UTC (rev 223059)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2017-10-09 19:55:27 UTC (rev 223060)
@@ -1,3 +1,25 @@
+2017-10-09  Dean Jackson  <[email protected]>
+
+        Import WPT imagebitmap-renderingcontext
+        https://bugs.webkit.org/show_bug.cgi?id=177963
+
+        Reviewed by Sam Weinig.
+
+        * resources/import-expectations.json:
+        * web-platform-tests/imagebitmap-renderingcontext/bitmaprenderer-as-imagesource-expected.txt: Added.
+        * web-platform-tests/imagebitmap-renderingcontext/bitmaprenderer-as-imagesource.html: Added.
+        * web-platform-tests/imagebitmap-renderingcontext/context-creation-expected.txt: Added.
+        * web-platform-tests/imagebitmap-renderingcontext/context-creation-with-alpha-expected.txt: Added.
+        * web-platform-tests/imagebitmap-renderingcontext/context-creation-with-alpha.html: Added.
+        * web-platform-tests/imagebitmap-renderingcontext/context-creation.html: Added.
+        * web-platform-tests/imagebitmap-renderingcontext/context-preserves-canvas-expected.txt: Added.
+        * web-platform-tests/imagebitmap-renderingcontext/context-preserves-canvas.html: Added.
+        * web-platform-tests/imagebitmap-renderingcontext/tranferFromImageBitmap-null-expected.txt: Added.
+        * web-platform-tests/imagebitmap-renderingcontext/tranferFromImageBitmap-null.html: Added.
+        * web-platform-tests/imagebitmap-renderingcontext/transferFromImageBitmap-detached-expected.txt: Added.
+        * web-platform-tests/imagebitmap-renderingcontext/transferFromImageBitmap-detached.html: Added.
+        * web-platform-tests/imagebitmap-renderingcontext/w3c-import.log: Added.
+
 2017-10-09  Ryan Haddad  <[email protected]>
 
         Unreviewed, rolling out r223021.

Modified: trunk/LayoutTests/imported/w3c/resources/import-expectations.json (223059 => 223060)


--- trunk/LayoutTests/imported/w3c/resources/import-expectations.json	2017-10-09 19:32:31 UTC (rev 223059)
+++ trunk/LayoutTests/imported/w3c/resources/import-expectations.json	2017-10-09 19:55:27 UTC (rev 223060)
@@ -233,7 +233,7 @@
     "web-platform-tests/html/webappapis/the-windoworworkerglobalscope-mixin": "import", 
     "web-platform-tests/http": "skip", 
     "web-platform-tests/image-decodes": "skip", 
-    "web-platform-tests/imagebitmap-renderingcontext": "skip", 
+    "web-platform-tests/imagebitmap-renderingcontext": "import", 
     "web-platform-tests/infrastructure": "skip", 
     "web-platform-tests/innerText": "import", 
     "web-platform-tests/input-events": "skip", 

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/bitmaprenderer-as-imagesource-expected.txt (0 => 223060)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/bitmaprenderer-as-imagesource-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/bitmaprenderer-as-imagesource-expected.txt	2017-10-09 19:55:27 UTC (rev 223060)
@@ -0,0 +1,5 @@
+
+FAIL Test that createImageBitmap from a bitmaprenderer canvas produces correct result Can't find variable: createImageBitmap
+FAIL Test that createImageBitmap on a bitmaprenderer canvas that never consumes any source produces correct result Can't find variable: createImageBitmap
+FAIL Test that createImageBitmap on a bitmaprenderer canvas that consumes null produces correct result null is not an object (evaluating 'ctx.transferFromImageBitmap')
+
Property changes on: trunk/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/bitmaprenderer-as-imagesource-expected.txt
___________________________________________________________________

Added: svn:eol-style

+native \ No newline at end of property

Added: svn:keywords

+Date Revision \ No newline at end of property

Added: svn:mime-type

+text/plain \ No newline at end of property

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/bitmaprenderer-as-imagesource.html (0 => 223060)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/bitmaprenderer-as-imagesource.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/bitmaprenderer-as-imagesource.html	2017-10-09 19:55:27 UTC (rev 223060)
@@ -0,0 +1,90 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Canvas's ImageBitmapRenderingContext test</title>
+<script src=""
+<script src=""
+<link rel="help" href=""
+<script>
+var width = 10;
+var height = 10;
+
+function testCanvas(ctx, x, y, r, g, b, a)
+{
+    var color = ctx.getImageData(x, y, 1, 1).data;
+    assert_array_equals(color, [r, g, b, a]);
+}
+
+function consumeImageBitmap(image, t)
+{
+    var myCanvas = document.createElement('canvas');
+    myCanvas.width = myCanvas.height = 20;
+    var myCtx = myCanvas.getContext('bitmaprenderer');
+    myCtx.transferFromImageBitmap(image);
+
+    createImageBitmap(myCanvas).then(t.step_func_done(function(imageBitmap) {
+        // Per spec, when transferFromImageBitmap happens, the transferred
+        // ImageBitmap (|image| here) must determine the intrinsic size of
+        // myCanvas, and hence myCanvas.width/height is ignored. Therefore,
+        // |imageBitmap| should have the same size as the |image|.
+        assert_equals(imageBitmap.width, width);
+        assert_equals(imageBitmap.height, height);
+
+        var dstCanvas = document.createElement('canvas');
+        dstCanvas.width = dstCanvas.height = 20;
+        var dstCtx = dstCanvas.getContext('2d');
+        dstCtx.drawImage(myCanvas, 0, 0);
+        testCanvas(dstCtx, 5, 5, 0, 255, 0, 255);
+        testCanvas(dstCtx, 15, 15, 0, 0, 0, 0);
+    }));
+}
+
+async_test(function(t) {
+    var canvas = document.createElement("canvas");
+    canvas.width = width;
+    canvas.height = height;
+    var ctx = canvas.getContext('2d');
+    ctx.fillStyle = '#0f0';
+    ctx.fillRect(0, 0, width, height);
+    createImageBitmap(canvas).then(t.step_func(function(image) {
+        consumeImageBitmap(image, t);
+    }));
+}, 'Test that createImageBitmap from a bitmaprenderer canvas produces correct result');
+
+async_test(function(t) {
+    var canvas = document.createElement("canvas");
+    canvas.width = width;
+    canvas.height = height;
+    var ctx = canvas.getContext('bitmaprenderer');
+    createImageBitmap(canvas).then(t.step_func_done(function(image) {
+        assert_equals(image.width, width);
+        assert_equals(image.height, height);
+
+        var dstCanvas = document.createElement('canvas');
+        dstCanvas.width = width;
+        dstCanvas.height = height;
+        var dstCtx = dstCanvas.getContext('2d');
+        dstCtx.drawImage(canvas, 0, 0);
+        testCanvas(dstCtx, 5, 5, 0, 0, 0, 0);
+    }));
+}, 'Test that createImageBitmap on a bitmaprenderer canvas that never consumes any source produces correct result');
+
+
+async_test(function(t) {
+    var canvas = document.createElement("canvas");
+    canvas.width = width;
+    canvas.height = height;
+    var ctx = canvas.getContext('bitmaprenderer');
+    ctx.transferFromImageBitmap(null);
+    createImageBitmap(canvas).then(t.step_func_done(function(image) {
+        assert_equals(image.width, width);
+        assert_equals(image.height, height);
+
+        var dstCanvas = document.createElement('canvas');
+        dstCanvas.width = width;
+        dstCanvas.height = height;
+        var dstCtx = dstCanvas.getContext('2d');
+        dstCtx.drawImage(canvas, 0, 0);
+        testCanvas(dstCtx, 5, 5, 0, 0, 0, 0);
+    }));
+}, 'Test that createImageBitmap on a bitmaprenderer canvas that consumes null produces correct result');
+</script>
Property changes on: trunk/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/bitmaprenderer-as-imagesource.html
___________________________________________________________________

Added: svn:eol-style

+native \ No newline at end of property

Added: svn:keywords

+Date Revision \ No newline at end of property

Added: svn:mime-type

+text/html \ No newline at end of property

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/context-creation-expected.txt (0 => 223060)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/context-creation-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/context-creation-expected.txt	2017-10-09 19:55:27 UTC (rev 223060)
@@ -0,0 +1,3 @@
+
+FAIL Test that canvas.getContext('bitmaprenderer') returns an instance of ImageBitmapRenderingContext Can't find variable: ImageBitmapRenderingContext
+
Property changes on: trunk/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/context-creation-expected.txt
___________________________________________________________________

Added: svn:eol-style

+native \ No newline at end of property

Added: svn:keywords

+Date Revision \ No newline at end of property

Added: svn:mime-type

+text/plain \ No newline at end of property

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/context-creation-with-alpha-expected.txt (0 => 223060)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/context-creation-with-alpha-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/context-creation-with-alpha-expected.txt	2017-10-09 19:55:27 UTC (rev 223060)
@@ -0,0 +1,5 @@
+
+FAIL Test that an ImageBitmapRenderingContext with alpha disabled makes the canvas opaque Can't find variable: createImageBitmap
+FAIL Test that an ImageBitmapRenderingContext with alpha enabled preserves the alpha Can't find variable: createImageBitmap
+FAIL Test that the 'alpha' context creation attribute is true by default Can't find variable: createImageBitmap
+
Property changes on: trunk/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/context-creation-with-alpha-expected.txt
___________________________________________________________________

Added: svn:eol-style

+native \ No newline at end of property

Added: svn:keywords

+Date Revision \ No newline at end of property

Added: svn:mime-type

+text/plain \ No newline at end of property

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/context-creation-with-alpha.html (0 => 223060)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/context-creation-with-alpha.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/context-creation-with-alpha.html	2017-10-09 19:55:27 UTC (rev 223060)
@@ -0,0 +1,75 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Canvas's ImageBitmapRenderingContext test</title>
+<script src=""
+<script src=""
+<link rel="help" href=""
+<script>
+var width = 10;
+var height = 10;
+
+function testCanvas(ctx, r, g, b, a)
+{
+    var color = ctx.getImageData(5, 5, 1, 1).data;
+    assert_array_equals(color, [r, g, b, a]);
+}
+
+function consumeImageBitmap(image, alphaVal, expectedR, expectedG, expectedB, expectedA)
+{
+    var dstCanvas = document.createElement('canvas');
+    dstCanvas.width = width;
+    dstCanvas.height = height;
+    var dstCtx;
+    if (alphaVal == 'true')
+        dstCtx = dstCanvas.getContext('bitmaprenderer', { alpha: true });
+    else if (alphaVal == 'false')
+        dstCtx = dstCanvas.getContext('bitmaprenderer', { alpha: false });
+    else
+        dstCtx = dstCanvas.getContext('bitmaprenderer');
+    dstCtx.transferFromImageBitmap(image);
+
+    var myCanvas = document.createElement('canvas');
+    myCanvas.width = width;
+    myCanvas.height = height;
+    var myCtx = myCanvas.getContext('2d');
+    myCtx.drawImage(dstCanvas, 0, 0);
+    testCanvas(myCtx, expectedR, expectedG, expectedB, expectedA);
+}
+
+promise_test(function() {
+    var srcCanvas = document.createElement('canvas');
+    srcCanvas.width = width;
+    srcCanvas.height = height;
+    var ctx = srcCanvas.getContext('2d');
+    ctx.fillStyle = 'rgba(0, 255, 0, 0.5)';
+    ctx.fillRect(0, 0, width, height);
+    return createImageBitmap(srcCanvas).then(function(image) {
+        consumeImageBitmap(image, 'false', 0, 127, 0, 255);
+    });
+}, "Test that an ImageBitmapRenderingContext with alpha disabled makes the canvas opaque");
+
+promise_test(function() {
+    var srcCanvas = document.createElement('canvas');
+    srcCanvas.width = width;
+    srcCanvas.height = height;
+    var ctx = srcCanvas.getContext('2d');
+    ctx.fillStyle = 'rgba(0, 255, 0, 0.5)';
+    ctx.fillRect(0, 0, width, height);
+    return createImageBitmap(srcCanvas).then(function(image) {
+        consumeImageBitmap(image, 'true', 0, 255, 0, 127);
+    });
+}, "Test that an ImageBitmapRenderingContext with alpha enabled preserves the alpha");
+
+promise_test(function() {
+    var srcCanvas = document.createElement('canvas');
+    srcCanvas.width = width;
+    srcCanvas.height = height;
+    var ctx = srcCanvas.getContext('2d');
+    ctx.fillStyle = 'rgba(0, 255, 0, 0.5)';
+    ctx.fillRect(0, 0, width, height);
+    return createImageBitmap(srcCanvas).then(function(image) {
+        consumeImageBitmap(image, '', 0, 255, 0, 127);
+    });
+}, "Test that the 'alpha' context creation attribute is true by default");
+
+</script>
Property changes on: trunk/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/context-creation-with-alpha.html
___________________________________________________________________

Added: svn:eol-style

+native \ No newline at end of property

Added: svn:keywords

+Date Revision \ No newline at end of property

Added: svn:mime-type

+text/html \ No newline at end of property

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/context-creation.html (0 => 223060)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/context-creation.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/context-creation.html	2017-10-09 19:55:27 UTC (rev 223060)
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Canvas's ImageBitmapRenderingContext test</title>
+<script src=""
+<script src=""
+<link rel="help" href=""
+<script>
+var width = 10;
+var height = 10;
+
+test(function() {
+    var canvas = document.createElement("canvas");
+    canvas.width = width;
+    canvas.height = height;
+    var ctx = canvas.getContext('bitmaprenderer');
+    assert_true(ctx instanceof ImageBitmapRenderingContext);
+}, "Test that canvas.getContext('bitmaprenderer') returns an instance of ImageBitmapRenderingContext");
+
+</script>
Property changes on: trunk/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/context-creation.html
___________________________________________________________________

Added: svn:eol-style

+native \ No newline at end of property

Added: svn:keywords

+Date Revision \ No newline at end of property

Added: svn:mime-type

+text/html \ No newline at end of property

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/context-preserves-canvas-expected.txt (0 => 223060)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/context-preserves-canvas-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/context-preserves-canvas-expected.txt	2017-10-09 19:55:27 UTC (rev 223060)
@@ -0,0 +1,3 @@
+
+FAIL Test that ctx.canvas on a ImageBitmapRenderingContext returns the original canvas null is not an object (evaluating 'ctx.canvas')
+
Property changes on: trunk/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/context-preserves-canvas-expected.txt
___________________________________________________________________

Added: svn:eol-style

+native \ No newline at end of property

Added: svn:keywords

+Date Revision \ No newline at end of property

Added: svn:mime-type

+text/plain \ No newline at end of property

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/context-preserves-canvas.html (0 => 223060)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/context-preserves-canvas.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/context-preserves-canvas.html	2017-10-09 19:55:27 UTC (rev 223060)
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Canvas's ImageBitmapRenderingContext test</title>
+<script src=""
+<script src=""
+<link rel="help" href=""
+<script>
+var width = 10;
+var height = 10;
+
+test(function() {
+    var canvas = document.createElement("canvas");
+    canvas.width = width;
+    canvas.height = height;
+    var ctx = canvas.getContext('bitmaprenderer');
+    var dstCanvas = ctx.canvas;
+    assert_equals(dstCanvas.width, width);
+    assert_equals(dstCanvas.height, height);
+}, "Test that ctx.canvas on a ImageBitmapRenderingContext returns the original canvas");
+
+</script>
Property changes on: trunk/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/context-preserves-canvas.html
___________________________________________________________________

Added: svn:eol-style

+native \ No newline at end of property

Added: svn:keywords

+Date Revision \ No newline at end of property

Added: svn:mime-type

+text/html \ No newline at end of property

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/tranferFromImageBitmap-null-expected.txt (0 => 223060)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/tranferFromImageBitmap-null-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/tranferFromImageBitmap-null-expected.txt	2017-10-09 19:55:27 UTC (rev 223060)
@@ -0,0 +1,3 @@
+
+FAIL Test that transferFromImageBitmap(null) discards the previously transferred image Can't find variable: createImageBitmap
+
Property changes on: trunk/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/tranferFromImageBitmap-null-expected.txt
___________________________________________________________________

Added: svn:eol-style

+native \ No newline at end of property

Added: svn:keywords

+Date Revision \ No newline at end of property

Added: svn:mime-type

+text/plain \ No newline at end of property

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/tranferFromImageBitmap-null.html (0 => 223060)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/tranferFromImageBitmap-null.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/tranferFromImageBitmap-null.html	2017-10-09 19:55:27 UTC (rev 223060)
@@ -0,0 +1,75 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Canvas's ImageBitmapRenderingContext test</title>
+<script src=""
+<script src=""
+<link rel="help" href=""
+<script>
+var width = 10;
+var height = 10;
+
+function testCanvas(ctx, r, g, b, a)
+{
+    var color = ctx.getImageData(5, 5, 1, 1).data;
+    assert_array_equals(color, [r, g, b, a]);
+}
+
+promise_test(function() {
+    function testTransferFromImageBitmapNullability(greenImage, redImage) {
+        var bitmapCanvas = document.createElement('canvas');
+        bitmapCanvas.width = width;
+        bitmapCanvas.height = height;
+        var bitmapCtx = bitmapCanvas.getContext('bitmaprenderer');
+        bitmapCtx.transferFromImageBitmap(greenImage);
+
+        // Make sure the bitmap renderer canvas is filled correctly.
+        var myCanvas = document.createElement('canvas');
+        myCanvas.width = width;
+        myCanvas.height = height;
+        var myCtx = myCanvas.getContext('2d');
+        myCtx.drawImage(bitmapCanvas, 0, 0);
+        testCanvas(myCtx, 0, 255, 0, 255);
+
+        // Test if passing null resets the bitmap renderer canvas.
+        // Drawing the resetted canvas cannot change the destination canvas.
+        bitmapCtx.transferFromImageBitmap(null);
+        var myCanvas2 = document.createElement('canvas');
+        myCanvas2.width = width;
+        myCanvas2.height = height;
+        var myCtx2 = myCanvas2.getContext('2d');
+        myCtx2.drawImage(bitmapCanvas, 0, 0);
+        testCanvas(myCtx2, 0, 0, 0, 0);
+
+        // Test if we can redraw the bitmap canvas correctly after reset.
+        bitmapCtx.transferFromImageBitmap(redImage);
+        var myCanvas3 = document.createElement('canvas');
+        myCanvas3.width = width;
+        myCanvas3.height = height;
+        var myCtx3 = myCanvas3.getContext('2d');
+        myCtx3.drawImage(bitmapCanvas, 0, 0);
+        testCanvas(myCtx3, 255, 0, 0, 255);
+    }
+
+    var greenCanvas = document.createElement('canvas');
+    greenCanvas.width = width;
+    greenCanvas.height = height;
+    var greenCtx = greenCanvas.getContext('2d');
+    greenCtx.fillStyle = '#0f0';
+    greenCtx.fillRect(0, 0, width, height);
+
+    var redCanvas = document.createElement('canvas');
+    redCanvas.width = width;
+    redCanvas.height = height;
+    var redCtx = redCanvas.getContext('2d');
+    redCtx.fillStyle = '#f00';
+    redCtx.fillRect(0, 0, width, height);
+
+    return Promise.all([
+        createImageBitmap(greenCanvas),
+        createImageBitmap(redCanvas),
+    ]).then(([greenImage, redImage]) => {
+        testTransferFromImageBitmapNullability(greenImage, redImage);
+    });
+},'Test that transferFromImageBitmap(null) discards the previously transferred image');
+
+</script>
Property changes on: trunk/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/tranferFromImageBitmap-null.html
___________________________________________________________________

Added: svn:eol-style

+native \ No newline at end of property

Added: svn:keywords

+Date Revision \ No newline at end of property

Added: svn:mime-type

+text/html \ No newline at end of property

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/transferFromImageBitmap-detached-expected.txt (0 => 223060)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/transferFromImageBitmap-detached-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/transferFromImageBitmap-detached-expected.txt	2017-10-09 19:55:27 UTC (rev 223060)
@@ -0,0 +1,3 @@
+
+FAIL Test transferFromImageBitmap(image) with a detached image should throw InvalidStateError Can't find variable: createImageBitmap
+
Property changes on: trunk/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/transferFromImageBitmap-detached-expected.txt
___________________________________________________________________

Added: svn:eol-style

+native \ No newline at end of property

Added: svn:keywords

+Date Revision \ No newline at end of property

Added: svn:mime-type

+text/plain \ No newline at end of property

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/transferFromImageBitmap-detached.html (0 => 223060)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/transferFromImageBitmap-detached.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/transferFromImageBitmap-detached.html	2017-10-09 19:55:27 UTC (rev 223060)
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Canvas's ImageBitmapRenderingContext test</title>
+<script src=""
+<script src=""
+<link rel="help" href=""
+<script>
+var width = 10;
+var height = 10;
+
+promise_test(function() {
+    function testException(image) {
+        var dstCanvas = document.createElement('canvas');
+        dstCanvas.width = width;
+        dstCanvas.height = height;
+        var dstCtx = dstCanvas.getContext('bitmaprenderer');
+        dstCtx.transferFromImageBitmap(image);
+
+        // The image should be detached after transferFromImageBitmap.
+        assert_equals(image.width, 0);
+        assert_equals(image.height, 0);
+        assert_throws("InvalidStateError", function() { dstCtx.transferFromImageBitmap(image); });
+    }
+
+    var srcCanvas = document.createElement('canvas');
+    srcCanvas.width = width;
+    srcCanvas.height = height;
+    var ctx = srcCanvas.getContext('2d');
+    ctx.fillStyle = 'rgba(0, 255, 0, 0.5)';
+    ctx.fillRect(0, 0, width, height);
+    return createImageBitmap(srcCanvas).then(testException);
+}, "Test transferFromImageBitmap(image) with a detached image should throw InvalidStateError");
+
+</script>
Property changes on: trunk/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/transferFromImageBitmap-detached.html
___________________________________________________________________

Added: svn:eol-style

+native \ No newline at end of property

Added: svn:keywords

+Date Revision \ No newline at end of property

Added: svn:mime-type

+text/html \ No newline at end of property

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/w3c-import.log (0 => 223060)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/w3c-import.log	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/w3c-import.log	2017-10-09 19:55:27 UTC (rev 223060)
@@ -0,0 +1,22 @@
+The tests in this directory were imported from the W3C repository.
+Do NOT modify these tests directly in WebKit.
+Instead, create a pull request on the WPT github:
+	https://github.com/w3c/web-platform-tests
+
+Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport
+
+Do NOT modify or remove this file.
+
+------------------------------------------------------------------------
+Properties requiring vendor prefixes:
+None
+Property values requiring vendor prefixes:
+None
+------------------------------------------------------------------------
+List of files:
+/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/bitmaprenderer-as-imagesource.html
+/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/context-creation-with-alpha.html
+/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/context-creation.html
+/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/context-preserves-canvas.html
+/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/tranferFromImageBitmap-null.html
+/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/transferFromImageBitmap-detached.html
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to