⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 264459 in webkit


Ignore:
Timestamp:
Jul 16, 2020, 9:26:57 AM (6 years ago)
Author:
Chris Dumez
Message:

Resync web-platform-tests/imagebitmap-renderingcontext from upstream
​https://bugs.webkit.org/show_bug.cgi?id=214376

Reviewed by Carlos Alberto Lopez Perez.

Resync web-platform-tests/imagebitmap-renderingcontext from upstream b2a666d93581a71e9338b2.

  • web-platform-tests/imagebitmap-renderingcontext/META.yml: Added.
  • web-platform-tests/imagebitmap-renderingcontext/context-creation-offscreen-expected.txt: Added.
  • web-platform-tests/imagebitmap-renderingcontext/context-creation-offscreen-with-alpha-expected.txt: Added.
  • web-platform-tests/imagebitmap-renderingcontext/context-creation-offscreen-with-alpha.html: Copied from LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/context-creation-with-alpha.html.
  • web-platform-tests/imagebitmap-renderingcontext/context-creation-offscreen.html: Added.
  • web-platform-tests/imagebitmap-renderingcontext/context-creation-with-alpha-expected.txt:
  • web-platform-tests/imagebitmap-renderingcontext/context-creation-with-alpha.html:
  • web-platform-tests/imagebitmap-renderingcontext/context-preserves-canvas.html:
  • web-platform-tests/imagebitmap-renderingcontext/toBlob-origin-clean-offscreen.sub-expected.txt: Added.
  • web-platform-tests/imagebitmap-renderingcontext/toBlob-origin-clean-offscreen.sub.html: Added.
  • web-platform-tests/imagebitmap-renderingcontext/tranferFromImageBitmap-ToBlob-offscreen-expected.txt: Added.
  • web-platform-tests/imagebitmap-renderingcontext/tranferFromImageBitmap-ToBlob-offscreen.html: Added.
  • web-platform-tests/imagebitmap-renderingcontext/tranferFromImageBitmap-TransferToImageBitmap-offscreen-expected.txt: Added.
  • web-platform-tests/imagebitmap-renderingcontext/tranferFromImageBitmap-TransferToImageBitmap-offscreen.html: Added.
  • web-platform-tests/imagebitmap-renderingcontext/tranferFromImageBitmap-null-offscreen-expected.txt: Added.
  • web-platform-tests/imagebitmap-renderingcontext/tranferFromImageBitmap-null-offscreen.html: Copied from LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/tranferFromImageBitmap-null.html.
  • web-platform-tests/imagebitmap-renderingcontext/tranferFromImageBitmap-null.html:
  • web-platform-tests/imagebitmap-renderingcontext/transferFromImageBitmap-detached.html:
  • web-platform-tests/imagebitmap-renderingcontext/w3c-import.log:
