diff options
Diffstat (limited to 'testing/web-platform/tests/html')
229 files changed, 3312 insertions, 2020 deletions
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/read-media/cross-origin-video.html b/testing/web-platform/tests/html/browsers/browsing-the-web/read-media/cross-origin-video.html index 5f3e95cce4..a3badfcb5e 100644 --- a/testing/web-platform/tests/html/browsers/browsing-the-web/read-media/cross-origin-video.html +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/read-media/cross-origin-video.html @@ -22,8 +22,7 @@ promise_test(async () => { + 'VIDEO%26PartialContent'; let v = document.createElement("video"); - if (v.canPlayType("video/ogv") == "") - frame.src += "%26mp4"; + frame.src += "%26mp4"; document.body.appendChild(frame); await new Promise(resolve => frame.onload = resolve); diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/history_reload_referrer-1.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/history_reload_referrer-1.html deleted file mode 100644 index d083a2a1d3..0000000000 --- a/testing/web-platform/tests/html/browsers/history/the-history-interface/history_reload_referrer-1.html +++ /dev/null @@ -1,16 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <title> - Ensure referrer header persists after - history.pushState/replaceState/fragment navigation and reload - </title> - </head> - <body> - <noscript><p>Enable JavaScript and reload</p></noscript> - <div id="log"></div> - <script type="text/javascript"> - location.href = "history_reload_referrer-2.html?pipe=sub"; - </script> - </body> -</html> diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/history_reload_referrer-2.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/history_reload_referrer-2.html deleted file mode 100644 index d85517a15f..0000000000 --- a/testing/web-platform/tests/html/browsers/history/the-history-interface/history_reload_referrer-2.html +++ /dev/null @@ -1,56 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <title> - Ensure referrer header persists after - history.pushState/replaceState/fragment navigation and reload - </title> - </head> - <body> - <a id="fragment" href="#fragment">fragment</a> - <noscript><p>Enable JavaScript and reload</p></noscript> - <div id="log"></div> - <script type="text/javascript"> - const step = localStorage.getItem("history_reload_referrer_step") || "1"; - localStorage.setItem("history_reload_referrer_step", parseInt(step) + 1); - - var httpReferer = unescape("{{headers[referer]}}"); - var expectedReferrer = location.href.replace( - /\/[^\/]*$/, - "\/history_reload_referrer-1.html" - ); - - parent.test(function () { - parent.assert_equals(httpReferer, expectedReferrer); - }, `Step ${step}: Checking HTTP referrer (is "${httpReferer}")`); - parent.test(function () { - parent.assert_equals(document.referrer, expectedReferrer); - }, `Step ${step}: Checking document.referrer (is "${httpReferer}")`); - - switch (step) { - case "1": - history.pushState("", "", location); - location.reload(); - break; - - case "2": - history.replaceState("", "", location); - location.reload(); - break; - - case "3": - document.getElementById("fragment").click(); - location.reload(); - break; - - case "4": - localStorage.removeItem("history_reload_referrer_step"); - parent.done(); - break; - - default: - throw new Error(`Unexpected step "${step}"`); - } - </script> - </body> -</html> diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/history_reload_referrer.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/history_reload_referrer.html deleted file mode 100644 index d11ee89702..0000000000 --- a/testing/web-platform/tests/html/browsers/history/the-history-interface/history_reload_referrer.html +++ /dev/null @@ -1,26 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <title> - Ensure referrer header persists after - history.pushState/replaceState/fragment navigation and reload - </title> - <script type="text/javascript" src="/resources/testharness.js"></script> - <script - type="text/javascript" - src="/resources/testharnessreport.js" - ></script> - </head> - <body> - <noscript><p>Enable JavaScript and reload</p></noscript> - <div id="log"></div> - <script type="text/javascript"> - setup({ explicit_done: true }); - var iframe = document.createElement("iframe"); - window.onload = function () { - iframe.setAttribute("src", "history_reload_referrer-1.html"); - document.body.appendChild(iframe); - }; - </script> - </body> -</html> diff --git a/testing/web-platform/tests/html/browsers/sandboxing/window-open-blank-from-different-initiator.html b/testing/web-platform/tests/html/browsers/sandboxing/window-open-blank-from-different-initiator.html index 91817c3db4..3e227b456f 100644 --- a/testing/web-platform/tests/html/browsers/sandboxing/window-open-blank-from-different-initiator.html +++ b/testing/web-platform/tests/html/browsers/sandboxing/window-open-blank-from-different-initiator.html @@ -68,8 +68,7 @@ const runTest = (description, createNewPopup) => { // Open a new window and start loading from an unresponsive server. The frame // will be left with the initial empty document and a pending navigation. runTest("One pending navigation", async (test, popup_name) => { - const unresponsive_path = - "/fetch/api/resources/infinite-slow-response.py"; + const unresponsive_path = "/common/slow.py?delay=1000000"; return window.open(same_origin + unresponsive_path, popup_name); }); diff --git a/testing/web-platform/tests/html/canvas/element/fill-and-stroke-styles/2d.gradient.colormix.html b/testing/web-platform/tests/html/canvas/element/fill-and-stroke-styles/2d.gradient.colormix.html new file mode 100644 index 0000000000..f0dff89ae9 --- /dev/null +++ b/testing/web-platform/tests/html/canvas/element/fill-and-stroke-styles/2d.gradient.colormix.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> +<title>Canvas test: 2d.gradient.colormix</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/html/canvas/resources/canvas-tests.js"></script> +<link rel="stylesheet" href="/html/canvas/resources/canvas-tests.css"> +<body class="show_output"> + +<h1>2d.gradient.colormix</h1> +<p class="desc">color-mix works as CanvasGradient color input</p> + + +<p class="output">Actual output:</p> +<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas> + +<ul id="d"></ul> +<script> +var t = async_test("color-mix works as CanvasGradient color input"); +_addTest(function(canvas, ctx) { + + var g = ctx.createLinearGradient(0, 0, 100, 0); + g.addColorStop(0, '#f00'); + g.addColorStop(1, 'color-mix(in srgb, #0f0, #00f)'); + ctx.fillStyle = g; + ctx.fillRect(0, 0, 100, 50); + _assertPixelApprox(canvas, 25,25, 212,81,61,255, 3); + _assertPixelApprox(canvas, 50,25, 167,106,88,255, 3); + _assertPixelApprox(canvas, 75,25, 113,120,109,255, 3); + +}); +</script> + diff --git a/testing/web-platform/tests/html/canvas/element/filters/2d.filter.canvasFilterObject.dropShadow.exceptions.tentative.html b/testing/web-platform/tests/html/canvas/element/filters/2d.filter.canvasFilterObject.dropShadow.exceptions.tentative.html index 05984a47f8..8fc6377f83 100644 --- a/testing/web-platform/tests/html/canvas/element/filters/2d.filter.canvasFilterObject.dropShadow.exceptions.tentative.html +++ b/testing/web-platform/tests/html/canvas/element/filters/2d.filter.canvasFilterObject.dropShadow.exceptions.tentative.html @@ -77,63 +77,6 @@ _addTest(function(canvas, ctx) { {name: 'dropShadow', floodOpacity: [20]}); ctx.filter = new CanvasFilter( {name: 'dropShadow', floodOpacity: '30'}); - // dx - ctx.filter = new CanvasFilter( - {name: 'dropShadow', dx: 10}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', dx: -1}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', dx: 0.5}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', dx: null}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', dx: true}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', dx: false}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', dx: []}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', dx: [20]}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', dx: '30'}); - // dy - ctx.filter = new CanvasFilter( - {name: 'dropShadow', dy: 10}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', dy: -1}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', dy: 0.5}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', dy: null}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', dy: true}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', dy: false}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', dy: []}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', dy: [20]}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', dy: '30'}); - // floodOpacity - ctx.filter = new CanvasFilter( - {name: 'dropShadow', floodOpacity: 10}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', floodOpacity: -1}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', floodOpacity: 0.5}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', floodOpacity: null}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', floodOpacity: true}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', floodOpacity: false}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', floodOpacity: []}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', floodOpacity: [20]}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', floodOpacity: '30'}); // stdDeviation ctx.filter = new CanvasFilter( {name: 'dropShadow', stdDeviation: 10}); diff --git a/testing/web-platform/tests/html/canvas/element/filters/2d.filter.layers.dropShadow.exceptions.html b/testing/web-platform/tests/html/canvas/element/filters/2d.filter.layers.dropShadow.exceptions.html index df5e0c7dc3..0c3b6a8ce9 100644 --- a/testing/web-platform/tests/html/canvas/element/filters/2d.filter.layers.dropShadow.exceptions.html +++ b/testing/web-platform/tests/html/canvas/element/filters/2d.filter.layers.dropShadow.exceptions.html @@ -77,63 +77,6 @@ _addTest(function(canvas, ctx) { {name: 'dropShadow', floodOpacity: [20]}}); ctx.endLayer(); ctx.beginLayer({filter: {name: 'dropShadow', floodOpacity: '30'}}); ctx.endLayer(); - // dx - ctx.beginLayer({filter: - {name: 'dropShadow', dx: 10}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', dx: -1}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', dx: 0.5}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', dx: null}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', dx: true}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', dx: false}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', dx: []}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', dx: [20]}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', dx: '30'}}); ctx.endLayer(); - // dy - ctx.beginLayer({filter: - {name: 'dropShadow', dy: 10}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', dy: -1}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', dy: 0.5}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', dy: null}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', dy: true}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', dy: false}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', dy: []}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', dy: [20]}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', dy: '30'}}); ctx.endLayer(); - // floodOpacity - ctx.beginLayer({filter: - {name: 'dropShadow', floodOpacity: 10}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', floodOpacity: -1}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', floodOpacity: 0.5}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', floodOpacity: null}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', floodOpacity: true}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', floodOpacity: false}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', floodOpacity: []}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', floodOpacity: [20]}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', floodOpacity: '30'}}); ctx.endLayer(); // stdDeviation ctx.beginLayer({filter: {name: 'dropShadow', stdDeviation: 10}}); ctx.endLayer(); diff --git a/testing/web-platform/tests/html/canvas/element/layers/2d.layer.layer-rendering-state-reset-in-layer.html b/testing/web-platform/tests/html/canvas/element/layers/2d.layer.layer-rendering-state-reset-in-layer.html index 9283fd39b7..5d755cfc49 100644 --- a/testing/web-platform/tests/html/canvas/element/layers/2d.layer.layer-rendering-state-reset-in-layer.html +++ b/testing/web-platform/tests/html/canvas/element/layers/2d.layer.layer-rendering-state-reset-in-layer.html @@ -16,8 +16,9 @@ <ul id="d"></ul> <script> -var t = async_test("Tests that layers ignore the global context filter."); -_addTest(function(canvas, ctx) { +test(t => { + var canvas = document.getElementById('c'); + var ctx = canvas.getContext('2d'); ctx.globalAlpha = 0.5; ctx.globalCompositeOperation = 'xor'; @@ -51,6 +52,6 @@ _addTest(function(canvas, ctx) { _assertSame(ctx.shadowOffsetY, 20, "ctx.shadowOffsetY", "20"); _assertSame(ctx.shadowBlur, 30, "ctx.shadowBlur", "30"); -}); +}, "Tests that layers ignore the global context filter."); </script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.image.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.image.worker.js index 20953417cc..1a181a1cc1 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.image.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.image.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -21,6 +20,5 @@ promise_test(async t => { ctx.drawImage(bitmap, 0, 0); _assertPixelApprox(canvas, 50,25, 2,253,0,255, 2); - t.done(); }, ""); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.imagepattern.worker.js b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.imagepattern.worker.js index c6ab163b65..cb8f1413a2 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.imagepattern.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/compositing/2d.composite.globalAlpha.imagepattern.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -22,6 +21,5 @@ promise_test(async t => { ctx.globalAlpha = 0.01; ctx.fillRect(0, 0, 100, 50); _assertPixelApprox(canvas, 50,25, 2,253,0,255, 2); - t.done(); }, ""); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.3arg.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.3arg.worker.js index b2f860bc60..e91416b036 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.3arg.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.3arg.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -28,6 +27,5 @@ promise_test(async t => { _assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); _assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); _assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); - t.done(); }, ""); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.5arg.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.5arg.worker.js index f725acf011..a852f59e55 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.5arg.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.5arg.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -29,6 +28,5 @@ promise_test(async t => { _assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); _assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); _assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); - t.done(); }, ""); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.basic.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.basic.worker.js index b2d6f7d860..ca5b6c223c 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.basic.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.basic.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -22,6 +21,5 @@ promise_test(async t => { _assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); _assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); _assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); - t.done(); }, ""); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.destpos.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.destpos.worker.js index 380d526f9b..aff6c21108 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.destpos.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.destpos.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -28,6 +27,5 @@ promise_test(async t => { _assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); _assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); _assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); - t.done(); }, ""); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.destsize.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.destsize.worker.js index 76e3e8baaf..a3c14535c5 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.destsize.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.destsize.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -30,6 +29,5 @@ promise_test(async t => { _assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); _assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); _assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); - t.done(); }, ""); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.sourcepos.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.sourcepos.worker.js index d3525435fa..0c060f7008 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.sourcepos.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.sourcepos.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -21,6 +20,5 @@ promise_test(async t => { _assertPixelApprox(canvas, 99,0, 0,255,0,255, 2); _assertPixelApprox(canvas, 0,49, 0,255,0,255, 2); _assertPixelApprox(canvas, 99,49, 0,255,0,255, 2); - t.done(); }, ""); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.sourcesize.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.sourcesize.worker.js index aa15efb705..7d7f064b26 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.sourcesize.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.9arg.sourcesize.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -28,6 +27,5 @@ promise_test(async t => { _assertPixelApprox(canvas, 80,20, 0,255,0,255, 2); _assertPixelApprox(canvas, 20,30, 0,255,0,255, 2); _assertPixelApprox(canvas, 80,30, 0,255,0,255, 2); - t.done(); }, ""); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.alpha.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.alpha.worker.js index 958a2431b6..6854a06d9f 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.alpha.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.alpha.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -20,6 +19,5 @@ promise_test(async t => { ctx.drawImage(bitmap, 0, 0); _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); - t.done(); }, ""); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.broken.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.broken.worker.js index dc695b5459..1b2b0f83ed 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.broken.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.broken.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -15,6 +14,5 @@ promise_test(async t => { const blob = await response.blob(); await promise_rejects_dom(t, 'InvalidStateError', createImageBitmap(blob), 'The source image could not be decoded.'); - t.done(); }, ""); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.clip.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.clip.worker.js index fea2a7bac7..ce4231c2ac 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.clip.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.clip.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -25,6 +24,5 @@ promise_test(async t => { ctx.clip(); ctx.drawImage(bitmap, 0, 0); _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); - t.done(); }, ""); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.composite.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.composite.worker.js index 0b17673b68..e9d0d9c77a 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.composite.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.composite.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -20,6 +19,5 @@ promise_test(async t => { ctx.drawImage(bitmap, 0, 0); _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); - t.done(); }, ""); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.floatsource.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.floatsource.worker.js index 1efc17d04d..18ecb11aac 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.floatsource.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.floatsource.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -16,6 +15,5 @@ promise_test(async t => { const bitmap = await createImageBitmap(blob); ctx.drawImage(bitmap, 10.1, 10.1, 0.1, 0.1, 0, 0, 100, 50); _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); - t.done(); }, ""); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.negativedest.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.negativedest.worker.js index ce5cf5efad..36c4b27472 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.negativedest.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.negativedest.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -28,6 +27,5 @@ promise_test(async t => { _assertPixelApprox(canvas, 51,48, 0,255,0,255, 2); _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); - t.done(); }, "Negative destination width/height represents the correct rectangle"); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.negativedir.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.negativedir.worker.js index c82b9ba1be..f774deef61 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.negativedir.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.negativedir.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -28,6 +27,5 @@ promise_test(async t => { _assertPixelApprox(canvas, 51,48, 0,255,0,255, 2); _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); - t.done(); }, "Negative dimensions do not affect the direction of the image"); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.negativesource.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.negativesource.worker.js index f92d15774d..804a09f699 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.negativesource.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.negativesource.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -28,6 +27,5 @@ promise_test(async t => { _assertPixelApprox(canvas, 51,48, 0,255,0,255, 2); _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); - t.done(); }, "Negative source width/height represents the correct rectangle"); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.nonfinite.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.nonfinite.worker.js index a56f09e0b2..e9ca406fd2 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.nonfinite.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.nonfinite.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -319,6 +318,5 @@ promise_test(async t => { ctx.drawImage(bitmap, 0, 0, 100, 50, 0, Infinity, 100, Infinity); ctx.drawImage(bitmap, 0, 0, 100, 50, 0, 0, Infinity, Infinity); _assertPixel(canvas, 50,25, 0,255,0,255); - t.done(); }, "drawImage() with Infinity/NaN is ignored"); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.nowrap.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.nowrap.worker.js index 47a77834c0..5728d424d3 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.nowrap.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.nowrap.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -21,6 +20,5 @@ promise_test(async t => { _assertPixelApprox(canvas, 45,25, 0,255,0,255, 2); _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); _assertPixelApprox(canvas, 55,25, 0,255,0,255, 2); - t.done(); }, "Stretched images do not get pixels wrapping around the edges"); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.path.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.path.worker.js index 3259ff0258..b18d021074 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.path.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.path.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -20,6 +19,5 @@ promise_test(async t => { ctx.drawImage(bitmap, 0, 0); ctx.fill(); _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); - t.done(); }, ""); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.transform.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.transform.worker.js index 4a4cd07be9..1ba832155c 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.transform.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.transform.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -20,6 +19,5 @@ promise_test(async t => { ctx.drawImage(bitmap, 0, 0); _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); - t.done(); }, ""); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.zerosource.worker.js b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.zerosource.worker.js index a80bfff562..61b70b0c47 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.zerosource.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/drawing-images-to-the-canvas/2d.drawImage.zerosource.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -20,6 +19,5 @@ promise_test(async t => { ctx.drawImage(bitmap, 10, 10, 1, 0, 0, 0, 100, 50); ctx.drawImage(bitmap, 10, 10, 0, 0, 0, 0, 100, 50); _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); - t.done(); }, "drawImage with zero-sized source rectangle draws nothing without exception"); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.basic.image.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.basic.image.worker.js index 14cfcbc993..cc2dc301ca 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.basic.image.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.basic.image.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -24,6 +23,5 @@ promise_test(async t => { _assertPixel(canvas, 98,1, 0,255,0,255); _assertPixel(canvas, 1,48, 0,255,0,255); _assertPixel(canvas, 98,48, 0,255,0,255); - t.done(); }, ""); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.basic.type.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.basic.type.worker.js index 56a8a7d23c..382214a49e 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.basic.type.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.basic.type.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -20,6 +19,5 @@ promise_test(async t => { var img = await createImageBitmap(blob); var pattern = ctx.createPattern(img, 'no-repeat'); _assert(pattern.thisImplementsCanvasPattern, "pattern.thisImplementsCanvasPattern"); - t.done(); }, ""); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.crosscanvas.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.crosscanvas.worker.js index d9004fc028..ff2acc6851 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.crosscanvas.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.crosscanvas.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -22,6 +21,5 @@ promise_test(async t => { ctx.fillRect(0, 0, 100, 50); _assertPixel(canvas, 50,25, 0,255,0,255); - t.done(); }, ""); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.norepeat.basic.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.norepeat.basic.worker.js index 9ac4e1605c..a093e61d25 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.norepeat.basic.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.norepeat.basic.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -25,6 +24,5 @@ promise_test(async t => { _assertPixel(canvas, 98,1, 0,255,0,255); _assertPixel(canvas, 1,48, 0,255,0,255); _assertPixel(canvas, 98,48, 0,255,0,255); - t.done(); }, ""); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.norepeat.coord1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.norepeat.coord1.worker.js index 6c4a1409b7..3b4365d6e7 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.norepeat.coord1.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.norepeat.coord1.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -28,6 +27,5 @@ promise_test(async t => { _assertPixel(canvas, 98,1, 0,255,0,255); _assertPixel(canvas, 1,48, 0,255,0,255); _assertPixel(canvas, 98,48, 0,255,0,255); - t.done(); }, ""); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.norepeat.coord2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.norepeat.coord2.worker.js index d2fdd86022..3314efdd3a 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.norepeat.coord2.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.norepeat.coord2.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -29,6 +28,5 @@ promise_test(async t => { _assertPixel(canvas, 98,1, 0,255,0,255); _assertPixel(canvas, 1,48, 0,255,0,255); _assertPixel(canvas, 98,48, 0,255,0,255); - t.done(); }, ""); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.norepeat.coord3.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.norepeat.coord3.worker.js index 584a5d6cfd..6120bd0549 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.norepeat.coord3.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.norepeat.coord3.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -29,6 +28,5 @@ promise_test(async t => { _assertPixel(canvas, 98,1, 0,255,0,255); _assertPixel(canvas, 1,48, 0,255,0,255); _assertPixel(canvas, 98,48, 0,255,0,255); - t.done(); }, ""); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.norepeat.outside.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.norepeat.outside.worker.js index 0b5fef95ce..b029f90a37 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.norepeat.outside.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.norepeat.outside.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -31,6 +30,5 @@ promise_test(async t => { _assertPixel(canvas, 98,1, 0,255,0,255); _assertPixel(canvas, 1,48, 0,255,0,255); _assertPixel(canvas, 98,48, 0,255,0,255); - t.done(); }, ""); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.orientation.image.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.orientation.image.worker.js index b303b2d813..b3e61d53e9 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.orientation.image.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.orientation.image.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -31,6 +30,5 @@ promise_test(async t => { _assertPixel(canvas, 98,1, 0,255,0,255); _assertPixel(canvas, 1,48, 0,255,0,255); _assertPixel(canvas, 98,48, 0,255,0,255); - t.done(); }, "Image patterns do not get flipped when painted"); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeat.basic.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeat.basic.worker.js index 37f4c04228..872acb1c20 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeat.basic.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeat.basic.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -25,6 +24,5 @@ promise_test(async t => { _assertPixel(canvas, 98,1, 0,255,0,255); _assertPixel(canvas, 1,48, 0,255,0,255); _assertPixel(canvas, 98,48, 0,255,0,255); - t.done(); }, ""); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeat.coord1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeat.coord1.worker.js index efbd1c5846..009b072b22 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeat.coord1.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeat.coord1.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -26,6 +25,5 @@ promise_test(async t => { _assertPixel(canvas, 98,1, 0,255,0,255); _assertPixel(canvas, 1,48, 0,255,0,255); _assertPixel(canvas, 98,48, 0,255,0,255); - t.done(); }, ""); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeat.coord2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeat.coord2.worker.js index db707ecb0a..21e3349003 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeat.coord2.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeat.coord2.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -22,6 +21,5 @@ promise_test(async t => { _assertPixel(canvas, 98,1, 0,255,0,255); _assertPixel(canvas, 1,48, 0,255,0,255); _assertPixel(canvas, 98,48, 0,255,0,255); - t.done(); }, ""); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeat.coord3.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeat.coord3.worker.js index e58cddccfe..39c6037ad0 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeat.coord3.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeat.coord3.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -25,6 +24,5 @@ promise_test(async t => { _assertPixel(canvas, 98,1, 0,255,0,255); _assertPixel(canvas, 1,48, 0,255,0,255); _assertPixel(canvas, 98,48, 0,255,0,255); - t.done(); }, ""); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeat.outside.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeat.outside.worker.js index 4a173af0b4..2b4739fbb4 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeat.outside.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeat.outside.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -26,6 +25,5 @@ promise_test(async t => { _assertPixel(canvas, 98,1, 0,255,0,255); _assertPixel(canvas, 1,48, 0,255,0,255); _assertPixel(canvas, 98,48, 0,255,0,255); - t.done(); }, ""); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeatx.basic.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeatx.basic.worker.js index e776f7a008..0b93221e07 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeatx.basic.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeatx.basic.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -27,6 +26,5 @@ promise_test(async t => { _assertPixel(canvas, 98,1, 0,255,0,255); _assertPixel(canvas, 1,48, 0,255,0,255); _assertPixel(canvas, 98,48, 0,255,0,255); - t.done(); }, ""); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeatx.coord1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeatx.coord1.worker.js index 57c2102cc8..9dec7cea47 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeatx.coord1.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeatx.coord1.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -31,6 +30,5 @@ promise_test(async t => { _assertPixel(canvas, 98,25, 0,255,0,255); _assertPixel(canvas, 1,48, 0,255,0,255); _assertPixel(canvas, 98,48, 0,255,0,255); - t.done(); }, ""); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeatx.outside.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeatx.outside.worker.js index e40f6aa207..65cfe4e5ed 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeatx.outside.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeatx.outside.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -28,6 +27,5 @@ promise_test(async t => { _assertPixel(canvas, 98,1, 0,255,0,255); _assertPixel(canvas, 1,48, 0,255,0,255); _assertPixel(canvas, 98,48, 0,255,0,255); - t.done(); }, ""); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeaty.basic.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeaty.basic.worker.js index 6a53b5dc4d..ee717dcabc 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeaty.basic.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeaty.basic.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -27,6 +26,5 @@ promise_test(async t => { _assertPixel(canvas, 98,1, 0,255,0,255); _assertPixel(canvas, 1,48, 0,255,0,255); _assertPixel(canvas, 98,48, 0,255,0,255); - t.done(); }, ""); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeaty.coord1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeaty.coord1.worker.js index d59abb6e07..e35777a8db 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeaty.coord1.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeaty.coord1.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -31,6 +30,5 @@ promise_test(async t => { _assertPixel(canvas, 1,48, 0,255,0,255); _assertPixel(canvas, 50,48, 0,255,0,255); _assertPixel(canvas, 98,48, 0,255,0,255); - t.done(); }, ""); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeaty.outside.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeaty.outside.worker.js index c4feba10ca..531ff55637 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeaty.outside.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.paint.repeaty.outside.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -28,6 +27,5 @@ promise_test(async t => { _assertPixel(canvas, 98,1, 0,255,0,255); _assertPixel(canvas, 1,48, 0,255,0,255); _assertPixel(canvas, 98,48, 0,255,0,255); - t.done(); }, ""); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.repeat.empty.worker.js b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.repeat.empty.worker.js index 5aefc0dab3..c2ed94a4bb 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.repeat.empty.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/fill-and-stroke-styles/2d.pattern.repeat.empty.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -24,6 +23,5 @@ promise_test(async t => { _assertPixel(canvas, 98,1, 0,255,0,255); _assertPixel(canvas, 1,48, 0,255,0,255); _assertPixel(canvas, 98,48, 0,255,0,255); - t.done(); }, ""); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.dropShadow.exceptions.tentative.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.dropShadow.exceptions.tentative.html index cdd501ba8e..4a4ce5a59a 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.dropShadow.exceptions.tentative.html +++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.dropShadow.exceptions.tentative.html @@ -78,63 +78,6 @@ t.step(function() { {name: 'dropShadow', floodOpacity: [20]}); ctx.filter = new CanvasFilter( {name: 'dropShadow', floodOpacity: '30'}); - // dx - ctx.filter = new CanvasFilter( - {name: 'dropShadow', dx: 10}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', dx: -1}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', dx: 0.5}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', dx: null}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', dx: true}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', dx: false}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', dx: []}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', dx: [20]}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', dx: '30'}); - // dy - ctx.filter = new CanvasFilter( - {name: 'dropShadow', dy: 10}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', dy: -1}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', dy: 0.5}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', dy: null}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', dy: true}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', dy: false}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', dy: []}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', dy: [20]}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', dy: '30'}); - // floodOpacity - ctx.filter = new CanvasFilter( - {name: 'dropShadow', floodOpacity: 10}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', floodOpacity: -1}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', floodOpacity: 0.5}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', floodOpacity: null}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', floodOpacity: true}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', floodOpacity: false}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', floodOpacity: []}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', floodOpacity: [20]}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', floodOpacity: '30'}); // stdDeviation ctx.filter = new CanvasFilter( {name: 'dropShadow', stdDeviation: 10}); diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.dropShadow.exceptions.tentative.worker.js b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.dropShadow.exceptions.tentative.worker.js index 1d56865e68..b51af5757c 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.dropShadow.exceptions.tentative.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.dropShadow.exceptions.tentative.worker.js @@ -74,63 +74,6 @@ t.step(function() { {name: 'dropShadow', floodOpacity: [20]}); ctx.filter = new CanvasFilter( {name: 'dropShadow', floodOpacity: '30'}); - // dx - ctx.filter = new CanvasFilter( - {name: 'dropShadow', dx: 10}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', dx: -1}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', dx: 0.5}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', dx: null}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', dx: true}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', dx: false}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', dx: []}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', dx: [20]}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', dx: '30'}); - // dy - ctx.filter = new CanvasFilter( - {name: 'dropShadow', dy: 10}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', dy: -1}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', dy: 0.5}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', dy: null}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', dy: true}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', dy: false}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', dy: []}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', dy: [20]}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', dy: '30'}); - // floodOpacity - ctx.filter = new CanvasFilter( - {name: 'dropShadow', floodOpacity: 10}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', floodOpacity: -1}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', floodOpacity: 0.5}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', floodOpacity: null}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', floodOpacity: true}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', floodOpacity: false}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', floodOpacity: []}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', floodOpacity: [20]}); - ctx.filter = new CanvasFilter( - {name: 'dropShadow', floodOpacity: '30'}); // stdDeviation ctx.filter = new CanvasFilter( {name: 'dropShadow', stdDeviation: 10}); diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.dropShadow.exceptions.html b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.dropShadow.exceptions.html index 10392dea5a..45d81a6f2b 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.dropShadow.exceptions.html +++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.dropShadow.exceptions.html @@ -78,63 +78,6 @@ t.step(function() { {name: 'dropShadow', floodOpacity: [20]}}); ctx.endLayer(); ctx.beginLayer({filter: {name: 'dropShadow', floodOpacity: '30'}}); ctx.endLayer(); - // dx - ctx.beginLayer({filter: - {name: 'dropShadow', dx: 10}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', dx: -1}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', dx: 0.5}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', dx: null}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', dx: true}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', dx: false}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', dx: []}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', dx: [20]}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', dx: '30'}}); ctx.endLayer(); - // dy - ctx.beginLayer({filter: - {name: 'dropShadow', dy: 10}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', dy: -1}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', dy: 0.5}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', dy: null}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', dy: true}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', dy: false}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', dy: []}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', dy: [20]}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', dy: '30'}}); ctx.endLayer(); - // floodOpacity - ctx.beginLayer({filter: - {name: 'dropShadow', floodOpacity: 10}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', floodOpacity: -1}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', floodOpacity: 0.5}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', floodOpacity: null}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', floodOpacity: true}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', floodOpacity: false}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', floodOpacity: []}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', floodOpacity: [20]}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', floodOpacity: '30'}}); ctx.endLayer(); // stdDeviation ctx.beginLayer({filter: {name: 'dropShadow', stdDeviation: 10}}); ctx.endLayer(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.dropShadow.exceptions.worker.js b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.dropShadow.exceptions.worker.js index 86b8c56af6..65fc751215 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.dropShadow.exceptions.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/filters/2d.filter.layers.dropShadow.exceptions.worker.js @@ -74,63 +74,6 @@ t.step(function() { {name: 'dropShadow', floodOpacity: [20]}}); ctx.endLayer(); ctx.beginLayer({filter: {name: 'dropShadow', floodOpacity: '30'}}); ctx.endLayer(); - // dx - ctx.beginLayer({filter: - {name: 'dropShadow', dx: 10}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', dx: -1}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', dx: 0.5}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', dx: null}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', dx: true}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', dx: false}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', dx: []}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', dx: [20]}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', dx: '30'}}); ctx.endLayer(); - // dy - ctx.beginLayer({filter: - {name: 'dropShadow', dy: 10}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', dy: -1}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', dy: 0.5}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', dy: null}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', dy: true}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', dy: false}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', dy: []}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', dy: [20]}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', dy: '30'}}); ctx.endLayer(); - // floodOpacity - ctx.beginLayer({filter: - {name: 'dropShadow', floodOpacity: 10}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', floodOpacity: -1}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', floodOpacity: 0.5}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', floodOpacity: null}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', floodOpacity: true}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', floodOpacity: false}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', floodOpacity: []}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', floodOpacity: [20]}}); ctx.endLayer(); - ctx.beginLayer({filter: - {name: 'dropShadow', floodOpacity: '30'}}); ctx.endLayer(); // stdDeviation ctx.beginLayer({filter: {name: 'dropShadow', stdDeviation: 10}}); ctx.endLayer(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.layer-rendering-state-reset-in-layer.html b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.layer-rendering-state-reset-in-layer.html index 867553b45e..cebdfd5f27 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.layer-rendering-state-reset-in-layer.html +++ b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.layer-rendering-state-reset-in-layer.html @@ -10,13 +10,7 @@ <script> -var t = async_test("Tests that layers ignore the global context filter."); -var t_pass = t.done.bind(t); -var t_fail = t.step_func(function(reason) { - throw reason; -}); -t.step(function() { - +test(t => { var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -51,7 +45,6 @@ t.step(function() { _assertSame(ctx.shadowOffsetX, 10, "ctx.shadowOffsetX", "10"); _assertSame(ctx.shadowOffsetY, 20, "ctx.shadowOffsetY", "20"); _assertSame(ctx.shadowBlur, 30, "ctx.shadowBlur", "30"); - t.done(); -}); +}, "Tests that layers ignore the global context filter."); </script> diff --git a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.layer-rendering-state-reset-in-layer.worker.js b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.layer-rendering-state-reset-in-layer.worker.js index 5c2bb73e8f..a566cccf14 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.layer-rendering-state-reset-in-layer.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.layer-rendering-state-reset-in-layer.worker.js @@ -6,13 +6,7 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); -var t = async_test("Tests that layers ignore the global context filter."); -var t_pass = t.done.bind(t); -var t_fail = t.step_func(function(reason) { - throw reason; -}); -t.step(function() { - +test(t => { var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -47,6 +41,5 @@ t.step(function() { _assertSame(ctx.shadowOffsetX, 10, "ctx.shadowOffsetX", "10"); _assertSame(ctx.shadowOffsetY, 20, "ctx.shadowOffsetY", "20"); _assertSame(ctx.shadowBlur, 30, "ctx.shadowBlur", "30"); - t.done(); -}); +}, "Tests that layers ignore the global context filter."); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.malformed-operations-with-promises.convertToBlob.worker.js b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.malformed-operations-with-promises.convertToBlob.worker.js index be0f4f2cde..8361e19108 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.malformed-operations-with-promises.convertToBlob.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.malformed-operations-with-promises.convertToBlob.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(200, 200); var ctx = canvas.getContext('2d'); @@ -18,6 +17,5 @@ promise_test(async t => { // Calling again inside a layer should throw. ctx.beginLayer(); await promise_rejects_dom(t, 'InvalidStateError', canvas.convertToBlob()); - t.done(); }, "Check that exceptions are thrown for operations that are malformed while layers are open."); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.malformed-operations-with-promises.createImageBitmap.worker.js b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.malformed-operations-with-promises.createImageBitmap.worker.js index b286b7a9e7..d64f693864 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.malformed-operations-with-promises.createImageBitmap.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.malformed-operations-with-promises.createImageBitmap.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(200, 200); var ctx = canvas.getContext('2d'); @@ -18,6 +17,5 @@ promise_test(async t => { // Calling again inside a layer should throw. ctx.beginLayer(); await promise_rejects_dom(t, 'InvalidStateError', createImageBitmap(canvas)); - t.done(); }, "Check that exceptions are thrown for operations that are malformed while layers are open."); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.image.alpha.worker.js b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.image.alpha.worker.js index 827bd2ce65..dee8927564 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.image.alpha.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.image.alpha.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -21,6 +20,5 @@ promise_test(async t => { ctx.drawImage(img, 0, -50); _assertPixelApprox(canvas, 50,25, 127,0,127,255, 2); - t.done(); }, "Shadows are drawn correctly for partially-transparent images"); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.image.basic.worker.js b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.image.basic.worker.js index 2d02232c68..7aa17da784 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.image.basic.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.image.basic.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -21,6 +20,5 @@ promise_test(async t => { ctx.drawImage(img, 0, -50); _assertPixel(canvas, 50,25, 0,255,0,255); - t.done(); }, "Shadows are drawn for images"); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.image.scale.worker.js b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.image.scale.worker.js index 2c10381f98..3c1cf872ec 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.image.scale.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.image.scale.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -23,6 +22,5 @@ promise_test(async t => { _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); - t.done(); }, "Shadows are drawn correctly for scaled images"); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.image.section.worker.js b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.image.section.worker.js index 94affdfb6a..c357a3a3ab 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.image.section.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.image.section.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -23,6 +22,5 @@ promise_test(async t => { _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); _assertPixelApprox(canvas, 50,25, 0,255,0,255, 2); _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); - t.done(); }, "Shadows are not drawn for areas outside image source rectangles"); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.image.transparent.1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.image.transparent.1.worker.js index c5421d7042..5440944e93 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.image.transparent.1.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.image.transparent.1.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -21,6 +20,5 @@ promise_test(async t => { ctx.drawImage(img, 0, -50); _assertPixel(canvas, 50,25, 0,255,0,255); - t.done(); }, "Shadows are not drawn for transparent images"); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.image.transparent.2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.image.transparent.2.worker.js index 071c584fa8..0554c03750 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.image.transparent.2.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.image.transparent.2.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -27,6 +26,5 @@ promise_test(async t => { _assertPixel(canvas, 25,25, 0,255,0,255); _assertPixel(canvas, 50,25, 0,255,0,255); _assertPixel(canvas, 75,25, 0,255,0,255); - t.done(); }, "Shadows are not drawn for transparent parts of images"); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.pattern.alpha.worker.js b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.pattern.alpha.worker.js index 41a826a158..9d5e5b07a9 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.pattern.alpha.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.pattern.alpha.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -23,6 +22,5 @@ promise_test(async t => { ctx.fillRect(0, -50, 100, 50); _assertPixelApprox(canvas, 50,25, 127,0,127,255, 2); - t.done(); }, "Shadows are drawn correctly for partially-transparent fill patterns"); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.pattern.basic.worker.js b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.pattern.basic.worker.js index 7a8f7e8479..d2db2427c5 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.pattern.basic.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.pattern.basic.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -23,6 +22,5 @@ promise_test(async t => { ctx.fillRect(0, -50, 100, 50); _assertPixel(canvas, 50,25, 0,255,0,255); - t.done(); }, "Shadows are drawn for fill patterns"); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.pattern.transparent.1.worker.js b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.pattern.transparent.1.worker.js index 8414db6d08..af079851e6 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.pattern.transparent.1.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.pattern.transparent.1.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -23,6 +22,5 @@ promise_test(async t => { ctx.fillRect(0, -50, 100, 50); _assertPixel(canvas, 50,25, 0,255,0,255); - t.done(); }, "Shadows are not drawn for transparent fill patterns"); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.pattern.transparent.2.worker.js b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.pattern.transparent.2.worker.js index 726a42d6cd..1cf4f3ee36 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.pattern.transparent.2.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/shadows/2d.shadow.pattern.transparent.2.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -27,6 +26,5 @@ promise_test(async t => { _assertPixel(canvas, 25,25, 0,255,0,255); _assertPixel(canvas, 50,25, 0,255,0,255); _assertPixel(canvas, 75,25, 0,255,0,255); - t.done(); }, "Shadows are not drawn for transparent parts of fill patterns"); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.center.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.center.worker.js index 44f093cdac..c11c8437e2 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.center.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.center.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -27,6 +26,5 @@ promise_test(async t => { _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); _assertPixelApprox(canvas, 5,45, 0,255,0,255, 2); _assertPixelApprox(canvas, 95,45, 0,255,0,255, 2); - t.done(); }, "textAlign center is the center of the em squares (not the bounding box)"); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.end.ltr.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.end.ltr.worker.js index 4bd0f5a314..f5c5769470 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.end.ltr.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.end.ltr.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -28,6 +27,5 @@ promise_test(async t => { _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); _assertPixelApprox(canvas, 5,45, 0,255,0,255, 2); _assertPixelApprox(canvas, 95,45, 0,255,0,255, 2); - t.done(); }, "textAlign end with ltr is the right edge"); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.end.rtl.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.end.rtl.worker.js index b3e62d8538..90e21f41dc 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.end.rtl.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.end.rtl.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -28,6 +27,5 @@ promise_test(async t => { _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); _assertPixelApprox(canvas, 5,45, 0,255,0,255, 2); _assertPixelApprox(canvas, 95,45, 0,255,0,255, 2); - t.done(); }, "textAlign end with rtl is the left edge"); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.left.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.left.worker.js index c7dc0bed42..0f92969632 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.left.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.left.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -27,6 +26,5 @@ promise_test(async t => { _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); _assertPixelApprox(canvas, 5,45, 0,255,0,255, 2); _assertPixelApprox(canvas, 95,45, 0,255,0,255, 2); - t.done(); }, "textAlign left is the left of the first em square (not the bounding box)"); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.right.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.right.worker.js index 58fe85e0b7..594192812a 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.right.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.right.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -27,6 +26,5 @@ promise_test(async t => { _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); _assertPixelApprox(canvas, 5,45, 0,255,0,255, 2); _assertPixelApprox(canvas, 95,45, 0,255,0,255, 2); - t.done(); }, "textAlign right is the right of the last em square (not the bounding box)"); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.start.ltr.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.start.ltr.worker.js index c0793d9af6..32e6fc0f20 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.start.ltr.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.start.ltr.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -28,6 +27,5 @@ promise_test(async t => { _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); _assertPixelApprox(canvas, 5,45, 0,255,0,255, 2); _assertPixelApprox(canvas, 95,45, 0,255,0,255, 2); - t.done(); }, "textAlign start with ltr is the left edge"); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.start.rtl.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.start.rtl.worker.js index ed706c287a..67a196daf7 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.start.rtl.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.align.start.rtl.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -28,6 +27,5 @@ promise_test(async t => { _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); _assertPixelApprox(canvas, 5,45, 0,255,0,255, 2); _assertPixelApprox(canvas, 95,45, 0,255,0,255, 2); - t.done(); }, "textAlign start with rtl is the right edge"); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.baseline.alphabetic.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.baseline.alphabetic.worker.js index a98a5863d9..a0ab72915f 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.baseline.alphabetic.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.baseline.alphabetic.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -27,6 +26,5 @@ promise_test(async t => { _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); _assertPixelApprox(canvas, 5,45, 0,255,0,255, 2); _assertPixelApprox(canvas, 95,45, 0,255,0,255, 2); - t.done(); }, ""); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.baseline.bottom.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.baseline.bottom.worker.js index 30f60c574b..e171388834 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.baseline.bottom.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.baseline.bottom.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -27,6 +26,5 @@ promise_test(async t => { _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); _assertPixelApprox(canvas, 5,45, 0,255,0,255, 2); _assertPixelApprox(canvas, 95,45, 0,255,0,255, 2); - t.done(); }, "textBaseline bottom is the bottom of the em square (not the bounding box)"); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.baseline.hanging.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.baseline.hanging.worker.js index 638506a279..906fdbbf27 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.baseline.hanging.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.baseline.hanging.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -27,6 +26,5 @@ promise_test(async t => { _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); _assertPixelApprox(canvas, 5,45, 0,255,0,255, 2); _assertPixelApprox(canvas, 95,45, 0,255,0,255, 2); - t.done(); }, ""); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.baseline.ideographic.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.baseline.ideographic.worker.js index 7c682fb5f1..76ac1d9da2 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.baseline.ideographic.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.baseline.ideographic.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -27,6 +26,5 @@ promise_test(async t => { _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); _assertPixelApprox(canvas, 5,45, 0,255,0,255, 2); _assertPixelApprox(canvas, 95,45, 0,255,0,255, 2); - t.done(); }, ""); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.baseline.middle.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.baseline.middle.worker.js index c373ab6c72..c288ab4c86 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.baseline.middle.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.baseline.middle.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -27,6 +26,5 @@ promise_test(async t => { _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); _assertPixelApprox(canvas, 5,45, 0,255,0,255, 2); _assertPixelApprox(canvas, 95,45, 0,255,0,255, 2); - t.done(); }, "textBaseline middle is the middle of the em square (not the bounding box)"); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.baseline.top.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.baseline.top.worker.js index effc4418c3..e7d0b167c0 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.baseline.top.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.baseline.top.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -27,6 +26,5 @@ promise_test(async t => { _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); _assertPixelApprox(canvas, 5,45, 0,255,0,255, 2); _assertPixelApprox(canvas, 95,45, 0,255,0,255, 2); - t.done(); }, "textBaseline top is the top of the em square (not the bounding box)"); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.bound.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.bound.worker.js index adcb45faaa..a314870f11 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.bound.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.bound.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -24,6 +23,5 @@ promise_test(async t => { _assertPixelApprox(canvas, 95,5, 0,255,0,255, 2); _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); - t.done(); }, "fillText handles maxWidth based on line size, not bounding box size"); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.fontface.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.fontface.worker.js index 8df519b7d1..e225e70351 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.fontface.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.fontface.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -24,6 +23,5 @@ promise_test(async t => { _assertPixelApprox(canvas, 95,5, 0,255,0,255, 2); _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); - t.done(); }, "fillText works on @font-face fonts"); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fontface.notinpage.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fontface.notinpage.worker.js index 628cb39506..c35c82d71f 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fontface.notinpage.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fontface.notinpage.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -24,6 +23,5 @@ promise_test(async t => { _assertPixelApprox(canvas, 95,5, 0,255,0,255, 2); _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); - t.done(); }, "@font-face fonts should work even if they are not used in the page"); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fontface.repeat.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fontface.repeat.worker.js index 7567c09558..fb1f7980a6 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fontface.repeat.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fontface.repeat.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -27,6 +26,5 @@ promise_test(async t => { _assertPixelApprox(canvas, 95,5, 0,255,0,255, 2); _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); - t.done(); }, "Draw with the font immediately, then wait a bit until and draw again. (This crashes some version of WebKit.)"); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fontface.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fontface.worker.js index 02257f0a06..a09a0f88d7 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fontface.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.fontface.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -24,6 +23,5 @@ promise_test(async t => { _assertPixelApprox(canvas, 95,5, 0,255,0,255, 2); _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); - t.done(); }, ""); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.space.basic.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.space.basic.worker.js index ef09925c55..96bd4159c7 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.space.basic.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.space.basic.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -22,6 +21,5 @@ promise_test(async t => { ctx.fillText('E EE', -100, 37.5); _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); - t.done(); }, "U+0020 is rendered the correct size (1em wide)"); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.end.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.end.worker.js index 9a9afa1e74..e9cd9dc829 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.end.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.end.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -23,6 +22,5 @@ promise_test(async t => { ctx.fillText('EE ', 100, 37.5); _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); _assertPixelApprox(canvas, 75,25, 255,0,0,255, 2); - t.done(); }, "Space characters at the end of a line are NOT collapsed"); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.nonspace.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.nonspace.worker.js index a12c2f9a48..a37094e28c 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.nonspace.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.nonspace.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -22,6 +21,5 @@ promise_test(async t => { ctx.fillText('E\x0b EE', -150, 37.5); _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); - t.done(); }, "Non-space characters are not converted to U+0020 and collapsed"); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.other.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.other.worker.js index bbf9e684be..1f090cb426 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.other.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.other.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -22,6 +21,5 @@ promise_test(async t => { ctx.fillText('E \x09\x0a\x0c\x0d \x09\x0a\x0c\x0dEE', 0, 37.5); _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); _assertPixelApprox(canvas, 75,25, 255,0,0,255, 2); - t.done(); }, "Space characters are converted to U+0020, and are NOT collapsed"); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.space.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.space.worker.js index e5ab7b67f4..02551b7de7 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.space.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.space.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -22,6 +21,5 @@ promise_test(async t => { ctx.fillText('E EE', 0, 37.5); _assertPixelApprox(canvas, 25,25, 0,255,0,255, 2); _assertPixelApprox(canvas, 75,25, 255,0,0,255, 2); - t.done(); }, "Space characters are converted to U+0020, and are NOT collapsed"); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.start.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.start.worker.js index 20fec7801f..bd6e523283 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.start.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.start.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -22,6 +21,5 @@ promise_test(async t => { ctx.fillText(' EE', 0, 37.5); _assertPixelApprox(canvas, 25,25, 255,0,0,255, 2); _assertPixelApprox(canvas, 75,25, 0,255,0,255, 2); - t.done(); }, "Space characters at the start of a line are NOT collapsed"); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.actualBoundingBox.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.actualBoundingBox.worker.js index c3d18ff878..aaec2e7e8e 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.actualBoundingBox.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.actualBoundingBox.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -41,6 +40,5 @@ promise_test(async t => { _assert(ctx.measureText('ABCD').actualBoundingBoxRight >= 200, "ctx.measureText('ABCD').actualBoundingBoxRight >= 200"); _assert(ctx.measureText('ABCD').actualBoundingBoxAscent >= 85, "ctx.measureText('ABCD').actualBoundingBoxAscent >= 85"); _assert(ctx.measureText('ABCD').actualBoundingBoxDescent >= 37, "ctx.measureText('ABCD').actualBoundingBoxDescent >= 37"); - t.done(); }, "Testing actualBoundingBox"); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.advances.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.advances.worker.js index 4b02f06f2d..3bf2d9f719 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.advances.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.advances.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -32,6 +31,5 @@ promise_test(async t => { _assertSame(ctx.measureText('Hello').advances[2], tm.advances[2], "ctx.measureText('Hello').advances[\""+(2)+"\"]", "tm.advances[\""+(2)+"\"]"); _assertSame(ctx.measureText('Hello').advances[3], tm.advances[3], "ctx.measureText('Hello').advances[\""+(3)+"\"]", "tm.advances[\""+(3)+"\"]"); _assertSame(ctx.measureText('Hello').advances[4], tm.advances[4], "ctx.measureText('Hello').advances[\""+(4)+"\"]", "tm.advances[\""+(4)+"\"]"); - t.done(); }, "Testing width advances"); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.baselines.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.baselines.worker.js index ddb48f4fe0..6e7b064ac8 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.baselines.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.baselines.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -25,6 +24,5 @@ promise_test(async t => { _assertSame(Math.abs(ctx.measureText('ABCD').alphabeticBaseline), 0, "Math.abs(ctx.measureText('ABCD').alphabeticBaseline)", "0"); _assertSame(ctx.measureText('ABCD').ideographicBaseline, 6.25, "ctx.measureText('ABCD').ideographicBaseline", "6.25"); _assertSame(ctx.measureText('ABCD').hangingBaseline, 25, "ctx.measureText('ABCD').hangingBaseline", "25"); - t.done(); }, "Testing baselines"); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.emHeights-low-ascent.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.emHeights-low-ascent.worker.js index 09ee787309..cbcb5ec004 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.emHeights-low-ascent.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.emHeights-low-ascent.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -25,6 +24,5 @@ promise_test(async t => { _assertSame(ctx.measureText('ABCD').emHeightAscent, 20, "ctx.measureText('ABCD').emHeightAscent", "20"); _assertSame(ctx.measureText('ABCD').emHeightDescent, 20, "ctx.measureText('ABCD').emHeightDescent", "20"); _assertSame(ctx.measureText('ABCD').emHeightDescent + ctx.measureText('ABCD').emHeightAscent, 40, "ctx.measureText('ABCD').emHeightDescent + ctx.measureText('ABCD').emHeightAscent", "40"); - t.done(); }, "Testing emHeights with reduced ascent metric"); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.emHeights-zero-descent.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.emHeights-zero-descent.worker.js index a2f09782c9..4b62bd5665 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.emHeights-zero-descent.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.emHeights-zero-descent.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -25,6 +24,5 @@ promise_test(async t => { _assertSame(ctx.measureText('ABCD').emHeightAscent, 40, "ctx.measureText('ABCD').emHeightAscent", "40"); _assertSame(ctx.measureText('ABCD').emHeightDescent, 0, "ctx.measureText('ABCD').emHeightDescent", "0"); _assertSame(ctx.measureText('ABCD').emHeightDescent + ctx.measureText('ABCD').emHeightAscent, 40, "ctx.measureText('ABCD').emHeightDescent + ctx.measureText('ABCD').emHeightAscent", "40"); - t.done(); }, "Testing emHeights with zero descent metric"); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.emHeights.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.emHeights.worker.js index 0385d3d737..163394ff1b 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.emHeights.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.emHeights.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -25,6 +24,5 @@ promise_test(async t => { _assertSame(ctx.measureText('ABCD').emHeightAscent, 30, "ctx.measureText('ABCD').emHeightAscent", "30"); _assertSame(ctx.measureText('ABCD').emHeightDescent, 10, "ctx.measureText('ABCD').emHeightDescent", "10"); _assertSame(ctx.measureText('ABCD').emHeightDescent + ctx.measureText('ABCD').emHeightAscent, 40, "ctx.measureText('ABCD').emHeightDescent + ctx.measureText('ABCD').emHeightAscent", "40"); - t.done(); }, "Testing emHeights"); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.fontBoundingBox-reduced-ascent.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.fontBoundingBox-reduced-ascent.worker.js index dea67ff8f6..6ea01b1496 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.fontBoundingBox-reduced-ascent.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.fontBoundingBox-reduced-ascent.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -23,6 +22,5 @@ promise_test(async t => { _assertSame(ctx.measureText('ABCD').fontBoundingBoxAscent, 10, "ctx.measureText('ABCD').fontBoundingBoxAscent", "10"); _assertSame(ctx.measureText('ABCD').fontBoundingBoxDescent, 10, "ctx.measureText('ABCD').fontBoundingBoxDescent", "10"); - t.done(); }, "Testing fontBoundingBox for OffscreenCanvas with reduced ascent metric"); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.fontBoundingBox-zero-descent.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.fontBoundingBox-zero-descent.worker.js index 99a886d015..c8175eec3c 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.fontBoundingBox-zero-descent.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.fontBoundingBox-zero-descent.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -23,6 +22,5 @@ promise_test(async t => { _assertSame(ctx.measureText('ABCD').fontBoundingBoxAscent, 30, "ctx.measureText('ABCD').fontBoundingBoxAscent", "30"); _assertSame(ctx.measureText('ABCD').fontBoundingBoxDescent, 0, "ctx.measureText('ABCD').fontBoundingBoxDescent", "0"); - t.done(); }, "Testing fontBoundingBox for OffscreenCanvas with zero descent metric"); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.fontBoundingBox.ahem.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.fontBoundingBox.ahem.worker.js index 255bcd108a..080a4d45b8 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.fontBoundingBox.ahem.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.fontBoundingBox.ahem.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -22,6 +21,5 @@ promise_test(async t => { _assertSame(ctx.measureText('A').fontBoundingBoxDescent, 10, "ctx.measureText('A').fontBoundingBoxDescent", "10"); _assertSame(ctx.measureText('ABCD').fontBoundingBoxAscent, 40, "ctx.measureText('ABCD').fontBoundingBoxAscent", "40"); _assertSame(ctx.measureText('ABCD').fontBoundingBoxDescent, 10, "ctx.measureText('ABCD').fontBoundingBoxDescent", "10"); - t.done(); }, "Testing fontBoundingBox for font ahem"); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.fontBoundingBox.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.fontBoundingBox.worker.js index b2cde04c0d..5c28b8f688 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.fontBoundingBox.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.fontBoundingBox.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -23,6 +22,5 @@ promise_test(async t => { _assertSame(ctx.measureText('ABCD').fontBoundingBoxAscent, 30, "ctx.measureText('ABCD').fontBoundingBoxAscent", "30"); _assertSame(ctx.measureText('ABCD').fontBoundingBoxDescent, 10, "ctx.measureText('ABCD').fontBoundingBoxDescent", "10"); - t.done(); }, "Testing fontBoundingBox measurements"); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.width.basic.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.width.basic.worker.js index 866ad8b3c5..f653f20f8e 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.width.basic.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.width.basic.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -22,6 +21,5 @@ promise_test(async t => { ctx.font = '100px CanvasTest'; _assertSame(ctx.measureText('A').width, 100, "ctx.measureText('A').width", "100"); - t.done(); }, "The width of character is same as font used"); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.width.empty.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.width.empty.worker.js index 6fb89c5ba7..932b82e129 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.width.empty.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.width.empty.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -17,6 +16,5 @@ promise_test(async t => { await self.fonts.ready; ctx.font = '50px CanvasTest'; _assertSame(ctx.measureText("").width, 0, "ctx.measureText(\"\").width", "0"); - t.done(); }, "The empty string has zero width"); done(); diff --git a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.width.space.worker.js b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.width.space.worker.js index d832feec5f..3f0e6d65da 100644 --- a/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.width.space.worker.js +++ b/testing/web-platform/tests/html/canvas/offscreen/text/2d.text.measure.width.space.worker.js @@ -7,7 +7,6 @@ importScripts("/resources/testharness.js"); importScripts("/html/canvas/resources/canvas-tests.js"); promise_test(async t => { - var canvas = new OffscreenCanvas(100, 50); var ctx = canvas.getContext('2d'); @@ -23,6 +22,5 @@ promise_test(async t => { _assertSame(ctx.measureText(' AB').width, 150, "ctx.measureText(' AB').width", "150"); _assertSame(ctx.measureText('AB ').width, 150, "ctx.measureText('AB ').width", "150"); - t.done(); }, "Space characters are converted to U+0020 and NOT collapsed"); done(); diff --git a/testing/web-platform/tests/html/canvas/tools/gentest.py b/testing/web-platform/tests/html/canvas/tools/gentest.py index 36cb7fe0f6..784005fc9a 100644 --- a/testing/web-platform/tests/html/canvas/tools/gentest.py +++ b/testing/web-platform/tests/html/canvas/tools/gentest.py @@ -1,3 +1,4 @@ +"""Script invoking the old and the new Canvas test generator.""" # To use this script: # -make a python virtual environment somewhere (it doesn't matter where) # python3 -m venv venv @@ -9,10 +10,10 @@ # python3 gentest.py from gentestutils import genTestUtils -from gentestutilsunion import genTestUtils_union +import gentestutilsunion genTestUtils('../element', '../element', 'templates.yaml', 'name2dir-canvas.yaml', False) genTestUtils('../offscreen', '../offscreen', 'templates.yaml', 'name2dir-offscreen.yaml', True) -genTestUtils_union('name2dir.yaml') +gentestutilsunion.generate_test_files('name2dir.yaml') diff --git a/testing/web-platform/tests/html/canvas/tools/gentestutilsunion.py b/testing/web-platform/tests/html/canvas/tools/gentestutilsunion.py index d7042810be..57077f6057 100644 --- a/testing/web-platform/tests/html/canvas/tools/gentestutilsunion.py +++ b/testing/web-platform/tests/html/canvas/tools/gentestutilsunion.py @@ -1,3 +1,4 @@ +"""Generates Canvas tests from YAML file definitions.""" # Current code status: # # This was originally written by Philip Taylor for use at @@ -28,7 +29,8 @@ # # * Test the tests, add new ones to Git, remove deleted ones from Git, etc. -from typing import Any, DefaultDict, List, Mapping, Optional, Set, Tuple +from typing import Any, DefaultDict, FrozenSet, List, Mapping, MutableMapping +from typing import Optional, Set, Tuple import re import collections @@ -36,10 +38,12 @@ import dataclasses import enum import importlib import itertools -import jinja2 import os import pathlib import sys +import textwrap + +import jinja2 try: import cairocffi as cairo # type: ignore @@ -61,12 +65,12 @@ class InvalidTestDefinitionError(Error): """Raised on invalid test definition.""" -def _doubleQuoteEscape(string: str) -> str: +def _double_quote_escape(string: str) -> str: return string.replace('\\', '\\\\').replace('"', '\\"') -def _escapeJS(string: str) -> str: - string = _doubleQuoteEscape(string) +def _escape_js(string: str) -> str: + string = _double_quote_escape(string) # Kind of an ugly hack, for nicer failure-message output. string = re.sub(r'\[(\w+)\]', r'[\\""+(\1)+"\\"]', string) return string @@ -135,15 +139,15 @@ def _expand_nonfinite(method: str, argstr: str, tail: str) -> str: match = re.match('<(.*)>', arg) if match is None: raise InvalidTestDefinitionError( - f"Expected arg to match format '<(.*)>', but was: {arg}") + f'Expected arg to match format "<(.*)>", but was: {arg}') a = match.group(1) args.append(a.split(' ')) calls = [] # Start with the valid argument list. call = [args[j][0] for j in range(len(args))] # For each argument alone, try setting it to all its invalid values: - for i in range(len(args)): - for a in args[i][1:]: + for i, arg in enumerate(args): + for a in arg[1:]: c2 = call[:] c2[i] = a calls.append(c2) @@ -162,7 +166,8 @@ def _expand_nonfinite(method: str, argstr: str, tail: str) -> str: f(call, 0, 0) - return '\n'.join('%s(%s)%s' % (method, ', '.join(c), tail) for c in calls) + str_calls = (', '.join(c) for c in calls) + return '\n'.join(f'{method}({params}){tail}' for params in str_calls) def _get_test_sub_dir(name: str, name_to_sub_dir: Mapping[str, str]) -> str: @@ -170,7 +175,7 @@ def _get_test_sub_dir(name: str, name_to_sub_dir: Mapping[str, str]) -> str: if name.startswith(prefix): return name_to_sub_dir[prefix] raise InvalidTestDefinitionError( - 'Test "%s" has no defined target directory mapping' % name) + f'Test "{name}" has no defined target directory mapping') def _remove_extra_newlines(text: str) -> str: @@ -183,6 +188,7 @@ def _remove_extra_newlines(text: str) -> str: text = re.sub(r'\\-\n\s*', '', text, flags=re.MULTILINE | re.DOTALL) return text + def _expand_test_code(code: str) -> str: code = re.sub(r' @moz-todo', '', code) @@ -215,48 +221,59 @@ def _expand_test_code(code: str) -> str: flags=re.MULTILINE | re.DOTALL) code = re.sub( - r'@assert (.*) === (.*);', lambda m: '_assertSame(%s, %s, "%s", "%s");' - % (m.group(1), m.group(2), _escapeJS(m.group(1)), _escapeJS(m.group(2)) - ), code) + r'@assert (.*) === (.*);', lambda m: + (f'_assertSame({m.group(1)}, {m.group(2)}, ' + f'"{_escape_js(m.group(1))}", "{_escape_js(m.group(2))}");'), code) code = re.sub( r'@assert (.*) !== (.*);', lambda m: - '_assertDifferent(%s, %s, "%s", "%s");' % (m.group(1), m.group( - 2), _escapeJS(m.group(1)), _escapeJS(m.group(2))), code) + (f'_assertDifferent({m.group(1)}, {m.group(2)}, ' + f'"{_escape_js(m.group(1))}", "{_escape_js(m.group(2))}");'), code) code = re.sub( - r'@assert (.*) =~ (.*);', lambda m: 'assert_regexp_match(%s, %s);' % ( - m.group(1), m.group(2)), code) + r'@assert (.*) =~ (.*);', + lambda m: f'assert_regexp_match({m.group(1)}, {m.group(2)});', code) code = re.sub( - r'@assert (.*);', lambda m: '_assert(%s, "%s");' % (m.group( - 1), _escapeJS(m.group(1))), code) + r'@assert (.*);', + lambda m: f'_assert({m.group(1)}, "{_escape_js(m.group(1))}");', code) - assert ('@' not in code) + assert '@' not in code return code -class CanvasType(str, enum.Enum): - HTML_CANVAS = 'htmlcanvas' - OFFSCREEN_CANVAS = 'offscreencanvas' - WORKER = 'worker' +_TestParams = Mapping[str, Any] +_MutableTestParams = MutableMapping[str, Any] + +class _CanvasType(str, enum.Enum): + HTML_CANVAS = 'HtmlCanvas' + OFFSCREEN_CANVAS = 'OffscreenCanvas' + WORKER = 'Worker' -def _get_enabled_canvas_types(test: Mapping[str, Any]) -> Set[CanvasType]: - return {CanvasType(t.lower()) for t in test.get('canvasType', CanvasType)} + +class _TemplateType(str, enum.Enum): + REFERENCE = 'reference' + HTML_REFERENCE = 'html_reference' + TESTHARNESS = 'testharness' @dataclasses.dataclass -class TestConfig: - out_dir: str - image_out_dir: str +class _OutputPaths: + element: str + offscreen: str + + def sub_path(self, sub_dir: str): + """Create a new _OutputPaths that is a subpath of this _OutputPath.""" + return _OutputPaths(element=os.path.join(self.element, sub_dir), + offscreen=os.path.join(self.offscreen, sub_dir)) -def _validate_test(test: Mapping[str, Any]): +def _validate_test(test: _TestParams): if test.get('expected', '') == 'green' and re.search( r'@assert pixel .* 0,0,0,0;', test['code']): - print('Probable incorrect pixel test in %s' % test['name']) + print(f'Probable incorrect pixel test in {test["name"]}') if 'size' in test and (not isinstance(test['size'], list) or len(test['size']) != 2): @@ -264,21 +281,20 @@ def _validate_test(test: Mapping[str, Any]): f'Invalid canvas size "{test["size"]}" in test {test["name"]}. ' 'Expected an array with two numbers.') - if 'test_type' in test and test['test_type'] != 'promise': - raise InvalidTestDefinitionError( - f'Test {test["name"]}\' test_type is invalid, it only accepts ' - '"promise" now for creating promise test type in the template ' - 'file.') + if test['template_type'] == _TemplateType.TESTHARNESS: + valid_test_types = {'sync', 'async', 'promise'} + else: + valid_test_types = {'promise'} - if 'reference' in test and 'html_reference' in test: + test_type = test.get('test_type') + if test_type is not None and test_type not in valid_test_types: raise InvalidTestDefinitionError( - f'Test {test["name"]} is invalid, "reference" and "html_reference" ' - 'can\'t both be specified at the same time.') + f'Invalid test_type: {test_type}. ' + f'Valid values are: {valid_test_types}.') -def _render_template(jinja_env: jinja2.Environment, - template: jinja2.Template, - params: Mapping[str, Any]) -> str: +def _render_template(jinja_env: jinja2.Environment, template: jinja2.Template, + params: _TestParams) -> str: """Renders the specified jinja template. The template is repetitively rendered until no more changes are observed. @@ -294,236 +310,276 @@ def _render_template(jinja_env: jinja2.Environment, def _render(jinja_env: jinja2.Environment, template_name: str, - params: Mapping[str, Any]): - params = dict(params) - params.update({ - # Render the code on its own, as it could contain templates expanding - # to multuple lines. This is needed to get proper indentation of the - # code in the main template. - 'code': _render_template(jinja_env, - jinja_env.from_string(params['code']), - params) - }) - - return _render_template(jinja_env, jinja_env.get_template(template_name), - params) - - -def _write_reference_test(jinja_env: jinja2.Environment, - params: Mapping[str, Any], - enabled_tests: Set[CanvasType], - canvas_path: str, offscreen_path: str): - if CanvasType.HTML_CANVAS in enabled_tests: - html_params = dict(params) - html_params.update({'canvas_type': CanvasType.HTML_CANVAS.value}) - pathlib.Path(f'{canvas_path}.html').write_text( - _render(jinja_env, "reftest_element.html", html_params), 'utf-8') - if CanvasType.OFFSCREEN_CANVAS in enabled_tests: - offscreen_params = dict(params) - offscreen_params.update({ - 'canvas_type': CanvasType.OFFSCREEN_CANVAS.value - }) - pathlib.Path(f'{offscreen_path}.html').write_text( - _render(jinja_env, "reftest_offscreen.html", offscreen_params), - 'utf-8') - if CanvasType.WORKER in enabled_tests: - worker_params = dict(params) - worker_params.update({'canvas_type': CanvasType.WORKER.value}) - pathlib.Path(f'{offscreen_path}.w.html').write_text( - _render(jinja_env, "reftest_worker.html", worker_params), 'utf-8') - - js_ref = params.get('reference', '') - html_ref = params.get('html_reference', '') - ref_params = dict(params) - ref_params.update({ - 'is_test_reference': True, - 'code': js_ref or html_ref - }) - ref_template_name = 'reftest_element.html' if js_ref else 'reftest.html' - if CanvasType.HTML_CANVAS in enabled_tests: - pathlib.Path(f'{canvas_path}-expected.html').write_text( - _render(jinja_env, ref_template_name, ref_params), 'utf-8') - if {CanvasType.OFFSCREEN_CANVAS, CanvasType.WORKER} & enabled_tests: - pathlib.Path(f'{offscreen_path}-expected.html').write_text( - _render(jinja_env, ref_template_name, ref_params), 'utf-8') - - -def _write_testharness_test(jinja_env: jinja2.Environment, - params: Mapping[str, Any], - enabled_tests: Set[CanvasType], - canvas_path: str, - offscreen_path: str): - # Create test cases for canvas and offscreencanvas. - if CanvasType.HTML_CANVAS in enabled_tests: - html_params = dict(params) - html_params.update({'canvas_type': CanvasType.HTML_CANVAS.value}) - pathlib.Path(f'{canvas_path}.html').write_text( - _render(jinja_env, "testharness_element.html", html_params), - 'utf-8') - - if CanvasType.OFFSCREEN_CANVAS in enabled_tests: - offscreen_params = dict(params) - offscreen_params.update({ - 'canvas_type': CanvasType.OFFSCREEN_CANVAS.value - }) - pathlib.Path(f'{offscreen_path}.html').write_text( - _render(jinja_env, "testharness_offscreen.html", offscreen_params), - 'utf-8') - - if CanvasType.WORKER in enabled_tests: - worker_params = dict(params) - worker_params.update({'canvas_type': CanvasType.WORKER.value}) - pathlib.Path(f'{offscreen_path}.worker.js').write_text( - _render(jinja_env, "testharness_worker.js", worker_params), - 'utf-8') - - -def _generate_expected_image(expected: str, name: str, sub_dir: str, - enabled_canvas_types: Set[CanvasType], - html_canvas_cfg: TestConfig, - offscreen_canvas_cfg: TestConfig) -> str: - """Creates a reference image using Cairo and returns the file location.""" - if expected == 'green': - return '/images/green-100x50.png' - if expected == 'clear': - return '/images/clear-100x50.png' - if ';' in expected: - print('Found semicolon in %s' % name) - expected = re.sub( - r'^size (\d+) (\d+)', - r'surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, \1, \2)' - r'\ncr = cairo.Context(surface)', expected) - - if CanvasType.HTML_CANVAS in enabled_canvas_types: - expected_canvas = ( - expected + "\nsurface.write_to_png('%s.png')\n" % - os.path.join(html_canvas_cfg.image_out_dir, sub_dir, name)) - eval(compile(expected_canvas, '<test %s>' % name, 'exec'), {}, - {'cairo': cairo}) - - if {CanvasType.OFFSCREEN_CANVAS, CanvasType.WORKER} & enabled_canvas_types: - expected_offscreen = ( - expected + "\nsurface.write_to_png('%s.png')\n" % - os.path.join(offscreen_canvas_cfg.image_out_dir, sub_dir, name)) - eval(compile(expected_offscreen, '<test %s>' % name, 'exec'), {}, - {'cairo': cairo}) - - return '%s.png' % name - - -def _generate_test(test: Mapping[str, Any], jinja_env: jinja2.Environment, - name_to_sub_dir: Mapping[str, str], - used_tests: DefaultDict[str, Set[CanvasType]], - html_canvas_cfg: TestConfig, - offscreen_canvas_cfg: TestConfig) -> None: - _validate_test(test) - - name = test['name'] - - sub_dir = _get_test_sub_dir(name, name_to_sub_dir) - enabled_canvas_types = _get_enabled_canvas_types(test) - - # Defaults: - params = { - 'desc': '', - 'size': [100, 50], - } - - params.update(test) - - # Render parameters used in the test name. - name = jinja_env.from_string(name).render(params) - print('\r(%s)' % name, ' ' * 32, '\t') - - expected_img = None - if 'expected' in test and test['expected'] is not None: - expected_img = _generate_expected_image(test['expected'], name, - sub_dir, enabled_canvas_types, - html_canvas_cfg, - offscreen_canvas_cfg) - - params.update({ - 'code': _expand_test_code(test['code']), - 'expected_img': expected_img - }) - - already_tested = used_tests[name].intersection(enabled_canvas_types) - if already_tested: - raise InvalidTestDefinitionError( - f'Test {name} is defined twice for types {already_tested}') - used_tests[name].update(enabled_canvas_types) + params: _TestParams, output_file_name: str): + template = jinja_env.get_template(template_name) + file_content = _render_template(jinja_env, template, params) + pathlib.Path(output_file_name).write_text(file_content, 'utf-8') + + +def _preprocess_code(jinja_env: jinja2.Environment, code: str, + params: _TestParams) -> str: + code = _expand_test_code(code) + # Render the code on its own, as it could contain templates expanding + # to multiple lines. This is needed to get proper indentation of the + # code in the main template. + code = _render_template(jinja_env, jinja_env.from_string(code), params) + return code - canvas_path = os.path.join(html_canvas_cfg.out_dir, sub_dir, name) - offscreen_path = os.path.join(offscreen_canvas_cfg.out_dir, sub_dir, name) - if 'manual' in test: - canvas_path += '-manual' - offscreen_path += '-manual' - if 'reference' in test or 'html_reference' in test: - _write_reference_test(jinja_env, params, enabled_canvas_types, - canvas_path, offscreen_path) - else: - _write_testharness_test(jinja_env, params, enabled_canvas_types, - canvas_path, offscreen_path) +class _Variant(): + + def __init__(self, params: _MutableTestParams) -> None: + self._params = params + + @property + def params(self) -> _TestParams: + """Read-only getter for this variant's param dict.""" + return self._params + + @staticmethod + def create_with_defaults(test: _TestParams) -> '_Variant': + """Create a _Variant from the specified params. + + Default values are added for certain parameters, if missing.""" + params = { + 'desc': '', + 'size': [100, 50], + 'variant_names': [], + } + params.update(test) + return _Variant(params) + def _get_variant_name(self, jinja_env: jinja2.Environment) -> str: + name = self.params['name'] + if self.params.get('append_variants_to_name', True): + name = '.'.join([name] + self.params['variant_names']) -def _recursive_expand_variant_matrix(test_list: List[Mapping[str, Any]], - variant_matrix: List[Mapping[str, Any]], + name = jinja_env.from_string(name).render(self.params) + return name + + def _get_file_name(self) -> str: + file_name = self.params['name'] + + if 'manual' in self.params: + file_name += '-manual' + + return file_name + + def _get_canvas_types(self) -> FrozenSet[_CanvasType]: + canvas_types = self.params.get('canvas_types', _CanvasType) + invalid_types = { + type + for type in canvas_types if type not in list(_CanvasType) + } + if invalid_types: + raise InvalidTestDefinitionError( + f'Invalid canvas_types: {list(invalid_types)}. ' + f'Accepted values are: {[t.value for t in _CanvasType]}') + return frozenset(_CanvasType(t) for t in canvas_types) + + def _get_template_type(self) -> _TemplateType: + if 'reference' in self.params and 'html_reference' in self.params: + raise InvalidTestDefinitionError( + f'Test {self.params["name"]} is invalid, "reference" and ' + '"html_reference" can\'t both be specified at the same time.') + + if 'reference' in self.params: + return _TemplateType.REFERENCE + if 'html_reference' in self.params: + return _TemplateType.HTML_REFERENCE + return _TemplateType.TESTHARNESS + + def finalize_params(self, jinja_env: jinja2.Environment) -> None: + """Finalize this variant by adding computed param fields.""" + self._params['name'] = self._get_variant_name(jinja_env) + self._params['file_name'] = self._get_file_name() + self._params['canvas_types'] = self._get_canvas_types() + self._params['template_type'] = self._get_template_type() + + if 'reference' in self._params: + self._params['reference'] = _preprocess_code( + jinja_env, self._params['reference'], self._params) + + if 'html_reference' in self._params: + self._params['html_reference'] = _preprocess_code( + jinja_env, self._params['html_reference'], self._params) + + code_params = dict(self.params) + if _CanvasType.HTML_CANVAS in self.params['canvas_types']: + code_params['canvas_type'] = _CanvasType.HTML_CANVAS.value + self._params['code_element'] = _preprocess_code( + jinja_env, self._params['code'], code_params) + + if _CanvasType.OFFSCREEN_CANVAS in self.params['canvas_types']: + code_params['canvas_type'] = _CanvasType.OFFSCREEN_CANVAS.value + self._params['code_offscreen'] = _preprocess_code( + jinja_env, self._params['code'], code_params) + + if _CanvasType.WORKER in self.params['canvas_types']: + code_params['canvas_type'] = _CanvasType.WORKER.value + self._params['code_worker'] = _preprocess_code( + jinja_env, self._params['code'], code_params) + + _validate_test(self._params) + + def generate_expected_image(self, output_dirs: _OutputPaths) -> None: + """Creates a reference image using Cairo and save filename in params.""" + if 'expected' not in self.params: + return + + expected = self.params['expected'] + name = self.params['name'] + + if expected == 'green': + self._params['expected_img'] = '/images/green-100x50.png' + return + if expected == 'clear': + self._params['expected_img'] = '/images/clear-100x50.png' + return + if ';' in expected: + print(f'Found semicolon in {name}') + expected = re.sub( + r'^size (\d+) (\d+)', + r'surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, \1, \2)' + r'\ncr = cairo.Context(surface)', expected) + + output_paths = output_dirs.sub_path(name) + if _CanvasType.HTML_CANVAS in self.params['canvas_types']: + expected_canvas = ( + f'{expected}\n' + f'surface.write_to_png("{output_paths.element}.png")\n') + eval(compile(expected_canvas, f'<test {name}>', 'exec'), {}, + {'cairo': cairo}) + + if {_CanvasType.OFFSCREEN_CANVAS, _CanvasType.WORKER + } & self.params['canvas_types']: + expected_offscreen = ( + f'{expected}\n' + f'surface.write_to_png("{output_paths.offscreen}.png")\n') + eval(compile(expected_offscreen, f'<test {name}>', 'exec'), {}, + {'cairo': cairo}) + + self._params['expected_img'] = f'{name}.png' + + def _write_reference_test(self, jinja_env: jinja2.Environment, + output_files: _OutputPaths): + params = dict(self.params) + if _CanvasType.HTML_CANVAS in params['canvas_types']: + _render(jinja_env, 'reftest_element.html', params, + f'{output_files.element}.html') + if _CanvasType.OFFSCREEN_CANVAS in params['canvas_types']: + _render(jinja_env, 'reftest_offscreen.html', params, + f'{output_files.offscreen}.html') + if _CanvasType.WORKER in params['canvas_types']: + _render(jinja_env, 'reftest_worker.html', params, + f'{output_files.offscreen}.w.html') + + params['is_test_reference'] = True + is_html_ref = params['template_type'] == _TemplateType.HTML_REFERENCE + ref_template = 'reftest.html' if is_html_ref else 'reftest_element.html' + if _CanvasType.HTML_CANVAS in params['canvas_types']: + _render(jinja_env, ref_template, params, + f'{output_files.element}-expected.html') + if {_CanvasType.OFFSCREEN_CANVAS, _CanvasType.WORKER + } & params['canvas_types']: + _render(jinja_env, ref_template, params, + f'{output_files.offscreen}-expected.html') + + def _write_testharness_test(self, jinja_env: jinja2.Environment, + output_files: _OutputPaths): + # Create test cases for canvas and offscreencanvas. + if _CanvasType.HTML_CANVAS in self.params['canvas_types']: + _render(jinja_env, 'testharness_element.html', self.params, + f'{output_files.element}.html') + + if _CanvasType.OFFSCREEN_CANVAS in self.params['canvas_types']: + _render(jinja_env, 'testharness_offscreen.html', self.params, + f'{output_files.offscreen}.html') + + if _CanvasType.WORKER in self.params['canvas_types']: + _render(jinja_env, 'testharness_worker.js', self.params, + f'{output_files.offscreen}.worker.js') + + def generate_test(self, jinja_env: jinja2.Environment, + output_dirs: _OutputPaths) -> None: + """Generate the test files to the specified output dirs.""" + output_files = output_dirs.sub_path(self.params['file_name']) + + if self.params['template_type'] in (_TemplateType.REFERENCE, + _TemplateType.HTML_REFERENCE): + self._write_reference_test(jinja_env, output_files) + else: + self._write_testharness_test(jinja_env, output_files) + + +def _recursive_expand_variant_matrix(original_test: _TestParams, + variant_matrix: List[_TestParams], current_selection: List[Tuple[str, Any]], - original_test: Mapping[str, Any]): + test_variants: List[_Variant]): if len(current_selection) == len(variant_matrix): # Selection for each variant is done, so add a new test to test_list. - test = original_test.copy() + test = dict(original_test) variant_name_list = [] - should_append_variant_names = original_test.get( - 'append_variants_to_name', True) for variant_name, variant_params in current_selection: - variant_name_list.append(variant_name) - # Append variant name. Variant names starting with '_' are - # not appended, which is useful to create variants with the same - # name in different folders (element vs. offscreen). - if (should_append_variant_names - and not variant_name.startswith('_')): - test['name'] += '.' + variant_name test.update(variant_params) - # Expose variant names as a list so they can be used from the yaml - # files, which helps with better naming of tests. - test.update({'variant_names': variant_name_list}) - test_list.append(test) + variant_name_list.append(variant_name) + # Expose variant names as a list so they can be used from the yaml + # files, which helps with better naming of tests. + test.update({'variant_names': variant_name_list}) + test_variants.append(_Variant.create_with_defaults(test)) else: # Continue the recursion with each possible selection for the current # variant. variant = variant_matrix[len(current_selection)] for variant_options in variant.items(): current_selection.append(variant_options) - _recursive_expand_variant_matrix(test_list, variant_matrix, - current_selection, original_test) + _recursive_expand_variant_matrix(original_test, variant_matrix, + current_selection, test_variants) current_selection.pop() -def _expand_variant_matrix( - variant_matrix: List[Mapping[str, Any]], - original_test: Mapping[str, Any]) -> List[Mapping[str, Any]]: +def _get_variants(test: _TestParams) -> List[_Variant]: current_selection = [] - matrix_tests = [] - _recursive_expand_variant_matrix(matrix_tests, variant_matrix, - current_selection, original_test) - return matrix_tests + test_variants = [] + variants = test.get('variants', []) + if not isinstance(variants, list): + raise InvalidTestDefinitionError( + textwrap.dedent(""" + Variants must be specified as a list of variant dimensions, e.g.: + variants: + - dimension1-variant1: + param: ... + dimension1-variant2: + param: ... + - dimension2-variant1: + param: ... + dimension2-variant2: + param: ...""")) + _recursive_expand_variant_matrix(test, variants, current_selection, + test_variants) + return test_variants + + +def _check_uniqueness(tested: DefaultDict[str, Set[_CanvasType]], name: str, + canvas_types: FrozenSet[_CanvasType]) -> None: + already_tested = tested[name].intersection(canvas_types) + if already_tested: + raise InvalidTestDefinitionError( + f'Test {name} is defined twice for types {already_tested}') + tested[name].update(canvas_types) -def genTestUtils_union(NAME2DIRFILE: str) -> None: - CANVASOUTPUTDIR = '../element' - CANVASIMAGEOUTPUTDIR = '../element' - OFFSCREENCANVASOUTPUTDIR = '../offscreen' - OFFSCREENCANVASIMAGEOUTPUTDIR = '../offscreen' +def generate_test_files(name_to_dir_file: str) -> None: + """Generate Canvas tests from YAML file definition.""" + output_dirs = _OutputPaths(element='../element', offscreen='../offscreen') jinja_env = jinja2.Environment( - loader=jinja2.PackageLoader("gentestutilsunion"), + loader=jinja2.PackageLoader('gentestutilsunion'), keep_trailing_newline=True, trim_blocks=True, lstrip_blocks=True) - jinja_env.filters['double_quote_escape'] = _doubleQuoteEscape + jinja_env.filters['double_quote_escape'] = _double_quote_escape # Run with --test argument to run unit tests. if len(sys.argv) > 1 and sys.argv[1] == '--test': @@ -531,16 +587,19 @@ def genTestUtils_union(NAME2DIRFILE: str) -> None: doctest.testmod() sys.exit() - name_to_sub_dir = yaml.safe_load(pathlib.Path(NAME2DIRFILE).read_text()) + name_to_sub_dir = (yaml.safe_load( + pathlib.Path(name_to_dir_file).read_text(encoding='utf-8'))) tests = [] test_yaml_directory = 'yaml-new' - TESTSFILES = [ + yaml_files = [ os.path.join(test_yaml_directory, f) for f in os.listdir(test_yaml_directory) if f.endswith('.yaml') ] - for t in sum( - [yaml.safe_load(pathlib.Path(f).read_text()) for f in TESTSFILES], []): + for t in sum([ + yaml.safe_load(pathlib.Path(f).read_text(encoding='utf-8')) + for f in yaml_files + ], []): if 'DISABLED' in t: continue if 'meta' in t: @@ -550,14 +609,11 @@ def genTestUtils_union(NAME2DIRFILE: str) -> None: tests.append(t) # Ensure the test output directories exist. - testdirs = [ - CANVASOUTPUTDIR, OFFSCREENCANVASOUTPUTDIR, CANVASIMAGEOUTPUTDIR, - OFFSCREENCANVASIMAGEOUTPUTDIR - ] + test_dirs = [output_dirs.element, output_dirs.offscreen] for sub_dir in set(name_to_sub_dir.values()): - testdirs.append('%s/%s' % (CANVASOUTPUTDIR, sub_dir)) - testdirs.append('%s/%s' % (OFFSCREENCANVASOUTPUTDIR, sub_dir)) - for d in testdirs: + test_dirs.append(f'{output_dirs.element}/{sub_dir}') + test_dirs.append(f'{output_dirs.offscreen}/{sub_dir}') + for d in test_dirs: try: os.mkdir(d) except FileExistsError: @@ -565,24 +621,19 @@ def genTestUtils_union(NAME2DIRFILE: str) -> None: used_tests = collections.defaultdict(set) for test in tests: - if 'variant_matrix' in test: - variants = _expand_variant_matrix(test['variant_matrix'], test) - elif 'variants' in test: - variant_matrix = [test['variants']] - variants = _expand_variant_matrix(variant_matrix, test) - else: - variants = [test] - - for variant in variants: - _generate_test(variant, - jinja_env, - name_to_sub_dir, - used_tests, - html_canvas_cfg=TestConfig( - out_dir=CANVASOUTPUTDIR, - image_out_dir=CANVASIMAGEOUTPUTDIR), - offscreen_canvas_cfg=TestConfig( - out_dir=OFFSCREENCANVASOUTPUTDIR, - image_out_dir=OFFSCREENCANVASIMAGEOUTPUTDIR)) + print(test['name']) + for variant in _get_variants(test): + variant.finalize_params(jinja_env) + if test['name'] != variant.params['name']: + print(f' {variant.params["name"]}') + + sub_dir = _get_test_sub_dir(variant.params['file_name'], + name_to_sub_dir) + output_sub_dirs = output_dirs.sub_path(sub_dir) + + _check_uniqueness(used_tests, variant.params['name'], + variant.params['canvas_types']) + variant.generate_expected_image(output_sub_dirs) + variant.generate_test(jinja_env, output_sub_dirs) print() diff --git a/testing/web-platform/tests/html/canvas/tools/templates/reftest.html b/testing/web-platform/tests/html/canvas/tools/templates/reftest.html index 4c9affbbbb..f68d4c4621 100644 --- a/testing/web-platform/tests/html/canvas/tools/templates/reftest.html +++ b/testing/web-platform/tests/html/canvas/tools/templates/reftest.html @@ -5,7 +5,7 @@ <p class="desc">{{ desc }}</p> {% if notes %}<p class="notes">{{ notes }}{% endif %} -{{ code | trim }} +{{ html_reference | trim }} {% for image in images %} <img src="/images/{{ image }}" id="{{ image }}" class="resource"> {% endfor -%} diff --git a/testing/web-platform/tests/html/canvas/tools/templates/reftest_element.html b/testing/web-platform/tests/html/canvas/tools/templates/reftest_element.html index 6684e9c615..6f7a8c8507 100644 --- a/testing/web-platform/tests/html/canvas/tools/templates/reftest_element.html +++ b/testing/web-platform/tests/html/canvas/tools/templates/reftest_element.html @@ -20,7 +20,8 @@ const canvas = document.getElementById("canvas"); const ctx = canvas.getContext('2d'{% if attributes %}, {{ attributes }}{% endif %}); - {{ code | trim | indent(2) }} + {{ reference | trim | indent(2) if is_test_reference else + code_element | trim | indent(2) }} {% if test_type == 'promise' %} document.documentElement.classList.remove("reftest-wait"); {% endif %} diff --git a/testing/web-platform/tests/html/canvas/tools/templates/reftest_offscreen.html b/testing/web-platform/tests/html/canvas/tools/templates/reftest_offscreen.html index 1d0d93dfa1..abc840159f 100644 --- a/testing/web-platform/tests/html/canvas/tools/templates/reftest_offscreen.html +++ b/testing/web-platform/tests/html/canvas/tools/templates/reftest_offscreen.html @@ -18,7 +18,7 @@ const canvas = new OffscreenCanvas({{ size[0] }}, {{ size[1] }}); const ctx = canvas.getContext('2d'{% if attributes %}, {{ attributes }}{% endif %}); - {{ code | trim | indent(2) }} + {{ code_offscreen | trim | indent(2) }} const outputCanvas = document.getElementById("canvas"); outputCanvas.getContext('2d'{% if attributes %}, {{ attributes }}{% endif %}).drawImage(canvas, 0, 0); diff --git a/testing/web-platform/tests/html/canvas/tools/templates/reftest_worker.html b/testing/web-platform/tests/html/canvas/tools/templates/reftest_worker.html index e636d3634b..02281af5d1 100644 --- a/testing/web-platform/tests/html/canvas/tools/templates/reftest_worker.html +++ b/testing/web-platform/tests/html/canvas/tools/templates/reftest_worker.html @@ -18,7 +18,7 @@ const canvas = new OffscreenCanvas({{ size[0] }}, {{ size[1] }}); const ctx = canvas.getContext('2d'{% if attributes %}, {{ attributes }}{% endif %}); - {{ code | trim | indent(4) }} + {{ code_worker | trim | indent(4) }} const bitmap = canvas.transferToImageBitmap(); self.postMessage(bitmap, bitmap); diff --git a/testing/web-platform/tests/html/canvas/tools/templates/testharness_element.html b/testing/web-platform/tests/html/canvas/tools/templates/testharness_element.html index 56cde7936a..c8de772ea6 100644 --- a/testing/web-platform/tests/html/canvas/tools/templates/testharness_element.html +++ b/testing/web-platform/tests/html/canvas/tools/templates/testharness_element.html @@ -42,21 +42,29 @@ {% if test_type == 'promise' %} promise_test(async t => { - var canvas = document.getElementById('c'); - var ctx = canvas.getContext('2d'{% if attributes %}, {{ attributes }}{% endif %}); -{% else %} +{% elif test_type == 'async' %} +async_test(t => { +{% elif test_type == 'sync' %} +test(t => { +{% endif %} +{% if not test_type %} var t = async_test("{{ desc | double_quote_escape }}"); _addTest(function(canvas, ctx) { + +{% else %} + var canvas = document.getElementById('c'); + var ctx = canvas.getContext('2d'{% if attributes %}, {{ attributes }}{% endif %}); + {% endif %} - {# Test body: #} - {{ code | trim | indent(2) }} + {#- Test body: #} + {{ code_element | trim | indent(2) }} {# Promise vs. async test footer: #} -{% if test_type == 'promise' %} -}, "{{ desc }}"); -{% else %} +{% if not test_type %} }{% if attributes %}, {{ attributes }}{% endif %}); +{% else %} +}, "{{ desc | double_quote_escape }}"); {% endif -%} </script> diff --git a/testing/web-platform/tests/html/canvas/tools/templates/testharness_offscreen.html b/testing/web-platform/tests/html/canvas/tools/templates/testharness_offscreen.html index 8ebbff77a6..68147680e1 100644 --- a/testing/web-platform/tests/html/canvas/tools/templates/testharness_offscreen.html +++ b/testing/web-platform/tests/html/canvas/tools/templates/testharness_offscreen.html @@ -15,6 +15,11 @@ {#- Promise vs. async test header: +#} {% if test_type == 'promise' %} promise_test(async t => { + +{% elif test_type == 'async' %} +async_test(t => { +{% elif test_type == 'sync' %} +test(t => { {% else %} var t = async_test("{{ desc | double_quote_escape }}"); var t_pass = t.done.bind(t); @@ -22,22 +27,23 @@ var t_fail = t.step_func(function(reason) { throw reason; }); t.step(function() { + {% endif %} -{# Test body: #} +{#- Test body: #} var canvas = new OffscreenCanvas({{ size[0] }}, {{ size[1] }}); var ctx = canvas.getContext('2d'{% if attributes %}, {{ attributes }}{% endif %}); - {{ code | trim | indent(2)}} + {{ code_offscreen | trim | indent(2)}} {#- Promise vs. async test footer: +#} -{% if test_type == 'promise' %} - -}, "{{ desc }}"); -{% else %} +{% if not test_type %} t.done(); }); +{% else %} + +}, "{{ desc | double_quote_escape }}"); {% endif %} </script> {% for svgimage in svgimages %} diff --git a/testing/web-platform/tests/html/canvas/tools/templates/testharness_worker.js b/testing/web-platform/tests/html/canvas/tools/templates/testharness_worker.js index f1f04e7bb6..570d479a0a 100644 --- a/testing/web-platform/tests/html/canvas/tools/templates/testharness_worker.js +++ b/testing/web-platform/tests/html/canvas/tools/templates/testharness_worker.js @@ -10,6 +10,10 @@ importScripts("/html/canvas/resources/canvas-tests.js"); {# Promise vs. async test header: #} {% if test_type == 'promise' %} promise_test(async t => { +{% elif test_type == 'async' %} +async_test(t => { +{% elif test_type == 'sync' %} +test(t => { {% else %} var t = async_test("{{ desc | double_quote_escape }}"); var t_pass = t.done.bind(t); @@ -17,19 +21,20 @@ var t_fail = t.step_func(function(reason) { throw reason; }); t.step(function() { + {% endif %} -{# Test body: #} +{#- Test body: #} var canvas = new OffscreenCanvas({{ size[0] }}, {{ size[1] }}); var ctx = canvas.getContext('2d'{% if attributes %}, {{ attributes }}{% endif %}); - {{ code | trim | indent(2)}} - t.done(); + {{ code_worker | trim | indent(2)}} {#- Promise vs. async test footer: +#} -{% if test_type == 'promise' %} -}, "{{ desc }}"); -{% else %} +{% if not test_type %} + t.done(); }); +{% else %} +}, "{{ desc | double_quote_escape }}"); {% endif %} done(); diff --git a/testing/web-platform/tests/html/canvas/tools/yaml-new/color_space.yaml b/testing/web-platform/tests/html/canvas/tools/yaml-new/color_space.yaml index 39556caf0a..56f6d01d30 100644 --- a/testing/web-platform/tests/html/canvas/tools/yaml-new/color_space.yaml +++ b/testing/web-platform/tests/html/canvas/tools/yaml-new/color_space.yaml @@ -36,8 +36,7 @@ - name: 2d.color.space.p3.toBlob.p3.canvas desc: test if toblob returns p3 data from p3 color space canvas attributes: '{colorSpace: "display-p3"}' - canvasType: - ['HTMLCanvas'] + canvas_types: ['HtmlCanvas'] code: | ctx.fillStyle = "rgba(155, 27, 27, 1)"; ctx.fillRect(0, 0, 1, 1); @@ -68,8 +67,7 @@ - name: 2d.color.space.p3.toDataURL.p3.canvas desc: test if toDataURL returns p3 data from canvas with p3 color space attributes: '{colorSpace: "display-p3"}' - canvasType: - ['HTMLCanvas'] + canvas_types: ['HtmlCanvas'] code: | ctx.fillStyle = "rgba(155, 27, 27, 1)"; ctx.fillRect(0, 0, 1, 1); @@ -96,8 +94,7 @@ - name: 2d.color.space.p3.toDataURL.jpeg.p3.canvas desc: test if toDataURL('image/jpeg') returns p3 data from canvas with p3 color space attributes: '{colorSpace: "display-p3"}' - canvasType: - ['HTMLCanvas'] + canvas_types: ['HtmlCanvas'] code: | ctx.fillStyle = "rgba(155, 27, 27, 1)"; ctx.fillRect(0, 0, 1, 1); @@ -124,8 +121,7 @@ - name: 2d.color.space.p3.toBlob.with.putImageData desc: Use putImageData to put some p3 data in canvas and test if toBlob returns the same data attributes: '{colorSpace: "display-p3"}' - canvasType: - ['HTMLCanvas'] + canvas_types: ['HtmlCanvas'] code: | canvas.width = 2; canvas.height = 2; @@ -162,8 +158,7 @@ - name: 2d.color.space.p3.toDataURL.with.putImageData desc: Use putImageData to put some p3 data in canvas and test if toDataURL returns the same data attributes: '{colorSpace: "display-p3"}' - canvasType: - ['HTMLCanvas'] + canvas_types: ['HtmlCanvas'] code: | canvas.width = 2; canvas.height = 2; @@ -197,7 +192,7 @@ - name: 2d.color.space.p3.fillText desc: Test if fillText can be used with a solid display-p3 color attributes: '{colorSpace: "display-p3"}' - canvasType: ['HTMLCanvas'] + canvas_types: ['HtmlCanvas'] code: | deferTest(); @@ -236,8 +231,7 @@ - name: 2d.color.space.p3.strokeText desc: Test if strokeText can be used with a solid display-p3 color attributes: '{colorSpace: "display-p3"}' - canvasType: - ['HTMLCanvas'] + canvas_types: ['HtmlCanvas'] code: | deferTest(); @@ -277,8 +271,7 @@ - name: 2d.color.space.p3.fillText.shadow desc: Test if fillText can be used with a display-p3 shadow color attributes: '{colorSpace: "display-p3"}' - canvasType: - ['HTMLCanvas'] + canvas_types: ['HtmlCanvas'] code: | deferTest(); diff --git a/testing/web-platform/tests/html/canvas/tools/yaml-new/compositing.yaml b/testing/web-platform/tests/html/canvas/tools/yaml-new/compositing.yaml index bd7fae1d62..6bd0aaad8a 100644 --- a/testing/web-platform/tests/html/canvas/tools/yaml-new/compositing.yaml +++ b/testing/web-platform/tests/html/canvas/tools/yaml-new/compositing.yaml @@ -43,7 +43,7 @@ expected: green - name: 2d.composite.globalAlpha.canvas - canvasType: ['HTMLCanvas'] + canvas_types: ['HtmlCanvas'] code: | var canvas2 = document.createElement('canvas'); canvas2.width = 100; @@ -61,7 +61,7 @@ expected: green - name: 2d.composite.globalAlpha.canvaspattern - canvasType: ['HTMLCanvas'] + canvas_types: ['HtmlCanvas'] code: | var canvas2 = document.createElement('canvas'); canvas2.width = 100; @@ -80,7 +80,7 @@ expected: green - name: 2d.composite.globalAlpha.canvascopy - canvasType: ['HTMLCanvas'] + canvas_types: ['HtmlCanvas'] code: | var canvas2 = document.createElement('canvas'); canvas2.width = 100; @@ -173,7 +173,7 @@ expected: green - name: 2d.composite.globalAlpha.canvas - canvasType: ['OffscreenCanvas', 'Worker'] + canvas_types: ['OffscreenCanvas', 'Worker'] code: | var offscreenCanvas2 = new OffscreenCanvas(100, 50); var ctx2 = offscreenCanvas2.getContext('2d'); @@ -203,7 +203,7 @@ expected: green - name: 2d.composite.globalAlpha.canvaspattern - canvasType: ['OffscreenCanvas', 'Worker'] + canvas_types: ['OffscreenCanvas', 'Worker'] code: | var offscreenCanvas2 = new OffscreenCanvas(100, 50); var ctx2 = offscreenCanvas2.getContext('2d'); @@ -218,7 +218,7 @@ @assert pixel 50,25 ==~ 2,253,0,255; - name: 2d.composite.globalAlpha.canvascopy - canvasType: ['OffscreenCanvas', 'Worker'] + canvas_types: ['OffscreenCanvas', 'Worker'] code: | var offscreenCanvas2 = new OffscreenCanvas(100, 50); var ctx2 = offscreenCanvas2.getContext('2d'); diff --git a/testing/web-platform/tests/html/canvas/tools/yaml-new/conformance_requirements.yaml b/testing/web-platform/tests/html/canvas/tools/yaml-new/conformance_requirements.yaml index 3483d115f4..a070c0a6ef 100644 --- a/testing/web-platform/tests/html/canvas/tools/yaml-new/conformance_requirements.yaml +++ b/testing/web-platform/tests/html/canvas/tools/yaml-new/conformance_requirements.yaml @@ -1,7 +1,7 @@ - name: 2d.conformance.requirements.delete desc: window.CanvasRenderingContext2D is Configurable notes: &bindings Defined in "Web IDL" (draft) - canvasType: ['HTMLCanvas'] + canvas_types: ['HtmlCanvas'] code: | @assert window.CanvasRenderingContext2D !== undefined; @assert delete window.CanvasRenderingContext2D === true; @@ -172,7 +172,6 @@ desc: void methods return undefined images: - yellow.png - canvasType: ['HTMLCanvas'] + canvas_types: ['HtmlCanvas'] code: | @assert ctx.drawImage(document.getElementById('yellow.png'), 0, 0, 1, 1, 0, 0, 0, 0) === undefined; - diff --git a/testing/web-platform/tests/html/canvas/tools/yaml-new/drawing-images-to-the-canvas.yaml b/testing/web-platform/tests/html/canvas/tools/yaml-new/drawing-images-to-the-canvas.yaml index 09e9e00186..7ebe9cca85 100644 --- a/testing/web-platform/tests/html/canvas/tools/yaml-new/drawing-images-to-the-canvas.yaml +++ b/testing/web-platform/tests/html/canvas/tools/yaml-new/drawing-images-to-the-canvas.yaml @@ -1,5 +1,5 @@ - name: 2d.drawImage.canvas - canvasType: ['HTMLCanvas'] + canvas_types: ['HtmlCanvas'] code: | var canvas2 = document.createElement('canvas'); canvas2.width = 100; @@ -70,12 +70,12 @@ desc: Incorrect image types in drawImage do not match any defined overloads, so WebIDL throws a TypeError notes: &bindings Defined in "Web IDL" (draft) - canvasType: ['HTMLCanvas'] + canvas_types: ['HtmlCanvas'] code: | @assert throws TypeError ctx.drawImage(document.createElement('p'), 0, 0); - name: 2d.drawImage.incomplete.nosrc - canvasType: ['HTMLCanvas'] + canvas_types: ['HtmlCanvas'] mozilla: {throws: !!null ''} code: | ctx.fillStyle = '#0f0'; @@ -86,7 +86,7 @@ expected: green - name: 2d.drawImage.incomplete.immediate - canvasType: ['HTMLCanvas'] + canvas_types: ['HtmlCanvas'] images: - red.png code: | @@ -103,7 +103,7 @@ expected: green - name: 2d.drawImage.incomplete.reload - canvasType: ['HTMLCanvas'] + canvas_types: ['HtmlCanvas'] images: - yellow.png - red.png @@ -122,7 +122,7 @@ expected: green - name: 2d.drawImage.incomplete.emptysrc - canvasType: ['HTMLCanvas'] + canvas_types: ['HtmlCanvas'] images: - red.png mozilla: {throws: !!null ''} @@ -136,7 +136,7 @@ expected: green - name: 2d.drawImage.incomplete.removedsrc - canvasType: ['HTMLCanvas'] + canvas_types: ['HtmlCanvas'] images: - red.png mozilla: {throws: !!null ''} @@ -150,7 +150,7 @@ expected: green - name: 2d.drawImage.nonexistent - canvasType: ['HTMLCanvas'] + canvas_types: ['HtmlCanvas'] images: - not-found-at-all.png code: | @@ -159,7 +159,7 @@ - name: 2d.drawImage.zerocanvas desc: drawImage with zero-sized canvas as the source shoud throw exception - canvasType: ['HTMLCanvas'] + canvas_types: ['HtmlCanvas'] code: | var canvas2 = document.createElement('canvas'); canvas2.width = 0; @@ -176,7 +176,7 @@ - name: 2d.drawImage.animated.gif desc: drawImage() of an animated GIF draws the first frame - canvasType: ['HTMLCanvas'] + canvas_types: ['HtmlCanvas'] images: - anim-gr.gif code: | @@ -330,7 +330,7 @@ @assert pixel 99,49 ==~ 0,255,0,255; - name: 2d.drawImage.canvas - canvasType: ['OffscreenCanvas', 'Worker'] + canvas_types: ['OffscreenCanvas', 'Worker'] code: | var offscreenCanvas2 = new OffscreenCanvas(100, 50); var ctx2 = offscreenCanvas2.getContext('2d'); @@ -344,7 +344,7 @@ @assert pixel 99,49 ==~ 0,255,0,255; - name: 2d.drawImage.zerocanvas - canvasType: ['OffscreenCanvas', 'Worker'] + canvas_types: ['OffscreenCanvas', 'Worker'] code: | var offscreenCanvas2 = new OffscreenCanvas(0, 10); @assert throws INVALID_STATE_ERR ctx.drawImage(offscreenCanvas2, 0, 0); @@ -385,7 +385,7 @@ - name: 2d.drawImage.zerosource.image desc: drawImage with zero-sized source rectangle from image draws nothing without exception test_type: promise - canvasType: ['HTMLCanvas', 'OffscreenCanvas'] + canvas_types: ['HtmlCanvas', 'OffscreenCanvas'] code: | ctx.fillStyle = '#0f0'; ctx.fillRect(0, 0, 100, 50); @@ -483,7 +483,7 @@ - name: 2d.drawImage.outsidesource DISABLED: fix this to match the current spec (transparent black outside source) - canvasType: ['OffscreenCanvas', 'Worker'] + canvas_types: ['OffscreenCanvas', 'Worker'] code: | const response_red = await fetch('/images/red.png'); const blob_red = await response_red.blob(); @@ -518,7 +518,7 @@ - name: 2d.drawImage.svg desc: drawImage() of an SVG image test_type: promise - canvasType: ['HTMLCanvas', 'OffscreenCanvas'] + canvas_types: ['HtmlCanvas', 'OffscreenCanvas'] code: | const img = new Image(); const imageLoadPromise = new Promise((resolve, reject) => { @@ -641,7 +641,7 @@ - name: 2d.drawImage.detachedcanvas desc: drawImage with detached OffscreenCanvas as the source should throw exception - canvasType: ['HTMLCanvas'] + canvas_types: ['HtmlCanvas'] code: | var canvas2 = new OffscreenCanvas(80, 80); (new MessageChannel()).port1.postMessage(canvas2, [canvas2]); diff --git a/testing/web-platform/tests/html/canvas/tools/yaml-new/drawing-rectangles-to-the-canvas.yaml b/testing/web-platform/tests/html/canvas/tools/yaml-new/drawing-rectangles-to-the-canvas.yaml index 408e932abe..cb7ae0d858 100644 --- a/testing/web-platform/tests/html/canvas/tools/yaml-new/drawing-rectangles-to-the-canvas.yaml +++ b/testing/web-platform/tests/html/canvas/tools/yaml-new/drawing-rectangles-to-the-canvas.yaml @@ -375,8 +375,7 @@ - name: 2d.fillStyle.colorObject desc: ctx.fillStyle works with color objects - canvasType: - ['HTMLCanvas'] + canvas_types: ['HtmlCanvas'] code: | ctx.fillStyle = {r: 1, g: 0, b: 0}; ctx.fillRect(0, 0, 100, 50); @@ -400,8 +399,7 @@ - name: 2d.fillStyle.colorObject.transparency desc: ctx.fillStyle with color objects has transparency - canvasType: - ['HTMLCanvas'] + canvas_types: ['HtmlCanvas'] code: | ctx.fillStyle = {r: 0, g: 1, b: 0, a: 0}; ctx.fillRect(0, 0, 100, 50); @@ -422,8 +420,7 @@ - name: 2d.strokeStyle.colorObject desc: ctx.strokeStyle works with color objects - canvasType: - ['HTMLCanvas'] + canvas_types: ['HtmlCanvas'] code: | ctx.lineWidth = 50; ctx.strokeStyle = {r: 1, g: 0, b: 0}; @@ -448,8 +445,7 @@ - name: 2d.strokeStyle.colorObject.transparency desc: ctx.strokeStyle with color objects has transparency - canvasType: - ['HTMLCanvas'] + canvas_types: ['HtmlCanvas'] code: | ctx.lineWidth = 50; ctx.strokeStyle = {r: 0, g: 1, b: 0, a: 0}; diff --git a/testing/web-platform/tests/html/canvas/tools/yaml-new/fill-and-stroke-styles.yaml b/testing/web-platform/tests/html/canvas/tools/yaml-new/fill-and-stroke-styles.yaml index c992af6e7c..72d027a634 100644 --- a/testing/web-platform/tests/html/canvas/tools/yaml-new/fill-and-stroke-styles.yaml +++ b/testing/web-platform/tests/html/canvas/tools/yaml-new/fill-and-stroke-styles.yaml @@ -1,6 +1,6 @@ - name: 2d.fillStyle.parse.current.basic desc: currentColor is computed from the canvas element - canvasType: ['HtmlCanvas'] + canvas_types: ['HtmlCanvas'] code: | canvas.setAttribute('style', 'color: #0f0'); ctx.fillStyle = '#f00'; @@ -11,7 +11,7 @@ - name: 2d.fillStyle.parse.current.changed desc: currentColor is computed when the attribute is set, not when it is painted - canvasType: ['HtmlCanvas'] + canvas_types: ['HtmlCanvas'] code: | canvas.setAttribute('style', 'color: #0f0'); ctx.fillStyle = '#f00'; @@ -23,7 +23,7 @@ - name: 2d.fillStyle.parse.current.removed desc: currentColor is solid black when the canvas element is not in a document - canvasType: ['HtmlCanvas'] + canvas_types: ['HtmlCanvas'] code: | // Try not to let it undetectably incorrectly pick up opaque-black // from other parts of the document: @@ -119,7 +119,7 @@ desc: window.CanvasGradient exists and has the right properties notes: &bindings Defined in "Web IDL" (draft) code: | - {% set root = 'self' if canvas_type == 'worker' else 'window' %} + {% set root = 'self' if canvas_type == 'Worker' else 'window' %} @assert {{ root }}.CanvasGradient !== undefined; @assert {{ root }}.CanvasGradient.prototype.addColorStop !== undefined; @@ -127,7 +127,7 @@ desc: createLinearGradient() and createRadialGradient() returns objects implementing CanvasGradient code: | - {% set root = 'self' if canvas_type == 'worker' else 'window' %} + {% set root = 'self' if canvas_type == 'Worker' else 'window' %} {{ root }}.CanvasGradient.prototype.thisImplementsCanvasGradient = true; var g1 = ctx.createLinearGradient(0, 0, 100, 0); @@ -483,16 +483,17 @@ ctx.fillRect(0, 0, 100, 50); @assert pixel 50,25 ==~ 0,255,0,255; expected: green + append_variants_to_name: false variants: - _HtmlCanvas: - canvasType: ['HtmlCanvas'] + - HtmlCanvas: + canvas_types: ['HtmlCanvas'] create_canvas: document.createElement('canvas') - _OffscreenCanvas: - canvasType: ['OffscreenCanvas', 'Worker'] + OffscreenCanvas: + canvas_types: ['OffscreenCanvas', 'Worker'] create_canvas: new OffscreenCanvas(100, 50) - name: 2d.gradient.object.current - canvasType: ['HtmlCanvas'] + canvas_types: ['HtmlCanvas'] code: | canvas.setAttribute('style', 'color: #f00'); @@ -1126,7 +1127,7 @@ images: - green.png code: | - {% set root = 'self' if canvas_type == 'worker' else 'window' %} + {% set root = 'self' if canvas_type == 'Worker' else 'window' %} @assert {{ root }}.CanvasPattern !== undefined; {{ root }}.CanvasPattern.prototype.thisImplementsCanvasPattern = true; @@ -1135,11 +1136,13 @@ var pattern = ctx.createPattern(img, 'no-repeat'); @assert pattern.thisImplementsCanvasPattern; variants: &load-image-variant-definition - _HtmlCanvas: - canvasType: ['HtmlCanvas'] + - HtmlCanvas: + append_variants_to_name: false + canvas_types: ['HtmlCanvas'] load_image: var img = document.getElementById('{{ (images or svgimages)[0] }}'); - _OffscreenCanvas: - canvasType: ['OffscreenCanvas', 'Worker'] + OffscreenCanvas: + append_variants_to_name: false + canvas_types: ['OffscreenCanvas', 'Worker'] test_type: promise load_image: |- var response = await fetch('/images/{{ (images or svgimages)[0] }}') @@ -1189,14 +1192,16 @@ @assert pixel 98,48 == 0,255,0,255; expected: green variants: &create-canvas2-variant-definition - _HtmlCanvas: - canvasType: ['HtmlCanvas'] + - HtmlCanvas: + append_variants_to_name: false + canvas_types: ['HtmlCanvas'] create_canvas2: |- var canvas2 = document.createElement('canvas'); canvas2.width = 100; canvas2.height = 50; - _OffscreenCanvas: - canvasType: ['OffscreenCanvas', 'Worker'] + OffscreenCanvas: + append_variants_to_name: false + canvas_types: ['OffscreenCanvas', 'Worker'] create_canvas2: |- var canvas2 = new OffscreenCanvas(100, 50); @@ -1299,13 +1304,13 @@ @assert throws TypeError ctx.createPattern('../images/red.png', 'repeat'); - name: 2d.pattern.image.incomplete.nosrc - canvasType: ['HtmlCanvas'] + canvas_types: ['HtmlCanvas'] code: | var img = new Image(); @assert ctx.createPattern(img, 'repeat') === null; - name: 2d.pattern.image.incomplete.immediate - canvasType: ['HtmlCanvas'] + canvas_types: ['HtmlCanvas'] images: - red.png code: | @@ -1318,7 +1323,7 @@ @assert ctx.createPattern(img, 'repeat') === null; @moz-todo - name: 2d.pattern.image.incomplete.reload - canvasType: ['HtmlCanvas'] + canvas_types: ['HtmlCanvas'] images: - yellow.png - red.png @@ -1333,7 +1338,7 @@ @assert ctx.createPattern(img, 'repeat') === null; @moz-todo - name: 2d.pattern.image.incomplete.emptysrc - canvasType: ['HtmlCanvas'] + canvas_types: ['HtmlCanvas'] images: - red.png mozilla: {throws: !!null ''} @@ -1343,7 +1348,7 @@ @assert ctx.createPattern(img, 'repeat') === null; - name: 2d.pattern.image.incomplete.removedsrc - canvasType: ['HtmlCanvas'] + canvas_types: ['HtmlCanvas'] images: - red.png mozilla: {throws: !!null ''} @@ -1353,7 +1358,7 @@ @assert ctx.createPattern(img, 'repeat') === null; - name: 2d.pattern.image.broken - canvasType: ['HtmlCanvas'] + canvas_types: ['HtmlCanvas'] images: - broken.png code: | @@ -1361,7 +1366,7 @@ @assert throws INVALID_STATE_ERR ctx.createPattern(img, 'repeat'); - name: 2d.pattern.image.nonexistent - canvasType: ['HtmlCanvas'] + canvas_types: ['HtmlCanvas'] images: - no-such-image-really.png code: | @@ -1369,7 +1374,7 @@ @assert throws INVALID_STATE_ERR ctx.createPattern(img, 'repeat'); - name: 2d.pattern.svgimage.nonexistent - canvasType: ['HtmlCanvas'] + canvas_types: ['HtmlCanvas'] svgimages: - no-such-image-really.png code: | @@ -1377,7 +1382,7 @@ @assert throws INVALID_STATE_ERR ctx.createPattern(img, 'repeat'); - name: 2d.pattern.image.nonexistent-but-loading - canvasType: ['HtmlCanvas'] + canvas_types: ['HtmlCanvas'] code: | var img = document.createElement("img"); img.src = "/images/no-such-image-really.png"; @@ -1387,7 +1392,7 @@ @assert ctx.createPattern(img, 'repeat') === null; - name: 2d.pattern.image.nosrc - canvasType: ['HtmlCanvas'] + canvas_types: ['HtmlCanvas'] code: | var img = document.createElement("img"); @assert ctx.createPattern(img, 'repeat') === null; @@ -1395,7 +1400,7 @@ @assert ctx.createPattern(img, 'repeat') === null; - name: 2d.pattern.image.zerowidth - canvasType: ['HtmlCanvas'] + canvas_types: ['HtmlCanvas'] images: - red-zerowidth.svg code: | @@ -1403,7 +1408,7 @@ @assert ctx.createPattern(img, 'repeat') === null; - name: 2d.pattern.image.zeroheight - canvasType: ['HtmlCanvas'] + canvas_types: ['HtmlCanvas'] images: - red-zeroheight.svg code: | @@ -1411,7 +1416,7 @@ @assert ctx.createPattern(img, 'repeat') === null; - name: 2d.pattern.svgimage.zerowidth - canvasType: ['HtmlCanvas'] + canvas_types: ['HtmlCanvas'] svgimages: - red-zerowidth.svg code: | @@ -1419,7 +1424,7 @@ @assert ctx.createPattern(img, 'repeat') === null; - name: 2d.pattern.svgimage.zeroheight - canvasType: ['HtmlCanvas'] + canvas_types: ['HtmlCanvas'] svgimages: - red-zeroheight.svg code: | @@ -1469,7 +1474,7 @@ @assert throws SYNTAX_ERR ctx.createPattern(canvas, "repeat\0"); - name: 2d.pattern.modify.image1 - canvasType: ['HtmlCanvas'] + canvas_types: ['HtmlCanvas'] images: - green.png code: | @@ -1490,7 +1495,7 @@ expected: green - name: 2d.pattern.modify.image2 - canvasType: ['HtmlCanvas'] + canvas_types: ['HtmlCanvas'] images: - green.png code: | @@ -1515,7 +1520,7 @@ expected: green - name: 2d.pattern.modify.canvas1 - canvasType: ['HtmlCanvas'] + canvas_types: ['HtmlCanvas'] code: | {{ create_canvas2 }} var ctx2 = canvas2.getContext('2d'); @@ -1577,13 +1582,14 @@ @assert pixel 50,25 == 0,255,0,255; expected: green + append_variants_to_name: false variants: - _HtmlCanvas: - canvasType: ['HtmlCanvas'] + - HtmlCanvas: + canvas_types: ['HtmlCanvas'] load_image: var img = document.getElementById('{{ images[0] }}'); create_canvas: document.createElement('canvas') - _OffscreenCanvas: - canvasType: ['OffscreenCanvas', 'Worker'] + OffscreenCanvas: + canvas_types: ['OffscreenCanvas', 'Worker'] test_type: promise load_image: |- var response = await fetch('/images/{{ images[0] }}') @@ -1987,7 +1993,7 @@ - name: 2d.pattern.animated.gif desc: createPattern() of an animated GIF draws the first frame - canvasType: ['HtmlCanvas'] + canvas_types: ['HtmlCanvas'] images: - anim-gr.gif code: | @@ -2006,7 +2012,7 @@ - name: 2d.fillStyle.CSSRGB desc: CSSRGB works as color input - canvasType: ['HtmlCanvas', 'OffscreenCanvas'] + canvas_types: ['HtmlCanvas', 'OffscreenCanvas'] code: | ctx.fillStyle = new CSSRGB(1, 0, 1); @assert ctx.fillStyle === '#ff00ff'; @@ -2046,7 +2052,7 @@ - name: 2d.fillStyle.CSSHSL desc: CSSHSL works as color input - canvasType: ['HtmlCanvas', 'OffscreenCanvas'] + canvas_types: ['HtmlCanvas', 'OffscreenCanvas'] code: | ctx.fillStyle = new CSSHSL(CSS.deg(180), 0.5, 0.5); ctx.fillRect(0, 0, 100, 50); @@ -2077,7 +2083,7 @@ - name: 2d.fillStyle.colormix desc: color-mix works as color input - canvasType: ['HtmlCanvas', 'OffscreenCanvas', 'Worker'] + canvas_types: ['HtmlCanvas', 'OffscreenCanvas', 'Worker'] code: | ctx.fillStyle = "color-mix(in srgb, red, blue)"; @assert ctx.fillStyle === 'color(srgb 0.5 0 0.5)'; @@ -2086,7 +2092,7 @@ - name: 2d.fillStyle.colormix.currentcolor desc: color-mix works as color input with currentcolor - canvasType: ['HtmlCanvas'] + canvas_types: ['HtmlCanvas'] code: | canvas.setAttribute('style', 'color: magenta'); ctx.fillStyle = "color-mix(in srgb, black, currentcolor)"; @@ -2096,9 +2102,22 @@ - name: 2d.strokeStyle.colormix desc: color-mix works as color input - canvasType: ['HtmlCanvas', 'OffscreenCanvas'] + canvas_types: ['HtmlCanvas', 'OffscreenCanvas'] code: | ctx.strokeStyle = "color-mix(in srgb, red, blue)"; @assert ctx.strokeStyle === 'color(srgb 0.5 0 0.5)'; ctx.strokeStyle = "color-mix(in srgb, red, color(srgb 1 0 0))"; @assert ctx.strokeStyle === 'color(srgb 1 0 0)'; + +- name: 2d.gradient.colormix + desc: color-mix works as CanvasGradient color input + canvas_types: ['HtmlCanvas'] + code: | + var g = ctx.createLinearGradient(0, 0, 100, 0); + g.addColorStop(0, '#f00'); + g.addColorStop(1, 'color-mix(in srgb, #0f0, #00f)'); + ctx.fillStyle = g; + ctx.fillRect(0, 0, 100, 50); + @assert pixel 25,25 ==~ 212,81,61,255 +/- 3; + @assert pixel 50,25 ==~ 167,106,88,255 +/- 3; + @assert pixel 75,25 ==~ 113,120,109,255 +/- 3; diff --git a/testing/web-platform/tests/html/canvas/tools/yaml-new/filters.yaml b/testing/web-platform/tests/html/canvas/tools/yaml-new/filters.yaml index f327b9fe94..1ce9d8ed74 100644 --- a/testing/web-platform/tests/html/canvas/tools/yaml-new/filters.yaml +++ b/testing/web-platform/tests/html/canvas/tools/yaml-new/filters.yaml @@ -34,8 +34,7 @@ - name: 2d.filter.canvasFilterObject.tentative desc: Test CanvasFilter() object - canvasType: - ['HTMLCanvas'] + canvas_types: ['HtmlCanvas'] code: | @assert ctx.filter == 'none'; ctx.filter = 'blur(5px)'; @@ -63,7 +62,7 @@ - name: 2d.filter.canvasFilterObject.tentative desc: Test CanvasFilter() object - canvasType: ['OffscreenCanvas', 'Worker'] + canvas_types: ['OffscreenCanvas', 'Worker'] code: | @assert ctx.filter == 'none'; ctx.filter = 'blur(5px)'; @@ -106,7 +105,7 @@ "{name: 'gaussianBlur', stdDeviation: {}}") }}; append_variants_to_name: false variants: - layers: + - layers: filter_declaration: |- ctx.beginLayer({filter: param}) @@ -199,7 +198,7 @@ @assert pixel 60,30 ==~ 0,255,0,255; append_variants_to_name: false variants: - layers: + - layers: filter_declaration: |- ctx.beginLayer({filter: param}) @@ -251,7 +250,7 @@ {{ close_layer -}} append_variants_to_name: false variants: - layers: + - layers: filter_declaration: |- ctx.beginLayer({filter: param}) @@ -325,7 +324,7 @@ {{ close_layer }} append_variants_to_name: false variants: - layers: + - layers: filter_declaration: |- ctx.beginLayer({filter: param}) close_layer: ctx.endLayer(); @@ -376,7 +375,7 @@ } append_variants_to_name: false variants: - layers: + - layers: filter_declaration: |- ctx.beginLayer({filter: param}) close_layer: ctx.endLayer(); @@ -451,7 +450,7 @@ } append_variants_to_name: false variants: - layers: + - layers: filter_declaration: |- ctx.beginLayer({filter: param}) close_layer: ctx.endLayer(); @@ -530,7 +529,7 @@ } append_variants_to_name: false variants: - layers: + - layers: filter_declaration: |- ctx.beginLayer({filter: param}) close_layer: ctx.endLayer(); @@ -608,7 +607,7 @@ } append_variants_to_name: false variants: - layers: + - layers: filter_declaration: |- ctx.beginLayer({filter: param}) close_layer: ctx.endLayer(); @@ -641,30 +640,30 @@ fill="teal" filter="url(#blur)" /> </svg> append_variants_to_name: false - variant_matrix: - - layers: - filter_declaration: |- - ctx.beginLayer({filter: param}); - close_layer: ctx.endLayer(); - canvasFilterObject: - filter_declaration: |- - ctx.filter = new CanvasFilter(param); - tentative: .tentative - - x-only: - blur_x: 4 - blur_y: 0 - mostly-x: - blur_x: 4 - blur_y: 1 - isotropic: - blur_x: 4 - blur_y: 4 - mostly-y: - blur_x: 1 - blur_y: 4 - y-only: - blur_x: 0 - blur_y: 4 + variants: + - layers: + filter_declaration: |- + ctx.beginLayer({filter: param}); + close_layer: ctx.endLayer(); + canvasFilterObject: + filter_declaration: |- + ctx.filter = new CanvasFilter(param); + tentative: .tentative + - x-only: + blur_x: 4 + blur_y: 0 + mostly-x: + blur_x: 4 + blur_y: 1 + isotropic: + blur_x: 4 + blur_y: 4 + mostly-y: + blur_x: 1 + blur_y: 4 + y-only: + blur_x: 0 + blur_y: 4 - name: 2d.filter.{{ variant_names[0] }}.dropShadow{{ tentative }} desc: Test CanvasFilter() dropShadow object. @@ -818,7 +817,7 @@ </svg> append_variants_to_name: false variants: - layers: + - layers: filter_declaration: |- ctx.beginLayer({filter: param}); close_layer: | @@ -838,10 +837,6 @@ <10 | -1 | 0.5 | null | true | false | [] | [20] | '30'>}") }}; @unroll {{ filter_declaration | replace("param", "{\- name: 'dropShadow', \- - <dx | dy | floodOpacity>: \- - <10 | -1 | 0.5 | null | true | false | [] | [20] | '30'>}") }}; - @unroll {{ filter_declaration | replace("param", "{\- - name: 'dropShadow', \- <stdDeviation>: \- <10 | -1 | 0.5 | null | true | false | [] | [20] | '30' | \- [10, -1] | [0.5, null] | [true, false] | [[], [20]] | \- @@ -869,7 +864,7 @@ <'test' | 'rgba(NaN, 3, 2, 1)' | 10 | undefined | null | NaN>}") }}; append_variants_to_name: false variants: - layers: + - layers: filter_declaration: |- ctx.beginLayer({filter: param}); ctx.endLayer() @@ -990,7 +985,7 @@ } append_variants_to_name: false variants: - layers: + - layers: filter_declaration: |- ctx.beginLayer({filter: param}) close_layer: "\n ctx.endLayer();" diff --git a/testing/web-platform/tests/html/canvas/tools/yaml-new/layers.yaml b/testing/web-platform/tests/html/canvas/tools/yaml-new/layers.yaml index 437a70c3f7..d1e9a97043 100644 --- a/testing/web-platform/tests/html/canvas/tools/yaml-new/layers.yaml +++ b/testing/web-platform/tests/html/canvas/tools/yaml-new/layers.yaml @@ -41,7 +41,8 @@ ctx2.fillRect(70, 70, 75, 50); ctx.drawImage(canvas2, 0, 0); - variants: &global-state-variants + variants: + - &global-state-variants no-global-states: render_states: // No global states. alpha: &global-state-alpha @@ -168,7 +169,7 @@ }; img.src = 'data:image/svg+xml;base64,' + btoa(svg); variants: - <<: *global-state-variants + - <<: *global-state-variants alpha: <<: *global-state-alpha fuzzy: maxDifference=0-2; totalPixels=0-6766 @@ -287,6 +288,7 @@ - name: 2d.layer.layer-rendering-state-reset-in-layer desc: Tests that layers ignore the global context filter. + test_type: sync code: | ctx.globalAlpha = 0.5; ctx.globalCompositeOperation = 'xor'; @@ -556,7 +558,7 @@ - name: 2d.layer.flush-on-frame-presentation desc: Check that layers state stack is flushed and rebuilt on frame renders. size: [200, 200] - canvasType: ['HTMLCanvas'] + canvas_types: ['HtmlCanvas'] test_type: "promise" code: | ctx.fillStyle = 'purple'; @@ -612,7 +614,7 @@ assert_throws_dom("InvalidStateError", () => {{ operation }}); variants: - createPattern: + - createPattern: operation: ctx.createPattern(canvas, 'repeat') drawImage: setup: |- @@ -630,10 +632,10 @@ operation: |- ctx.putImageData(data, 0, 0) toDataURL: - canvasType: ['HTMLCanvas'] + canvas_types: ['HtmlCanvas'] operation: canvas.toDataURL() transferToImageBitmap: - canvasType: ['OffscreenCanvas', 'Worker'] + canvas_types: ['OffscreenCanvas', 'Worker'] operation: canvas.transferToImageBitmap() - name: 2d.layer.malformed-operations-with-promises @@ -651,14 +653,14 @@ ctx.beginLayer(); await promise_rejects_dom(t, 'InvalidStateError', {{ operation }}); variants: - convertToBlob: - canvasType: ['OffscreenCanvas', 'Worker'] + - convertToBlob: + canvas_types: ['OffscreenCanvas', 'Worker'] operation: |- canvas.convertToBlob() createImageBitmap: operation: createImageBitmap(canvas) toBlob: - canvasType: ['HTMLCanvas'] + canvas_types: ['HtmlCanvas'] operation: |- new Promise(resolve => canvas.toBlob(resolve)) @@ -824,7 +826,7 @@ - name: 2d.layer.valid-calls desc: No exception raised on {{ variant_desc }}. variants: - save: + - save: variant_desc: lone save() calls code: ctx.save(); beginLayer: @@ -867,7 +869,7 @@ {{ call_sequence | indent(2) }} }); variants: - endLayer: + - endLayer: variant_desc: lone endLayer calls call_sequence: ctx.endLayer(); save-endLayer: @@ -995,7 +997,7 @@ }; img.src = 'data:image/svg+xml;base64,' + btoa(svg); variants: - no-clipping: + - no-clipping: clipping: // No clipping. with-clipping: clipping: |- @@ -1029,7 +1031,7 @@ ctx.fillStyle = 'green'; ctx.fillRect(0, 0, 100, 100); variants: - short-distance: + - short-distance: distance: |- const delta = 1; clipping: // No clipping. @@ -1056,7 +1058,7 @@ desc: Checks that layer blending works inside opaque canvas size: [300, 300] code: | - {% if canvas_type == 'htmlcanvas' %} + {% if canvas_type == 'HtmlCanvas' %} const canvas2 = document.createElement('canvas'); canvas2.width = 200; canvas2.height = 200; @@ -1126,7 +1128,7 @@ </g> </svg> variants: - blur: + - blur: ctx_filter: |- 'blur(10px)' svg_filter: |- @@ -1149,7 +1151,7 @@ code: *filter-test-code html_reference: *filter-test-reference variants: - x-only: + - x-only: ctx_filter: |- { name: 'gaussianBlur', stdDeviation: [4, 0] } svg_filter: |- diff --git a/testing/web-platform/tests/html/canvas/tools/yaml-new/pixel-manipulation.yaml b/testing/web-platform/tests/html/canvas/tools/yaml-new/pixel-manipulation.yaml index 0643b047b1..6721f5ffde 100644 --- a/testing/web-platform/tests/html/canvas/tools/yaml-new/pixel-manipulation.yaml +++ b/testing/web-platform/tests/html/canvas/tools/yaml-new/pixel-manipulation.yaml @@ -11,7 +11,7 @@ - name: 2d.imageData.create2.type desc: createImageData(sw, sh) returns an ImageData object containing a Uint8ClampedArray object - canvasType: ['HTMLCanvas'] + canvas_types: ['HtmlCanvas'] code: | @assert window.ImageData !== undefined; @assert window.Uint8ClampedArray !== undefined; @@ -24,7 +24,7 @@ - name: 2d.imageData.create1.type desc: createImageData(imgdata) returns an ImageData object containing a Uint8ClampedArray object - canvasType: ['HTMLCanvas'] + canvas_types: ['HtmlCanvas'] code: | @assert window.ImageData !== undefined; @assert window.Uint8ClampedArray !== undefined; @@ -36,7 +36,7 @@ - name: 2d.imageData.create2.this desc: createImageData(sw, sh) should throw when called with the wrong |this| - canvasType: ['HTMLCanvas'] + canvas_types: ['HtmlCanvas'] notes: &bindings Defined in "Web IDL" (draft) code: | @assert throws TypeError CanvasRenderingContext2D.prototype.createImageData.call(null, 1, 1); @moz-todo @@ -45,7 +45,7 @@ - name: 2d.imageData.create1.this desc: createImageData(imgdata) should throw when called with the wrong |this| - canvasType: ['HTMLCanvas'] + canvas_types: ['HtmlCanvas'] notes: *bindings code: | var imgdata = ctx.createImageData(1, 1); @@ -160,7 +160,7 @@ - name: 2d.imageData.create.and.resize desc: Verify no crash when resizing an image bitmap to zero. - canvasType: ['HTMLCanvas'] + canvas_types: ['HtmlCanvas'] images: - red.png code: | @@ -179,7 +179,7 @@ @assert ctx.getImageData(0, 0, 100, 50) !== null; - name: 2d.imageData.get.type - canvasType: ['HTMLCanvas'] + canvas_types: ['HtmlCanvas'] desc: getImageData() returns an ImageData object containing a Uint8ClampedArray object code: | @@ -502,7 +502,7 @@ @assert imgdata.data[3] === 0; - name: 2d.imageData.object.ctor.size - canvasType: ['HTMLCanvas'] + canvas_types: ['HtmlCanvas'] desc: ImageData has a usable constructor code: | @assert window.ImageData !== undefined; @@ -516,7 +516,7 @@ } - name: 2d.imageData.object.ctor.basics - canvasType: ['HTMLCanvas'] + canvas_types: ['HtmlCanvas'] desc: Testing different type of ImageData constructor code: | function setRGBA(imageData, i, rgba) @@ -608,7 +608,7 @@ - name: 2d.imageData.object.ctor.array desc: ImageData has a usable constructor - canvasType: ['HTMLCanvas'] + canvas_types: ['HtmlCanvas'] code: | @assert window.ImageData !== undefined; @@ -620,7 +620,7 @@ - name: 2d.imageData.object.ctor.array.bounds desc: ImageData has a usable constructor - canvasType: ['HTMLCanvas'] + canvas_types: ['HtmlCanvas'] code: | @assert window.ImageData !== undefined; @@ -803,7 +803,7 @@ - name: 2d.imageData.put.cross desc: putImageData() accepts image data got from a different canvas - canvasType: ['HTMLCanvas'] + canvas_types: ['HtmlCanvas'] code: | var canvas2 = document.createElement('canvas'); var ctx2 = canvas2.getContext('2d'); @@ -818,7 +818,7 @@ - name: 2d.imageData.put.cross desc: putImageData() accepts image data got from a different canvas - canvasType: ['OffscreenCanvas', 'Worker'] + canvas_types: ['OffscreenCanvas', 'Worker'] code: | var offscreenCanvas2 = new OffscreenCanvas(100, 50); var ctx2 = offscreenCanvas2.getContext('2d'); diff --git a/testing/web-platform/tests/html/canvas/tools/yaml-new/reset.yaml b/testing/web-platform/tests/html/canvas/tools/yaml-new/reset.yaml index 086fb04e04..27764e4550 100644 --- a/testing/web-platform/tests/html/canvas/tools/yaml-new/reset.yaml +++ b/testing/web-platform/tests/html/canvas/tools/yaml-new/reset.yaml @@ -24,7 +24,7 @@ @assert ctx.{{ state_name }} == default_value; variants: - letter_spacing: + - letter_spacing: state_name: letterSpacing new_value: "'12px'" diff --git a/testing/web-platform/tests/html/canvas/tools/yaml-new/scroll.yaml b/testing/web-platform/tests/html/canvas/tools/yaml-new/scroll.yaml index dd088aa396..0579a8b3d7 100644 --- a/testing/web-platform/tests/html/canvas/tools/yaml-new/scroll.yaml +++ b/testing/web-platform/tests/html/canvas/tools/yaml-new/scroll.yaml @@ -1,7 +1,6 @@ - name: 2d.scrollPathIntoView.basic desc: scrollPathIntoView() works - canvasType: - ['HTMLCanvas'] + canvas_types: ['HtmlCanvas'] code: | var div = document.createElement('div'); div.style.cssText = 'width: 200vw; height: 200vh'; @@ -18,8 +17,7 @@ - name: 2d.scrollPathIntoView.verticalLR desc: scrollPathIntoView() works in vertical-lr writing mode - canvasType: - ['HTMLCanvas'] + canvas_types: ['HtmlCanvas'] code: | document.documentElement.style.cssText = 'writing-mode: vertical-lr'; var div = document.createElement('div'); @@ -37,8 +35,7 @@ - name: 2d.scrollPathIntoView.verticalRL desc: scrollPathIntoView() works in vertical-rl writing mode - canvasType: - ['HTMLCanvas'] + canvas_types: ['HtmlCanvas'] code: | document.documentElement.style.cssText = 'writing-mode: vertical-rl'; var div = document.createElement('div'); @@ -58,8 +55,7 @@ - name: 2d.scrollPathIntoView.path desc: scrollPathIntoView() with path argument works - canvasType: - ['HTMLCanvas'] + canvas_types: ['HtmlCanvas'] code: | var div = document.createElement('div'); div.style.cssText = 'width: 200vw; height: 200vh'; @@ -73,4 +69,3 @@ var rect = canvas.getBoundingClientRect(); @assert Math.round(rect.top) === -8; @assert Math.round(rect.left) === 200; - diff --git a/testing/web-platform/tests/html/canvas/tools/yaml-new/shadows.yaml b/testing/web-platform/tests/html/canvas/tools/yaml-new/shadows.yaml index 953ab2c555..e42237dadb 100644 --- a/testing/web-platform/tests/html/canvas/tools/yaml-new/shadows.yaml +++ b/testing/web-platform/tests/html/canvas/tools/yaml-new/shadows.yaml @@ -136,7 +136,7 @@ - name: 2d.shadow.attributes.shadowColor.current.basic desc: currentColor is computed from the canvas element - canvasType: ['HtmlCanvas'] + canvas_types: ['HtmlCanvas'] code: | canvas.style.color = '#0f0'; ctx.shadowColor = 'currentColor'; @@ -144,7 +144,7 @@ - name: 2d.shadow.attributes.shadowColor.current.changed desc: currentColor is computed when the attribute is set, not when it is painted - canvasType: ['HtmlCanvas'] + canvas_types: ['HtmlCanvas'] code: | canvas.style.color = '#0f0'; ctx.shadowColor = 'currentColor'; @@ -153,7 +153,7 @@ - name: 2d.shadow.attributes.shadowColor.current.removed desc: currentColor is solid black when the canvas element is not in a document - canvasType: ['HtmlCanvas'] + canvas_types: ['HtmlCanvas'] code: | // Try not to let it undetectably incorrectly pick up opaque-black // from other parts of the document: @@ -518,11 +518,13 @@ @assert pixel 50,25 == 0,255,0,255; expected: green variants: &load-image-variant-definition - _HtmlCanvas: - canvasType: ['HtmlCanvas'] + - HtmlCanvas: + append_variants_to_name: false + canvas_types: ['HtmlCanvas'] load_image: var img = document.getElementById('{{ images[0] }}'); - _OffscreenCanvas: - canvasType: ['OffscreenCanvas', 'Worker'] + OffscreenCanvas: + append_variants_to_name: false + canvas_types: ['OffscreenCanvas', 'Worker'] test_type: promise load_image: |- var response = await fetch('/images/{{ images[0] }}') @@ -640,14 +642,16 @@ @assert pixel 50,25 == 0,255,0,255; expected: green variants: &create-canvas2-variant-definition - _HtmlCanvas: - canvasType: ['HtmlCanvas'] + - HtmlCanvas: + append_variants_to_name: false + canvas_types: ['HtmlCanvas'] create_canvas2: |- var canvas2 = document.createElement('canvas'); canvas2.width = 100; canvas2.height = 50; - _OffscreenCanvas: - canvasType: ['OffscreenCanvas', 'Worker'] + OffscreenCanvas: + append_variants_to_name: false + canvas_types: ['OffscreenCanvas', 'Worker'] create_canvas2: |- var canvas2 = new OffscreenCanvas(100, 50); diff --git a/testing/web-platform/tests/html/canvas/tools/yaml-new/text.yaml b/testing/web-platform/tests/html/canvas/tools/yaml-new/text.yaml index ca945c2953..7f2047bc9c 100644 --- a/testing/web-platform/tests/html/canvas/tools/yaml-new/text.yaml +++ b/testing/web-platform/tests/html/canvas/tools/yaml-new/text.yaml @@ -38,7 +38,7 @@ - name: 2d.text.font.parse.size.percentage canvas: 'style="font-size: 144px"' - canvasType: ['HtmlCanvas'] + canvas_types: ['HtmlCanvas'] code: | ctx.font = '50% serif'; @assert ctx.font === '72px serif'; @moz-todo @@ -46,7 +46,7 @@ @assert ctx.font === '72px serif'; @moz-todo - name: 2d.text.font.parse.size.percentage.default - canvasType: ['HtmlCanvas'] + canvas_types: ['HtmlCanvas'] code: | var canvas2 = document.createElement('canvas'); var ctx2 = canvas2.getContext('2d'); @@ -113,7 +113,7 @@ @assert ctx.font === '10px sans-serif'; - name: 2d.text.font.relative_size - canvasType: ['HTMLCanvas'] + canvas_types: ['HtmlCanvas'] code: | var canvas2 = document.createElement('canvas'); var ctx2 = canvas2.getContext('2d'); @@ -121,7 +121,7 @@ @assert ctx2.font === '10px sans-serif'; - name: 2d.text.font.relative_size - canvasType: ['OffscreenCanvas', 'Worker'] + canvas_types: ['OffscreenCanvas', 'Worker'] code: | ctx.font = '1em sans-serif'; @assert ctx.font === '10px sans-serif'; @@ -236,16 +236,18 @@ @assert pixel 95,45 ==~ 0,255,0,255; expected: green variants: &load-font-variant-definition - _HtmlCanvas: - canvasType: ['HtmlCanvas'] + - HtmlCanvas: + append_variants_to_name: false + canvas_types: ['HtmlCanvas'] load_font: |- await document.fonts.ready; - _OffscreenCanvas: - canvasType: ['OffscreenCanvas', 'Worker'] + OffscreenCanvas: + append_variants_to_name: false + canvas_types: ['OffscreenCanvas', 'Worker'] load_font: |- var f = new FontFace("{{ fonts[0] }}", "url('/fonts/{{ fonts[0] }}.ttf')"); f.load(); - {% set root = 'self' if canvas_type == 'worker' else 'document' %} + {% set root = 'self' if canvas_type == 'Worker' else 'document' %} {{ root }}.fonts.add(f); await {{ root }}.fonts.ready; @@ -813,7 +815,7 @@ code: | {{ load_font }} ctx.font = '50px CanvasTest'; - {% if canvas_type != 'htmlcanvas' %} + {% if canvas_type != 'HtmlCanvas' %} ctx.direction = 'ltr'; {% endif %} ctx.fillStyle = '#f00'; @@ -839,7 +841,7 @@ code: | {{ load_font }} ctx.font = '50px CanvasTest'; - {% if canvas_type != 'htmlcanvas' %} + {% if canvas_type != 'HtmlCanvas' %} ctx.direction = 'rtl'; {% endif %} ctx.fillStyle = '#f00'; @@ -865,7 +867,7 @@ code: | {{ load_font }} ctx.font = '50px CanvasTest'; - {% if canvas_type != 'htmlcanvas' %} + {% if canvas_type != 'HtmlCanvas' %} ctx.direction = 'ltr'; {% endif %} ctx.fillStyle = '#f00'; @@ -891,7 +893,7 @@ code: | {{ load_font }} ctx.font = '50px CanvasTest'; - {% if canvas_type != 'htmlcanvas' %} + {% if canvas_type != 'HtmlCanvas' %} ctx.direction = 'rtl'; {% endif %} ctx.fillStyle = '#f00'; diff --git a/testing/web-platform/tests/html/canvas/tools/yaml-new/video.yaml b/testing/web-platform/tests/html/canvas/tools/yaml-new/video.yaml index f9b48fb8da..ca8a1ab816 100644 --- a/testing/web-platform/tests/html/canvas/tools/yaml-new/video.yaml +++ b/testing/web-platform/tests/html/canvas/tools/yaml-new/video.yaml @@ -1,7 +1,6 @@ - name: 2d.video.invalid desc: Verify test doesn't crash with invalid video. - canvasType: - ['HTMLCanvas'] + canvas_types: ['HtmlCanvas'] code: | var v = document.createElement('video'); v.play(); diff --git a/testing/web-platform/tests/html/dom/elements/global-attributes/dir-assorted.window.js b/testing/web-platform/tests/html/dom/elements/global-attributes/dir-assorted.window.js index 2017269f0b..93f798e600 100644 --- a/testing/web-platform/tests/html/dom/elements/global-attributes/dir-assorted.window.js +++ b/testing/web-platform/tests/html/dom/elements/global-attributes/dir-assorted.window.js @@ -64,6 +64,39 @@ test(() => { assert_true(ele2.matches(":dir(ltr)"), "child is LTR after change"); }, "Non-HTML element text contents influence dir=auto"); + +for (const tag of ["style", "script"]) { + test(() => { + const e1 = document.createElement("div"); + e1.dir = "auto"; + + const e2 = document.createElement(tag); + const node = document.createTextNode("\u05D0"); + e2.appendChild(node); + e1.appendChild(e2); + assert_true(e1.matches(":dir(ltr)", "is LTR before change")); + node.data = "ABC"; + assert_true(e1.matches(":dir(ltr)", "is LTR after change")); + + }, `${tag} element text contents do not influence dir=auto`); +} + +for (const tag of ["style", "script", "input", "textarea"]) { + test(() => { + const e1 = document.createElement("div"); + e1.dir = "auto"; + const svg = document.createElement("svg"); + const e2 = document.createElementNS("http://www.w3.org/2000/svg", tag); + const node = document.createTextNode("\u05D0"); + e2.appendChild(node); + svg.appendChild(e2); + e1.appendChild(svg); + assert_true(e1.matches(":dir(rtl)", "is RTL before change")); + node.data = "ABC"; + assert_true(e1.matches(":dir(ltr)", "is LTR after change")); + }, `non-html ${tag} element text contents influence dir=auto`); +} + test(() => { const e1 = document.createElement("div"); e1.dir = "auto"; diff --git a/testing/web-platform/tests/html/dom/historical.html b/testing/web-platform/tests/html/dom/historical.html index 396e57a391..2563810492 100644 --- a/testing/web-platform/tests/html/dom/historical.html +++ b/testing/web-platform/tests/html/dom/historical.html @@ -52,4 +52,9 @@ test(() => { test(() => { assert_false("HTMLTableHeaderCellElement" in window); }, "HTMLTableHeaderCellElement interface is removed") + +// removed in https://github.com/whatwg/html/commit/6e4bcf5630d08e03212ad4e1a3c78beecf2a92fa +test(() => { + assert_false("initHashChangeEvent" in HashChangeEvent.prototype); +}, "HashChangeEvent's initHashChangeEvent method is removed") </script> diff --git a/testing/web-platform/tests/html/dom/idlharness.https.html b/testing/web-platform/tests/html/dom/idlharness.https.html index 7d693d3c0a..357a4fbe0b 100644 --- a/testing/web-platform/tests/html/dom/idlharness.https.html +++ b/testing/web-platform/tests/html/dom/idlharness.https.html @@ -38,7 +38,7 @@ const waitForLoad = new Promise(resolve => { addEventListener('load', resolve); idl_test( ['html'], - ['wai-aria', 'SVG', 'cssom', 'touch-events', 'uievents', 'dom', 'xhr', 'FileAPI', 'mediacapture-streams', 'performance-timeline'], + ['wai-aria', 'SVG', 'cssom', 'touch-events', 'uievents', 'dom', 'xhr', 'FileAPI', 'mediacapture-streams', 'performance-timeline', 'trusted-types'], async idlArray => { self.documentWithHandlers = new Document(); const handler = function(e) {}; diff --git a/testing/web-platform/tests/html/editing/dnd/drop/events-contenteditable-manual.tentative.html b/testing/web-platform/tests/html/editing/dnd/drop/events-contenteditable-manual.tentative.html new file mode 100644 index 0000000000..9e513eb836 --- /dev/null +++ b/testing/web-platform/tests/html/editing/dnd/drop/events-contenteditable-manual.tentative.html @@ -0,0 +1,19 @@ +<!doctype html> +<meta charset=utf-8> +<title>Selection drag and drop: events for contenteditable</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<style> +[data-placeholder]:empty::before { content: attr(data-placeholder); } +</style> +<body data-expected-events=" + b:drop:, + a:beforeinput:deleteByDrag, + a:input:deleteByDrag, + b:beforeinput:insertFromDrop, + b:textInput:, + b:input:insertFromDrop"> +<div><input id=a data-select="0,7" value="Drag me"></div> +<div contenteditable=true id=b data-placeholder="...to here"></div> +<script src="/uievents/textInput/support/common.js"></script> +<script src="support/events.js"></script> diff --git a/testing/web-platform/tests/html/editing/dnd/drop/events-contenteditable-same-element-manual.tentative.html b/testing/web-platform/tests/html/editing/dnd/drop/events-contenteditable-same-element-manual.tentative.html new file mode 100644 index 0000000000..907306301f --- /dev/null +++ b/testing/web-platform/tests/html/editing/dnd/drop/events-contenteditable-same-element-manual.tentative.html @@ -0,0 +1,15 @@ +<!doctype html> +<meta charset=utf-8> +<title>Selection drag and drop: events for contenteditable (same element)</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<body data-expected-events=" + b:drop:, + b:beforeinput:deleteByDrag, + b:input:deleteByDrag, + b:beforeinput:insertFromDrop, + b:textInput:, + b:input:insertFromDrop"> +<div contenteditable=true id=b data-select="0,7">Drag me ...to here:</div> +<script src="/uievents/textInput/support/common.js"></script> +<script src="support/events.js"></script> diff --git a/testing/web-platform/tests/html/editing/dnd/drop/events-input-manual.tentative.html b/testing/web-platform/tests/html/editing/dnd/drop/events-input-manual.tentative.html new file mode 100644 index 0000000000..2f9914cca9 --- /dev/null +++ b/testing/web-platform/tests/html/editing/dnd/drop/events-input-manual.tentative.html @@ -0,0 +1,16 @@ +<!doctype html> +<meta charset=utf-8> +<title>Selection drag and drop: events for <input></title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<body data-expected-events=" + b:drop:, + a:beforeinput:deleteByDrag, + a:input:deleteByDrag, + b:beforeinput:insertFromDrop, + b:textInput:, + b:input:insertFromDrop"> +<div><input id=a data-select="0,7" value="Drag me"></div> +<div><input id=b placeholder="...to here"></div> +<script src="/uievents/textInput/support/common.js"></script> +<script src="support/events.js"></script> diff --git a/testing/web-platform/tests/html/editing/dnd/drop/events-input-same-element-manual.tentative.html b/testing/web-platform/tests/html/editing/dnd/drop/events-input-same-element-manual.tentative.html new file mode 100644 index 0000000000..8a578d51ad --- /dev/null +++ b/testing/web-platform/tests/html/editing/dnd/drop/events-input-same-element-manual.tentative.html @@ -0,0 +1,15 @@ +<!doctype html> +<meta charset=utf-8> +<title>Selection drag and drop: events for <input> (same element)</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<body data-expected-events=" + b:drop:, + b:beforeinput:deleteByDrag, + b:input:deleteByDrag, + b:beforeinput:insertFromDrop, + b:textInput:, + b:input:insertFromDrop"> +<input id=b data-select="0,7" value="Drag me ...to here:"> +<script src="/uievents/textInput/support/common.js"></script> +<script src="support/events.js"></script> diff --git a/testing/web-platform/tests/html/editing/dnd/drop/events-textarea-manual.tentative.html b/testing/web-platform/tests/html/editing/dnd/drop/events-textarea-manual.tentative.html new file mode 100644 index 0000000000..7fb8bf437f --- /dev/null +++ b/testing/web-platform/tests/html/editing/dnd/drop/events-textarea-manual.tentative.html @@ -0,0 +1,16 @@ +<!doctype html> +<meta charset=utf-8> +<title>Selection drag and drop: events for <textarea></title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<body data-expected-events=" + b:drop:, + a:beforeinput:deleteByDrag, + a:input:deleteByDrag, + b:beforeinput:insertFromDrop, + b:textInput:, + b:input:insertFromDrop"> +<div><input id=a data-select="0,7" value="Drag me"></div> +<div><textarea id=b placeholder="...to here"></textarea></div> +<script src="/uievents/textInput/support/common.js"></script> +<script src="support/events.js"></script> diff --git a/testing/web-platform/tests/html/editing/dnd/drop/events-textarea-same-element-manual.tentative.html b/testing/web-platform/tests/html/editing/dnd/drop/events-textarea-same-element-manual.tentative.html new file mode 100644 index 0000000000..c856fd4fbe --- /dev/null +++ b/testing/web-platform/tests/html/editing/dnd/drop/events-textarea-same-element-manual.tentative.html @@ -0,0 +1,15 @@ +<!doctype html> +<meta charset=utf-8> +<title>Selection drag and drop: events for <textarea> (same element)</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<body data-expected-events=" + b:drop:, + b:beforeinput:deleteByDrag, + b:input:deleteByDrag, + b:beforeinput:insertFromDrop, + b:textInput:, + b:input:insertFromDrop"> +<textarea id=b data-select="0,7">Drag me ...to here:</textarea> +<script src="/uievents/textInput/support/common.js"></script> +<script src="support/events.js"></script> diff --git a/testing/web-platform/tests/html/editing/dnd/drop/support/events.js b/testing/web-platform/tests/html/editing/dnd/drop/support/events.js new file mode 100644 index 0000000000..015cead385 --- /dev/null +++ b/testing/web-platform/tests/html/editing/dnd/drop/support/events.js @@ -0,0 +1,31 @@ +setup({ explicit_timeout: true, single_test: true }); +function rAF() { + return new Promise(resolve => { + requestAnimationFrame(resolve); + }); +} +const a = document.getElementById('a'); +const b = document.getElementById('b'); +const actualEvents = []; +const expectedEvents = document.body.dataset.expectedEvents.replace(/\s+/g, '').split(','); +const eventTypes = new Set(expectedEvents.map(s => s.split(':')[1])); +for (const eventType of eventTypes) { + if (a) { + a.addEventListener(eventType, e => { + actualEvents.push(`a:${e.type}:${e.inputType || ''}`); + }); + } + b.addEventListener(eventType, async (e) => { + actualEvents.push(`b:${e.type}:${e.inputType || ''}`); + if (e.type === "input") { + await rAF(); + await rAF(); + assert_array_equals(actualEvents, expectedEvents); + done(); + } + }); +} +const dragMeElement = document.querySelector('[data-select]'); +const [selectionStart, selectionEnd] = dragMeElement.dataset.select.split(',').map(s => parseInt(s, 10)); +setSelection(dragMeElement, selectionStart, selectionEnd); +dragMeElement.focus(); diff --git a/testing/web-platform/tests/html/editing/dnd/the-datatransfer-interface/dnd-datatransfer-setdragimage-manual.html b/testing/web-platform/tests/html/editing/dnd/the-datatransfer-interface/dnd-datatransfer-setdragimage-manual.html new file mode 100644 index 0000000000..acd8450308 --- /dev/null +++ b/testing/web-platform/tests/html/editing/dnd/the-datatransfer-interface/dnd-datatransfer-setdragimage-manual.html @@ -0,0 +1,108 @@ +<!DOCTYPE html> +<html> + +<head> + <style> + div { + margin: 0em; + padding: 2em; + } + + #source1, + #source2 { + color: blue; + border: 1px solid black; + } + + #target { + border: 1px solid black; + } + </style> + <script> + function getSolidColorImageBase64(color) { + var canvas = document.createElement('canvas'); + canvas.width = 256; + canvas.height = 256; + var ctx = canvas.getContext('2d'); + ctx.fillStyle = color; + ctx.fillRect(0, 0, canvas.width, canvas.height); + return canvas.toDataURL(); + } + function setDragImage(ev) { + var dragImage = document.createElement('img'); + if (ev.type === 'dragstart') { + dragImage = document.getElementById('dragImage'); + } + if (ev.type === 'dragover') { + // Red color image + dragImage.src = getSolidColorImageBase64('#FF0000'); + } + if (ev.type === 'dragenter') { + // Green color image + dragImage.src = getSolidColorImageBase64('#00FF00'); + } + if (ev.type === 'drop') { + // Yellow color image + dragImage.src = getSolidColorImageBase64('#FFFF00'); + } + ev.dataTransfer.setDragImage(dragImage, 10, 10); + } + + function dragstart_with_image_handler(ev) { + ev.dataTransfer.setData("text/plain", ev.target.id); + setDragImage(ev); + } + + function dragstart_without_image_handler(ev) { + ev.dataTransfer.setData("text/plain", ev.target.id); + } + + function dragover_handler(ev) { + setDragImage(ev); + ev.preventDefault(); + } + + function drag_enter(ev) { + setDragImage(ev); + ev.preventDefault(); + } + + function drop_handler(ev) { + setDragImage(ev); + ev.preventDefault(); + var data = ev.dataTransfer.getData("text"); + ev.target.appendChild(document.getElementById(data)); + } + </script> +</head> + +<body> + <div id="dragImageDiv"> + </div> + <div> + <p id="source1" ondragstart="dragstart_with_image_handler(event);" draggable="true"> + Select this element, drag it to the Drop Zone and drag image + should be visible. The drag image should be identical to the above image. + And the drag image should not change through out the drag and drop operation. + </p> + </div> + <div> + <p id="source2" ondragstart="dragstart_without_image_handler(event);" draggable="true"> + Select this element, drag it to the Drop Zone and drag image + should not be visible. + </p> + </div> + <div id="target" ondragenter="drag_enter(event);" ondrop="drop_handler(event);" ondragover="dragover_handler(event);"> + Drop Zone + </div> + <script> + var initialDragImage = document.createElement('img') + // Blue color image + initialDragImage.src = getSolidColorImageBase64('#0000FF') + initialDragImage.id = "dragImage" + var dragImageDiv = document.getElementById('dragImageDiv') + dragImageDiv.appendChild(initialDragImage); + </script> +</body> + +</html> diff --git a/testing/web-platform/tests/html/infrastructure/urls/resolving-urls/query-encoding/resources/resolve-url.js b/testing/web-platform/tests/html/infrastructure/urls/resolving-urls/query-encoding/resources/resolve-url.js index 74c4c2e997..8422ea4b3c 100644 --- a/testing/web-platform/tests/html/infrastructure/urls/resolving-urls/query-encoding/resources/resolve-url.js +++ b/testing/web-platform/tests/html/infrastructure/urls/resolving-urls/query-encoding/resources/resolve-url.js @@ -201,8 +201,6 @@ onload = function() { var video_ext = ''; if (elm.canPlayType('video/webm; codecs="vp9,opus"')) { video_ext = 'webm'; - } else if (elm.canPlayType('video/ogg; codecs="theora,flac"')) { - video_ext = 'ogv'; } else if (elm.canPlayType('video/mp4; codecs="avc1.42E01E,mp4a.40.2"')) { video_ext = 'mp4'; } diff --git a/testing/web-platform/tests/html/obsolete/requirements-for-implementations/the-marquee-element-0/marquee-overflow.html b/testing/web-platform/tests/html/obsolete/requirements-for-implementations/the-marquee-element-0/marquee-overflow.html new file mode 100644 index 0000000000..44b149952c --- /dev/null +++ b/testing/web-platform/tests/html/obsolete/requirements-for-implementations/the-marquee-element-0/marquee-overflow.html @@ -0,0 +1,18 @@ +<!doctype html> +<meta charset="utf-8"> +<title>Marquee forces overflow: hidden</title> +<link rel="help" href="https://html.spec.whatwg.org/#the-marquee-element"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<marquee style="overflow: visible"> </marquee> +<marquee style="overflow: scroll"> </marquee> +<marquee style="overflow: clip"> </marquee> +<marquee style="overflow: auto"> </marquee> + +<script> +test(() => { + for (let m of document.querySelectorAll("marquee")) { + assert_equals(getComputedStyle(m).overflow, "hidden", m.style); + } +}, "Marquee should have overflow: hidden !important in the UA stylesheet"); +</script> diff --git a/testing/web-platform/tests/html/rendering/non-replaced-elements/form-controls/resets.html b/testing/web-platform/tests/html/rendering/non-replaced-elements/form-controls/resets.html index db21188ee3..1a17aeac2d 100644 --- a/testing/web-platform/tests/html/rendering/non-replaced-elements/form-controls/resets.html +++ b/testing/web-platform/tests/html/rendering/non-replaced-elements/form-controls/resets.html @@ -50,6 +50,7 @@ input:not([type=image i], [type=range i], [type=checkbox i], [type=radio i]) { } input[type=hidden i] { display: none !important; } marquee { + overflow: hidden; text-align: initial; } table { display: table; box-sizing: border-box; } diff --git a/testing/web-platform/tests/html/rendering/widgets/button-layout/display-none-or-contents-ref.html b/testing/web-platform/tests/html/rendering/widgets/button-layout/display-none-or-contents-ref.html new file mode 100644 index 0000000000..c20a3065e4 --- /dev/null +++ b/testing/web-platform/tests/html/rendering/widgets/button-layout/display-none-or-contents-ref.html @@ -0,0 +1,3 @@ +<!DOCTYPE html> +<title>button (in button layout) with display: none/contents</title> +2
\ No newline at end of file diff --git a/testing/web-platform/tests/html/rendering/widgets/button-layout/display-none-or-contents.html b/testing/web-platform/tests/html/rendering/widgets/button-layout/display-none-or-contents.html new file mode 100644 index 0000000000..8f0ad3ab29 --- /dev/null +++ b/testing/web-platform/tests/html/rendering/widgets/button-layout/display-none-or-contents.html @@ -0,0 +1,12 @@ +<!DOCTYPE html> +<title>button (in button layout) with display: none/contents</title> +<link rel=match href=display-none-or-contents-ref.html> +<link rel=help href=https://html.spec.whatwg.org/multipage/rendering.html#button-layout-2> +<style> +#none{ display: none} +#contents { display: contents; font: initial } +</style> +<!-- Button layout should not impact "display: none" or "display: contents" on button elements --> +<!-- https://github.com/whatwg/html/pull/10244 --> +<button id=none>1</button> +<button id=contents>2</button>
\ No newline at end of file diff --git a/testing/web-platform/tests/html/semantics/embedded-content/media-elements/mime-types/canPlayType.html b/testing/web-platform/tests/html/semantics/embedded-content/media-elements/mime-types/canPlayType.html index 56edf25aa8..855f02d3b1 100644 --- a/testing/web-platform/tests/html/semantics/embedded-content/media-elements/mime-types/canPlayType.html +++ b/testing/web-platform/tests/html/semantics/embedded-content/media-elements/mime-types/canPlayType.html @@ -55,10 +55,13 @@ function type_codecs_test(type, audioCodecs, videoCodecs) { var typeSupported = false; var codecSupported = false; + var mimeSupported = canPlayType(type); + // Test 'type' without codecs. // Spec: Generally, a user agent should never return "probably" for a type // that allows the codecs parameter if that parameter is not present. test(function() { + assert_implements_optional(mimeSupported, type) t(type, 'maybe'); t(type + ';', 'maybe'); t(type + ';codecs', 'maybe'); @@ -69,6 +72,7 @@ function type_codecs_test(type, audioCodecs, videoCodecs) { function test_codec(codec) { var typeWithCodec = mime(type, [codec]); test(function() { + assert_implements_optional(canPlayType(typeWithCodec), type) t(typeWithCodec, 'probably'); codecSupported = true; }, typeWithCodec + ' (optional)'); @@ -81,6 +85,7 @@ function type_codecs_test(type, audioCodecs, videoCodecs) { // Test different pairings and orderings of audio+video codecs. if (audioCodecs.length > 0 && videoCodecs.length > 0) { test(function() { + assert_implements_optional(mimeSupported, type) audioCodecs.forEach(function(ac) { videoCodecs.forEach(function(vc) { var canPlayBoth = canPlayType(mime(type, [ac, vc])); @@ -93,6 +98,7 @@ function type_codecs_test(type, audioCodecs, videoCodecs) { }, type + ' codecs subset'); test(function() { + assert_implements_optional(mimeSupported, type) audioCodecs.forEach(function(ac) { videoCodecs.forEach(function(vc) { assert_equals(canPlayType(mime(type, [ac, vc])), diff --git a/testing/web-platform/tests/html/semantics/embedded-content/media-elements/track/track-element/track-cue-inline.html b/testing/web-platform/tests/html/semantics/embedded-content/media-elements/track/track-element/track-cue-inline.html index 3b4c3542a9..1a8aabcaff 100644 --- a/testing/web-platform/tests/html/semantics/embedded-content/media-elements/track/track-element/track-cue-inline.html +++ b/testing/web-platform/tests/html/semantics/embedded-content/media-elements/track/track-element/track-cue-inline.html @@ -4,7 +4,7 @@ <script src="/resources/testharnessreport.js"></script> <video> <source src="/media/test.mp4" type="video/mp4"> - <source src="/media/test.ogv" type="video/ogg"> + <source src="/media/test.webm" type="video/webm"> </video> <script> test(function() { @@ -13,4 +13,4 @@ test(function() { track.addCue(new VTTCue(0.0, 10.0, 'wow wow')); track.mode = 'showing'; }); -</script>
\ No newline at end of file +</script> diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-child-cross-origin.tentative.sub.window.js b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-child-cross-origin-delivered.tentative.sub.window.js index 95d53e1fe3..8074314557 100644 --- a/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-child-cross-origin.tentative.sub.window.js +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-child-cross-origin-delivered.tentative.sub.window.js @@ -9,16 +9,6 @@ 'use strict'; -// /* ---------------------- CROSS ORIGIN (A -> B) TESTS ---------------------- */ - -promise_test(async t => { - const main = await setupTest(); - const iframe_1 = await createNestedIframe(main, - "HTTP_REMOTE_ORIGIN", "allow-top-navigation", ""); - - await attemptTopNavigation(iframe_1, true); -}, "A cross-origin frame with frame sandbox flags can navigate top"); - promise_test(async t => { const main = await setupTest(); const iframe_1 = await createNestedIframe(main, diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-child-cross-origin-frame.tentative.sub.window.js b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-child-cross-origin-frame.tentative.sub.window.js new file mode 100644 index 0000000000..a2191b352a --- /dev/null +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-child-cross-origin-frame.tentative.sub.window.js @@ -0,0 +1,18 @@ +// META: title=Top-level navigation tests with cross origin & user activated child frames +// META: script=/common/dispatcher/dispatcher.js +// META: script=/common/get-host-info.sub.js +// META: script=/common/utils.js +// META: script=/resources/testdriver.js +// META: script=/resources/testdriver-vendor.js +// META: script=/html/browsers/browsing-the-web/remote-context-helper/resources/remote-context-helper.js +// META: script=./resources/sandbox-top-navigation-helper.sub.js + +'use strict'; + +promise_test(async t => { + const main = await setupTest(); + const iframe_1 = await createNestedIframe( + main, 'HTTP_REMOTE_ORIGIN', 'allow-top-navigation', ''); + + await attemptTopNavigation(iframe_1, true); +}, 'A cross-origin frame with frame sandbox flags can navigate top'); diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-child-delivered-both.tentative.sub.window.js b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-child-delivered-both.tentative.sub.window.js new file mode 100644 index 0000000000..540cc338c9 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-child-delivered-both.tentative.sub.window.js @@ -0,0 +1,20 @@ +// META: title=Top-level navigation tests with child frames +// META: script=/common/dispatcher/dispatcher.js +// META: script=/common/get-host-info.sub.js +// META: script=/common/utils.js +// META: script=/resources/testdriver.js +// META: script=/resources/testdriver-vendor.js +// META: script=/html/browsers/browsing-the-web/remote-context-helper/resources/remote-context-helper.js +// META: script=./resources/sandbox-top-navigation-helper.sub.js + +'use strict'; + +promise_test(async t => { + const main = await setupTest(); + const iframe_1 = await createNestedIframe( + main, 'HTTP_ORIGIN', '', + 'allow-top-navigation allow-top-navigation-by-user-activation allow-same-origin'); + + await attemptTopNavigation(iframe_1, true); +}, 'A frame with both top navigation delivered sandbox flags uses the less \ + restrictive one'); diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-child-delivered.tentative.sub.window.js b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-child-delivered.tentative.sub.window.js new file mode 100644 index 0000000000..c020513012 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-child-delivered.tentative.sub.window.js @@ -0,0 +1,18 @@ +// META: title=Top-level navigation tests with child frames +// META: script=/common/dispatcher/dispatcher.js +// META: script=/common/get-host-info.sub.js +// META: script=/common/utils.js +// META: script=/resources/testdriver.js +// META: script=/resources/testdriver-vendor.js +// META: script=/html/browsers/browsing-the-web/remote-context-helper/resources/remote-context-helper.js +// META: script=./resources/sandbox-top-navigation-helper.sub.js + +'use strict'; + +promise_test(async t => { + const main = await setupTest(); + const iframe_1 = await createNestedIframe( + main, 'HTTP_ORIGIN', '', 'allow-top-navigation allow-same-origin'); + + await attemptTopNavigation(iframe_1, true); +}, 'A same-origin frame with delivered sandbox flags can navigate top'); diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-child-frame-both.tentative.sub.window.js b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-child-frame-both.tentative.sub.window.js new file mode 100644 index 0000000000..ff7d2eb584 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-child-frame-both.tentative.sub.window.js @@ -0,0 +1,20 @@ +// META: title=Top-level navigation tests with child frames +// META: script=/common/dispatcher/dispatcher.js +// META: script=/common/get-host-info.sub.js +// META: script=/common/utils.js +// META: script=/resources/testdriver.js +// META: script=/resources/testdriver-vendor.js +// META: script=/html/browsers/browsing-the-web/remote-context-helper/resources/remote-context-helper.js +// META: script=./resources/sandbox-top-navigation-helper.sub.js + +'use strict'; + +promise_test(async t => { + const main = await setupTest(); + const iframe_1 = await createNestedIframe( + main, 'HTTP_ORIGIN', + 'allow-top-navigation allow-top-navigation-by-user-activation', ''); + + await attemptTopNavigation(iframe_1, true); +}, 'A frame with both top navigation frame sandbox flags uses the less \ + restrictive one'); diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-child-frame.tentative.sub.window.js b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-child-frame.tentative.sub.window.js new file mode 100644 index 0000000000..35abc554b6 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-child-frame.tentative.sub.window.js @@ -0,0 +1,18 @@ +// META: title=Top-level navigation tests with child frames +// META: script=/common/dispatcher/dispatcher.js +// META: script=/common/get-host-info.sub.js +// META: script=/common/utils.js +// META: script=/resources/testdriver.js +// META: script=/resources/testdriver-vendor.js +// META: script=/html/browsers/browsing-the-web/remote-context-helper/resources/remote-context-helper.js +// META: script=./resources/sandbox-top-navigation-helper.sub.js + +'use strict'; + +promise_test(async t => { + const main = await setupTest(); + const iframe_1 = await createNestedIframe( + main, 'HTTP_ORIGIN', 'allow-top-navigation allow-same-origin', ''); + + await attemptTopNavigation(iframe_1, true); +}, 'A same-origin frame with frame sandbox flags can navigate top'); diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-child-unsandboxed.tentative.sub.window.js b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-child-unsandboxed.tentative.sub.window.js new file mode 100644 index 0000000000..c2d78b6dd5 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-child-unsandboxed.tentative.sub.window.js @@ -0,0 +1,17 @@ +// META: title=Top-level navigation tests with child frames +// META: script=/common/dispatcher/dispatcher.js +// META: script=/common/get-host-info.sub.js +// META: script=/common/utils.js +// META: script=/resources/testdriver.js +// META: script=/resources/testdriver-vendor.js +// META: script=/html/browsers/browsing-the-web/remote-context-helper/resources/remote-context-helper.js +// META: script=./resources/sandbox-top-navigation-helper.sub.js + +'use strict'; + +promise_test(async t => { + const main = await setupTest(); + const iframe_1 = await createNestedIframe(main, 'HTTP_ORIGIN', '', ''); + + await attemptTopNavigation(iframe_1, true); +}, 'A same-origin unsandboxed frame can navigate top'); diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-child.tentative.sub.window.js b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-child.tentative.sub.window.js deleted file mode 100644 index 1d5ea93830..0000000000 --- a/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-child.tentative.sub.window.js +++ /dev/null @@ -1,56 +0,0 @@ -// META: title=Top-level navigation tests with child frames -// META: script=/common/dispatcher/dispatcher.js -// META: script=/common/get-host-info.sub.js -// META: script=/common/utils.js -// META: script=/resources/testdriver.js -// META: script=/resources/testdriver-vendor.js -// META: script=/html/browsers/browsing-the-web/remote-context-helper/resources/remote-context-helper.js -// META: script=./resources/sandbox-top-navigation-helper.sub.js - -'use strict'; - -/* ----------------------- SAME ORIGIN (A -> A) TESTS ----------------------- */ - -promise_test(async t => { - const main = await setupTest(); - const iframe_1 = await createNestedIframe(main, - "HTTP_ORIGIN", "", "allow-top-navigation allow-same-origin"); - - await attemptTopNavigation(iframe_1, true); -}, "A same-origin frame with delivered sandbox flags can navigate top"); - -promise_test(async t => { - const main = await setupTest(); - const iframe_1 = await createNestedIframe(main, - "HTTP_ORIGIN", "allow-top-navigation allow-same-origin", ""); - - await attemptTopNavigation(iframe_1, true); -}, "A same-origin frame with frame sandbox flags can navigate top"); - -promise_test(async t => { - const main = await setupTest(); - const iframe_1 = await createNestedIframe(main, - "HTTP_ORIGIN", "", ""); - - await attemptTopNavigation(iframe_1, true); -}, "A same-origin unsandboxed frame can navigate top"); - -promise_test(async t => { - const main = await setupTest(); - const iframe_1 = await createNestedIframe(main, - "HTTP_ORIGIN", "", - "allow-top-navigation allow-top-navigation-by-user-activation allow-same-origin"); - - await attemptTopNavigation(iframe_1, true); -}, "A frame with both top navigation delivered sandbox flags uses the less \ - restrictive one"); - -promise_test(async t => { - const main = await setupTest(); - const iframe_1 = await createNestedIframe(main, - "HTTP_ORIGIN", - "allow-top-navigation allow-top-navigation-by-user-activation", ""); - - await attemptTopNavigation(iframe_1, true); -}, "A frame with both top navigation frame sandbox flags uses the less \ - restrictive one"); diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-cross-origin-escalate.tentative.sub.window.js b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-cross-origin-escalate.tentative.sub.window.js new file mode 100644 index 0000000000..c394699d85 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-cross-origin-escalate.tentative.sub.window.js @@ -0,0 +1,20 @@ +// META: title=Top-level navigation tests with frames that try to give themselves top-nav permission +// META: script=/common/dispatcher/dispatcher.js +// META: script=/common/get-host-info.sub.js +// META: script=/common/utils.js +// META: script=/resources/testdriver.js +// META: script=/resources/testdriver-vendor.js +// META: script=/html/browsers/browsing-the-web/remote-context-helper/resources/remote-context-helper.js +// META: script=./resources/sandbox-top-navigation-helper.sub.js + +'use strict'; + +promise_test(async t => { + const main = await setupTest(); + const iframe_1 = await createNestedIframe(main, 'HTTP_REMOTE_ORIGIN', '', ''); + const iframe_2 = await createNestedIframe( + iframe_1, 'HTTP_REMOTE_ORIGIN', 'allow-top-navigation', ''); + + await attemptTopNavigation(iframe_2, false); +}, 'A cross origin unsandboxed frame can\'t escalate privileges in a child \ + frame'); diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-cross-site.tentative.sub.window.js b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-cross-site.tentative.sub.window.js index 26db4eeaca..cacc5bd983 100644 --- a/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-cross-site.tentative.sub.window.js +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-cross-site.tentative.sub.window.js @@ -20,24 +20,3 @@ promise_test(async t => { await attemptTopNavigation(new_iframe, false); }, "A cross-site unsandboxed iframe navigation consumes user activation and " + "disallows top-level navigation."); - -promise_test(async t => { - const main = await setupTest(); - - const iframe = await createNestedIframe(main, "HTTP_ORIGIN", "", ""); - await activate(iframe); - - const new_iframe = await navigateFrameTo(iframe, "HTTP_REMOTE_ORIGIN"); - await attemptTopNavigation(new_iframe, true); -}, "A same-site unsandboxed iframe navigation does not consume user " + - "activation and allows top-level navigation."); - -promise_test(async t => { - const main = await setupTest(); - - const iframe = await createNestedIframe(main, "HTTP_ORIGIN", "", ""); - - const new_iframe = await navigateFrameTo(iframe, "HTTP_REMOTE_ORIGIN"); - await attemptTopNavigation(new_iframe, false); -}, "A same-site unsandboxed iframe navigation without sticky user activation " + - "does not allow top-level navigation."); diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-escalate-privileges.tentative.sub.window.js b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-escalate-privileges.tentative.sub.window.js deleted file mode 100644 index 2ea0ba606e..0000000000 --- a/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-escalate-privileges.tentative.sub.window.js +++ /dev/null @@ -1,63 +0,0 @@ -// META: title=Top-level navigation tests with frames that try to give themselves top-nav permission -// META: script=/common/dispatcher/dispatcher.js -// META: script=/common/get-host-info.sub.js -// META: script=/common/utils.js -// META: script=/resources/testdriver.js -// META: script=/resources/testdriver-vendor.js -// META: script=/html/browsers/browsing-the-web/remote-context-helper/resources/remote-context-helper.js -// META: script=./resources/sandbox-top-navigation-helper.sub.js - -'use strict'; - -promise_test(async t => { - const main = await setupTest(); - const iframe_1 = await createNestedIframe(main, - "HTTP_REMOTE_ORIGIN", "", ""); - const iframe_2 = await createNestedIframe(iframe_1, - "HTTP_REMOTE_ORIGIN", "allow-top-navigation", ""); - - await attemptTopNavigation(iframe_2, false); -}, "A cross origin unsandboxed frame can't escalate privileges in a child \ - frame"); - -promise_test(async t => { - const main = await setupTest(); - const iframe_1 = await createNestedIframe(main, - "HTTP_REMOTE_ORIGIN", "allow-top-navigation", ""); - const iframe_2 = await createNestedIframe(iframe_1, - "OTHER_ORIGIN", "", ""); - - await attemptTopNavigation(iframe_2, true); -}, "An unsandboxed grandchild inherits its parents ability to navigate top."); - -promise_test(async t => { - const main = await setupTest(); - const iframe_1 = await createNestedIframe(main, - "HTTP_ORIGIN", "", ""); - const iframe_2 = await createNestedIframe(iframe_1, - "HTTP_ORIGIN", "allow-top-navigation", ""); - - await attemptTopNavigation(iframe_2, true); -}, "A same-origin grandchild with frame allow-top can navigate top"); - -promise_test(async t => { - const main = await setupTest(); - const iframe_1 = await createNestedIframe(main, - "HTTP_ORIGIN", "", ""); - const iframe_2 = await createNestedIframe(iframe_1, - "HTTP_ORIGIN", "", "allow-top-navigation"); - - await attemptTopNavigation(iframe_2, false); -}, "A sandboxed same-origin grandchild without allow-same-origin can't \ - escalate its own top-nav privileges"); - -promise_test(async t => { - const main = await setupTest(); - const iframe_1 = await createNestedIframe(main, - "HTTP_ORIGIN", "", ""); - const iframe_2 = await createNestedIframe(iframe_1, - "HTTP_ORIGIN", "", "allow-same-origin allow-top-navigation"); - - await attemptTopNavigation(iframe_2, true); -}, "A sandboxed same-origin grandchild with allow-same-origin can \ - give itself top-nav privileges"); diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-grandchild-allow-same-origin.tentative.sub.window.js b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-grandchild-allow-same-origin.tentative.sub.window.js new file mode 100644 index 0000000000..2be6cd66a7 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-grandchild-allow-same-origin.tentative.sub.window.js @@ -0,0 +1,20 @@ +// META: title=Top-level navigation tests with frames that try to give themselves top-nav permission +// META: script=/common/dispatcher/dispatcher.js +// META: script=/common/get-host-info.sub.js +// META: script=/common/utils.js +// META: script=/resources/testdriver.js +// META: script=/resources/testdriver-vendor.js +// META: script=/html/browsers/browsing-the-web/remote-context-helper/resources/remote-context-helper.js +// META: script=./resources/sandbox-top-navigation-helper.sub.js + +'use strict'; + +promise_test(async t => { + const main = await setupTest(); + const iframe_1 = await createNestedIframe(main, 'HTTP_ORIGIN', '', ''); + const iframe_2 = await createNestedIframe( + iframe_1, 'HTTP_ORIGIN', '', 'allow-same-origin allow-top-navigation'); + + await attemptTopNavigation(iframe_2, true); +}, 'A sandboxed same-origin grandchild with allow-same-origin can \ + give itself top-nav privileges'); diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-grandchild-frame-allow-top.tentative.sub.window.js b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-grandchild-frame-allow-top.tentative.sub.window.js new file mode 100644 index 0000000000..43ca5eb404 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-grandchild-frame-allow-top.tentative.sub.window.js @@ -0,0 +1,19 @@ +// META: title=Top-level navigation tests with frames that try to give themselves top-nav permission +// META: script=/common/dispatcher/dispatcher.js +// META: script=/common/get-host-info.sub.js +// META: script=/common/utils.js +// META: script=/resources/testdriver.js +// META: script=/resources/testdriver-vendor.js +// META: script=/html/browsers/browsing-the-web/remote-context-helper/resources/remote-context-helper.js +// META: script=./resources/sandbox-top-navigation-helper.sub.js + +'use strict'; + +promise_test(async t => { + const main = await setupTest(); + const iframe_1 = await createNestedIframe(main, 'HTTP_ORIGIN', '', ''); + const iframe_2 = await createNestedIframe( + iframe_1, 'HTTP_ORIGIN', 'allow-top-navigation', ''); + + await attemptTopNavigation(iframe_2, true); +}, 'A same-origin grandchild with frame allow-top can navigate top'); diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-grandchild-sandboxed-cross-origin-parent.tentative.sub.window.js b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-grandchild-sandboxed-cross-origin-parent.tentative.sub.window.js new file mode 100644 index 0000000000..8833ad42bb --- /dev/null +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-grandchild-sandboxed-cross-origin-parent.tentative.sub.window.js @@ -0,0 +1,19 @@ +// META: title=Top-level navigation tests with grandchild frames +// META: script=/common/dispatcher/dispatcher.js +// META: script=/common/get-host-info.sub.js +// META: script=/common/utils.js +// META: script=/resources/testdriver.js +// META: script=/resources/testdriver-vendor.js +// META: script=/html/browsers/browsing-the-web/remote-context-helper/resources/remote-context-helper.js +// META: script=./resources/sandbox-top-navigation-helper.sub.js + +'use strict'; + +promise_test(async t => { + const main = await setupTest(); + const iframe_1 = await createNestedIframe(main, 'HTTP_REMOTE_ORIGIN', '', ''); + const iframe_2 = await createNestedIframe( + iframe_1, 'HTTP_ORIGIN', 'allow-top-navigation allow-same-origin', ''); + + await attemptTopNavigation(iframe_2, true); +}, 'A same-origin sandboxed grandchild in a cross-origin parent can navigate top'); diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-grandchild-sandboxed-escalate.tentative.sub.window.js b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-grandchild-sandboxed-escalate.tentative.sub.window.js new file mode 100644 index 0000000000..448925144a --- /dev/null +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-grandchild-sandboxed-escalate.tentative.sub.window.js @@ -0,0 +1,20 @@ +// META: title=Top-level navigation tests with frames that try to give themselves top-nav permission +// META: script=/common/dispatcher/dispatcher.js +// META: script=/common/get-host-info.sub.js +// META: script=/common/utils.js +// META: script=/resources/testdriver.js +// META: script=/resources/testdriver-vendor.js +// META: script=/html/browsers/browsing-the-web/remote-context-helper/resources/remote-context-helper.js +// META: script=./resources/sandbox-top-navigation-helper.sub.js + +'use strict'; + +promise_test(async t => { + const main = await setupTest(); + const iframe_1 = await createNestedIframe(main, 'HTTP_ORIGIN', '', ''); + const iframe_2 = await createNestedIframe( + iframe_1, 'HTTP_ORIGIN', '', 'allow-top-navigation'); + + await attemptTopNavigation(iframe_2, false); +}, 'A sandboxed same-origin grandchild without allow-same-origin can\'t \ + escalate its own top-nav privileges'); diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-grandchild-sandboxed.tentative.sub.window.js b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-grandchild-sandboxed.tentative.sub.window.js new file mode 100644 index 0000000000..a4b43a7b1f --- /dev/null +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-grandchild-sandboxed.tentative.sub.window.js @@ -0,0 +1,19 @@ +// META: title=Top-level navigation tests with grandchild frames +// META: script=/common/dispatcher/dispatcher.js +// META: script=/common/get-host-info.sub.js +// META: script=/common/utils.js +// META: script=/resources/testdriver.js +// META: script=/resources/testdriver-vendor.js +// META: script=/html/browsers/browsing-the-web/remote-context-helper/resources/remote-context-helper.js +// META: script=./resources/sandbox-top-navigation-helper.sub.js + +'use strict'; + +promise_test(async t => { + const main = await setupTest(); + const iframe_1 = await createNestedIframe(main, 'HTTP_ORIGIN', '', ''); + const iframe_2 = + await createNestedIframe(iframe_1, 'HTTP_ORIGIN', 'allow-scripts', ''); + + await attemptTopNavigation(iframe_2, false); +}, 'A fully sandboxed same-origin grandchild can\'t navigate top'); diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-grandchild-unsandboxed-cross-origin-parent.tentative.sub.window.js b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-grandchild-unsandboxed-cross-origin-parent.tentative.sub.window.js new file mode 100644 index 0000000000..5abbb9c30c --- /dev/null +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-grandchild-unsandboxed-cross-origin-parent.tentative.sub.window.js @@ -0,0 +1,18 @@ +// META: title=Top-level navigation tests with grandchild frames +// META: script=/common/dispatcher/dispatcher.js +// META: script=/common/get-host-info.sub.js +// META: script=/common/utils.js +// META: script=/resources/testdriver.js +// META: script=/resources/testdriver-vendor.js +// META: script=/html/browsers/browsing-the-web/remote-context-helper/resources/remote-context-helper.js +// META: script=./resources/sandbox-top-navigation-helper.sub.js + +'use strict'; + +promise_test(async t => { + const main = await setupTest(); + const iframe_1 = await createNestedIframe(main, 'HTTP_REMOTE_ORIGIN', '', ''); + const iframe_2 = await createNestedIframe(iframe_1, 'HTTP_ORIGIN', '', ''); + + await attemptTopNavigation(iframe_2, true); +}, 'A same-origin grandchild in a cross-origin parent can navigate top'); diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-grandchild-unsandboxed-inherit.tentative.sub.window.js b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-grandchild-unsandboxed-inherit.tentative.sub.window.js new file mode 100644 index 0000000000..a31c56b935 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-grandchild-unsandboxed-inherit.tentative.sub.window.js @@ -0,0 +1,19 @@ +// META: title=Top-level navigation tests with frames that try to give themselves top-nav permission +// META: script=/common/dispatcher/dispatcher.js +// META: script=/common/get-host-info.sub.js +// META: script=/common/utils.js +// META: script=/resources/testdriver.js +// META: script=/resources/testdriver-vendor.js +// META: script=/html/browsers/browsing-the-web/remote-context-helper/resources/remote-context-helper.js +// META: script=./resources/sandbox-top-navigation-helper.sub.js + +'use strict'; + +promise_test(async t => { + const main = await setupTest(); + const iframe_1 = await createNestedIframe( + main, 'HTTP_REMOTE_ORIGIN', 'allow-top-navigation', ''); + const iframe_2 = await createNestedIframe(iframe_1, 'OTHER_ORIGIN', '', ''); + + await attemptTopNavigation(iframe_2, true); +}, 'An unsandboxed grandchild inherits its parents ability to navigate top.'); diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-grandchild-unsandboxed.tentative.sub.window.js b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-grandchild-unsandboxed.tentative.sub.window.js new file mode 100644 index 0000000000..7fe80dfa1b --- /dev/null +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-grandchild-unsandboxed.tentative.sub.window.js @@ -0,0 +1,18 @@ +// META: title=Top-level navigation tests with grandchild frames +// META: script=/common/dispatcher/dispatcher.js +// META: script=/common/get-host-info.sub.js +// META: script=/common/utils.js +// META: script=/resources/testdriver.js +// META: script=/resources/testdriver-vendor.js +// META: script=/html/browsers/browsing-the-web/remote-context-helper/resources/remote-context-helper.js +// META: script=./resources/sandbox-top-navigation-helper.sub.js + +'use strict'; + +promise_test(async t => { + const main = await setupTest(); + const iframe_1 = await createNestedIframe(main, 'HTTP_ORIGIN', '', ''); + const iframe_2 = await createNestedIframe(iframe_1, 'HTTP_ORIGIN', '', ''); + + await attemptTopNavigation(iframe_2, true); +}, 'An unsandboxed same-origin grandchild can navigate top'); diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-grandchild.tentative.sub.window.js b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-grandchild.tentative.sub.window.js deleted file mode 100644 index 326c1dd54a..0000000000 --- a/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-grandchild.tentative.sub.window.js +++ /dev/null @@ -1,50 +0,0 @@ -// META: title=Top-level navigation tests with grandchild frames -// META: script=/common/dispatcher/dispatcher.js -// META: script=/common/get-host-info.sub.js -// META: script=/common/utils.js -// META: script=/resources/testdriver.js -// META: script=/resources/testdriver-vendor.js -// META: script=/html/browsers/browsing-the-web/remote-context-helper/resources/remote-context-helper.js -// META: script=./resources/sandbox-top-navigation-helper.sub.js - -'use strict'; - -promise_test(async t => { - const main = await setupTest(); - const iframe_1 = await createNestedIframe(main, - "HTTP_ORIGIN", "", ""); - const iframe_2 = await createNestedIframe(iframe_1, - "HTTP_ORIGIN", "allow-scripts", ""); - - await attemptTopNavigation(iframe_2, false); -}, "A fully sandboxed same-origin grandchild can't navigate top"); - -promise_test(async t => { - const main = await setupTest(); - const iframe_1 = await createNestedIframe(main, - "HTTP_ORIGIN", "", ""); - const iframe_2 = await createNestedIframe(iframe_1, - "HTTP_ORIGIN", "", ""); - - await attemptTopNavigation(iframe_2, true); -}, "An unsandboxed same-origin grandchild can navigate top"); - -promise_test(async t => { - const main = await setupTest(); - const iframe_1 = await createNestedIframe(main, - "HTTP_REMOTE_ORIGIN", "", ""); - const iframe_2 = await createNestedIframe(iframe_1, - "HTTP_ORIGIN", "", ""); - - await attemptTopNavigation(iframe_2, true); -}, "A same-origin grandchild in a cross-origin parent can navigate top"); - -promise_test(async t => { - const main = await setupTest(); - const iframe_1 = await createNestedIframe(main, - "HTTP_REMOTE_ORIGIN", "", ""); - const iframe_2 = await createNestedIframe(iframe_1, - "HTTP_ORIGIN", "allow-top-navigation allow-same-origin", ""); - - await attemptTopNavigation(iframe_2, true); -}, "A same-origin sandboxed grandchild in a cross-origin parent can navigate top");
\ No newline at end of file diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-same-site-no-activation.tentative.sub.window.js b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-same-site-no-activation.tentative.sub.window.js new file mode 100644 index 0000000000..03350e76e2 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-same-site-no-activation.tentative.sub.window.js @@ -0,0 +1,23 @@ +// META: title=Top-level navigation tests with cross origin & user activated child frames +// META: script=/common/dispatcher/dispatcher.js +// META: script=/common/get-host-info.sub.js +// META: script=/common/utils.js +// META: script=/resources/testdriver.js +// META: script=/resources/testdriver-actions.js +// META: script=/resources/testdriver-vendor.js +// META: script=/html/browsers/browsing-the-web/remote-context-helper/resources/remote-context-helper.js +// META: script=./resources/sandbox-top-navigation-helper.sub.js + +'use strict'; + +promise_test( + async t => { + const main = await setupTest(); + + const iframe = await createNestedIframe(main, 'HTTP_ORIGIN', '', ''); + + const new_iframe = await navigateFrameTo(iframe, 'HTTP_REMOTE_ORIGIN'); + await attemptTopNavigation(new_iframe, false); + }, + 'A same-site unsandboxed iframe navigation without sticky user activation ' + + 'does not allow top-level navigation.'); diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-same-site.tentative.sub.window.js b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-same-site.tentative.sub.window.js new file mode 100644 index 0000000000..0ee6b8edcc --- /dev/null +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-same-site.tentative.sub.window.js @@ -0,0 +1,24 @@ +// META: title=Top-level navigation tests with cross origin & user activated child frames +// META: script=/common/dispatcher/dispatcher.js +// META: script=/common/get-host-info.sub.js +// META: script=/common/utils.js +// META: script=/resources/testdriver.js +// META: script=/resources/testdriver-actions.js +// META: script=/resources/testdriver-vendor.js +// META: script=/html/browsers/browsing-the-web/remote-context-helper/resources/remote-context-helper.js +// META: script=./resources/sandbox-top-navigation-helper.sub.js + +'use strict'; + +promise_test( + async t => { + const main = await setupTest(); + + const iframe = await createNestedIframe(main, 'HTTP_ORIGIN', '', ''); + await activate(iframe); + + const new_iframe = await navigateFrameTo(iframe, 'HTTP_REMOTE_ORIGIN'); + await attemptTopNavigation(new_iframe, true); + }, + 'A same-site unsandboxed iframe navigation does not consume user ' + + 'activation and allows top-level navigation.'); diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-user-activation-no-sticky.tentative.sub.window.js b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-user-activation-no-sticky.tentative.sub.window.js new file mode 100644 index 0000000000..c62155ce30 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-user-activation-no-sticky.tentative.sub.window.js @@ -0,0 +1,19 @@ +// META: title=Top-level navigation tests with cross origin & user activated child frames +// META: script=/common/dispatcher/dispatcher.js +// META: script=/common/get-host-info.sub.js +// META: script=/common/utils.js +// META: script=/resources/testdriver.js +// META: script=/resources/testdriver-actions.js +// META: script=/resources/testdriver-vendor.js +// META: script=/html/browsers/browsing-the-web/remote-context-helper/resources/remote-context-helper.js +// META: script=./resources/sandbox-top-navigation-helper.sub.js + +'use strict'; + +promise_test(async t => { + const main = await setupTest(); + const iframe_1 = await createNestedIframe( + main, 'HTTP_ORIGIN', 'allow-top-navigation-by-user-activation', ''); + + await attemptTopNavigation(iframe_1, false); +}, 'allow-top-navigation-by-user-activation set but no sticky activation'); diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-user-activation.tentative.sub.window.js b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-user-activation-sticky.tentative.sub.window.js index 5079c8ad14..e62fbdfb22 100644 --- a/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-user-activation.tentative.sub.window.js +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/sandbox-top-navigation-user-activation-sticky.tentative.sub.window.js @@ -10,8 +10,6 @@ 'use strict'; -/* ------------------------- USER ACTIVATION TESTS ------------------------- */ - promise_test(async t => { const main = await setupTest(); const iframe_1 = await createNestedIframe(main, @@ -20,11 +18,3 @@ promise_test(async t => { await attemptTopNavigation(iframe_1, true); }, "Allow top with user activation + user activation"); - -promise_test(async t => { - const main = await setupTest(); - const iframe_1 = await createNestedIframe(main, - "HTTP_ORIGIN", "allow-top-navigation-by-user-activation", ""); - - await attemptTopNavigation(iframe_1, false); -}, "allow-top-navigation-by-user-activation set but no sticky activation"); diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-object-element/usemap-casing.html b/testing/web-platform/tests/html/semantics/embedded-content/the-object-element/usemap-casing.html index 114a472fb6..9431c73fe7 100644 --- a/testing/web-platform/tests/html/semantics/embedded-content/the-object-element/usemap-casing.html +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-object-element/usemap-casing.html @@ -8,53 +8,53 @@ <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<div id="log"></div> +<object data="/images/threecolors.png" usemap="#sanityCheck" width="100" height="100"></object> +<map name="sanityCheck"><area shape="rect" coords="0,0,100,100"></map> + +<object data="/images/threecolors.png" usemap="#sImPlE" width="100" height="100"></object> +<map name="simple"><area shape="rect" coords="0,0,100,100"></map> +<map name="SIMPLE"><area shape="rect" coords="0,0,100,100"></map> + +<object data="/images/threecolors.png" usemap="#paSSfield-killroyß" width="100" height="100"></object> +<map name="passfield-killroyß"><area shape="rect" coords="0,0,100,100"></map> +<map name="PASSFIELD-KILLROYß"><area shape="rect" coords="0,0,100,100"></map> +<map name="paſſfield-killroyß"><area shape="rect" coords="0,0,100,100"></map> +<map name="passfield-Killroyß"><area shape="rect" coords="0,0,100,100"></map> +<map name="paßfield-killroyß"><area shape="rect" coords="0,0,100,100"></map> +<map name="paẞfield-killroyß"><area shape="rect" coords="0,0,100,100"></map> +<map name="passfield-killroyẞ"><area shape="rect" coords="0,0,100,100"></map> +<map name="passfield-killroyß"><area shape="rect" coords="0,0,100,100"></map> +<map name="passfıeld-killroyß"><area shape="rect" coords="0,0,100,100"></map> +<map name="passfİeld-killroyß"><area shape="rect" coords="0,0,100,100"></map> + +<object data="/images/threecolors.png" usemap="#глупый" width="100" height="100"></object> +<map name="глупый"><area shape="rect" coords="0,0,100,100"></map> +<map name="ГЛУПЫЙ"><area shape="rect" coords="0,0,100,100"></map> +<map name="ГЛУПЫЙ"><area shape="rect" coords="0,0,100,100"></map> + +<object data="/images/threecolors.png" usemap="#åωk" width="100" height="100"></object> +<map name="ÅΩK"><area shape="rect" coords="0,0,100,100"></map> +<map name="Åωk"><area shape="rect" coords="0,0,100,100"></map> +<map name="åΩk"><area shape="rect" coords="0,0,100,100"></map> +<map name="åωK"><area shape="rect" coords="0,0,100,100"></map> + +<object data="/images/threecolors.png" usemap="#blah1" width="100" height="100"></object> +<map name="blah①"><area shape="rect" coords="0,0,100,100"></map> +<map name="blⒶh1"><area shape="rect" coords="0,0,100,100"></map> +<map name="blⓐh1"><area shape="rect" coords="0,0,100,100"></map> + +<object data="/images/threecolors.png" usemap="#tÉdz5アパートFi" width="100" height="100"></object> +<map name="TÉDZ5アパートFi"><area shape="rect" coords="0,0,100,100"></map> +<map name="TéDZ⁵アパートFi"><area shape="rect" coords="0,0,100,100"></map> +<map name="tÉdz5㌀Fi"><area shape="rect" coords="0,0,100,100"></map> +<map name="tÉdz5アパートFi"><area shape="rect" coords="0,0,100,100"></map> +<map name="TÉDZ⁵アパートFi"><area shape="rect" coords="0,0,100,100"></map> +<map name="TÉDZ5アパートfi"><area shape="rect" coords="0,0,100,100"></map> + +<object data="/images/threecolors.png" usemap="#ΣΣ" width="100" height="100"></object> +<map name="σς"><area shape="rect" coords="0,0,100,100"></map> -<object data="/images/threecolors.png" usemap="#sanityCheck" width="300" height="300"></object> -<map name="sanityCheck"><area shape="rect" coords="0,0,300,300"></map> - -<object data="/images/threecolors.png" usemap="#sImPlE" width="300" height="300"></object> -<map name="simple"><area shape="rect" coords="0,0,300,300"></map> -<map name="SIMPLE"><area shape="rect" coords="0,0,300,300"></map> - -<object data="/images/threecolors.png" usemap="#paSSfield-killroyß" width="300" height="300"></object> -<map name="passfield-killroyß"><area shape="rect" coords="0,0,300,300"></map> -<map name="PASSFIELD-KILLROYß"><area shape="rect" coords="0,0,300,300"></map> -<map name="paſſfield-killroyß"><area shape="rect" coords="0,0,300,300"></map> -<map name="passfield-Killroyß"><area shape="rect" coords="0,0,300,300"></map> -<map name="paßfield-killroyß"><area shape="rect" coords="0,0,300,300"></map> -<map name="paẞfield-killroyß"><area shape="rect" coords="0,0,300,300"></map> -<map name="passfield-killroyẞ"><area shape="rect" coords="0,0,300,300"></map> -<map name="passfield-killroyß"><area shape="rect" coords="0,0,300,300"></map> -<map name="passfıeld-killroyß"><area shape="rect" coords="0,0,300,300"></map> -<map name="passfİeld-killroyß"><area shape="rect" coords="0,0,300,300"></map> - -<object data="/images/threecolors.png" usemap="#глупый" width="300" height="300"></object> -<map name="глупый"><area shape="rect" coords="0,0,300,300"></map> -<map name="ГЛУПЫЙ"><area shape="rect" coords="0,0,300,300"></map> -<map name="ГЛУПЫЙ"><area shape="rect" coords="0,0,300,300"></map> - -<object data="/images/threecolors.png" usemap="#åωk" width="300" height="300"></object> -<map name="ÅΩK"><area shape="rect" coords="0,0,300,300"></map> -<map name="Åωk"><area shape="rect" coords="0,0,300,300"></map> -<map name="åΩk"><area shape="rect" coords="0,0,300,300"></map> -<map name="åωK"><area shape="rect" coords="0,0,300,300"></map> - -<object data="/images/threecolors.png" usemap="#blah1" width="300" height="300"></object> -<map name="blah①"><area shape="rect" coords="0,0,300,300"></map> -<map name="blⒶh1"><area shape="rect" coords="0,0,300,300"></map> -<map name="blⓐh1"><area shape="rect" coords="0,0,300,300"></map> - -<object data="/images/threecolors.png" usemap="#tÉdz5アパートFi" width="300" height="300"></object> -<map name="TÉDZ5アパートFi"><area shape="rect" coords="0,0,300,300"></map> -<map name="TéDZ⁵アパートFi"><area shape="rect" coords="0,0,300,300"></map> -<map name="tÉdz5㌀Fi"><area shape="rect" coords="0,0,300,300"></map> -<map name="tÉdz5アパートFi"><area shape="rect" coords="0,0,300,300"></map> -<map name="TÉDZ⁵アパートFi"><area shape="rect" coords="0,0,300,300"></map> -<map name="TÉDZ5アパートfi"><area shape="rect" coords="0,0,300,300"></map> - -<object data="/images/threecolors.png" usemap="#ΣΣ" width="300" height="300"></object> -<map name="σς"><area shape="rect" coords="0,0,300,300"></map> +<div id="log"></div> <script> "use strict"; diff --git a/testing/web-platform/tests/html/semantics/forms/the-select-element/resources/stylable-select-styles.css b/testing/web-platform/tests/html/semantics/forms/the-select-element/resources/stylable-select-styles.css deleted file mode 100644 index a7e9a87cdf..0000000000 --- a/testing/web-platform/tests/html/semantics/forms/the-select-element/resources/stylable-select-styles.css +++ /dev/null @@ -1,18 +0,0 @@ -.stylable-select-datalist { - box-shadow: 0px 12.8px 28.8px rgba(0, 0, 0, 0.13), 0px 0px 9.2px rgba(0, 0, 0, 0.11); - box-sizing: border-box; - overflow: auto; - border: 1px solid rgba(0, 0, 0, 0.15); - border-radius: 0.25em; - padding: 0.25em 0; - background-color: Field; - margin: 0; - inset: auto; - min-inline-size: anchor-size(self-inline); - min-block-size: 1lh; - inset-block-start: anchor(self-end); - inset-inline-start: anchor(self-start); - - font-family: Arial; - font-size: 13.3333px; -} diff --git a/testing/web-platform/tests/html/semantics/forms/the-select-element/select-child-button-and-datalist-ref.html b/testing/web-platform/tests/html/semantics/forms/the-select-element/select-child-button-and-datalist-ref.html deleted file mode 100644 index 46bbd0ccd0..0000000000 --- a/testing/web-platform/tests/html/semantics/forms/the-select-element/select-child-button-and-datalist-ref.html +++ /dev/null @@ -1,12 +0,0 @@ -<!DOCTYPE html> -<link rel=stylesheet href="resources/stylable-select-styles.css"> - -<button popovertarget=popover id=button>button</button> -<div id=popover popover=auto anchor=button class=stylable-select-datalist> - <option>one</option> - <option>two</option> -</div> - -<script> -document.getElementById('popover').showPopover(); -</script> diff --git a/testing/web-platform/tests/html/semantics/forms/the-select-element/stylable-select/resources/select-reset-non-interoperable-styles.css b/testing/web-platform/tests/html/semantics/forms/the-select-element/stylable-select/resources/select-reset-non-interoperable-styles.css new file mode 100644 index 0000000000..d2b9d9df26 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/forms/the-select-element/stylable-select/resources/select-reset-non-interoperable-styles.css @@ -0,0 +1,5 @@ +/* TODO(crbug.com/1511354): linux.css sets background-color on select, consider + * removing it. */ +select { + background-color: Field; +} diff --git a/testing/web-platform/tests/html/semantics/forms/the-select-element/stylable-select/resources/stylable-select-styles.css b/testing/web-platform/tests/html/semantics/forms/the-select-element/stylable-select/resources/stylable-select-styles.css new file mode 100644 index 0000000000..042de838d1 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/forms/the-select-element/stylable-select/resources/stylable-select-styles.css @@ -0,0 +1,37 @@ +/* These are UA styles for select and stylable select. */ + +.stylable-select-container { + background-color: Field; + border: 1px solid rgba(0, 0, 0, 0); + border-radius: 0; + box-sizing: border-box; + display: inline-block; +} + +.stylable-select-datalist { + box-shadow: 0px 12.8px 28.8px rgba(0, 0, 0, 0.13), 0px 0px 9.2px rgba(0, 0, 0, 0.11); + box-sizing: border-box; + overflow: auto; + border: 1px solid rgba(0, 0, 0, 0.15); + border-radius: 0.25em; + padding: 0.25em 0; + background-color: Field; + margin: 0; + inset: auto; + min-inline-size: anchor-size(self-inline); + min-block-size: 1lh; + inset-block-start: anchor(self-end); + inset-inline-start: anchor(self-start); + + font-family: Arial; + font-size: 13.3333px; +} + +/* These are the UA styles for <option> in chromium. + * They will either have to be specced or also added to the main test file. + * TODO(crbug.com/1511354): Spec these UA styles. */ +.stylable-select-option { + min-height: 1.2em; + padding: 0px 2px 1px; + white-space: nowrap; +} diff --git a/testing/web-platform/tests/html/semantics/forms/the-select-element/stylable-select/select-appearance-custom-button-no-datalist.tentative.html b/testing/web-platform/tests/html/semantics/forms/the-select-element/stylable-select/select-appearance-custom-button-no-datalist.tentative.html new file mode 100644 index 0000000000..94d7fd53b3 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/forms/the-select-element/stylable-select/select-appearance-custom-button-no-datalist.tentative.html @@ -0,0 +1,22 @@ +<!DOCTYPE html> +<html class=reftest-wait> +<link rel=author href="mailto:jarhar@chromium.org"> +<link rel=help href="https://github.com/whatwg/html/issues/9799"> +<link rel=match href="select-appearance-no-button-custom-datalist-ref.html"> +<link rel=stylesheet href="resources/select-reset-non-interoperable-styles.css"> +<script src="/resources/testdriver.js"></script> +<script src="/resources/testdriver-vendor.js"></script> + +<select style="appearance:base-select"> + <button type=popover>one</button> + <option>one</option> + <option>two</option> +</select> + +<script> +(async () => { + await test_driver.bless(); + document.querySelector('select').showPicker(); + document.documentElement.classList.remove('reftest-wait'); +})(); +</script> diff --git a/testing/web-platform/tests/html/semantics/forms/the-select-element/stylable-select/select-appearance-no-button-custom-datalist-ref.html b/testing/web-platform/tests/html/semantics/forms/the-select-element/stylable-select/select-appearance-no-button-custom-datalist-ref.html new file mode 100644 index 0000000000..8e5eadaf57 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/forms/the-select-element/stylable-select/select-appearance-no-button-custom-datalist-ref.html @@ -0,0 +1,14 @@ +<!DOCTYPE html> +<link rel=stylesheet href="resources/stylable-select-styles.css"> + +<div id=container class=stylable-select-container> + <button popovertarget=popover id=button>one</button> + <div id=popover popover=auto anchor=container class=stylable-select-datalist> + <div class=stylable-select-option>one</div> + <div class=stylable-select-option>two</div> + </div> +</div> + +<script> +document.getElementById('popover').showPopover(); +</script> diff --git a/testing/web-platform/tests/html/semantics/forms/the-select-element/select-child-button-and-datalist-invalidation.tentative.html b/testing/web-platform/tests/html/semantics/forms/the-select-element/stylable-select/select-appearance-no-button-custom-datalist.tentative.html index f71c1e52fc..87425cf7a3 100644 --- a/testing/web-platform/tests/html/semantics/forms/the-select-element/select-child-button-and-datalist-invalidation.tentative.html +++ b/testing/web-platform/tests/html/semantics/forms/the-select-element/stylable-select/select-appearance-no-button-custom-datalist.tentative.html @@ -2,12 +2,12 @@ <html class=reftest-wait> <link rel=author href="mailto:jarhar@chromium.org"> <link rel=help href="https://github.com/whatwg/html/issues/9799"> -<link rel=match href="select-child-button-and-datalist-ref.html"> +<link rel=match href="select-appearance-no-button-custom-datalist-ref.html"> +<link rel=stylesheet href="resources/select-reset-non-interoperable-styles.css"> <script src="/resources/testdriver.js"></script> <script src="/resources/testdriver-vendor.js"></script> -<select> - <button type=popover>button</button> +<select style="appearance:base-select"> <datalist> <option>one</option> <option>two</option> @@ -15,9 +15,9 @@ </select> <script> -requestAnimationFrame(() => { - document.querySelector('select').style = 'appearance:bikeshed'; - document.querySelector('button').click(); +(async () => { + await test_driver.bless(); + document.querySelector('select').showPicker(); document.documentElement.classList.remove('reftest-wait'); -}); +})(); </script> diff --git a/testing/web-platform/tests/html/semantics/forms/the-select-element/stylable-select/select-appearance-no-button-no-datalist.tentative.html b/testing/web-platform/tests/html/semantics/forms/the-select-element/stylable-select/select-appearance-no-button-no-datalist.tentative.html new file mode 100644 index 0000000000..b2a6b5a6d3 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/forms/the-select-element/stylable-select/select-appearance-no-button-no-datalist.tentative.html @@ -0,0 +1,21 @@ +<!DOCTYPE html> +<html class=reftest-wait> +<link rel=author href="mailto:jarhar@chromium.org"> +<link rel=help href="https://github.com/whatwg/html/issues/9799"> +<link rel=match href="select-appearance-no-button-custom-datalist-ref.html"> +<link rel=stylesheet href="resources/select-reset-non-interoperable-styles.css"> +<script src="/resources/testdriver.js"></script> +<script src="/resources/testdriver-vendor.js"></script> + +<select style="appearance:base-select"> + <option>one</option> + <option>two</option> +</select> + +<script> +(async () => { + await test_driver.bless(); + document.querySelector('select').showPicker(); + document.documentElement.classList.remove('reftest-wait'); +})(); +</script> diff --git a/testing/web-platform/tests/html/semantics/forms/the-select-element/stylable-select/select-child-button-and-datalist-invalidation.tentative.html b/testing/web-platform/tests/html/semantics/forms/the-select-element/stylable-select/select-child-button-and-datalist-invalidation.tentative.html new file mode 100644 index 0000000000..b6d85ac90a --- /dev/null +++ b/testing/web-platform/tests/html/semantics/forms/the-select-element/stylable-select/select-child-button-and-datalist-invalidation.tentative.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<html class=reftest-wait> +<link rel=author href="mailto:jarhar@chromium.org"> +<link rel=help href="https://github.com/whatwg/html/issues/9799"> +<link rel=match href="select-child-button-and-datalist-ref.html"> +<link rel=stylesheet href="resources/select-reset-non-interoperable-styles.css"> + +<style> +.blue { + color: blue; +} +</style> + +<select> + <button type=popover>button</button> + <datalist> + <option> + <span class=blue>option</span> one + </option> + <option> + <span class=blue>option</span> two + </option> + </datalist> +</select> + +<script> +requestAnimationFrame(() => { + document.querySelector('select').style = 'appearance:base-select'; + document.querySelector('button').click(); + document.documentElement.classList.remove('reftest-wait'); +}); +</script> diff --git a/testing/web-platform/tests/html/semantics/forms/the-select-element/stylable-select/select-child-button-and-datalist-ref.html b/testing/web-platform/tests/html/semantics/forms/the-select-element/stylable-select/select-child-button-and-datalist-ref.html new file mode 100644 index 0000000000..e99ca4d57a --- /dev/null +++ b/testing/web-platform/tests/html/semantics/forms/the-select-element/stylable-select/select-child-button-and-datalist-ref.html @@ -0,0 +1,25 @@ +<!DOCTYPE html> +<link rel=stylesheet href="resources/stylable-select-styles.css"> + +<style> +.blue { + color: blue; +} +</style> + +<div id=container class=stylable-select-container> + <button popovertarget=popover id=button>button</button> + <div id=popover popover=auto anchor=container class=stylable-select-datalist> + <div tabindex=0 class=stylable-select-option> + <span class=blue>option</span> one + </div> + <div tabindex=0 class=stylable-select-option> + <span class=blue>option</span> two + </div> + </div> +</div> + +<script> +document.getElementById('popover').showPopover(); +document.querySelector('div.stylable-select-option').focus(); +</script> diff --git a/testing/web-platform/tests/html/semantics/forms/the-select-element/select-child-button-and-datalist.tentative.html b/testing/web-platform/tests/html/semantics/forms/the-select-element/stylable-select/select-child-button-and-datalist.tentative.html index 54785ace95..610861aad8 100644 --- a/testing/web-platform/tests/html/semantics/forms/the-select-element/select-child-button-and-datalist.tentative.html +++ b/testing/web-platform/tests/html/semantics/forms/the-select-element/stylable-select/select-child-button-and-datalist.tentative.html @@ -2,14 +2,23 @@ <link rel=author href="mailto:jarhar@chromium.org"> <link rel=help href="https://github.com/whatwg/html/issues/9799"> <link rel=match href="select-child-button-and-datalist-ref.html"> -<script src="/resources/testdriver.js"></script> -<script src="/resources/testdriver-vendor.js"></script> +<link rel=stylesheet href="resources/select-reset-non-interoperable-styles.css"> -<select style="appearance:bikeshed"> +<style> +.blue { + color: blue; +} +</style> + +<select style="appearance:base-select"> <button type=popover>button</button> <datalist> - <option>one</option> - <option>two</option> + <option> + <span class=blue>option</span> one + </option> + <option> + <span class=blue>option</span> two + </option> </datalist> </select> diff --git a/testing/web-platform/tests/html/semantics/forms/the-select-element/select-datalist-options-idl.tentative.html b/testing/web-platform/tests/html/semantics/forms/the-select-element/stylable-select/select-datalist-options-idl.tentative.html index 993f6e126c..92eabdc5d8 100644 --- a/testing/web-platform/tests/html/semantics/forms/the-select-element/select-datalist-options-idl.tentative.html +++ b/testing/web-platform/tests/html/semantics/forms/the-select-element/stylable-select/select-datalist-options-idl.tentative.html @@ -12,6 +12,9 @@ </div> <option class=three>three</option> </datalist> + <datalist> + <option>ignored since not in first datalist</option> + </datalist> </select> <script> diff --git a/testing/web-platform/tests/html/semantics/forms/the-select-element/stylable-select/select-keyboard-behavior.tentative.html b/testing/web-platform/tests/html/semantics/forms/the-select-element/stylable-select/select-keyboard-behavior.tentative.html new file mode 100644 index 0000000000..2fb11ba68b --- /dev/null +++ b/testing/web-platform/tests/html/semantics/forms/the-select-element/stylable-select/select-keyboard-behavior.tentative.html @@ -0,0 +1,208 @@ +<!DOCTYPE html> +<link rel=author href="mailto:jarhar@chromium.org"> +<link rel=help href="https://bugs.chromium.org/p/chromium/issues/detail?id=1422275"> +<link rel=help href="https://github.com/openui/open-ui/issues/433#issuecomment-1452461404"> +<link rel=help href="https://github.com/openui/open-ui/issues/386#issuecomment-1452469497"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/resources/testdriver.js"></script> +<script src="/resources/testdriver-vendor.js"></script> +<script src="/resources/testdriver-actions.js"></script> + +<style> +select { + appearance: base-select; +} +</style> + +<form></form> + +<div id=notform> + <select id=defaultbutton-defaultdatalist> + <option class=one>one</option> + <option class=two>two</option> + <option class=three>three</option> + </select> + + <select id=defaultbutton-customdatalist> + <datalist> + <option class=one>one</option> + <option class=two>two</option> + <option class=three>three</option> + </datalist> + </select> + + <select id=custombutton-defaultdatalist> + <button type=popover>custom button</button> + <option class=one>one</option> + <option class=two>two</option> + <option class=three>three</option> + </select> + + <select id=custombutton-customdatalist> + <button type=popover>custom button</button> + <datalist> + <option class=one>one</option> + <option class=two>two</option> + <option class=three>three</option> + </datalist> + </select> +</div> + +<script> +const Enter = '\uE007'; +const Escape = '\uE00C'; +const ArrowLeft = '\uE012'; +const ArrowUp = '\uE013'; +const ArrowRight = '\uE014'; +const ArrowDown = '\uE015'; +const Space = ' '; +const form = document.querySelector('form'); +const notform = document.getElementById('notform'); + +for (const id of ['defaultbutton-defaultdatalist', + 'defaultbutton-customdatalist', + 'custombutton-defaultdatalist', + 'custombutton-customdatalist']) { + const select = document.getElementById(id); + + async function closeListbox() { + await test_driver.click(select); + } + + function addCloseCleanup(t) { + t.add_cleanup(async () => { + if (select.matches(':open')) { + await closeListbox(); + } + if (select.matches(':open')) { + throw new Error('select failed to close!'); + } + select.value = 'one'; + }); + } + + promise_test(async t => { + addCloseCleanup(t); + // TODO(http://crbug.com/1350299): When focus for custom buttons is fixed, + // then we shouldn't need to explicitly focus the custom button like this + // anymore. + const customButton = select.querySelector('button'); + if (customButton) { + customButton.focus(); + } else { + select.focus(); + } + assert_false(select.matches(':open'), + 'The select should initially be closed.'); + await test_driver.send_keys(document.activeElement, Space); + assert_true(select.matches(':open'), + 'The select should be open after pressing space.'); + }, `${id}: When the listbox is closed, spacebar should open the listbox.`); + + promise_test(async t => { + addCloseCleanup(t); + select.value = 'two'; + select.focus(); + assert_false(select.matches(':open'), + 'The select should initially be closed.'); + + await test_driver.send_keys(document.activeElement, ArrowLeft); + assert_true(select.matches(':open'), + 'Arrow left should open the listbox.'); + assert_equals(select.value, 'two', + 'Arrow left should not change the selected value.'); + await closeListbox(); + + await test_driver.send_keys(document.activeElement, ArrowUp); + assert_true(select.matches(':open'), + 'Arrow up should open the listbox.'); + assert_equals(select.value, 'two', + 'Arrow up should not change the selected value.'); + await closeListbox(); + + await test_driver.send_keys(document.activeElement, ArrowRight); + assert_true(select.matches(':open'), + 'Arrow right should open the listbox.'); + assert_equals(select.value, 'two', + 'Arrow right should not change the selected value.'); + await closeListbox(); + + await test_driver.send_keys(document.activeElement, ArrowDown); + assert_true(select.matches(':open'), + 'Arrow down should open the listbox.'); + assert_equals(select.value, 'two', + 'Arrow down should not change the selected value.'); + }, `${id}: When the listbox is closed, all arrow keys should open the listbox.`); + + promise_test(async t => { + addCloseCleanup(t); + + // TODO(http://crbug.com/1350299): When focus for custom buttons is fixed, + // then we shouldn't need to explicitly use the custom button like this + // anymore. + const customButton = select.querySelector('button'); + if (customButton) { + await test_driver.send_keys(customButton, Enter); + } else { + await test_driver.send_keys(select, Enter); + } + assert_false(select.matches(':open'), + 'Enter should not open the listbox when outside a form.'); + + form.appendChild(select); + let formWasSubmitted = false; + form.addEventListener('submit', event => { + event.preventDefault(); + formWasSubmitted = true; + }, {once: true}); + if (customButton) { + await test_driver.send_keys(customButton, Enter); + } else { + await test_driver.send_keys(select, Enter); + } + assert_true(formWasSubmitted, + 'Enter should submit the form when the listbox is closed.'); + assert_false(select.matches(':open'), + 'Enter should not open the listbox when it is in a form.'); + }, `${id}: When the listbox is closed, the enter key should submit the form or do nothing.`); + + promise_test(async t => { + addCloseCleanup(t); + const optionOne = select.querySelector('.one'); + const optionTwo = select.querySelector('.two'); + const optionThree = select.querySelector('.three'); + + select.value = 'two'; + await test_driver.click(select); + assert_true(select.matches(':open'), + 'The select should open when clicked.'); + assert_equals(document.activeElement, optionTwo, + 'The selected option should receive initial focus.'); + + await test_driver.send_keys(document.activeElement, ArrowDown); + assert_equals(document.activeElement, optionThree, + 'The next option should receive focus when the down arrow key is pressed.'); + assert_equals(select.value, 'two', + 'The selects value should not change when focusing another option.'); + + await test_driver.send_keys(document.activeElement, ArrowUp); + assert_equals(document.activeElement, optionTwo, + 'The previous option should receive focus when the up arrow key is pressed.'); + assert_equals(select.value, 'two', + 'The selects value should not change when focusing another option.'); + + await test_driver.send_keys(document.activeElement, ArrowUp); + assert_equals(document.activeElement, optionOne, + 'The first option should be selected.'); + assert_equals(select.value, 'two', + 'The selects value should not change when focusing another option.'); + + await test_driver.send_keys(document.activeElement, Enter); + assert_false(select.matches(':open'), + 'The listbox should be closed after pressing enter.'); + assert_equals(select.value, 'one', + 'The selects value should change after pressing enter on a different option.'); + }, `${id}: When the listbox is open, the enter key should commit the selected option.`); +} +</script> diff --git a/testing/web-platform/tests/html/semantics/forms/the-select-element/stylable-select/select-mouse-behavior.tentative.html b/testing/web-platform/tests/html/semantics/forms/the-select-element/stylable-select/select-mouse-behavior.tentative.html new file mode 100644 index 0000000000..aff976d1ad --- /dev/null +++ b/testing/web-platform/tests/html/semantics/forms/the-select-element/stylable-select/select-mouse-behavior.tentative.html @@ -0,0 +1,62 @@ +<!DOCTYPE html> +<link rel=author href="mailto:jarhar@chromium.org"> +<link rel=help href="https://bugs.chromium.org/p/chromium/issues/detail?id=1422275"> +<link rel=help href="https://github.com/openui/open-ui/issues/433#issuecomment-1452461404"> +<link rel=help href="https://github.com/openui/open-ui/issues/386#issuecomment-1452469497"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/resources/testdriver.js"></script> +<script src="/resources/testdriver-vendor.js"></script> +<script src="/resources/testdriver-actions.js"></script> + +<style> +select { + appearance: base-select; +} +</style> + +<!-- TODO(http://crbug.com/1511354): Add test cases with no <button> and no <datalist>. --> +<select> + <button type=popover>button</button> + <datalist> + <option class=one>one</option> + <option class=two>two</option> + </datalist> +</select> + +<script> +const select = document.querySelector('select'); +const button = document.querySelector('button'); +const optionOne = document.querySelector('option.one'); +const optionTwo = document.querySelector('option.two'); + +promise_test(async () => { + assert_false(select.matches(':open'), + 'Select should be closed at the start of the test.'); + + await test_driver.click(button); + assert_true(select.matches(':open'), + 'Select should be open after clicking the button.'); + + await test_driver.click(button); + assert_false(select.matches(':open'), + 'Select should be closed after clicking the button a second time.'); +}, 'Select with appearance:base-select should open and close when clicking the button.'); + +promise_test(async () => { + assert_false(select.matches(':open'), + 'Select should be closed at the start of the test.'); + assert_equals(select.value, 'one', + 'Select.value should be one at the start of the test.'); + + await test_driver.click(button); + assert_true(select.matches(':open'), + 'Select should be open after clicking the button.'); + + await test_driver.click(optionTwo); + assert_false(select.matches(':open'), + 'Select should be closed after clicking an option.'); + assert_equals(select.value, 'two', + 'Select.value should be two after clicking the option.'); +}, 'Clicking an option in an appearance:base-select select should choose the option and close the popover.'); +</script> diff --git a/testing/web-platform/tests/html/semantics/forms/the-select-element/select-parsing.tentative.html b/testing/web-platform/tests/html/semantics/forms/the-select-element/stylable-select/select-parsing.tentative.html index 31133446d4..31133446d4 100644 --- a/testing/web-platform/tests/html/semantics/forms/the-select-element/select-parsing.tentative.html +++ b/testing/web-platform/tests/html/semantics/forms/the-select-element/stylable-select/select-parsing.tentative.html diff --git a/testing/web-platform/tests/html/semantics/forms/the-select-element/stylable-select/selectedoption.tentative.html b/testing/web-platform/tests/html/semantics/forms/the-select-element/stylable-select/selectedoption.tentative.html new file mode 100644 index 0000000000..16d711515c --- /dev/null +++ b/testing/web-platform/tests/html/semantics/forms/the-select-element/stylable-select/selectedoption.tentative.html @@ -0,0 +1,82 @@ +<!DOCTYPE html> +<link rel=author href="mailto:jarhar@chromium.org"> +<link rel=help href="https://github.com/whatwg/html/issues/9799"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/resources/testdriver.js"></script> +<script src="/resources/testdriver-vendor.js"></script> + +<form> + <select style="appearance:base-select"> + <button> + <selectedoption></selectedoption> + </button> + <datalist> + <option class=one value=one> + <span class=one>span</span> one + </option> + <option class=two value=two> + <span class=two>span</span> two + </option> + </datalist> + </select> +</form> + +<script> +promise_test(async () => { + const optionOne = document.querySelector('option.one'); + const optionTwo = document.querySelector('option.two'); + const selectedOption = document.querySelector('selectedoption'); + const select = document.querySelector('select'); + const spanTwo = document.querySelector('span.two'); + const form = document.querySelector('form'); + const button = document.querySelector('button'); + + assert_equals(selectedOption.innerHTML, optionOne.innerHTML, + 'The innerHTML of <selectedoption> should initially match the innerHTML of the selected <option>.'); + + select.value = 'two'; + assert_equals(selectedOption.innerHTML, optionTwo.innerHTML, + 'The innerHTML of <selectedoption> should change after the selected option is changed.'); + + spanTwo.textContent = 'new span'; + assert_equals(selectedOption.innerHTML, optionTwo.innerHTML, + '<selectedoption> should respond to text content changes.'); + + spanTwo.appendChild(document.createElement('div')); + assert_equals(selectedOption.innerHTML, optionTwo.innerHTML, + '<selectedoption> should respond to new elements being added to descendants.'); + + spanTwo.setAttribute('data-foo', 'bar'); + assert_equals(selectedOption.innerHTML, optionTwo.innerHTML, + '<selectedoption> should respond to attributes being added to descendants.'); + + form.reset(); + assert_equals(select.value, 'one', + 'form.reset() should change the selects value to one.'); + assert_equals(selectedOption.innerHTML, optionOne.innerHTML, + 'The innerHTML of <selectedoption> should be updated in response to a form reset.'); + + await test_driver.bless(); + select.showPicker(); + await test_driver.click(optionTwo); + assert_equals(select.value, 'two', + 'Clicking on another option should change select.value.'); + assert_equals(selectedOption.innerHTML, optionTwo.innerHTML, + 'Clicking on an option element should update the <selectedoption>.'); + + selectedOption.remove(); + assert_equals(selectedOption.innerHTML, '', + 'Removing the <selectedoption> from the <select> should make it clear its contents.'); + button.appendChild(selectedOption); + assert_equals(selectedOption.innerHTML, optionTwo.innerHTML, + 'Re-inserting the <selectedoption> should make it update its contents.'); + + optionTwo.remove(); + assert_equals(selectedOption.innerHTML, optionOne.innerHTML, + 'The innerHTML of <selectedoption> should be updated in response to selected <option> removal.'); + optionOne.remove(); + assert_equals(selectedOption.innerHTML, '', + 'The content of <selectedoption> should be cleared if there is no selected <option>.'); +}, 'The <selectedoption> element should reflect the HTML contents of the selected <option>.'); +</script> diff --git a/testing/web-platform/tests/html/semantics/invokers/idlharness.tentative.html b/testing/web-platform/tests/html/semantics/invokers/idlharness.tentative.html index b215f65813..8a86a5aaa1 100644 --- a/testing/web-platform/tests/html/semantics/invokers/idlharness.tentative.html +++ b/testing/web-platform/tests/html/semantics/invokers/idlharness.tentative.html @@ -1,6 +1,6 @@ <!doctype html> <meta charset="utf-8" /> -<meta name="author" title="Keith Cirkel" href="mailto:keithamus@github.com" /> +<meta name="author" title="Keith Cirkel" href="mailto:wpt@keithcirkel.co.uk" /> <link rel="help" href="https://open-ui.org/components/invokers.explainer/" /> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> diff --git a/testing/web-platform/tests/html/semantics/invokers/interestelement-interface.tentative.html b/testing/web-platform/tests/html/semantics/invokers/interestelement-interface.tentative.html index dc119de833..8b1e375695 100644 --- a/testing/web-platform/tests/html/semantics/invokers/interestelement-interface.tentative.html +++ b/testing/web-platform/tests/html/semantics/invokers/interestelement-interface.tentative.html @@ -1,5 +1,6 @@ <!doctype html> <meta charset="utf-8" /> +<meta name="author" title="Keith Cirkel" href="mailto:keithamus@github.com" /> <meta name="author" title="Luke Warlow" href="mailto:lwarlow@igalia.com" /> <link rel="help" href="https://open-ui.org/components/interest-invokers.explainer/" /> <script src="/resources/testharness.js"></script> diff --git a/testing/web-platform/tests/html/semantics/invokers/interestevent-dispatch-shadow.tentative.html b/testing/web-platform/tests/html/semantics/invokers/interestevent-dispatch-shadow.tentative.html new file mode 100644 index 0000000000..d96907ec84 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/invokers/interestevent-dispatch-shadow.tentative.html @@ -0,0 +1,104 @@ +<!doctype html> +<meta charset="utf-8" /> +<meta name="author" title="Keith Cirkel" href="mailto:keithamus@github.com" /> +<meta name="author" title="Luke Warlow" href="mailto:lwarlow@igalia.com" /> +<link rel="help" href="https://open-ui.org/components/interest-invokers.explainer/" /> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/resources/testdriver.js"></script> +<script src="/resources/testdriver-actions.js"></script> +<script src="/resources/testdriver-vendor.js"></script> +<script src="resources/invoker-utils.js"></script> + +<div id="div"></div> +<button id="button"></button> + +<script> + test(function () { + const host = document.createElement("div"); + const shadow = host.attachShadow({ mode: "closed" }); + const slot = shadow.appendChild(document.createElement("slot")); + let childEvent = null; + let childEventTarget = null; + let childEventInvoker = null; + let hostEvent = null; + let hostEventTarget = null; + let hostEventInvoker = null; + slot.addEventListener( + "interest", + (e) => { + childEvent = e; + childEventTarget = e.target; + childEventInvoker = e.invoker; + }, + { once: true }, + ); + host.addEventListener( + "interest", + (e) => { + hostEvent = e; + hostEventTarget = e.target; + hostEventInvoker = e.invoker; + }, + { once: true }, + ); + const event = new InterestEvent("interest", { + bubbles: true, + invoker: slot, + composed: true, + }); + slot.dispatchEvent(event); + assert_true(childEvent instanceof InterestEvent, "slot saw interest event"); + assert_equals( + childEventTarget, + slot, + "target is child inside shadow boundary", + ); + assert_equals( + childEventInvoker, + slot, + "invoker is child inside shadow boundary", + ); + assert_equals( + hostEvent, + childEvent, + "event dispatch propagates across shadow boundary", + ); + assert_equals( + hostEventTarget, + host, + "target is retargeted to shadowroot host", + ); + assert_equals( + hostEventInvoker, + host, + "invoker is retargeted to shadowroot host", + ); + }, "InterestEvent propagates across shadow boundaries retargeting invoker"); + + test(function (t) { + const host = document.createElement("div"); + document.body.append(host); + t.add_cleanup(() => host.remove()); + const shadow = host.attachShadow({ mode: "open" }); + const button = shadow.appendChild(document.createElement("button")); + const interestee = host.appendChild(document.createElement("div")); + button.interestTargetElement = interestee; + let event = null; + let eventTarget = null; + let eventInvoker = null; + interestee.addEventListener( + "interest", + (e) => { + event = e; + eventTarget = e.target; + eventInvoker = e.invoker; + }, + { once: true }, + ); + button.focus(); + assert_true(event instanceof InterestEvent); + assert_equals(eventTarget, interestee, "target is interestee"); + assert_equals(eventInvoker, host, "interestee is host"); + }, "cross shadow InterestEvent retargets interestee to host element"); +</script> diff --git a/testing/web-platform/tests/html/semantics/invokers/interestevent-interface.tentative.html b/testing/web-platform/tests/html/semantics/invokers/interestevent-interface.tentative.html new file mode 100644 index 0000000000..ed7d82f1fb --- /dev/null +++ b/testing/web-platform/tests/html/semantics/invokers/interestevent-interface.tentative.html @@ -0,0 +1,167 @@ +<!doctype html> +<meta charset="utf-8" /> +<meta name="author" title="Keith Cirkel" href="mailto:keithamus@github.com" /> +<meta name="author" title="Luke Warlow" href="mailto:lwarlow@igalia.com" /> +<link rel="help" href="https://open-ui.org/components/interest-invokers.explainer/" /> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/resources/testdriver.js"></script> +<script src="/resources/testdriver-actions.js"></script> +<script src="/resources/testdriver-vendor.js"></script> +<script src="resources/invoker-utils.js"></script> + +<div id="div"></div> +<button id="button"></button> + +<script> + test(function () { + const event = new InterestEvent("test"); + assert_equals(event.action, ""); + assert_readonly(event, "action", "readonly attribute value"); + }, "action is a readonly defaulting to ''"); + + test(function () { + const event = new InterestEvent("test"); + assert_equals(event.invoker, null); + assert_readonly(event, "invoker", "readonly attribute value"); + }, "invoker is readonly defaulting to null"); + + test(function () { + const event = new InterestEvent("test", { action: "sAmPle" }); + assert_equals(event.action, "sAmPle"); + }, "action reflects initialized attribute"); + + test(function () { + const event = new InterestEvent("test", { action: undefined }); + assert_equals(event.action, ""); + }, "action set to undefined"); + + test(function () { + const event = new InterestEvent("test", { action: null }); + assert_equals(event.action, "null"); + }, "action set to null"); + + test(function () { + const event = new InterestEvent("test", { action: false }); + assert_equals(event.action, "false"); + }, "action set to false"); + + test(function () { + const event = new InterestEvent("test", { action: "" }); + assert_equals(event.action, ""); + }, "action explicitly set to empty string"); + + test(function () { + const event = new InterestEvent("test", { action: true }); + assert_equals(event.action, "true"); + }, "action set to true"); + + test(function () { + const event = new InterestEvent("test", { action: 0.5 }); + assert_equals(event.action, "0.5"); + }, "action set to a number"); + + test(function () { + const event = new InterestEvent("test", { action: [] }); + assert_equals(event.action, ""); + }, "action set to []"); + + test(function () { + const event = new InterestEvent("test", { action: [1, 2, 3] }); + assert_equals(event.action, "1,2,3"); + }, "action set to [1, 2, 3]"); + + test(function () { + const event = new InterestEvent("test", { action: { sample: 0.5 } }); + assert_equals(event.action, "[object Object]"); + }, "action set to an object"); + + test(function () { + const event = new InterestEvent("test", { + action: { + toString() { + return "sample"; + }, + }, + }); + assert_equals(event.action, "sample"); + }, "action set to an object with a toString function"); + + test(function () { + const eventInit = { action: "sample", invoker: document.body }; + const event = new InterestEvent("test", eventInit); + assert_equals(event.action, "sample"); + assert_equals(event.invoker, document.body); + }, "InterestEventInit properties set value"); + + test(function () { + const eventInit = { + action: "open", + invoker: document.getElementById("div"), + }; + const event = new InterestEvent("beforetoggle", eventInit); + assert_equals(event.action, "open"); + assert_equals(event.invoker, document.getElementById("div")); + }, "InterestEventInit properties set value 2"); + + test(function () { + const eventInit = { + action: "closed", + invoker: document.getElementById("button"), + }; + const event = new InterestEvent("toggle", eventInit); + assert_equals(event.action, "closed"); + assert_equals(event.invoker, document.getElementById("button")); + }, "InterestEventInit properties set value 3"); + + test(function () { + const event = new InterestEvent("test", { invoker: undefined }); + assert_equals(event.invoker, null); + }, "invoker set to undefined"); + + test(function () { + const event = new InterestEvent("test", { invoker: null }); + assert_equals(event.invoker, null); + }, "invoker set to null"); + + test(function () { + assert_throws_js( + TypeError, + function () { + new InterestEvent("test", { invoker: false }); + }, + "invoker is not an object", + ); + }, "invoker set to false"); + + test(function () { + assert_throws_js( + TypeError, + function () { + const event = new InterestEvent("test", { invoker: true }); + }, + "invoker is not an object", + ); + }, "invoker set to true"); + + test(function () { + assert_throws_js( + TypeError, + function () { + const event = new InterestEvent("test", { invoker: {} }); + }, + "invoker is not an object", + ); + }, "invoker set to {}"); + + test(function () { + assert_throws_js( + TypeError, + function () { + const eventInit = { action: "closed", invoker: new XMLHttpRequest() }; + const event = new InterestEvent("toggle", eventInit); + }, + "invoker is not an Element", + ); + }, "invoker set to non-Element EventTarget"); +</script> diff --git a/testing/web-platform/tests/html/semantics/invokers/interesttarget-button-event-dispatch.tentative.html b/testing/web-platform/tests/html/semantics/invokers/interesttarget-button-event-dispatch.tentative.html new file mode 100644 index 0000000000..7fdfdfaa70 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/invokers/interesttarget-button-event-dispatch.tentative.html @@ -0,0 +1,155 @@ +<!doctype html> +<meta charset="utf-8" /> +<meta name="author" title="Keith Cirkel" href="mailto:keithamus@github.com" /> +<meta name="author" title="Luke Warlow" href="mailto:lwarlow@igalia.com" /> +<link rel="help" href="https://open-ui.org/components/invokers.explainer/" /> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/resources/testdriver.js"></script> +<script src="/resources/testdriver-actions.js"></script> +<script src="/resources/testdriver-vendor.js"></script> +<script src="resources/invoker-utils.js"></script> + +<div id="interestee"></div> +<button id="interestbutton" interesttarget="interestee">Button</button> +<a href="/" id="interestanchor" interesttarget="interestee">Anchor</a> +<button id="otherbutton">Other Button</button> + +<script> + promise_test(async function (t) { + t.add_cleanup(() => otherbutton.focus()); + let event = null; + interestee.addEventListener("interest", (e) => (event = e), { once: true }); + interestbutton.focus(); + assert_true(event instanceof InterestEvent, "event is InterestEvent"); + assert_equals(event.type, "interest", "type"); + assert_equals(event.bubbles, false, "bubbles"); + assert_equals(event.composed, true, "composed"); + assert_equals(event.isTrusted, true, "isTrusted"); + assert_equals(event.action, "", "action"); + assert_equals(event.target, interestee, "target"); + assert_equals(event.invoker, interestbutton, "invoker"); + }, "InterestEvent dispatches on button focus"); + + promise_test(async function (t) { + t.add_cleanup(() => otherbutton.focus()); + let event = null; + interestee.addEventListener("interest", (e) => (event = e), { once: true }); + await hoverOver(interestbutton); + assert_true(event instanceof InterestEvent, "event is InterestEvent"); + assert_equals(event.type, "interest", "type"); + assert_equals(event.bubbles, false, "bubbles"); + assert_equals(event.composed, true, "composed"); + assert_equals(event.isTrusted, true, "isTrusted"); + assert_equals(event.action, "", "action"); + assert_equals(event.target, interestee, "target"); + assert_equals(event.invoker, interestbutton, "invoker"); + }, "InterestEvent dispatches on button hover"); + + promise_test(async function (t) { + t.add_cleanup(() => otherbutton.focus()); + let event = null; + interestee.addEventListener("interest", (e) => (event = e), { once: true }); + interestanchor.focus(); + assert_true(event instanceof InterestEvent, "event is InterestEvent"); + assert_equals(event.type, "interest", "type"); + assert_equals(event.bubbles, false, "bubbles"); + assert_equals(event.composed, true, "composed"); + assert_equals(event.isTrusted, true, "isTrusted"); + assert_equals(event.action, "", "action"); + assert_equals(event.target, interestee, "target"); + assert_equals(event.invoker, interestanchor, "invoker"); + }, "InterestEvent dispatches on anchor focus"); + + promise_test(async function (t) { + t.add_cleanup(() => otherbutton.focus()); + let event = null; + interestee.addEventListener("interest", (e) => (event = e), { once: true }); + await hoverOver(interestanchor); + assert_true(event instanceof InterestEvent, "event is InterestEvent"); + assert_equals(event.type, "interest", "type"); + assert_equals(event.bubbles, false, "bubbles"); + assert_equals(event.composed, true, "composed"); + assert_equals(event.isTrusted, true, "isTrusted"); + assert_equals(event.action, "", "action"); + assert_equals(event.target, interestee, "target"); + assert_equals(event.invoker, interestanchor, "invoker"); + }, "InterestEvent dispatches on anchor hover"); + + promise_test(async function (t) { + t.add_cleanup(() => otherbutton.focus()); + let event = null; + interestee.addEventListener("interest", (e) => (event = e), { once: true }); + interestbutton.interestAction = "fooBar"; + interestbutton.focus(); + assert_true(event instanceof InterestEvent, "event is InterestEvent"); + assert_equals(event.type, "interest", "type"); + assert_equals(event.bubbles, false, "bubbles"); + assert_equals(event.composed, true, "composed"); + assert_equals(event.isTrusted, true, "isTrusted"); + assert_equals(event.action, "fooBar", "action"); + assert_equals(event.target, interestee, "target"); + assert_equals(event.invoker, interestbutton, "invoker"); + }, "event action is set to interestAction"); + + promise_test(async function (t) { + t.add_cleanup(() => otherbutton.focus()); + let event = null; + interestee.addEventListener("interest", (e) => (event = e), { once: true }); + interestbutton.setAttribute("interestaction", "BaRbAz"); + interestbutton.focus(); + assert_true(event instanceof InterestEvent, "event is InterestEvent"); + assert_equals(event.type, "interest", "type"); + assert_equals(event.bubbles, false, "bubbles"); + assert_equals(event.composed, true, "composed"); + assert_equals(event.isTrusted, true, "isTrusted"); + assert_equals(event.action, "BaRbAz", "action"); + assert_equals(event.target, interestee, "target"); + assert_equals(event.invoker, interestbutton, "invoker"); + }, "event action is set to interestaction attribute"); + + promise_test(async function (t) { + t.add_cleanup(() => { + interestbutton.removeAttribute('disabled'); + otherbutton.focus(); + }); + let called = false; + interestee.addEventListener( + "interest", + () => { + called = true; + }, + { once: true }, + ); + interestbutton.setAttribute("disabled", ""); + interestbutton.focus(); + assert_false(called, "event was not called"); + }, "event does not dispatch if invoker is disabled"); + + promise_test(async function (t) { + svgInterestee = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); + t.add_cleanup(() => { + interestbutton.interestTargetElement = interestee; + svgInterestee.remove(); + otherbutton.focus(); + }); + document.body.append(svgInterestee); + let called = false; + assert_false(svgInterestee instanceof HTMLElement); + assert_true(svgInterestee instanceof Element); + let event = null; + svgInterestee.addEventListener( + "interest", + (e) => { + event = e; + called = true; + }, + { once: true }, + ); + interestbutton.interestTargetElement = svgInterestee; + interestbutton.focus(); + assert_true(called, "event was called"); + assert_equals(event.invoker, interestbutton, "event.invoker is set to right element"); + assert_equals(event.target, svgInterestee, "event.target is set to right element"); + }, "event dispatches if interestee is non-HTML Element"); +</script> diff --git a/testing/web-platform/tests/html/semantics/invokers/interesttarget-on-popover-behavior.tentative.html b/testing/web-platform/tests/html/semantics/invokers/interesttarget-on-popover-behavior.tentative.html new file mode 100644 index 0000000000..b930fc645d --- /dev/null +++ b/testing/web-platform/tests/html/semantics/invokers/interesttarget-on-popover-behavior.tentative.html @@ -0,0 +1,113 @@ +<!doctype html> +<meta charset="utf-8" /> +<meta name="author" title="Keith Cirkel" href="mailto:keithamus@github.com" /> +<meta name="author" title="Luke Warlow" href="mailto:lwarlow@igalia.com" /> +<link rel="help" href="https://open-ui.org/components/interest-invokers.explainer/" /> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/resources/testdriver.js"></script> +<script src="/resources/testdriver-actions.js"></script> +<script src="/resources/testdriver-vendor.js"></script> +<script src="resources/invoker-utils.js"></script> + +<div id="interestee" popover> + Popover Content +</div> +<button id="interestbutton" interesttarget="interestee">Interest Invoker</button> +<button id="otherbutton">Other button</button> + +<script> + function reset() { + hoverOver(otherbutton); + otherbutton.focus(); + interestee.hidePopover(); + interestbutton.removeAttribute("interestaction"); + } + + // auto + + promise_test(async function (t) { + t.add_cleanup(reset); + assert_false(interestee.matches(":popover-open")); + await hoverOver(interestbutton); + assert_true(interestee.matches(":popover-open")); + }, "hover interest invoking (as auto) closed popover opens"); + + promise_test(async function (t) { + t.add_cleanup(reset); + interestee.showPopover(); + assert_true(interestee.matches(":popover-open")); + await hoverOver(interestbutton); + assert_false(interestee.matches(":popover-open")); + }, "hover interest invoking (as auto) open popover closes"); + + promise_test(async function (t) { + t.add_cleanup(reset); + assert_false(interestee.matches(":popover-open")); + interestbutton.focus(); + assert_true(interestee.matches(":popover-open")); + }, "focus interest invoking (as auto) closed popover opens"); + + promise_test(async function (t) { + t.add_cleanup(reset); + interestee.showPopover(); + assert_true(interestee.matches(":popover-open")); + interestbutton.focus(); + assert_false(interestee.matches(":popover-open")); + }, "focus interest invoking (as auto) open popover closes"); + + promise_test(async function (t) { + t.add_cleanup(reset); + assert_false(interestee.matches(":popover-open")); + interestee.addEventListener("interest", (e) => e.preventDefault(), { + once: true, + }); + await hoverOver(interestbutton); + assert_false(interestee.matches(":popover-open")); + }, "interest invoking (as auto) closed popover with preventDefault does not open"); + + // togglepopover + + promise_test(async function (t) { + t.add_cleanup(reset); + assert_false(interestee.matches(":popover-open")); + interestbutton.setAttribute("interestaction", "togglepopover"); + await hoverOver(interestbutton); + assert_true(interestee.matches(":popover-open")); + }, "hover interest invoking (as togglepopover) closed popover opens"); + + promise_test(async function (t) { + t.add_cleanup(reset); + interestee.showPopover(); + assert_true(interestee.matches(":popover-open")); + interestbutton.setAttribute("interestaction", "togglepopover"); + await hoverOver(interestbutton); + assert_false(interestee.matches(":popover-open")); + }, "hover interest invoking (as togglepopover) open popover closes"); + + promise_test(async function (t) { + t.add_cleanup(reset); + assert_false(interestee.matches(":popover-open")); + interestbutton.setAttribute("interestaction", "togglepopover"); + interestbutton.focus(); + assert_true(interestee.matches(":popover-open")); + }, "focus interest invoking (as togglepopover) closed popover opens"); + + promise_test(async function (t) { + t.add_cleanup(reset); + interestee.showPopover(); + assert_true(interestee.matches(":popover-open")); + interestbutton.setAttribute("interestaction", "togglepopover"); + interestbutton.focus(); + assert_false(interestee.matches(":popover-open")); + }, "focus interest invoking (as togglepopover) open popover closes"); + + promise_test(async function (t) { + t.add_cleanup(reset); + assert_false(interestee.matches(":popover-open")); + interestbutton.setAttribute("interestaction", "tOgGlEpOpOvEr"); + interestbutton.focus(); + assert_true(interestee.matches(":popover-open")); + }, "interest invoking (as togglepopover - case insensitive) closed popover opens"); + +</script> diff --git a/testing/web-platform/tests/html/semantics/invokers/invokeelement-interface.tentative.html b/testing/web-platform/tests/html/semantics/invokers/invokeelement-interface.tentative.html index 5a2854fe31..5adacadabb 100644 --- a/testing/web-platform/tests/html/semantics/invokers/invokeelement-interface.tentative.html +++ b/testing/web-platform/tests/html/semantics/invokers/invokeelement-interface.tentative.html @@ -1,6 +1,6 @@ <!doctype html> <meta charset="utf-8" /> -<meta name="author" title="Keith Cirkel" href="mailto:keithamus@github.com" /> +<meta name="author" title="Keith Cirkel" href="mailto:wpt@keithcirkel.co.uk" /> <link rel="help" href="https://open-ui.org/components/invokers.explainer/" /> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> diff --git a/testing/web-platform/tests/html/semantics/invokers/invokeevent-dispatch-shadow.tentative.html b/testing/web-platform/tests/html/semantics/invokers/invokeevent-dispatch-shadow.tentative.html index 84337d5723..1ecff88760 100644 --- a/testing/web-platform/tests/html/semantics/invokers/invokeevent-dispatch-shadow.tentative.html +++ b/testing/web-platform/tests/html/semantics/invokers/invokeevent-dispatch-shadow.tentative.html @@ -1,6 +1,6 @@ <!doctype html> <meta charset="utf-8" /> -<meta name="author" title="Keith Cirkel" href="mailto:keithamus@github.com" /> +<meta name="author" title="Keith Cirkel" href="mailto:wpt@keithcirkel.co.uk" /> <link rel="help" href="https://open-ui.org/components/invokers.explainer/" /> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> diff --git a/testing/web-platform/tests/html/semantics/invokers/invokeevent-interface.tentative.html b/testing/web-platform/tests/html/semantics/invokers/invokeevent-interface.tentative.html index 382f808071..0cfb4d5ee5 100644 --- a/testing/web-platform/tests/html/semantics/invokers/invokeevent-interface.tentative.html +++ b/testing/web-platform/tests/html/semantics/invokers/invokeevent-interface.tentative.html @@ -1,6 +1,6 @@ <!doctype html> <meta charset="utf-8" /> -<meta name="author" title="Keith Cirkel" href="mailto:keithamus@github.com" /> +<meta name="author" title="Keith Cirkel" href="mailto:wpt@keithcirkel.co.uk" /> <link rel="help" href="https://open-ui.org/components/invokers.explainer/" /> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> diff --git a/testing/web-platform/tests/html/semantics/invokers/invoketarget-button-event-dispatch.tentative.html b/testing/web-platform/tests/html/semantics/invokers/invoketarget-button-event-dispatch.tentative.html index d8d9c04022..9120cc3192 100644 --- a/testing/web-platform/tests/html/semantics/invokers/invoketarget-button-event-dispatch.tentative.html +++ b/testing/web-platform/tests/html/semantics/invokers/invoketarget-button-event-dispatch.tentative.html @@ -1,6 +1,7 @@ <!doctype html> <meta charset="utf-8" /> -<meta name="author" title="Keith Cirkel" href="mailto:keithamus@github.com" /> +<meta name="author" title="Keith Cirkel" href="mailto:wpt@keithcirkel.co.uk" /> +<meta name="timeout" content="long" /> <link rel="help" href="https://open-ui.org/components/invokers.explainer/" /> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> @@ -27,35 +28,63 @@ assert_equals(event.invoker, invokerbutton, "invoker"); }, "event dispatches on click"); - promise_test(async function (t) { - let event = null; - invokee.addEventListener("invoke", (e) => (event = e), { once: true }); - invokerbutton.invokeAction = "fooBar"; - await clickOn(invokerbutton); - assert_true(event instanceof InvokeEvent, "event is InvokeEvent"); - assert_equals(event.type, "invoke", "type"); - assert_equals(event.bubbles, false, "bubbles"); - assert_equals(event.composed, true, "composed"); - assert_equals(event.isTrusted, true, "isTrusted"); - assert_equals(event.action, "fooBar", "action"); - assert_equals(event.target, invokee, "target"); - assert_equals(event.invoker, invokerbutton, "invoker"); - }, "event action is set to invokeAction"); + // valid custom invokeactions + ["-foo", "foo-", "cAsE-cArRiEs", "-", "-a-", "a-b", "---", "show-picker"].forEach( + (action) => { + promise_test(async function (t) { + t.add_cleanup(() => invokerbutton.removeAttribute("invokeaction")); + let event = null; + invokee.addEventListener("invoke", (e) => (event = e), { once: true }); + invokerbutton.invokeAction = action; + await clickOn(invokerbutton); + assert_true(event instanceof InvokeEvent, "event is InvokeEvent"); + assert_equals(event.type, "invoke", "type"); + assert_equals(event.bubbles, false, "bubbles"); + assert_equals(event.composed, true, "composed"); + assert_equals(event.isTrusted, true, "isTrusted"); + assert_equals(event.action, action, "action"); + assert_equals(event.target, invokee, "target"); + assert_equals(event.invoker, invokerbutton, "invoker"); + }, `setting custom invokeAction property to ${action} (must include dash) sets event action`); - promise_test(async function (t) { - let event = null; - invokee.addEventListener("invoke", (e) => (event = e), { once: true }); - invokerbutton.setAttribute("invokeaction", "BaRbAz"); - await clickOn(invokerbutton); - assert_true(event instanceof InvokeEvent, "event is InvokeEvent"); - assert_equals(event.type, "invoke", "type"); - assert_equals(event.bubbles, false, "bubbles"); - assert_equals(event.composed, true, "composed"); - assert_equals(event.isTrusted, true, "isTrusted"); - assert_equals(event.action, "BaRbAz", "action"); - assert_equals(event.target, invokee, "target"); - assert_equals(event.invoker, invokerbutton, "invoker"); - }, "event action is set to invokeaction attribute"); + promise_test(async function (t) { + t.add_cleanup(() => invokerbutton.removeAttribute("invokeaction")); + let event = null; + invokee.addEventListener("invoke", (e) => (event = e), { once: true }); + invokerbutton.setAttribute("invokeaction", action); + await clickOn(invokerbutton); + assert_true(event instanceof InvokeEvent, "event is InvokeEvent"); + assert_equals(event.type, "invoke", "type"); + assert_equals(event.bubbles, false, "bubbles"); + assert_equals(event.composed, true, "composed"); + assert_equals(event.isTrusted, true, "isTrusted"); + assert_equals(event.action, action, "action"); + assert_equals(event.target, invokee, "target"); + assert_equals(event.invoker, invokerbutton, "invoker"); + }, `setting custom invokeaction attribute to ${action} (must include dash) sets event action`); + }, + ); + + // invalid custom invokeactions + ["foo", "foobar", "foo bar", "em—dash", "hidedocument"].forEach((action) => { + promise_test(async function (t) { + t.add_cleanup(() => invokerbutton.removeAttribute("invokeaction")); + let event = null; + invokee.addEventListener("invoke", (e) => (event = e), { once: true }); + invokerbutton.invokeAction = action; + await clickOn(invokerbutton); + assert_equals(event, null, "event should not have fired"); + }, `setting custom invokeAction property to ${action} (no dash) did not dispatch an event`); + + promise_test(async function (t) { + t.add_cleanup(() => invokerbutton.removeAttribute("invokeaction")); + let event = null; + invokee.addEventListener("invoke", (e) => (event = e), { once: true }); + invokerbutton.setAttribute("invokeaction", action); + await clickOn(invokerbutton); + assert_equals(event, null, "event should not have fired"); + }, `setting custom invokeaction attribute to ${action} (no dash) did not dispatch an event`); + }); promise_test(async function (t) { let called = false; @@ -78,7 +107,7 @@ }, "event does not dispatch if click:preventDefault is called"); promise_test(async function (t) { - t.add_cleanup(() => invokerbutton.removeAttribute('disabled')); + t.add_cleanup(() => invokerbutton.removeAttribute("disabled")); let called = false; invokee.addEventListener( "invoke", @@ -93,7 +122,7 @@ }, "event does not dispatch if invoker is disabled"); promise_test(async function (t) { - svgInvokee = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); + svgInvokee = document.createElementNS("http://www.w3.org/2000/svg", "svg"); t.add_cleanup(() => { invokerbutton.invokeTargetElement = invokee; svgInvokee.remove(); @@ -115,7 +144,15 @@ invokerbutton.invokeTargetElement = svgInvokee; await clickOn(invokerbutton); assert_true(called, "event was called"); - assert_equals(eventInvoker, invokerbutton, "event.invoker is set to right element"); - assert_equals(eventTarget, svgInvokee, "event.target is set to right element"); + assert_equals( + eventInvoker, + invokerbutton, + "event.invoker is set to right element", + ); + assert_equals( + eventTarget, + svgInvokee, + "event.target is set to right element", + ); }, "event dispatches if invokee is non-HTML Element"); </script> diff --git a/testing/web-platform/tests/html/semantics/invokers/invoketarget-fullscreen-behavior.tentative.html b/testing/web-platform/tests/html/semantics/invokers/invoketarget-fullscreen-behavior.tentative.html index b72020283e..2e2c5f683f 100644 --- a/testing/web-platform/tests/html/semantics/invokers/invoketarget-fullscreen-behavior.tentative.html +++ b/testing/web-platform/tests/html/semantics/invokers/invoketarget-fullscreen-behavior.tentative.html @@ -1,6 +1,7 @@ <!doctype html> <meta charset="utf-8" /> <meta name="author" title="Luke Warlow" href="mailto:luke@warlow.dev" /> +<meta name="timeout" content="long" /> <link rel="help" href="https://open-ui.org/components/invokers.explainer/" /> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> diff --git a/testing/web-platform/tests/html/semantics/invokers/invoketarget-on-audio-behavior.tentative.html b/testing/web-platform/tests/html/semantics/invokers/invoketarget-on-audio-behavior.tentative.html index f3abeae165..37acb7a539 100644 --- a/testing/web-platform/tests/html/semantics/invokers/invoketarget-on-audio-behavior.tentative.html +++ b/testing/web-platform/tests/html/semantics/invokers/invoketarget-on-audio-behavior.tentative.html @@ -1,6 +1,7 @@ <!doctype html> <meta charset="utf-8" /> <meta name="author" title="Luke Warlow" href="mailto:luke@warlow.dev" /> +<meta name="timeout" content="long" /> <link rel="help" href="https://open-ui.org/components/invokers.explainer/" /> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> @@ -25,7 +26,7 @@ assert_true(invokee.paused); invokerbutton.setAttribute("invokeaction", ""); await clickOn(invokerbutton); - await new Promise(resolve => { + await new Promise((resolve) => { requestAnimationFrame(resolve); }); assert_true(invokee.paused); @@ -43,7 +44,7 @@ assert_true(invokee.paused); invokerbutton.setAttribute("invokeaction", "playpause"); await clickOn(invokerbutton); - await new Promise(resolve => { + await new Promise((resolve) => { requestAnimationFrame(resolve); }); assert_false(invokee.paused); @@ -59,7 +60,7 @@ assert_true(invokee.paused); invokerbutton.setAttribute("invokeaction", "playpause"); invokerbutton.click(); - await new Promise(resolve => { + await new Promise((resolve) => { requestAnimationFrame(resolve); }); assert_false(invokee.paused); @@ -78,7 +79,7 @@ assert_true(invokee.paused); invokerbutton.setAttribute("invokeaction", "playpause"); await clickOn(invokerbutton); - await new Promise(resolve => { + await new Promise((resolve) => { requestAnimationFrame(resolve); }); assert_true(invokee.paused); @@ -91,12 +92,12 @@ invokee.currentTime = 0; invokee.muted = false; }); - await test_driver.bless('play audio'); + await test_driver.bless("play audio"); invokee.play(); assert_false(invokee.paused); invokerbutton.setAttribute("invokeaction", "playpause"); await clickOn(invokerbutton); - await new Promise(resolve => { + await new Promise((resolve) => { requestAnimationFrame(resolve); }); assert_true(invokee.paused); @@ -114,7 +115,7 @@ assert_true(invokee.paused); invokerbutton.setAttribute("invokeaction", "play"); await clickOn(invokerbutton); - await new Promise(resolve => { + await new Promise((resolve) => { requestAnimationFrame(resolve); }); assert_false(invokee.paused); @@ -130,7 +131,7 @@ assert_true(invokee.paused); invokerbutton.setAttribute("invokeaction", "play"); invokerbutton.click(); - await new Promise(resolve => { + await new Promise((resolve) => { requestAnimationFrame(resolve); }); assert_false(invokee.paused); @@ -149,7 +150,7 @@ assert_true(invokee.paused); invokerbutton.setAttribute("invokeaction", "play"); await clickOn(invokerbutton); - await new Promise(resolve => { + await new Promise((resolve) => { requestAnimationFrame(resolve); }); assert_true(invokee.paused); @@ -162,12 +163,12 @@ invokee.currentTime = 0; invokee.muted = false; }); - await test_driver.bless('play audio'); + await test_driver.bless("play audio"); invokee.play(); assert_false(invokee.paused); invokerbutton.setAttribute("invokeaction", "play"); await clickOn(invokerbutton); - await new Promise(resolve => { + await new Promise((resolve) => { requestAnimationFrame(resolve); }); assert_false(invokee.paused); @@ -185,8 +186,8 @@ assert_true(invokee.paused); invokerbutton.setAttribute("invokeaction", "pause"); await clickOn(invokerbutton); - await new Promise(resolve => { - requestAnimationFrame(resolve); + await new Promise((resolve) => { + requestAnimationFrame(resolve); }); assert_true(invokee.paused); }, "invoking audio with pause action is a no-op"); @@ -204,7 +205,7 @@ assert_true(invokee.paused); invokerbutton.setAttribute("invokeaction", "pause"); await clickOn(invokerbutton); - await new Promise(resolve => { + await new Promise((resolve) => { requestAnimationFrame(resolve); }); assert_true(invokee.paused); @@ -217,12 +218,12 @@ invokee.currentTime = 0; invokee.muted = false; }); - await test_driver.bless('play audio'); + await test_driver.bless("play audio"); invokee.play(); assert_false(invokee.paused); invokerbutton.setAttribute("invokeaction", "pause"); await clickOn(invokerbutton); - await new Promise(resolve => { + await new Promise((resolve) => { requestAnimationFrame(resolve); }); assert_true(invokee.paused); @@ -240,7 +241,7 @@ assert_false(invokee.muted); invokerbutton.setAttribute("invokeaction", "toggleMuted"); await clickOn(invokerbutton); - await new Promise(resolve => { + await new Promise((resolve) => { requestAnimationFrame(resolve); }); assert_true(invokee.muted); @@ -259,7 +260,7 @@ assert_false(invokee.muted); invokerbutton.setAttribute("invokeaction", "toggleMuted"); await clickOn(invokerbutton); - await new Promise(resolve => { + await new Promise((resolve) => { requestAnimationFrame(resolve); }); assert_false(invokee.muted); @@ -276,10 +277,9 @@ assert_true(invokee.muted); invokerbutton.setAttribute("invokeaction", "toggleMuted"); await clickOn(invokerbutton); - await new Promise(resolve => { + await new Promise((resolve) => { requestAnimationFrame(resolve); }); assert_false(invokee.muted); }, "invoking muted audio with toggleMuted action unmutes it"); - </script> diff --git a/testing/web-platform/tests/html/semantics/invokers/invoketarget-on-audio-invalid-behavior.tentative.html b/testing/web-platform/tests/html/semantics/invokers/invoketarget-on-audio-invalid-behavior.tentative.html new file mode 100644 index 0000000000..9e15ce38e8 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/invokers/invoketarget-on-audio-invalid-behavior.tentative.html @@ -0,0 +1,37 @@ +<!doctype html> +<meta charset="utf-8" /> +<meta name="author" title="Keith Cirkel" href="mailto:wpt@keithcirkel.co.uk" /> +<meta name="timeout" content="long" /> +<link rel="help" href="https://open-ui.org/components/invokers.explainer/" /> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/resources/testdriver.js"></script> +<script src="/resources/testdriver-actions.js"></script> +<script src="/resources/testdriver-vendor.js"></script> +<script src="resources/invoker-utils.js"></script> + +<audio controls id="invokee" src="/media/sound_5.mp3"></audio> +<button id="invokerbutton" invoketarget="invokee"></button> + +<script> + // invalid actions on audio + [ + "foo-bar", + "showpopover", + "showmodal", + "showpicker", + "open", + "close", + ].forEach((action) => { + promise_test(async function (t) { + t.add_cleanup(() => invokerbutton.removeAttribute("invokeaction")); + invokerbutton.setAttribute("invokeaction", action); + assert_true(invokee.paused); + assert_false(invokee.muted); + await clickOn(invokerbutton); + await waitForRender(); + assert_true(invokee.paused); + assert_false(invokee.muted); + }, `invoking (as ${action}) on audio does nothing`); + }); +</script> diff --git a/testing/web-platform/tests/html/semantics/invokers/invoketarget-on-details-behavior.tentative.html b/testing/web-platform/tests/html/semantics/invokers/invoketarget-on-details-behavior.tentative.html index c6735e2611..ad9b6caa57 100644 --- a/testing/web-platform/tests/html/semantics/invokers/invoketarget-on-details-behavior.tentative.html +++ b/testing/web-platform/tests/html/semantics/invokers/invoketarget-on-details-behavior.tentative.html @@ -1,6 +1,7 @@ <!doctype html> <meta charset="utf-8" /> <meta name="author" title="Luke Warlow" href="mailto:luke@warlow.dev" /> +<meta name="timeout" content="long" /> <link rel="help" href="https://open-ui.org/components/invokers.explainer/" /> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> @@ -9,210 +10,136 @@ <script src="/resources/testdriver-vendor.js"></script> <script src="resources/invoker-utils.js"></script> -<details id="invokee"> - Details Contents -</details> +<details id="invokee">Details Contents</details> <button id="invokerbutton" invoketarget="invokee"></button> <script> - // auto - - promise_test(async function (t) { - assert_false(invokee.matches("[open]")); - await clickOn(invokerbutton); - t.add_cleanup(() => invokee.removeAttribute('open')); - assert_true(invokee.matches("[open]")); - }, "invoking closed details with auto action opens"); - - promise_test(async function (t) { - assert_false(invokee.matches("[open]")); - invokee.addEventListener("invoke", (e) => e.preventDefault(), { - once: true, - }); - await clickOn(invokerbutton); - t.add_cleanup(() => invokee.removeAttribute('open')); - assert_false(invokee.matches("[open]")); - }, "invoking closed details with auto action and preventDefault does not open"); - - promise_test(async function (t) { - invokee.setAttribute('open', ''); - assert_true(invokee.matches("[open]")); - await clickOn(invokerbutton); - assert_false(invokee.matches("[open]")); - }, "invoking open details with auto action closes"); - - promise_test(async function (t) { - invokee.setAttribute('open', ''); - t.add_cleanup(() => invokee.removeAttribute('open')); - invokee.addEventListener("invoke", (e) => e.preventDefault(), { - once: true, - }); - assert_true(invokee.matches("[open]")); - await clickOn(invokerbutton); - assert_true(invokee.matches("[open]")); - }, "invoking open details with auto action and preventDefault does not close"); - - promise_test(async function (t) { - t.add_cleanup(() => invokee.removeAttribute('open')); - invokee.addEventListener("invoke", (e) => { - invokee.setAttribute('open', ''); - }, { - once: true, - }); - assert_false(invokee.matches("[open]")); - await clickOn(invokerbutton); - assert_false(invokee.matches("[open]")); - }, "invoking details with auto action where event listener opens leads to a closed details"); - - promise_test(async function (t) { - invokee.setAttribute('open', ''); - t.add_cleanup(() => invokee.removeAttribute('open')); - invokee.addEventListener("invoke", (e) => { - invokee.removeAttribute('open'); - }, { - once: true, - }); - assert_true(invokee.matches("[open]")); - await clickOn(invokerbutton); - assert_true(invokee.matches("[open]")); - }, "invoking open details with auto action where event listener closes leads to an open details"); - - // toggle - - promise_test(async function (t) { - assert_false(invokee.matches("[open]")); - invokerbutton.setAttribute("invokeaction", "toggle"); - t.add_cleanup(() => invokerbutton.removeAttribute("invokeaction")); - await clickOn(invokerbutton); - t.add_cleanup(() => invokee.removeAttribute('open')); - assert_true(invokee.matches("[open]")); - }, "invoking closed details with toggle action opens"); - - promise_test(async function (t) { - assert_false(invokee.matches("[open]")); - invokerbutton.setAttribute("invokeaction", "tOgGlE"); - t.add_cleanup(() => invokerbutton.removeAttribute("invokeaction")); - await clickOn(invokerbutton); - t.add_cleanup(() => invokee.removeAttribute('open')); - assert_true(invokee.matches("[open]")); - }, "invoking closed details with toggle (case-insensitive) action opens"); - - promise_test(async function (t) { - assert_false(invokee.matches("[open]")); - invokerbutton.setAttribute("invokeaction", "toggle"); - t.add_cleanup(() => invokerbutton.removeAttribute("invokeaction")); - invokee.addEventListener("invoke", (e) => e.preventDefault(), { + function resetState() { + invokerbutton.removeAttribute("invokeaction"); + invokee.removeAttribute("open"); + } + + // Open actions + [ + null, + "", + "toggle", + "open", + /* test case sensitivity */ + "tOgGlE", + "oPeN", + ].forEach((action) => { + promise_test( + async function (t) { + t.add_cleanup(resetState); + if (action !== null) invokerbutton.invokeAction = action; + assert_false(invokee.matches("[open]")); + await clickOn(invokerbutton); + assert_true(invokee.matches("[open]")); + }, + `invoking (as ${ + action === null ? "auto" : action || "explicit empty" + }) closed details opens`, + ); + + promise_test( + async function (t) { + t.add_cleanup(resetState); + if (action !== null) invokerbutton.invokeAction = action; + assert_false(invokee.matches("[open]")); + invokee.addEventListener("invoke", (e) => e.preventDefault(), { + once: true, + }); + await clickOn(invokerbutton); + t.add_cleanup(() => invokee.removeAttribute("open")); + assert_false(invokee.matches("[open]")); + }, + `invoking (as ${ + action === null ? "auto" : action || "explicit empty" + }) closed details with preventDefault does not open`, + ); + }); + + // Close actions + [ + null, + "", + "toggle", + "close", + /* test case sensitivity */ + "tOgGlE", + "cLoSe", + ].forEach((action) => { + promise_test( + async function (t) { + t.add_cleanup(resetState); + if (action !== null) invokerbutton.invokeAction = action; + invokee.setAttribute("open", ""); + assert_true(invokee.matches("[open]")); + await clickOn(invokerbutton); + assert_false(invokee.matches("[open]")); + }, + `invoking (as ${ + action === null ? "auto" : action || "explicit empty" + }) open details closes`, + ); + + promise_test( + async function (t) { + t.add_cleanup(resetState); + if (action !== null) invokerbutton.invokeAction = action; + invokee.setAttribute("open", ""); + invokerbutton.setAttribute("invokeaction", "toggle"); + invokee.addEventListener("invoke", (e) => e.preventDefault(), { + once: true, + }); + assert_true(invokee.matches("[open]")); + await clickOn(invokerbutton); + assert_true(invokee.matches("[open]")); + }, + `invoking (as ${ + action === null ? "auto" : action || "explicit empty" + }) open details with prevent default closes`, + ); + }); + + // toggle specific + + promise_test(async function (t) { + t.add_cleanup(resetState); + invokerbutton.invokeAction = "toggle"; + invokee.addEventListener( + "invoke", + (e) => { + invokee.setAttribute("open", ""); + }, + { once: true, - }); - await clickOn(invokerbutton); - t.add_cleanup(() => invokee.removeAttribute('open')); + }, + ); assert_false(invokee.matches("[open]")); - }, "invoking closed details with toggle action and preventDefault does not open"); - - promise_test(async function (t) { - invokee.setAttribute('open', ''); - invokerbutton.setAttribute("invokeaction", "toggle"); - t.add_cleanup(() => invokerbutton.removeAttribute("invokeaction")); - assert_true(invokee.matches("[open]")); await clickOn(invokerbutton); assert_false(invokee.matches("[open]")); - }, "invoking open details with toggle action closes"); + }, "invoking (as toggle) closed details where event listener opens leads to a closed details"); - promise_test(async function (t) { - invokee.setAttribute('open', ''); - t.add_cleanup(() => invokee.removeAttribute('open')); - invokerbutton.setAttribute("invokeaction", "toggle"); - t.add_cleanup(() => invokerbutton.removeAttribute("invokeaction")); - invokee.addEventListener("invoke", (e) => e.preventDefault(), { - once: true, - }); - assert_true(invokee.matches("[open]")); - await clickOn(invokerbutton); - assert_true(invokee.matches("[open]")); - }, "invoking open details with toggle action and preventDefault does not close"); - - // open - - promise_test(async function (t) { - invokerbutton.setAttribute("invokeaction", "open"); - t.add_cleanup(() => invokerbutton.removeAttribute("invokeaction")); - assert_false(invokee.matches("[open]")); - await clickOn(invokerbutton); - t.add_cleanup(() => invokee.removeAttribute('open')); - assert_true(invokee.matches("[open]")); - }, "invoking closed details with open action opens"); - - promise_test(async function (t) { - invokerbutton.setAttribute("invokeaction", "oPeN"); - t.add_cleanup(() => invokerbutton.removeAttribute("invokeaction")); - assert_false(invokee.matches("[open]")); - await clickOn(invokerbutton); - t.add_cleanup(() => invokee.removeAttribute('open')); - assert_true(invokee.matches("[open]")); - }, "invoking closed details with open (case insensitive) action opens"); + // open specific promise_test(async function (t) { - invokerbutton.setAttribute("invokeaction", "open"); - t.add_cleanup(() => invokerbutton.removeAttribute("invokeaction")); - invokee.setAttribute('open', ''); + t.add_cleanup(resetState); + invokerbutton.invokeAction = "open"; + invokee.setAttribute("open", ""); assert_true(invokee.matches("[open]")); await clickOn(invokerbutton); - t.add_cleanup(() => invokee.removeAttribute('open')); assert_true(invokee.matches("[open]")); }, "invoking open details with open action is noop"); - promise_test(async function (t) { - invokerbutton.setAttribute("invokeaction", "open"); - t.add_cleanup(() => invokerbutton.removeAttribute("invokeaction")); - assert_false(invokee.matches("[open]")); - invokee.addEventListener("invoke", (e) => e.preventDefault(), { - once: true, - }); - await clickOn(invokerbutton); - t.add_cleanup(() => invokee.removeAttribute('open')); - assert_false(invokee.matches("[open]")); - }, "invoking closed popover with open action and preventDefault does not open"); - // close promise_test(async function (t) { - invokerbutton.setAttribute("invokeaction", "close"); - t.add_cleanup(() => invokerbutton.removeAttribute("invokeaction")); + t.add_cleanup(resetState); + invokerbutton.invokeAction = "close"; assert_false(invokee.matches("[open]")); await clickOn(invokerbutton); assert_false(invokee.matches("[open]")); }, "invoking closed details with close action is noop"); - - promise_test(async function (t) { - invokerbutton.setAttribute("invokeaction", "close"); - t.add_cleanup(() => invokerbutton.removeAttribute("invokeaction")); - invokee.setAttribute('open', ''); - assert_true(invokee.matches("[open]")); - await clickOn(invokerbutton); - t.add_cleanup(() => invokee.removeAttribute('open')); - assert_false(invokee.matches("[open]")); - }, "invoking open details with close action closes"); - - promise_test(async function (t) { - invokerbutton.setAttribute("invokeaction", "cLoSe"); - t.add_cleanup(() => invokerbutton.removeAttribute("invokeaction")); - invokee.setAttribute('open', ''); - assert_true(invokee.matches("[open]")); - await clickOn(invokerbutton); - t.add_cleanup(() => invokee.removeAttribute('open')); - assert_false(invokee.matches("[open]")); - }, "invoking open details with close (case insensitive) action closes"); - - promise_test(async function (t) { - invokerbutton.setAttribute("invokeaction", "close"); - t.add_cleanup(() => invokerbutton.removeAttribute("invokeaction")); - invokee.setAttribute('open', ''); - t.add_cleanup(() => invokee.removeAttribute('open')); - assert_true(invokee.matches("[open]")); - invokee.addEventListener("invoke", (e) => e.preventDefault(), { - once: true, - }); - await clickOn(invokerbutton); - assert_true(invokee.matches("[open]")); - }, "invoking open details with close action with preventDefault does not close"); </script> diff --git a/testing/web-platform/tests/html/semantics/invokers/invoketarget-on-details-invalid-behavior.tentative.html b/testing/web-platform/tests/html/semantics/invokers/invoketarget-on-details-invalid-behavior.tentative.html new file mode 100644 index 0000000000..d5e90af9c0 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/invokers/invoketarget-on-details-invalid-behavior.tentative.html @@ -0,0 +1,49 @@ +<!doctype html> +<meta charset="utf-8" /> +<meta name="author" title="Keith Cirkel" href="mailto:wpt@keithcirkel.co.uk" /> +<meta name="timeout" content="long" /> +<link rel="help" href="https://open-ui.org/components/invokers.explainer/" /> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/resources/testdriver.js"></script> +<script src="/resources/testdriver-actions.js"></script> +<script src="/resources/testdriver-vendor.js"></script> +<script src="resources/invoker-utils.js"></script> + +<details id="invokee">Details Contents</details> +<button id="invokerbutton" invoketarget="invokee"></button> + +<script> + function resetState() { + invokerbutton.removeAttribute("invokeaction"); + invokee.removeAttribute("open"); + } + + // invalid actions on details + [ + "foo-bar", + "showpopover", + "showmodal", + "showpicker", + "hidepopover", + "hide", + "toggleopen", + ].forEach((action) => { + promise_test(async function (t) { + t.add_cleanup(resetState); + invokerbutton.invokeAction = action; + assert_false(invokee.matches("[open]")); + await clickOn(invokerbutton); + assert_false(invokee.matches("[open]")); + }, `invoking (as ${action}) on details does nothing`); + + promise_test(async function (t) { + t.add_cleanup(resetState); + invokerbutton.invokeAction = action; + invokee.setAttribute("open", ""); + assert_true(invokee.matches("[open]")); + await clickOn(invokerbutton); + assert_true(invokee.matches("[open]")); + }, `invoking (as ${action}) on open details does nothing`); + }); +</script> diff --git a/testing/web-platform/tests/html/semantics/invokers/invoketarget-on-dialog-behavior.tentative.html b/testing/web-platform/tests/html/semantics/invokers/invoketarget-on-dialog-behavior.tentative.html index 774d308703..9f73e092b0 100644 --- a/testing/web-platform/tests/html/semantics/invokers/invoketarget-on-dialog-behavior.tentative.html +++ b/testing/web-platform/tests/html/semantics/invokers/invoketarget-on-dialog-behavior.tentative.html @@ -295,67 +295,6 @@ assert_false(invokee.matches(":modal"), "invokee :modal"); }, "invoking (as close) already closed dialog is noop"); - // invalid - [ - "foo", - "foo-bar", - "auto", - "showpopover", - "hidepopover", - "togglepopover", - "showpicker", - ].forEach((action) => { - promise_test(async function (t) { - t.add_cleanup(resetState); - invokerbutton.setAttribute("invokeaction", action); - assert_false(invokee.open, "invokee.open"); - assert_false(invokee.matches(":modal"), "invokee :modal"); - await clickOn(invokerbutton); - assert_false(invokee.open, "invokee.open"); - assert_false(invokee.matches(":modal"), "invokee :modal"); - }, `invoking (as ${action}) on dialog does nothing`); - - promise_test(async function (t) { - t.add_cleanup(resetState); - containedinvoker.setAttribute("invokeaction", action); - invokee.show(); - assert_true(invokee.open, "invokee.open"); - assert_false(invokee.matches(":modal"), "invokee :modal"); - await clickOn(containedinvoker); - assert_true(invokee.open, "invokee.open"); - assert_false(invokee.matches(":modal"), "invokee :modal"); - }, `invoking (as ${action}) on open dialog does nothing`); - - promise_test(async function (t) { - t.add_cleanup(resetState); - containedinvoker.setAttribute("invokeaction", action); - invokee.showModal(); - assert_true(invokee.open, "invokee.open"); - assert_true(invokee.matches(":modal"), "invokee :modal"); - await clickOn(containedinvoker); - assert_true(invokee.open, "invokee.open"); - assert_true(invokee.matches(":modal"), "invokee :modal"); - }, `invoking (as ${action}) on open modal dialog does nothing`); - - promise_test(async function (t) { - t.add_cleanup(resetState); - containedinvoker.setAttribute("invokeaction", action); - invokee.showModal(); - assert_true(invokee.open, "invokee.open"); - assert_true(invokee.matches(":modal"), "invokee :modal"); - invokee.addEventListener( - "invoke", - (e) => { - containedinvoker.setAttribute("invokeaction", ""); - }, - { once: true }, - ); - await clickOn(containedinvoker); - assert_true(invokee.open, "invokee.open"); - assert_true(invokee.matches(":modal"), "invokee :modal"); - }, `invoking (as ${action}) on open modal while changing the attributer does nothing`); - }); - // Open Popovers using Dialog actions ["showmodal", "close", ""].forEach((action) => { ["manual", "auto"].forEach((popoverState) => { diff --git a/testing/web-platform/tests/html/semantics/invokers/invoketarget-on-dialog-invalid-behavior.tentative.html b/testing/web-platform/tests/html/semantics/invokers/invoketarget-on-dialog-invalid-behavior.tentative.html new file mode 100644 index 0000000000..af84c22594 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/invokers/invoketarget-on-dialog-invalid-behavior.tentative.html @@ -0,0 +1,120 @@ +<!doctype html> +<meta charset="utf-8" /> +<meta name="author" title="Keith Cirkel" href="mailto:wpt@keithcirkel.co.uk" /> +<meta name="timeout" content="long"> +<link rel="help" href="https://open-ui.org/components/invokers.explainer/" /> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/resources/testdriver.js"></script> +<script src="/resources/testdriver-actions.js"></script> +<script src="/resources/testdriver-vendor.js"></script> +<script src="resources/invoker-utils.js"></script> + +<dialog id="invokee"> + <button id="containedinvoker" invoketarget="invokee"></button> +</dialog> +<button id="invokerbutton" invoketarget="invokee"></button> + +<script> + function resetState() { + invokee.close(); + try { invokee.hidePopover(); } catch {} + invokee.removeAttribute("popover"); + invokerbutton.removeAttribute("invokeaction"); + containedinvoker.removeAttribute("invokeaction"); + } + + // invalid + [ + "foo", + "foo-bar", + "auto", + "showpopover", + "hidepopover", + "togglepopover", + "showpicker", + ].forEach((action) => { + promise_test(async function (t) { + t.add_cleanup(resetState); + invokerbutton.setAttribute("invokeaction", action); + assert_false(invokee.open, "invokee.open"); + assert_false(invokee.matches(":modal"), "invokee :modal"); + await clickOn(invokerbutton); + assert_false(invokee.open, "invokee.open"); + assert_false(invokee.matches(":modal"), "invokee :modal"); + }, `invoking (as ${action}) on dialog does nothing`); + + promise_test(async function (t) { + t.add_cleanup(resetState); + containedinvoker.setAttribute("invokeaction", action); + invokee.show(); + assert_true(invokee.open, "invokee.open"); + assert_false(invokee.matches(":modal"), "invokee :modal"); + await clickOn(containedinvoker); + assert_true(invokee.open, "invokee.open"); + assert_false(invokee.matches(":modal"), "invokee :modal"); + }, `invoking (as ${action}) on open dialog does nothing`); + + promise_test(async function (t) { + t.add_cleanup(resetState); + containedinvoker.setAttribute("invokeaction", action); + invokee.showModal(); + assert_true(invokee.open, "invokee.open"); + assert_true(invokee.matches(":modal"), "invokee :modal"); + await clickOn(containedinvoker); + assert_true(invokee.open, "invokee.open"); + assert_true(invokee.matches(":modal"), "invokee :modal"); + }, `invoking (as ${action}) on open modal dialog does nothing`); + + promise_test(async function (t) { + t.add_cleanup(resetState); + containedinvoker.setAttribute("invokeaction", action); + invokee.showModal(); + assert_true(invokee.open, "invokee.open"); + assert_true(invokee.matches(":modal"), "invokee :modal"); + invokee.addEventListener( + "invoke", + (e) => { + containedinvoker.setAttribute("invokeaction", ""); + }, + { once: true }, + ); + await clickOn(containedinvoker); + assert_true(invokee.open, "invokee.open"); + assert_true(invokee.matches(":modal"), "invokee :modal"); + }, `invoking (as ${action}) on open modal while changing the attributer does nothing`); + }); + + // Open Popovers using Dialog actions + ["showmodal", "close", ""].forEach((action) => { + ["manual", "auto"].forEach((popoverState) => { + promise_test( + async function (t) { + t.add_cleanup(resetState); + invokee.setAttribute("popover", popoverState); + invokee.showPopover(); + containedinvoker.setAttribute("invokeaction", action); + assert_true( + invokee.matches(":popover-open"), + "invokee :popover-open", + ); + assert_false(invokee.open, "invokee.open"); + assert_false(invokee.matches(":modal"), "invokee :modal"); + invokee.addEventListener("invoke", (e) => e.preventDefault(), { + once: true, + }); + await clickOn(containedinvoker); + assert_true( + invokee.matches(":popover-open"), + "invokee :popover-open", + ); + assert_false(invokee.open, "invokee.open"); + assert_false(invokee.matches(":modal"), "invokee :modal"); + }, + `invoking (as ${ + action || "explicit empty" + }) dialog as open popover=${popoverState} is noop`, + ); + }); + }); +</script> diff --git a/testing/web-platform/tests/html/semantics/invokers/invoketarget-on-popover-behavior.tentative.html b/testing/web-platform/tests/html/semantics/invokers/invoketarget-on-popover-behavior.tentative.html index 2bddfa7621..f414559e55 100644 --- a/testing/web-platform/tests/html/semantics/invokers/invoketarget-on-popover-behavior.tentative.html +++ b/testing/web-platform/tests/html/semantics/invokers/invoketarget-on-popover-behavior.tentative.html @@ -1,6 +1,7 @@ <!doctype html> <meta charset="utf-8" /> -<meta name="author" title="Keith Cirkel" href="mailto:keithamus@github.com" /> +<meta name="author" title="Keith Cirkel" href="mailto:wpt@keithcirkel.co.uk" /> +<meta name="timeout" content="long" /> <link rel="help" href="https://open-ui.org/components/invokers.explainer/" /> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> @@ -19,215 +20,138 @@ promise_test(async function (t) { assert_false(invokee.matches(":popover-open")); - await clickOn(invokerbutton); - t.add_cleanup(() => invokee.hidePopover()); - assert_true(invokee.matches(":popover-open")); - }, "invoking (as auto) closed popover opens"); - - promise_test(async function (t) { - assert_false(invokee.matches(":popover-open")); - invokee.addEventListener("invoke", (e) => e.preventDefault(), { + invokee.addEventListener("invoke", (e) => { invokerbutton.setAttribute('invokeaction', 'hidepopover'); }, { once: true, }); await clickOn(invokerbutton); - t.add_cleanup(() => invokee.hidePopover()); - assert_false(invokee.matches(":popover-open")); - }, "invoking (as auto) closed popover with preventDefault does not open"); - - promise_test(async function (t) { - invokee.showPopover(); - assert_true(invokee.matches(":popover-open")); - await clickOn(invokerbutton); - assert_false(invokee.matches(":popover-open")); - }, "invoking (as auto) open popover closes"); - - promise_test(async function (t) { - invokee.showPopover(); - assert_true(invokee.matches(":popover-open")); - await clickOn(containedinvoker); - assert_false(invokee.matches(":popover-open")); - }, "invoking (as auto) from within open popover closes"); - - promise_test(async function (t) { - invokee.showPopover(); - t.add_cleanup(() => invokee.hidePopover()); - invokee.addEventListener("invoke", (e) => e.preventDefault(), { - once: true, + t.add_cleanup(() => { + invokee.hidePopover(); + invokerbutton.removeAttribute("invokeaction"); }); assert_true(invokee.matches(":popover-open")); - await clickOn(containedinvoker); - assert_true(invokee.matches(":popover-open")); - }, "invoking (as auto) open popover with preventDefault does not close"); - - // togglepopover - - promise_test(async function (t) { - assert_false(invokee.matches(":popover-open")); - invokerbutton.setAttribute("invokeaction", "togglepopover"); - t.add_cleanup(() => invokerbutton.removeAttribute("invokeaction")); - await clickOn(invokerbutton); - t.add_cleanup(() => invokee.hidePopover()); - assert_true(invokee.matches(":popover-open")); - }, "invoking (as togglepopover) closed popover opens"); - - promise_test(async function (t) { - assert_false(invokee.matches(":popover-open")); - invokerbutton.setAttribute("invokeaction", "tOgGlEpOpOvEr"); - t.add_cleanup(() => invokerbutton.removeAttribute("invokeaction")); - await clickOn(invokerbutton); - t.add_cleanup(() => invokee.hidePopover()); - assert_true(invokee.matches(":popover-open")); - }, "invoking (as togglepopover - case insensitive) closed popover opens"); - - promise_test(async function (t) { - assert_false(invokee.matches(":popover-open")); - invokerbutton.setAttribute("invokeaction", "togglepopover"); - t.add_cleanup(() => invokerbutton.removeAttribute("invokeaction")); - invokee.addEventListener("invoke", (e) => e.preventDefault(), { - once: true, - }); - await clickOn(invokerbutton); - t.add_cleanup(() => invokee.hidePopover()); - assert_false(invokee.matches(":popover-open")); - }, "invoking (as togglepopover) closed popover with preventDefault does not open"); - - promise_test(async function (t) { - invokee.showPopover(); - containedinvoker.setAttribute("invokeaction", "togglepopover"); - t.add_cleanup(() => containedinvoker.removeAttribute("invokeaction")); - assert_true(invokee.matches(":popover-open")); - await clickOn(invokerbutton); - assert_false(invokee.matches(":popover-open")); - }, "invoking (as togglepopover) open popover closes"); - - promise_test(async function (t) { - invokee.showPopover(); - containedinvoker.setAttribute("invokeaction", "togglepopover"); - t.add_cleanup(() => containedinvoker.removeAttribute("invokeaction")); - assert_true(invokee.matches(":popover-open")); - await clickOn(containedinvoker); - assert_false(invokee.matches(":popover-open")); - }, "invoking (as togglepopover) from within open popover closes"); - - promise_test(async function (t) { - invokee.showPopover(); - t.add_cleanup(() => invokee.hidePopover()); - containedinvoker.setAttribute("invokeaction", "togglepopover"); - t.add_cleanup(() => containedinvoker.removeAttribute("invokeaction")); - invokee.addEventListener("invoke", (e) => e.preventDefault(), { - once: true, - }); - assert_true(invokee.matches(":popover-open")); - await clickOn(containedinvoker); - assert_true(invokee.matches(":popover-open")); - }, "invoking (as togglepopover) open popover with preventDefault does not close"); - - // showpopover - - promise_test(async function (t) { + }, "changing invokeaction attribute inside invokeevent doesn't impact the invocation"); + + function resetState() { + invokerbutton.removeAttribute("invokeaction"); + containedinvoker.removeAttribute("invokeaction"); + try { + invokee.hidePopover(); + } catch {} + invokee.setAttribute("popover", ""); + } + + // Open actions + [ + null, + "", + "togglepopover", + "showpopover", + /* test case sensitivity */ + "tOgGlEpOpOvEr", + "sHoWpOpOvEr", + ].forEach((action) => { + promise_test( + async function (t) { + t.add_cleanup(resetState); + if (action !== null) invokerbutton.invokeAction = action; + assert_false(invokee.matches(":popover-open")); + await clickOn(invokerbutton); + assert_true(invokee.matches(":popover-open")); + }, + `invoking (as ${ + action === null ? "auto" : action || "explicit empty" + }) closed popover opens`, + ); + + promise_test( + async function (t) { + t.add_cleanup(resetState); + if (action !== null) invokerbutton.invokeAction = action; + assert_false(invokee.matches(":popover-open")); + invokee.addEventListener("invoke", (e) => e.preventDefault(), { + once: true, + }); + await clickOn(invokerbutton); + assert_false(invokee.matches(":popover-open")); + }, + `invoking (as ${ + action === null ? "auto" : action || "explicit empty" + }) closed popover with preventDefault does not open`, + ); + }); + + // Close actions + [ + null, + "", + "togglepopover", + "hidepopover", + /* test case sensitivity */ + "tOgGlEpOpOvEr", + "hIdEpOpOvEr", + ].forEach((action) => { + promise_test( + async function (t) { + t.add_cleanup(resetState); + if (action !== null) invokerbutton.invokeAction = action; + invokee.showPopover(); + assert_true(invokee.matches(":popover-open")); + await clickOn(invokerbutton); + assert_false(invokee.matches(":popover-open")); + }, + `invoking (as ${ + action === null ? "auto" : action || "explicit empty" + }) open popover closes`, + ); + + promise_test( + async function (t) { + t.add_cleanup(resetState); + if (action !== null) containedinvoker.invokeAction = action; + invokee.showPopover(); + assert_true(invokee.matches(":popover-open")); + await clickOn(containedinvoker); + assert_false(invokee.matches(":popover-open")); + }, + `invoking (as ${ + action === null ? "auto" : action || "explicit empty" + }) from within open popover closes`, + ); + + promise_test( + async function (t) { + t.add_cleanup(resetState); + if (action !== null) invcontainedinvokervokeaction = action; + invokee.showPopover(); + invokee.addEventListener("invoke", (e) => e.preventDefault(), { + once: true, + }); + assert_true(invokee.matches(":popover-open")); + await clickOn(containedinvoker); + assert_true(invokee.matches(":popover-open")); + }, + `invoking (as ${ + action === null ? "auto" : action || "explicit empty" + }) open popover with preventDefault does not close`, + ); + }); + + // showpopover specific + promise_test(async function (t) { + t.add_cleanup(resetState); invokerbutton.setAttribute("invokeaction", "showpopover"); - t.add_cleanup(() => invokerbutton.removeAttribute("invokeaction")); - assert_false(invokee.matches(":popover-open")); - await clickOn(invokerbutton); - t.add_cleanup(() => invokee.hidePopover()); - assert_true(invokee.matches(":popover-open")); - }, "invoking (as showpopover) closed popover opens"); - - promise_test(async function (t) { - invokerbutton.setAttribute("invokeaction", "sHoWpOpOvEr"); - t.add_cleanup(() => invokerbutton.removeAttribute("invokeaction")); - assert_false(invokee.matches(":popover-open")); - await clickOn(invokerbutton); - t.add_cleanup(() => invokee.hidePopover()); - assert_true(invokee.matches(":popover-open")); - }, "invoking (as showpopover - case insensitive) closed popover opens"); - - promise_test(async function (t) { - invokerbutton.setAttribute("invokeaction", "showpopover"); - t.add_cleanup(() => invokerbutton.removeAttribute("invokeaction")); invokee.showPopover(); assert_true(invokee.matches(":popover-open")); await clickOn(invokerbutton); - t.add_cleanup(() => invokee.hidePopover()); assert_true(invokee.matches(":popover-open")); }, "invoking (as showpopover) open popover is noop"); + // hidepopover specific promise_test(async function (t) { - invokerbutton.setAttribute("invokeaction", "showpopover"); - t.add_cleanup(() => invokerbutton.removeAttribute("invokeaction")); - assert_false(invokee.matches(":popover-open")); - invokee.addEventListener("invoke", (e) => e.preventDefault(), { - once: true, - }); - await clickOn(invokerbutton); - t.add_cleanup(() => invokee.hidePopover()); - assert_false(invokee.matches(":popover-open")); - }, "invoking (as showpopover) closed popover with preventDefault does not open"); - - // hidepopover - - promise_test(async function (t) { + t.add_cleanup(resetState); invokerbutton.setAttribute("invokeaction", "hidepopover"); - t.add_cleanup(() => invokerbutton.removeAttribute("invokeaction")); assert_false(invokee.matches(":popover-open")); await clickOn(invokerbutton); assert_false(invokee.matches(":popover-open")); }, "invoking (as hidepopover) closed popover is noop"); - - promise_test(async function (t) { - containedinvoker.setAttribute("invokeaction", "hidepopover"); - t.add_cleanup(() => containedinvoker.removeAttribute("invokeaction")); - invokee.showPopover(); - assert_true(invokee.matches(":popover-open")); - await clickOn(containedinvoker); - t.add_cleanup(() => invokee.hidePopover()); - assert_false(invokee.matches(":popover-open")); - }, "invoking (as hidepopover) open popover closes"); - - promise_test(async function (t) { - containedinvoker.setAttribute("invokeaction", "hIdEpOpOvEr"); - t.add_cleanup(() => containedinvoker.removeAttribute("invokeaction")); - invokee.showPopover(); - assert_true(invokee.matches(":popover-open")); - await clickOn(containedinvoker); - t.add_cleanup(() => invokee.hidePopover()); - assert_false(invokee.matches(":popover-open")); - }, "invoking (as hidepopover - case insensitive) open popover closes"); - - promise_test(async function (t) { - containedinvoker.setAttribute("invokeaction", "hidepopover"); - t.add_cleanup(() => containedinvoker.removeAttribute("invokeaction")); - invokee.showPopover(); - t.add_cleanup(() => invokee.hidePopover()); - assert_true(invokee.matches(":popover-open")); - invokee.addEventListener("invoke", (e) => e.preventDefault(), { - once: true, - }); - await clickOn(containedinvoker); - assert_true(invokee.matches(":popover-open")); - }, "invoking (as hidepopover) open popover with preventDefault does not close"); - - // invalid - - ["foo", "togglemodal", "showpicker", "toggle", "open", "close"].forEach(action => { - promise_test(async function (t) { - invokerbutton.setAttribute("invokeaction", action); - t.add_cleanup(() => invokerbutton.removeAttribute("invokeaction")); - assert_false(invokee.matches(":popover-open")); - await clickOn(invokerbutton); - assert_false(invokee.matches(":popover-open")); - }, `invoking (as ${action}) on popover does nothing`); - - promise_test(async function (t) { - invokerbutton.setAttribute("invokeaction", action); - t.add_cleanup(() => { - invokerbutton.removeAttribute("invokeaction") - invokee.hidePopover(); - }); - invokee.showPopover() - assert_true(invokee.matches(":popover-open")); - await clickOn(invokerbutton); - assert_true(invokee.matches(":popover-open")); - }, `invoking (as ${action}) on open popover does nothing`); - }) </script> diff --git a/testing/web-platform/tests/html/semantics/invokers/invoketarget-on-popover-invalid-behavior.tentative.html b/testing/web-platform/tests/html/semantics/invokers/invoketarget-on-popover-invalid-behavior.tentative.html new file mode 100644 index 0000000000..755f3a6777 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/invokers/invoketarget-on-popover-invalid-behavior.tentative.html @@ -0,0 +1,47 @@ +<!doctype html> +<meta charset="utf-8" /> +<meta name="author" title="Keith Cirkel" href="mailto:wpt@keithcirkel.co.uk" /> +<meta name="timeout" content="long" /> +<link rel="help" href="https://open-ui.org/components/invokers.explainer/" /> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/resources/testdriver.js"></script> +<script src="/resources/testdriver-actions.js"></script> +<script src="/resources/testdriver-vendor.js"></script> +<script src="resources/invoker-utils.js"></script> + +<div id="invokee" popover> + <button id="containedinvoker" invoketarget="invokee"></button> +</div> +<button id="invokerbutton" invoketarget="invokee"></button> + +<script> + function resetState() { + invokerbutton.removeAttribute("invokeaction"); + containedinvoker.removeAttribute("invokeaction"); + try { + invokee.hidePopover(); + } catch {} + invokee.setAttribute("popover", ""); + } + + // invalid actions on showpopover + ["foo-bar", "showmodal", "showpicker", "open", "close"].forEach((action) => { + promise_test(async function (t) { + t.add_cleanup(resetState); + invokerbutton.invokeAction = action; + assert_false(invokee.matches(":popover-open")); + await clickOn(invokerbutton); + assert_false(invokee.matches(":popover-open")); + }, `invoking (as ${action}) on popover does nothing`); + + promise_test(async function (t) { + t.add_cleanup(resetState); + invokerbutton.invokeAction = action; + invokee.showPopover(); + assert_true(invokee.matches(":popover-open")); + await clickOn(invokerbutton); + assert_true(invokee.matches(":popover-open")); + }, `invoking (as ${action}) on open popover does nothing`); + }); +</script> diff --git a/testing/web-platform/tests/html/semantics/invokers/invoketarget-on-video-behavior.tentative.html b/testing/web-platform/tests/html/semantics/invokers/invoketarget-on-video-behavior.tentative.html index 5bbcd83e72..d15d6f9584 100644 --- a/testing/web-platform/tests/html/semantics/invokers/invoketarget-on-video-behavior.tentative.html +++ b/testing/web-platform/tests/html/semantics/invokers/invoketarget-on-video-behavior.tentative.html @@ -1,6 +1,7 @@ <!doctype html> <meta charset="utf-8" /> <meta name="author" title="Luke Warlow" href="mailto:luke@warlow.dev" /> +<meta name="timeout" content="long" /> <link rel="help" href="https://open-ui.org/components/invokers.explainer/" /> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> @@ -25,7 +26,7 @@ assert_true(invokee.paused); invokerbutton.setAttribute("invokeaction", ""); await clickOn(invokerbutton); - await new Promise(resolve => { + await new Promise((resolve) => { requestAnimationFrame(resolve); }); assert_true(invokee.paused); @@ -43,7 +44,7 @@ assert_true(invokee.paused); invokerbutton.setAttribute("invokeaction", "playpause"); await clickOn(invokerbutton); - await new Promise(resolve => { + await new Promise((resolve) => { requestAnimationFrame(resolve); }); assert_false(invokee.paused); @@ -62,7 +63,7 @@ assert_true(invokee.paused); invokerbutton.setAttribute("invokeaction", "playpause"); await clickOn(invokerbutton); - await new Promise(resolve => { + await new Promise((resolve) => { requestAnimationFrame(resolve); }); assert_true(invokee.paused); @@ -75,12 +76,12 @@ invokee.currentTime = 0; invokee.muted = false; }); - await test_driver.bless('play video'); + await test_driver.bless("play video"); invokee.play(); assert_false(invokee.paused); invokerbutton.setAttribute("invokeaction", "playpause"); await clickOn(invokerbutton); - await new Promise(resolve => { + await new Promise((resolve) => { requestAnimationFrame(resolve); }); assert_true(invokee.paused); @@ -98,7 +99,7 @@ assert_true(invokee.paused); invokerbutton.setAttribute("invokeaction", "play"); await clickOn(invokerbutton); - await new Promise(resolve => { + await new Promise((resolve) => { requestAnimationFrame(resolve); }); assert_false(invokee.paused); @@ -112,12 +113,12 @@ invokee.muted = false; }); invokee.addEventListener("invoke", (e) => e.preventDefault(), { - once: true, + once: true, }); assert_true(invokee.paused); invokerbutton.setAttribute("invokeaction", "play"); await clickOn(invokerbutton); - await new Promise(resolve => { + await new Promise((resolve) => { requestAnimationFrame(resolve); }); assert_true(invokee.paused); @@ -130,12 +131,12 @@ invokee.currentTime = 0; invokee.muted = false; }); - await test_driver.bless('play video'); + await test_driver.bless("play video"); invokee.play(); assert_false(invokee.paused); invokerbutton.setAttribute("invokeaction", "play"); await clickOn(invokerbutton); - await new Promise(resolve => { + await new Promise((resolve) => { requestAnimationFrame(resolve); }); assert_false(invokee.paused); @@ -153,7 +154,7 @@ assert_true(invokee.paused); invokerbutton.setAttribute("invokeaction", "pause"); await clickOn(invokerbutton); - await new Promise(resolve => { + await new Promise((resolve) => { requestAnimationFrame(resolve); }); assert_true(invokee.paused); @@ -167,12 +168,12 @@ invokee.muted = false; }); invokee.addEventListener("invoke", (e) => e.preventDefault(), { - once: true, + once: true, }); assert_true(invokee.paused); invokerbutton.setAttribute("invokeaction", "pause"); await clickOn(invokerbutton); - await new Promise(resolve => { + await new Promise((resolve) => { requestAnimationFrame(resolve); }); assert_true(invokee.paused); @@ -185,12 +186,12 @@ invokee.currentTime = 0; invokee.muted = false; }); - await test_driver.bless('play video'); + await test_driver.bless("play video"); invokee.play(); assert_false(invokee.paused); invokerbutton.setAttribute("invokeaction", "pause"); await clickOn(invokerbutton); - await new Promise(resolve => { + await new Promise((resolve) => { requestAnimationFrame(resolve); }); assert_true(invokee.paused); @@ -208,7 +209,7 @@ assert_false(invokee.muted); invokerbutton.setAttribute("invokeaction", "toggleMuted"); await clickOn(invokerbutton); - await new Promise(resolve => { + await new Promise((resolve) => { requestAnimationFrame(resolve); }); assert_true(invokee.muted); @@ -222,12 +223,12 @@ invokee.muted = false; }); invokee.addEventListener("invoke", (e) => e.preventDefault(), { - once: true, + once: true, }); assert_false(invokee.muted); invokerbutton.setAttribute("invokeaction", "toggleMuted"); await clickOn(invokerbutton); - await new Promise(resolve => { + await new Promise((resolve) => { requestAnimationFrame(resolve); }); assert_false(invokee.muted); @@ -244,10 +245,9 @@ assert_true(invokee.muted); invokerbutton.setAttribute("invokeaction", "toggleMuted"); await clickOn(invokerbutton); - await new Promise(resolve => { + await new Promise((resolve) => { requestAnimationFrame(resolve); }); assert_false(invokee.muted); }, "invoking muted video with toggleMuted action unmutes it"); - </script> diff --git a/testing/web-platform/tests/html/semantics/invokers/resources/invoker-utils.js b/testing/web-platform/tests/html/semantics/invokers/resources/invoker-utils.js index 8420f24b6f..4261f9c0d3 100644 --- a/testing/web-platform/tests/html/semantics/invokers/resources/invoker-utils.js +++ b/testing/web-platform/tests/html/semantics/invokers/resources/invoker-utils.js @@ -14,3 +14,14 @@ async function clickOn(element) { .send(); await waitForRender(); } +async function hoverOver(element) { + await waitForRender(); + let rect = element.getBoundingClientRect(); + let actions = new test_driver.Actions(); + // FIXME: Switch to pointerMove(0, 0, {origin: element}) once + // https://github.com/web-platform-tests/wpt/issues/41257 is fixed. + await actions + .pointerMove(Math.round(rect.x + rect.width / 2), Math.round(rect.y + rect.height / 2), {}) + .send(); + await waitForRender(); +} diff --git a/testing/web-platform/tests/html/semantics/permission-element/bounded-css-properties-reference-expected.html b/testing/web-platform/tests/html/semantics/permission-element/bounded-css-properties-reference-expected.html new file mode 100644 index 0000000000..c62ff5b24d --- /dev/null +++ b/testing/web-platform/tests/html/semantics/permission-element/bounded-css-properties-reference-expected.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<meta charset=utf-8> +<body> + <div> + The permission element should have some limits for specific properties: + <ul> + <li>font-weight is adjusted to be at least 200.</li> + <li>font-style should only have "normal" or "italic" values.</li> + <li>word-spacing should be at most 0.5 of the font size, and non-negative.</li> + <li>letter-spacing should be between -0.05 and 0.2 of the font size.</li> + </ul> + </div> + +<style> + #id1 { + font-weight: 200; + font-style: normal; + word-spacing: 0.5em; + font-size: 100px; + height: auto; + width: auto; + letter-spacing: 20px; + } + #id2 { + word-spacing: 0em; + height: auto; + width: auto; + font-size: 10px; + letter-spacing: -0.5px; + } +</style> + +<permission id="id1" type="geolocation"> +<permission id="id2" type="camera"> +</body>
\ No newline at end of file diff --git a/testing/web-platform/tests/html/semantics/permission-element/bounded-css-properties-reference.tentative.html b/testing/web-platform/tests/html/semantics/permission-element/bounded-css-properties-reference.tentative.html new file mode 100644 index 0000000000..b8337ab87d --- /dev/null +++ b/testing/web-platform/tests/html/semantics/permission-element/bounded-css-properties-reference.tentative.html @@ -0,0 +1,37 @@ +<!DOCTYPE html> +<meta charset=utf-8> +<link rel="match" href="bounded-css-properties-reference-expected.html"> +<link rel="help" href="https://github.com/WICG/PEPC/blob/main/explainer.md#locking-the-pepc-style"> +<body> + <div> + The permission element should have some limits for specific properties: + <ul> + <li>font-weight is adjusted to be at least 200.</li> + <li>font-style should only have "normal" or "italic" values.</li> + <li>word-spacing should be at most 0.5 of the font size, and non-negative.</li> + <li>letter-spacing should be between -0.05 and 0.2 of the font size.</li> + </ul> + </div> + +<style> + #id1 { + font-weight: 100; + font-style: oblique 30deg; + word-spacing: 1em; + font-size: 100px; + height: auto; + width: auto; + letter-spacing: 25px; + } + #id2 { + word-spacing: -1000px; + height: auto; + width: auto; + font-size: 10px; + letter-spacing: -1px; + } +</style> + +<permission id="id1" type="geolocation"> +<permission id="id2" type="camera"> +</body>
\ No newline at end of file diff --git a/testing/web-platform/tests/html/semantics/permission-element/bounded-css-properties.html b/testing/web-platform/tests/html/semantics/permission-element/bounded-css-properties.html deleted file mode 100644 index 98c3d70e98..0000000000 --- a/testing/web-platform/tests/html/semantics/permission-element/bounded-css-properties.html +++ /dev/null @@ -1,38 +0,0 @@ -<!DOCTYPE html> -<meta charset=utf-8> -<script src="/resources/testharness.js"></script> -<script src="/resources/testharnessreport.js"></script> -<body> -<!--The permission element should have some limits for specific properties: - * font-weight is adjusted to be at least 200. - * font-style should only have "normal" or "italic" values. ---> -<style> - #id1 { - font-weight: 100; - font-style: oblique 30deg; - } - #id2 { - font-weight: 300; - font-style: italic; - } -</style> - - -<permission id="id1" type="geolocation"> -<permission id="id2" type="camera"> - -<script> - test(function(){ - var el_outside_bounds = document.getElementById("id1"); - assert_equals(getComputedStyle(el_outside_bounds).fontWeight, "200", "font-weight"); - assert_equals(getComputedStyle(el_outside_bounds).fontStyle, "normal", "font-style"); - }, "Properties with out-of-bounds values should be corrected"); - - test(function(){ - var el_inside_bounds = document.getElementById("id2"); - assert_equals(getComputedStyle(el_inside_bounds).fontWeight, "300", "font-weight"); - assert_equals(getComputedStyle(el_inside_bounds).fontStyle, "italic", "font-style"); - }, "Properties with values in bounds should not be modified"); -</script> -</body>
\ No newline at end of file diff --git a/testing/web-platform/tests/html/semantics/permission-element/bounded-css-properties.tentative.html b/testing/web-platform/tests/html/semantics/permission-element/bounded-css-properties.tentative.html new file mode 100644 index 0000000000..c0f0fe3454 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/permission-element/bounded-css-properties.tentative.html @@ -0,0 +1,64 @@ +<!DOCTYPE html> +<meta charset=utf-8> +<link rel="help" href="https://github.com/WICG/PEPC/blob/main/explainer.md#locking-the-pepc-style"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<body> +<!--The permission element should have some limits for specific properties: + * font-weight is adjusted to be at least 200. + * font-style should only have "normal" or "italic" values. + * word-spacing should be at most 0.5 of the font size, and non-negative. + * letter-spacing should be between -0.05 and 0.2 of the font size. +--> +<style> + #id-over-bounds { + font-weight: 100; + font-style: oblique 30deg; + word-spacing: 1em; + font-size: 100px; + letter-spacing: 21px; + } + #id-under-bounds { + word-spacing: -1px; + font-size: 100px; + letter-spacing: -6px; + } + #id-within-bounds { + font-weight: 300; + font-style: italic; + word-spacing: 0.4em; + font-size: 100px; + letter-spacing: 15px; + } +</style> + + +<permission id="id-over-bounds" type="geolocation"> +<permission id="id-under-bounds" type="camera"> +<permission id="id-within-bounds" type="microphone"> + +<script> + test(function(){ + var el = document.getElementById("id-over-bounds"); + assert_equals(getComputedStyle(el).fontWeight, "200", "font-weight"); + assert_equals(getComputedStyle(el).fontStyle, "normal", "font-style"); + assert_equals(getComputedStyle(el).wordSpacing, "50px", "word-spacing"); + assert_equals(getComputedStyle(el).letterSpacing, "20px", "letter-spacing"); + + el = document.getElementById("id-under-bounds"); + assert_equals(getComputedStyle(el).wordSpacing, "0px", "word-spacing, negative"); + assert_equals(getComputedStyle(el).letterSpacing, "-5px", "letter-spacing, negative"); + }, "Properties with out-of-bounds values should be corrected"); + + test(function(){ + var el = document.getElementById("id-within-bounds"); + assert_equals(getComputedStyle(el).fontWeight, "300", "font-weight"); + assert_equals(getComputedStyle(el).fontStyle, "italic", "font-style"); + assert_equals(getComputedStyle(el).wordSpacing, "40px", "word-spacing"); + assert_equals(getComputedStyle(el).letterSpacing, "15px", "letter-spacing"); + + el.style.letterSpacing = "-4px"; + assert_equals(getComputedStyle(el).letterSpacing, "-4px", "letter-spacing, negative"); + }, "Properties with values in bounds should not be modified"); +</script> +</body>
\ No newline at end of file diff --git a/testing/web-platform/tests/html/semantics/permission-element/display-css-property-reference-expected.html b/testing/web-platform/tests/html/semantics/permission-element/display-css-property-reference-expected.html new file mode 100644 index 0000000000..6a04c94c03 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/permission-element/display-css-property-reference-expected.html @@ -0,0 +1,16 @@ +<!DOCTYPE html> +<meta charset=utf-8> +<body> + <div> + The permission element should either be display 'none' or 'inline-block' + </div> + +<style> + #id1 { + display: inline-block; + } +</style> + +<permission id="id1" type="geolocation"> +<span>After element</span> +</body>
\ No newline at end of file diff --git a/testing/web-platform/tests/html/semantics/permission-element/display-css-property-reference.tentative.html b/testing/web-platform/tests/html/semantics/permission-element/display-css-property-reference.tentative.html new file mode 100644 index 0000000000..973a76d723 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/permission-element/display-css-property-reference.tentative.html @@ -0,0 +1,22 @@ +<!DOCTYPE html> +<meta charset=utf-8> +<link rel="match" href="display-css-property-reference-expected.html"> +<link rel="help" href="https://github.com/WICG/PEPC/blob/main/explainer.md#locking-the-pepc-style"> +<body> + <div> + The permission element should either be display 'none' or 'inline-block' + </div> + +<style> + #id1 { + display: flex; + } + #id2 { + display: none; + } +</style> + +<permission id="id1" type="geolocation"> +<permission id="id2" type="camera"> +<span>After element</span> +</body>
\ No newline at end of file diff --git a/testing/web-platform/tests/html/semantics/permission-element/display-css-property.tentative.html b/testing/web-platform/tests/html/semantics/permission-element/display-css-property.tentative.html new file mode 100644 index 0000000000..7aa22ef4a2 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/permission-element/display-css-property.tentative.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<meta charset=utf-8> +<link rel="help" href="https://github.com/WICG/PEPC/blob/main/explainer.md#locking-the-pepc-style"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<body> +<!-- + 'display' should either be 'none' or 'inline-block' +--> +<style> + #id1 { + display: inline-block; + } + #id2 { + display: block; + } + #id3 { + display: none; + } +</style> + + +<permission id="id1" type="geolocation"> +<permission id="id2" type="camera"> +<permission id="id3" type="microphone"> + +<script> + test(function(){ + assert_equals(getComputedStyle(document.getElementById("id1")).display, "inline-block", "'inline-block' should be kept"); + assert_equals(getComputedStyle(document.getElementById("id2")).display, "inline-block", "'block' should be changed to 'inline-block'"); + assert_equals(getComputedStyle(document.getElementById("id3")).display, "none", "'none' should be kept"); + }, "'display' should be either 'inline-block' or 'none'"); +</script> +</body>
\ No newline at end of file diff --git a/testing/web-platform/tests/html/semantics/permission-element/invalid-css-properties.html b/testing/web-platform/tests/html/semantics/permission-element/invalid-css-properties.tentative.html index c7186563f0..334280c83b 100644 --- a/testing/web-platform/tests/html/semantics/permission-element/invalid-css-properties.html +++ b/testing/web-platform/tests/html/semantics/permission-element/invalid-css-properties.tentative.html @@ -1,5 +1,6 @@ <!DOCTYPE html> <meta charset=utf-8> +<link rel="help" href="https://github.com/WICG/PEPC/blob/main/explainer.md#locking-the-pepc-style"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <body> diff --git a/testing/web-platform/tests/html/semantics/permission-element/negative-offset-and-margin.html b/testing/web-platform/tests/html/semantics/permission-element/negative-offset-and-margin.tentative.html index 97290bb4df..de622bbb3e 100644 --- a/testing/web-platform/tests/html/semantics/permission-element/negative-offset-and-margin.html +++ b/testing/web-platform/tests/html/semantics/permission-element/negative-offset-and-margin.tentative.html @@ -1,5 +1,6 @@ <!DOCTYPE html> <meta charset=utf-8> +<link rel="help" href="https://github.com/WICG/PEPC/blob/main/explainer.md#locking-the-pepc-style"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <body> diff --git a/testing/web-platform/tests/html/semantics/permission-element/no-end-tag-no-contents.html b/testing/web-platform/tests/html/semantics/permission-element/no-end-tag-no-contents.tentative.html index 5fcce1421b..bea3d7102c 100644 --- a/testing/web-platform/tests/html/semantics/permission-element/no-end-tag-no-contents.html +++ b/testing/web-platform/tests/html/semantics/permission-element/no-end-tag-no-contents.tentative.html @@ -1,5 +1,6 @@ <!DOCTYPE html> <meta charset=utf-8> +<link rel="help" href="https://github.com/WICG/PEPC/blob/main/explainer.md#locking-the-pepc-style"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <body> diff --git a/testing/web-platform/tests/html/semantics/popovers/button-type-reset-popovertarget.tentative.html b/testing/web-platform/tests/html/semantics/popovers/button-type-reset-popovertarget.tentative.html new file mode 100644 index 0000000000..975eab0d66 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/popovers/button-type-reset-popovertarget.tentative.html @@ -0,0 +1,43 @@ +<!DOCTYPE html> +<link rel=author href="mailto:jarhar@chromium.org"> +<link rel=help href="https://issues.chromium.org/issues/329118508"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> + +<div id=mypopover popover=auto>popover</div> + +<iframe name=foo></iframe> +<form target=foo action="about:blank"> + <button id=reset-in-form type=reset popovertarget=mypopover>reset</button> + <button id=submit-in-form type=submit popovertarget=mypopover>submit</button> + <button id=button-in-form type=button popovertarget=mypopover>type=button</button> +</form> + +<button id=reset-outside-form type=reset popovertarget=mypopover>reset</button> +<button id=submit-outside-form type=submit popovertarget=mypopover>submit</button> +<button id=button-outside-form type=button popovertarget=mypopover>type=button</button> + +<script> +test(() => { + const testButton = (id, expectedToToggle) => { + document.getElementById(id).click(); + if (expectedToToggle) { + assert_true(mypopover.matches(':popover-open'), + `${id}: button should open the popover.`); + } else { + assert_false(mypopover.matches(':popover-open'), + `${id}: button should not open the popover.`); + } + if (mypopover.matches(':popover-open')) { + mypopover.hidePopover(); + } + }; + + testButton('reset-in-form', false); + testButton('submit-in-form', false); + testButton('button-in-form', true); + testButton('reset-outside-form', true); + testButton('submit-outside-form', true); + testButton('button-outside-form', true); +}, 'Button type=reset and type=submit should not run popover algorithms when in a form.'); +</script> diff --git a/testing/web-platform/tests/html/semantics/popovers/popover-anchor-display.tentative.html b/testing/web-platform/tests/html/semantics/popovers/popover-anchor-display.tentative.html index d50dd6c857..bddc44006d 100644 --- a/testing/web-platform/tests/html/semantics/popovers/popover-anchor-display.tentative.html +++ b/testing/web-platform/tests/html/semantics/popovers/popover-anchor-display.tentative.html @@ -94,7 +94,7 @@ showDefaultopenPopoversOnLoad(); top: anchor(top); } #popover5 { - anchor-default: --anchor1; /* shouldn't be used */ + position-anchor: --anchor1; /* shouldn't be used */ left: anchor(implicit right); top: anchor(implicit top); } @@ -102,7 +102,7 @@ showDefaultopenPopoversOnLoad(); anchor-name: --anchor6; } #popover6 { - anchor-default: --anchor6; + position-anchor: --anchor6; left: anchor(right); /* shouldn't use the implicit anchor */ top: anchor(top); } diff --git a/testing/web-platform/tests/html/semantics/popovers/popover-anchor-scroll-display.tentative.html b/testing/web-platform/tests/html/semantics/popovers/popover-anchor-scroll-display.tentative.html index 7ed6cf1adf..2c6b0bafb9 100644 --- a/testing/web-platform/tests/html/semantics/popovers/popover-anchor-scroll-display.tentative.html +++ b/testing/web-platform/tests/html/semantics/popovers/popover-anchor-scroll-display.tentative.html @@ -56,7 +56,7 @@ anchor-name: --anchor2; } #popover2 { - anchor-default: --anchor2; + position-anchor: --anchor2; left: anchor(right); top: anchor(top); } diff --git a/testing/web-platform/tests/html/semantics/popovers/popover-light-dismiss.html b/testing/web-platform/tests/html/semantics/popovers/popover-light-dismiss.html index 916d52ef5e..45db242e91 100644 --- a/testing/web-platform/tests/html/semantics/popovers/popover-light-dismiss.html +++ b/testing/web-platform/tests/html/semantics/popovers/popover-light-dismiss.html @@ -11,6 +11,19 @@ <script src="/resources/testdriver-vendor.js"></script> <script src="resources/popover-utils.js"></script> +<style> + [popover] { + /* Position most popovers at the bottom-right, out of the way */ + inset:auto; + bottom:0; + right:0; + } + [popover]::backdrop { + /* This should *not* affect anything: */ + pointer-events: auto; + } +</style> + <button id=b1t popovertarget='p1'>Popover 1</button> <button id=b1s popovertarget='p1' popovertargetaction=show>Popover 1</button> <span id=outside>Outside all popovers</span> @@ -26,11 +39,6 @@ <style> #p1 {top: 50px;} #p2 {top: 120px;} - [popover] {bottom:auto;} - [popover]::backdrop { - /* This should *not* affect anything: */ - pointer-events: auto; - } </style> <script> const popover1 = document.querySelector('#p1'); @@ -584,24 +592,50 @@ promise_test(async () => { <div id=p29 popover>Popover 29</div> <button id=b29 popovertarget=p29>Open popover 29</button> -<iframe id=iframe29 width=100 height=100></iframe> +<iframe id=iframe29 width=100 height=30></iframe> <script> promise_test(async () => { let iframe_url = (new URL("/common/blank.html", location.href)).href; iframe29.src = iframe_url; iframe29.contentDocument.body.style.height = '100%'; - assert_false(p29.matches(':popover-open')); + assert_false(p29.matches(':popover-open'),'initially hidden'); p29.showPopover(); - assert_true(p29.matches(':popover-open')); + assert_true(p29.matches(':popover-open'),'showing'); let actions = new test_driver.Actions(); await actions.pointerMove(0,0,{origin: b29}) .pointerDown({button: actions.ButtonType.LEFT}) .send(); + await waitForRender(); + assert_true(p29.matches(':popover-open'),'showing after pointerdown'); actions = new test_driver.Actions(); await actions.pointerMove(0,0,{origin: iframe29.contentDocument.body}) .pointerUp({button: actions.ButtonType.LEFT}) .send(); - assert_true(p29.matches(':popover-open')); + await waitForRender(); + assert_true(p29.matches(':popover-open'),'showing after pointerup'); },`Pointer down in one document and pointer up in another document shouldn't dismiss popover`); </script> + +<div id=p30 popover>Popover 30</div> +<button id=b30 popovertarget=p30>Open popover 30</button> +<button id=b30b>Non-invoker</button> +<script> +promise_test(async () => { + assert_false(p30.matches(':popover-open'),'initially hidden'); + p30.showPopover(); + assert_true(p30.matches(':popover-open'),'showing'); + let actions = new test_driver.Actions(); + await actions.pointerMove(0,0,{origin: b30}) + .pointerDown({button: actions.ButtonType.LEFT}) + .send(); + await waitForRender(); + assert_true(p30.matches(':popover-open'),'showing after pointerdown'); + actions = new test_driver.Actions(); + await actions.pointerMove(0,0,{origin: b30b}) + .pointerUp({button: actions.ButtonType.LEFT}) + .send(); + await waitForRender(); + assert_true(p30.matches(':popover-open'),'showing after pointerup'); +},`Pointer down inside invoker and up outside that invoker shouldn't dismiss popover`); +</script> diff --git a/testing/web-platform/tests/html/semantics/popovers/popover-top-layer-nesting.tentative.html b/testing/web-platform/tests/html/semantics/popovers/popover-top-layer-nesting.html index a0b3b60b72..a0b3b60b72 100644 --- a/testing/web-platform/tests/html/semantics/popovers/popover-top-layer-nesting.tentative.html +++ b/testing/web-platform/tests/html/semantics/popovers/popover-top-layer-nesting.html diff --git a/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/css-module/integrity.html b/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/css-module/integrity.html index 1dd0dad470..7ee6452bcc 100644 --- a/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/css-module/integrity.html +++ b/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/css-module/integrity.html @@ -12,7 +12,7 @@ window.matchesEvents = []; window.mismatchesLog = []; window.mismatchesEvents = []; </script> -<script type="module" src="resources/integrity-matches.js" integrity="sha384-xvbfmg9iJFHqmCoOS4VNMCwnFPPxEoIlW1Ojzl+fgEd+Wf8Pyez+SMWue+KNovjA" onload="window.matchesEvents.push('load');" onerror="window.matchesEvents.push('error')"></script> +<script type="module" src="resources/integrity-matches.js" integrity="sha384-KtvB2Fgbhx2NAEizVeuGMa+QgvBzlBvVRxdpRnIECuGUvzzQsnVejyDL5J0fVP9M" onload="window.matchesEvents.push('load');" onerror="window.matchesEvents.push('error')"></script> <script type="module" src="resources/integrity-mismatches.js" integrity="sha384-doesnotmatch" onload="window.mismatchesEvents.push('load');" onerror="window.mismatchesEvents.push('error')"></script> <script type="module"> diff --git a/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/json-module/integrity.html b/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/json-module/integrity.html index 68a794b973..0aa92d9fdc 100644 --- a/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/json-module/integrity.html +++ b/testing/web-platform/tests/html/semantics/scripting-1/the-script-element/json-module/integrity.html @@ -12,7 +12,7 @@ window.matchesEvents = []; window.mismatchesLog = []; window.mismatchesEvents = []; </script> -<script type="module" src="integrity-matches.js" integrity="sha384-VmQQfGzBiLKdyzw4FA4kL4ohu4tyujV68ddgW1aN/1v3cBZNNBn2gDFdVQxfL7+a" onload="window.matchesEvents.push('load');" onerror="window.matchesEvents.push('error')"></script> +<script type="module" src="integrity-matches.js" integrity="sha384-kc1K2KFKQhnYE1AdnpmUUpFVnxz1GCgGbQ19e3zmXrZw23rgpwa9il4/pHp7NYWA" onload="window.matchesEvents.push('load');" onerror="window.matchesEvents.push('error')"></script> <script type="module" src="integrity-mismatches.js" integrity="sha384-doesnotmatch" onload="window.mismatchesEvents.push('load');" onerror="window.mismatchesEvents.push('error')"></script> <script type="module"> diff --git a/testing/web-platform/tests/html/webappapis/system-state-and-capabilities/the-navigator-object/navigator-window-controls-overlay.html b/testing/web-platform/tests/html/webappapis/system-state-and-capabilities/the-navigator-object/navigator-window-controls-overlay.tentative.html index 9cff8d3163..9cff8d3163 100644 --- a/testing/web-platform/tests/html/webappapis/system-state-and-capabilities/the-navigator-object/navigator-window-controls-overlay.html +++ b/testing/web-platform/tests/html/webappapis/system-state-and-capabilities/the-navigator-object/navigator-window-controls-overlay.tentative.html diff --git a/testing/web-platform/tests/html/webappapis/system-state-and-capabilities/the-navigator-object/navigator_user_agent.https.html b/testing/web-platform/tests/html/webappapis/system-state-and-capabilities/the-navigator-object/navigator_user_agent.https.tentative.html index 3fbe3eaa62..3fbe3eaa62 100644 --- a/testing/web-platform/tests/html/webappapis/system-state-and-capabilities/the-navigator-object/navigator_user_agent.https.html +++ b/testing/web-platform/tests/html/webappapis/system-state-and-capabilities/the-navigator-object/navigator_user_agent.https.tentative.html |