diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /testing/web-platform/tests/2dcontext/hit-regions | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'testing/web-platform/tests/2dcontext/hit-regions')
3 files changed, 118 insertions, 0 deletions
diff --git a/testing/web-platform/tests/2dcontext/hit-regions/.gitkeep b/testing/web-platform/tests/2dcontext/hit-regions/.gitkeep new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/testing/web-platform/tests/2dcontext/hit-regions/.gitkeep diff --git a/testing/web-platform/tests/2dcontext/hit-regions/addHitRegions-NotSupportedError-01.html b/testing/web-platform/tests/2dcontext/hit-regions/addHitRegions-NotSupportedError-01.html new file mode 100644 index 000000000..05818aeb8 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/hit-regions/addHitRegions-NotSupportedError-01.html @@ -0,0 +1,89 @@ +<!DOCTYPE html> +<html lang="en"> +<head> +<meta charset="UTF-8"> +<title>Hit regions: addHitRegion throws NotSupportedError</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +</head> +<body> +<div id="log"></div> +<div style="display: none"><canvas id="canvas"><button id="button">button</button></canvas></div> + +<script> +test(function () { + assert_throws({ name: "NotSupportedError" }, + function () { + var canvas = document.getElementById("canvas"); + // Reset context + canvas.width = canvas.width; + var button = document.getElementById("button"); + var context = canvas.getContext("2d"); + + // Shapes are painted without affecting the current default path, + // http://www.w3.org/html/wg/drafts/2dcontext/html5_canvas_CR/#drawing-rectangles-to-the-canvas + context.fillRect(25, 25, 25, 25); + + // If the specified path has no pixels, throw a NotSupportedError exception and abort these steps. + // http://www.w3.org/html/wg/drafts/2dcontext/html5_canvas_CR/#hit-regions + context.addHitRegion({ id: "notsupportederror_fillRect", control: button }) + }, "fillRect should not affect current default path and NotSupportedError should be thrown."); +}, "fillRect should not affect current default path and NotSupportedError should be thrown."); + +test(function () { + assert_throws({ name: "NotSupportedError" }, + function () { + var canvas = document.getElementById("canvas"); + // Reset context + canvas.width = canvas.width; + var button = document.getElementById("button"); + var context = canvas.getContext("2d"); + + // "Shapes are painted without affecting the current default path," + // http://www.w3.org/html/wg/drafts/2dcontext/html5_canvas_CR/#drawing-rectangles-to-the-canvas + context.strokeRect(75, 25, 25, 25); + + // "If the specified path has no pixels, throw a NotSupportedError exception and abort these steps." + // http://www.w3.org/html/wg/drafts/2dcontext/html5_canvas_CR/#hit-regions + context.addHitRegion({ id: "notsupportederror_strokeRect", control: button }) + }, "strokeRect should not affect current default path and NotSupportedError should be thrown."); +}, "strokeRect should not affect current default path and NotSupportedError should be thrown."); + +test(function() { + assert_throws({ name: "NotSupportedError" }, + function () { + var canvas = document.getElementById("canvas"); + // Reset context + canvas.width = canvas.width; + var button = document.getElementById("button"); + var context = canvas.getContext("2d"); + + // "These shapes are painted without affecting the current path" + // http://www.w3.org/html/wg/drafts/2dcontext/html5_canvas_CR/#drawing-rectangles-to-the-canvas + context.fillText("fillText", 25, 100); + + // "If the specified path has no pixels, throw a NotSupportedError exception and abort these steps." + // http://www.w3.org/html/wg/drafts/2dcontext/html5_canvas_CR/#drawing-text-to-the-canvas + context.addHitRegion({ id: "notsupportederror_fillText", control: button }); + }, "fillText should not affect current default path and NotSupportedError should be thrown."); +}, "fillText should not affect current default path and NotSupportedError should be thrown."); + +test(function() { + assert_throws({ name: "NotSupportedError" }, + function () { + var canvas = document.getElementById("canvas"); + canvas.width = canvas.width; + var button = document.getElementById("button"); + var context = canvas.getContext("2d"); + // "These shapes are painted without affecting the current path" + // http://www.w3.org/html/wg/drafts/2dcontext/html5_canvas_CR/#drawing-rectangles-to-the-canvas + context.strokeText("strokeText", 75, 100); + + // "If the specified path has no pixels, throw a NotSupportedError exception and abort these steps." + // http://www.w3.org/html/wg/drafts/2dcontext/html5_canvas_CR/#drawing-text-to-the-canvas + context.addHitRegion({ id: "notsupportederror_strokeText", control: button }); + }, "strokeText should not affect current default path and NotSupportedError shuld be thrown."); +}, "strokeText should not affect current default path and NotSupportedError shuld be thrown."); +</script> +</body> +</html> diff --git a/testing/web-platform/tests/2dcontext/hit-regions/hitregions-members-exist.html b/testing/web-platform/tests/2dcontext/hit-regions/hitregions-members-exist.html new file mode 100644 index 000000000..b9203f560 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/hit-regions/hitregions-members-exist.html @@ -0,0 +1,29 @@ +<!DOCTYPE html> +<title>Canvas test: 2d.hitregions.members.exist</title> +<meta name="author" content="Constantine Kim"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<body> + +<h1>2d.hitregions.members.exist</h1> +<canvas></canvas> +<div id="log"></div> +<script> +test(function () { + var ctx = document.createElement('canvas').getContext('2d'); + assert_equals(typeof ctx.addHitRegion, 'function'); +}, 'context.addHitRegion Exists'); + +test(function () { + var ctx = document.createElement('canvas').getContext('2d'); + assert_equals(typeof ctx.removeHitRegion, 'function'); +}, 'context.removeHitRegion Exists'); + +test(function () { + var ctx = document.createElement('canvas').getContext('2d'); + assert_equals(typeof ctx.clearHitRegions, 'function'); +}, 'context.clearHitRegions Exists'); + +</script> +</body> +</html>
\ No newline at end of file |