Location:
trunk/LayoutTests/imported/w3c
Files:
11 added
7 edited
2 copied

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r264458 r264459  
     12020-07-16  Chris Dumez  <cdumez@apple.com>
     2
     3        Resync web-platform-tests/imagebitmap-renderingcontext from upstream
     4        https://bugs.webkit.org/show_bug.cgi?id=214376
     5
     6        Reviewed by Carlos Alberto Lopez Perez.
     7
     8        Resync web-platform-tests/imagebitmap-renderingcontext from upstream b2a666d93581a71e9338b2.
     9
     10        * web-platform-tests/imagebitmap-renderingcontext/META.yml: Added.
     11        * web-platform-tests/imagebitmap-renderingcontext/context-creation-offscreen-expected.txt: Added.
     12        * web-platform-tests/imagebitmap-renderingcontext/context-creation-offscreen-with-alpha-expected.txt: Added.
     13        * web-platform-tests/imagebitmap-renderingcontext/context-creation-offscreen-with-alpha.html: Copied from LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/context-creation-with-alpha.html.
     14        * web-platform-tests/imagebitmap-renderingcontext/context-creation-offscreen.html: Added.
     15        * web-platform-tests/imagebitmap-renderingcontext/context-creation-with-alpha-expected.txt:
     16        * web-platform-tests/imagebitmap-renderingcontext/context-creation-with-alpha.html:
     17        * web-platform-tests/imagebitmap-renderingcontext/context-preserves-canvas.html:
     18        * web-platform-tests/imagebitmap-renderingcontext/toBlob-origin-clean-offscreen.sub-expected.txt: Added.
     19        * web-platform-tests/imagebitmap-renderingcontext/toBlob-origin-clean-offscreen.sub.html: Added.
     20        * web-platform-tests/imagebitmap-renderingcontext/tranferFromImageBitmap-ToBlob-offscreen-expected.txt: Added.
     21        * web-platform-tests/imagebitmap-renderingcontext/tranferFromImageBitmap-ToBlob-offscreen.html: Added.
     22        * web-platform-tests/imagebitmap-renderingcontext/tranferFromImageBitmap-TransferToImageBitmap-offscreen-expected.txt: Added.
     23        * web-platform-tests/imagebitmap-renderingcontext/tranferFromImageBitmap-TransferToImageBitmap-offscreen.html: Added.
     24        * web-platform-tests/imagebitmap-renderingcontext/tranferFromImageBitmap-null-offscreen-expected.txt: Added.
     25        * web-platform-tests/imagebitmap-renderingcontext/tranferFromImageBitmap-null-offscreen.html: Copied from LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/tranferFromImageBitmap-null.html.
     26        * web-platform-tests/imagebitmap-renderingcontext/tranferFromImageBitmap-null.html:
     27        * web-platform-tests/imagebitmap-renderingcontext/transferFromImageBitmap-detached.html:
     28        * web-platform-tests/imagebitmap-renderingcontext/w3c-import.log:
     29
    1302020-07-16  Chris Dumez  <cdumez@apple.com>
    231
  • trunk/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/context-creation-offscreen-with-alpha.html

    r264458 r264459  
    99var height = 10;
    1010
    11 function testCanvas(ctx, r, g, b, a)
     11function testImageBitmap(image, opts, expectedR, expectedG, expectedB, expectedA)
    1212{
    13     var color = ctx.getImageData(5, 5, 1, 1).data;
    14     assert_array_equals(color, [r, g, b, a]);
    15 }
    16 
    17 function consumeImageBitmap(image, alphaVal, expectedR, expectedG, expectedB, expectedA)
    18 {
    19     var dstCanvas = document.createElement('canvas');
    20     dstCanvas.width = width;
    21     dstCanvas.height = height;
    22     var dstCtx;
    23     if (alphaVal == 'true')
    24         dstCtx = dstCanvas.getContext('bitmaprenderer', { alpha: true });
    25     else if (alphaVal == 'false')
    26         dstCtx = dstCanvas.getContext('bitmaprenderer', { alpha: false });
    27     else
    28         dstCtx = dstCanvas.getContext('bitmaprenderer');
     13    var dstCanvas = new OffscreenCanvas(width,height);
     14    var dstCtx = dstCanvas.getContext('bitmaprenderer', opts);
    2915    dstCtx.transferFromImageBitmap(image);
    3016
    … …  
    3420    var myCtx = myCanvas.getContext('2d');
    3521    myCtx.drawImage(dstCanvas, 0, 0);
    36     testCanvas(myCtx, expectedR, expectedG, expectedB, expectedA);
     22    var color = myCtx.getImageData(5, 5, 1, 1).data;
     23    assert_array_approx_equals(color, [expectedR, expectedG, expectedB, expectedA],1);
    3724}
    3825
    … …  
    4532    ctx.fillRect(0, 0, width, height);
    4633    return createImageBitmap(srcCanvas).then(function(image) {
    47         consumeImageBitmap(image, 'false', 0, 127, 0, 255);
     34        testImageBitmap(image, {alpha: false}, 0, 255, 0, 128);
    4835    });
    4936}, "Test that an ImageBitmapRenderingContext with alpha disabled makes the canvas opaque");
    … …  
    5744    ctx.fillRect(0, 0, width, height);
    5845    return createImageBitmap(srcCanvas).then(function(image) {
    59         consumeImageBitmap(image, 'true', 0, 255, 0, 127);
     46        testImageBitmap(image, {alpha: true}, 0, 255, 0, 128);
    6047    });
    6148}, "Test that an ImageBitmapRenderingContext with alpha enabled preserves the alpha");
    … …  
    6956    ctx.fillRect(0, 0, width, height);
    7057    return createImageBitmap(srcCanvas).then(function(image) {
    71         consumeImageBitmap(image, '', 0, 255, 0, 127);
     58        testImageBitmap(image, {}, 0, 255, 0, 128);
    7259    });
    7360}, "Test that the 'alpha' context creation attribute is true by default");
  • trunk/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/context-creation-with-alpha-expected.txt

    r262254 r264459  
    11
    2 FAIL Test that an ImageBitmapRenderingContext with alpha disabled makes the canvas opaque assert_array_equals: expected property 1 to be 127 but got 255 (expected array [0, 127, 0, 255] got object "0,255,0,128")
    3 FAIL Test that an ImageBitmapRenderingContext with alpha enabled preserves the alpha assert_array_equals: expected property 3 to be 127 but got 128 (expected array [0, 255, 0, 127] got object "0,255,0,128")
    4 FAIL Test that the 'alpha' context creation attribute is true by default assert_array_equals: expected property 3 to be 127 but got 128 (expected array [0, 255, 0, 127] got object "0,255,0,128")
     2PASS Test that an ImageBitmapRenderingContext with alpha disabled makes the canvas opaque
     3PASS Test that an ImageBitmapRenderingContext with alpha enabled preserves the alpha
     4PASS Test that the 'alpha' context creation attribute is true by default
    55
  • trunk/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/context-creation-with-alpha.html

    r223060 r264459  
    99var height = 10;
    1010
    11 function testCanvas(ctx, r, g, b, a)
    12 {
    13     var color = ctx.getImageData(5, 5, 1, 1).data;
    14     assert_array_equals(color, [r, g, b, a]);
    15 }
    16 
    17 function consumeImageBitmap(image, alphaVal, expectedR, expectedG, expectedB, expectedA)
     11function testImageBitmap(image, opts, expectedR, expectedG, expectedB, expectedA)
    1812{
    1913    var dstCanvas = document.createElement('canvas');
    2014    dstCanvas.width = width;
    2115    dstCanvas.height = height;
    22     var dstCtx;
    23     if (alphaVal == 'true')
    24         dstCtx = dstCanvas.getContext('bitmaprenderer', { alpha: true });
    25     else if (alphaVal == 'false')
    26         dstCtx = dstCanvas.getContext('bitmaprenderer', { alpha: false });
    27     else
    28         dstCtx = dstCanvas.getContext('bitmaprenderer');
     16    var dstCtx = dstCanvas.getContext('bitmaprenderer', opts);
    2917    dstCtx.transferFromImageBitmap(image);
    3018
    … …  
    3422    var myCtx = myCanvas.getContext('2d');
    3523    myCtx.drawImage(dstCanvas, 0, 0);
    36     testCanvas(myCtx, expectedR, expectedG, expectedB, expectedA);
     24    var color = myCtx.getImageData(5, 5, 1, 1).data;
     25    assert_array_approx_equals(color, [expectedR, expectedG, expectedB, expectedA],1);
    3726}
    3827
    … …  
    4534    ctx.fillRect(0, 0, width, height);
    4635    return createImageBitmap(srcCanvas).then(function(image) {
    47         consumeImageBitmap(image, 'false', 0, 127, 0, 255);
     36        testImageBitmap(image, {alpha: false}, 0, 255, 0, 128);
    4837    });
    4938}, "Test that an ImageBitmapRenderingContext with alpha disabled makes the canvas opaque");
    … …  
    5746    ctx.fillRect(0, 0, width, height);
    5847    return createImageBitmap(srcCanvas).then(function(image) {
    59         consumeImageBitmap(image, 'true', 0, 255, 0, 127);
     48        testImageBitmap(image, {alpha: true}, 0, 255, 0, 128);
    6049    });
    6150}, "Test that an ImageBitmapRenderingContext with alpha enabled preserves the alpha");
    … …  
    6958    ctx.fillRect(0, 0, width, height);
    7059    return createImageBitmap(srcCanvas).then(function(image) {
    71         consumeImageBitmap(image, '', 0, 255, 0, 127);
     60        testImageBitmap(image, {}, 0, 255, 0, 128);
    7261    });
    7362}, "Test that the 'alpha' context creation attribute is true by default");
  • trunk/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/context-preserves-canvas.html

    r223060 r264459  
    44<script src="/resources/testharness.js"></script>
    55<script src="/resources/testharnessreport.js"></script>
    6 <link rel="help" href="https://html.spec.whatwg.org/multipage/scripting.html#the-imagebitmap-rendering-context">
     6<link rel="help" href="https://html.spec.whatwg.org/multipage/canvas.html#the-imagebitmap-rendering-context">
    77<script>
    8 var width = 10;
    9 var height = 10;
    10 
    118test(function() {
     9    var width = 10;
     10    var height = 10;
    1211    var canvas = document.createElement("canvas");
    1312    canvas.width = width;
    … …  
    1514    var ctx = canvas.getContext('bitmaprenderer');
    1615    var dstCanvas = ctx.canvas;
     16    assert_true("canvas" in ctx);
     17    assert_equals(dstCanvas, ctx.canvas);
     18    assert_equals(canvas, ctx.canvas);
    1719    assert_equals(dstCanvas.width, width);
    1820    assert_equals(dstCanvas.height, height);
    1921}, "Test that ctx.canvas on a ImageBitmapRenderingContext returns the original canvas");
    20 
    2122</script>
  • trunk/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/tranferFromImageBitmap-null-offscreen.html

    r264458 r264459  
    99var height = 10;
    1010
    11 function testCanvas(ctx, r, g, b, a)
     11function testCanvas(bitmapCanvas, r, g, b, a)
    1212{
    13     var color = ctx.getImageData(5, 5, 1, 1).data;
     13    var myCanvas = document.createElement('canvas');
     14    myCanvas.width = width;
     15    myCanvas.height = height;
     16    var myCtx = myCanvas.getContext('2d');
     17    myCtx.drawImage(bitmapCanvas, 0, 0);
     18    var color = myCtx.getImageData(5, 5, 1, 1).data;
    1419    assert_array_equals(color, [r, g, b, a]);
    1520}
    … …  
    1722promise_test(function() {
    1823    function testTransferFromImageBitmapNullability(greenImage, redImage) {
    19         var bitmapCanvas = document.createElement('canvas');
    20         bitmapCanvas.width = width;
    21         bitmapCanvas.height = height;
     24        var bitmapCanvas = new OffscreenCanvas(width,height);
    2225        var bitmapCtx = bitmapCanvas.getContext('bitmaprenderer');
    2326        bitmapCtx.transferFromImageBitmap(greenImage);
    2427
    2528        // Make sure the bitmap renderer canvas is filled correctly.
    26         var myCanvas = document.createElement('canvas');
    27         myCanvas.width = width;
    28         myCanvas.height = height;
    29         var myCtx = myCanvas.getContext('2d');
    30         myCtx.drawImage(bitmapCanvas, 0, 0);
    31         testCanvas(myCtx, 0, 255, 0, 255);
     29        testCanvas(bitmapCanvas, 0, 255, 0, 255);
    3230
    3331        // Test if passing null resets the bitmap renderer canvas.
    3432        // Drawing the resetted canvas cannot change the destination canvas.
    3533        bitmapCtx.transferFromImageBitmap(null);
    36         var myCanvas2 = document.createElement('canvas');
    37         myCanvas2.width = width;
    38         myCanvas2.height = height;
    39         var myCtx2 = myCanvas2.getContext('2d');
    40         myCtx2.drawImage(bitmapCanvas, 0, 0);
    41         testCanvas(myCtx2, 0, 0, 0, 0);
     34        testCanvas(bitmapCanvas, 0, 0, 0, 0);
    4235
    4336        // Test if we can redraw the bitmap canvas correctly after reset.
    4437        bitmapCtx.transferFromImageBitmap(redImage);
    45         var myCanvas3 = document.createElement('canvas');
    46         myCanvas3.width = width;
    47         myCanvas3.height = height;
    48         var myCtx3 = myCanvas3.getContext('2d');
    49         myCtx3.drawImage(bitmapCanvas, 0, 0);
    50         testCanvas(myCtx3, 255, 0, 0, 255);
     38        testCanvas(bitmapCanvas, 255, 0, 0, 255);
    5139    }
    5240
  • trunk/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/tranferFromImageBitmap-null.html

    r223060 r264459  
    99var height = 10;
    1010
    11 function testCanvas(ctx, r, g, b, a)
     11function testCanvas(bitmapCanvas, r, g, b, a)
    1212{
    13     var color = ctx.getImageData(5, 5, 1, 1).data;
     13    var myCanvas = document.createElement('canvas');
     14    myCanvas.width = width;
     15    myCanvas.height = height;
     16    var myCtx = myCanvas.getContext('2d');
     17    myCtx.drawImage(bitmapCanvas, 0, 0);
     18    var color = myCtx.getImageData(5, 5, 1, 1).data;
    1419    assert_array_equals(color, [r, g, b, a]);
    1520}
    … …  
    2429
    2530        // Make sure the bitmap renderer canvas is filled correctly.
    26         var myCanvas = document.createElement('canvas');
    27         myCanvas.width = width;
    28         myCanvas.height = height;
    29         var myCtx = myCanvas.getContext('2d');
    30         myCtx.drawImage(bitmapCanvas, 0, 0);
    31         testCanvas(myCtx, 0, 255, 0, 255);
     31        testCanvas(bitmapCanvas, 0, 255, 0, 255);
    3232
    3333        // Test if passing null resets the bitmap renderer canvas.
    3434        // Drawing the resetted canvas cannot change the destination canvas.
    3535        bitmapCtx.transferFromImageBitmap(null);
    36         var myCanvas2 = document.createElement('canvas');
    37         myCanvas2.width = width;
    38         myCanvas2.height = height;
    39         var myCtx2 = myCanvas2.getContext('2d');
    40         myCtx2.drawImage(bitmapCanvas, 0, 0);
    41         testCanvas(myCtx2, 0, 0, 0, 0);
     36        testCanvas(bitmapCanvas, 0, 0, 0, 0);
    4237
    4338        // Test if we can redraw the bitmap canvas correctly after reset.
    4439        bitmapCtx.transferFromImageBitmap(redImage);
    45         var myCanvas3 = document.createElement('canvas');
    46         myCanvas3.width = width;
    47         myCanvas3.height = height;
    48         var myCtx3 = myCanvas3.getContext('2d');
    49         myCtx3.drawImage(bitmapCanvas, 0, 0);
    50         testCanvas(myCtx3, 255, 0, 0, 255);
     40        testCanvas(bitmapCanvas, 255, 0, 0, 255);
    5141    }
    5242
  • trunk/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/transferFromImageBitmap-detached.html

    r223060 r264459  
    2020        assert_equals(image.width, 0);
    2121        assert_equals(image.height, 0);
    22         assert_throws("InvalidStateError", function() { dstCtx.transferFromImageBitmap(image); });
     22        assert_throws_dom("InvalidStateError", function() { dstCtx.transferFromImageBitmap(image); });
    2323    }
    2424
  • trunk/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/w3c-import.log

    r223060 r264459  
    22Do NOT modify these tests directly in WebKit.
    33Instead, create a pull request on the WPT github:
    4         https://github.com/w3c/web-platform-tests
     4        https://github.com/web-platform-tests/wpt
    55
    66Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport
    … …  
    1515------------------------------------------------------------------------
    1616List of files:
     17/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/META.yml
    1718/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/bitmaprenderer-as-imagesource.html
     19/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/context-creation-offscreen-with-alpha.html
     20/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/context-creation-offscreen.html
    1821/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/context-creation-with-alpha.html
    1922/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/context-creation.html
    2023/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/context-preserves-canvas.html
     24/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/toBlob-origin-clean-offscreen.sub.html
     25/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/tranferFromImageBitmap-ToBlob-offscreen.html
     26/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/tranferFromImageBitmap-TransferToImageBitmap-offscreen.html
     27/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/tranferFromImageBitmap-null-offscreen.html
    2128/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/tranferFromImageBitmap-null.html
    2229/LayoutTests/imported/w3c/web-platform-tests/imagebitmap-renderingcontext/transferFromImageBitmap-detached.html
Note: See TracChangeset for help on using the changeset viewer.