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/html/semantics/embedded-content/the-area-element | |
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/html/semantics/embedded-content/the-area-element')
6 files changed, 173 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-area-element/.gitkeep b/testing/web-platform/tests/html/semantics/embedded-content/the-area-element/.gitkeep new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-area-element/.gitkeep diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-area-element/area-coords.html b/testing/web-platform/tests/html/semantics/embedded-content/the-area-element/area-coords.html new file mode 100644 index 000000000..9ec6f3e42 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-area-element/area-coords.html @@ -0,0 +1,47 @@ +<!doctype html> +<meta charset=utf-8> +<title>HTMLAreaElement coords parsing</title> +<script src=/resources/testharness.js></script> +<script src=/resources/testharnessreport.js></script> +<style> + body { margin: 0 } +</style> +<img src=/images/threecolors.png usemap=#x id=img width=300 height=300> +<map name=x><area id=area></map> +<script src=support/hit-test.js></script> +<script> +tests = [ + {desc: 'COMMA', shape: 'rect', coords: "2,2,10,10", hit: hitRect}, + {desc: 'SEMICOLON', shape: 'rect', coords: "2;2;10;10", hit: hitRect}, + {desc: 'SPACE', shape: 'rect', coords: "2 2 10 10", hit: hitRect}, + {desc: 'TAB', shape: 'rect', coords: "2\t2\t10\t10", hit: hitRect}, + {desc: 'FORM FEED', shape: 'rect', coords: "2\f2\f10\f10", hit: hitRect}, + {desc: 'LINE FEED', shape: 'rect', coords: "2\n2\n10\n10", hit: hitRect}, + {desc: 'CARRIGAGE RETURN', shape: 'rect', coords: "2\r2\r10\r10", hit: hitRect}, + {desc: 'LINE TABULATION', shape: 'rect', coords: "2\u000b2\u000b10\u000b10", hit: hitNone}, + {desc: 'LINE NEXT', shape: 'rect', coords: "2\u00852\u008510\u008510", hit: hitNone}, + {desc: 'EN QUAD', shape: 'rect', coords: "2\u20002\u200010\u200010", hit: hitNone}, + {desc: 'abc between numbers', shape: 'rect', coords: "2a2b20c20,2,10,10", hit: hitRect}, + {desc: 'COLON between numbers', shape: 'rect', coords: "2:2:20:20,2,10,10", hit: hitRect}, + {desc: 'U+0000 between numbers', shape: 'rect', coords: "2\u00002\u000020\u000020,2,10,10", hit: hitRect}, + {desc: 'leading COMMA', shape: 'rect', coords: ",2,2,10,10", hit: hitRect}, + {desc: 'leading SPACE', shape: 'rect', coords: " 2,2,10,10", hit: hitRect}, + {desc: 'leading SEMICOLON', shape: 'rect', coords: ";2,2,10,10", hit: hitRect}, + {desc: 'trailing COMMA', shape: 'rect', coords: "2,2,10,", hit: hitNone}, + {desc: 'trailing SPACE', shape: 'rect', coords: "2,2,10 ", hit: hitNone}, + {desc: 'trailing SEMICOLON', shape: 'rect', coords: "2,2,10;", hit: hitNone}, + {desc: 'PERCENT', shape: 'rect', coords: "2%,2%,10%,10%", hit: hitRect}, + {desc: 'CSS units', shape: 'rect', coords: "2in,2in,10cm,10cm", hit: hitRect}, + {desc: 'float', shape: 'rect', coords: "1.4,1.4,10,10", hit: hitRect}, + {desc: 'number starting with PERIOD', shape: 'rect', coords: ".4,.4,10,10", hit: [[area, 1, 1], [img, 0, 0]]}, + {desc: 'sci-not', shape: 'rect', coords: "2,2,1e1,1e1", hit: hitRect}, + {desc: 'leading/trailing garbage', shape: 'rect', coords: "='2,2,10,10' ", hit: hitRect}, + {desc: 'non-ascii garbage', shape: 'rect', coords: "“2,2,10,10\"", hit: hitRect}, + {desc: 'URL garbage with number', shape: 'rect', coords: "2,2,10ls/spain/holidays/regions/10/Canary+Islands/Canary+Islands.html", hit: hitNone}, + {desc: 'consecutive COMMAs', shape: 'rect', coords: "2,,10,10", hit: hitNone}, + {desc: 'consecutive SPACEs', shape: 'rect', coords: "2 10,10", hit: hitNone}, + {desc: 'consecutive SEMICOLONs', shape: 'rect', coords: "2;;10,10", hit: hitNone}, + {desc: 'several consecutive separators', shape: 'rect', coords: ",,2;,;2,;,10 \t\r\n10;;", hit: hitRect}, + {desc: 'one too many numbers, trailing COMMA', shape: 'poly', coords: "100,100,120,100,100,120,300,", hit: hitPoly}, +]; +</script> diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-area-element/area-processing.html b/testing/web-platform/tests/html/semantics/embedded-content/the-area-element/area-processing.html new file mode 100644 index 000000000..d1c3a83dd --- /dev/null +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-area-element/area-processing.html @@ -0,0 +1,32 @@ +<!doctype html> +<meta charset=utf-8> +<title>HTMLAreaElement processing</title> +<script src=/resources/testharness.js></script> +<script src=/resources/testharnessreport.js></script> +<style> + body { margin: 0 } +</style> +<img src=/images/threecolors.png usemap=#x id=img width=300 height=300> +<map name=x><area id=area></map> +<script src=support/hit-test.js></script> +<script> +var tests = [ + {desc: 'too few numbers', shape: 'rect', coords: "2,2,10", hit: hitNone}, + {desc: 'negative', shape: 'rect', coords: "-10,-10,10,10", hit: [[area, 1, 1], [img, 299, 299]]}, + {desc: 'empty string', shape: 'rect', coords: "", hit: hitNone}, + {desc: 'omitted coords', shape: 'rect', coords: null, hit: hitNone}, + {desc: 'first > third', shape: 'rect', coords: "10,2,2,10", hit: hitRect}, + {desc: 'second > fourth', shape: 'rect', coords: "2,10,10,2", hit: hitRect}, + {desc: 'first > third, second > fourth', shape: 'rect', coords: "10,10,2,2", hit: hitRect}, + + {desc: 'negative', shape: 'default', coords: "-10,-10,-10,-10", hit: hitAll}, + + {desc: 'too few numbers', shape: 'circle', coords: "20,40", hit: hitNone}, + {desc: 'negative radius', shape: 'circle', coords: "20,40,-10", hit: hitNone}, + {desc: 'zero radius', shape: 'circle', coords: "20,40,0", hit: hitNone}, + + {desc: 'too few numbers', shape: 'poly', coords: "100,100,120,100,100", hit: hitNone}, + {desc: 'one too many numbers', shape: 'poly', coords: "100,100,120,100,100,120,300", hit: hitPoly}, + {desc: 'even-odd rule', shape: 'poly', coords: "100,100,200,100,100,200,150,50,200,200", hit: hitStar}, +]; +</script> diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-area-element/area-shape.html b/testing/web-platform/tests/html/semantics/embedded-content/the-area-element/area-shape.html new file mode 100644 index 000000000..1ad0690f9 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-area-element/area-shape.html @@ -0,0 +1,36 @@ +<!doctype html> +<meta charset=utf-8> +<title>HTMLAreaElement shape</title> +<script src=/resources/testharness.js></script> +<script src=/resources/testharnessreport.js></script> +<style> + body { margin: 0 } +</style> +<img src=/images/threecolors.png usemap=#x id=img width=300 height=300> +<map name=x><area id=area></map> +<script src=support/hit-test.js></script> +<script> +var tests = [ + {desc: 'missing value default', shape: null, coords: "2,2,10,10", hit: hitRect}, + {desc: 'missing value default', shape: null, coords: "20,40,10", hit: hitNone}, + {desc: 'missing value default', shape: null, coords: null, hit: hitNone}, + {desc: 'invalid value default', shape: 'foobar invalid', coords: "2,2,10,10", hit: hitRect}, + {desc: 'invalid value default', shape: '', coords: "2,2,10,10", hit: hitRect}, + + {desc: 'empty string', shape: 'default', coords: "", hit: hitAll}, + {desc: 'omitted coords', shape: 'DEFAULT', coords: null, hit: hitAll}, + + {desc: 'simple', shape: 'rect', coords: "2,2,10,10", hit: hitRect}, + {desc: 'simple', shape: 'rectangle', coords: "2,2,10,10", hit: hitRect}, + + {desc: 'simple', shape: 'circle', coords: "20,40,10", hit: hitCircle}, + {desc: 'simple', shape: 'circ', coords: "20,40,10", hit: hitCircle}, + {desc: 'simple', shape: 'CIRCLE', coords: "20,40,10", hit: hitCircle}, + {desc: 'simple', shape: 'CIRC', coords: "20,40,10", hit: hitCircle}, + {desc: 'LATIN CAPITAL LETTER I WITH DOT ABOVE', shape: 'C\u0130RCLE', coords: "20,40,10", hit: hitNone}, + {desc: 'LATIN SMALL LETTER DOTLESS I', shape: 'c\u0131rcle', coords: "20,40,10", hit: hitNone}, + + {desc: 'simple', shape: 'poly', coords: "100,100,120,100,100,120", hit: hitPoly}, + {desc: 'simple', shape: 'polygon', coords: "100,100,120,100,100,120", hit: hitPoly}, +]; +</script> diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-area-element/area-stringifier.html b/testing/web-platform/tests/html/semantics/embedded-content/the-area-element/area-stringifier.html new file mode 100644 index 000000000..d06429630 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-area-element/area-stringifier.html @@ -0,0 +1,16 @@ +<!DOCTYPE html> +<title>HTMLAreaElement stringifier</title> +<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com"> +<link rel="help" href="https://heycam.github.io/webidl/#es-stringifier"> +<script src=/resources/testharness.js></script> +<script src=/resources/testharnessreport.js></script> +<script src=/common/stringifiers.js></script> +<div id=log></div> +<script> +test(function() { + test_stringifier_attribute(document.createElement("area"), "href", false); + var area = document.createElement("area"); + area.setAttribute("href", "foo"); + test_stringifier_attribute(area, "href", false); +}) +</script> diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-area-element/support/hit-test.js b/testing/web-platform/tests/html/semantics/embedded-content/the-area-element/support/hit-test.js new file mode 100644 index 000000000..54cda3e5c --- /dev/null +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-area-element/support/hit-test.js @@ -0,0 +1,42 @@ +setup({explicit_done: true}); + +var img = document.getElementById('img'); +var area = document.getElementById('area'); + +var hitRect = [[area, 3, 3], [area, 9, 9], [img, 1, 3], [img, 3, 1], [img, 11, 9], [img, 9, 11], [img, 21, 41], [img, 101, 101]]; +var hitNone = [[img, 3, 3], [img, 9, 9], [img, 1, 3], [img, 3, 1], [img, 11, 9], [img, 9, 11], [img, 21, 41], [img, 101, 101]]; +var hitAll = [[area, 1, 1], [area, 1, 299], [area, 299, 1], [area, 299, 299], [area, 21, 41], [area, 101, 101]]; +var hitCircle = [[area, 11, 40], [area, 29, 40], [area, 20, 31], [area, 20, 49], [img, 12, 32], [img, 28, 48], [img, 101, 101]]; +var hitPoly = [[area, 101, 101], [area, 119, 101], [area, 101, 119], [img, 118, 118], [img, 3, 3], [img, 21, 41]]; +var hitStar = [[area, 101, 101], [area, 199, 101], [area, 150, 51], [img, 150, 125], [img, 3, 3], [img, 21, 41]]; + +var tests; +// The test file should have `tests` defined as follows: +// tests = [ +// {desc: string, shape: string?, coords: string?, hit: [[element, x, y], ...]}, +// ... +// ]; + +onload = function() { + tests.forEach(function(t) { + test(function(t_obj) { + if (area.shape === null) { + area.removeAttribute('shape'); + } else { + area.shape = t.shape; + } + if (area.coords === null) { + area.removeAttribute('coords'); + } else { + area.coords = t.coords; + } + t.hit.forEach(function(arr) { + var expected = arr[0]; + var x = arr[1]; + var y = arr[2]; + assert_equals(document.elementFromPoint(x, y), expected, 'elementFromPoint('+x+', '+y+')'); + }); + }, t.desc + ': ' + format_value(t.coords) + ' (' + t.shape + ')'); + }); + done(); +}; |