Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(62)

Side by Side Diff: third_party/WebKit/LayoutTests/fast/html/resources/hit-test.js

Issue 1618373002: Add tests for HTMLAreaElement coords/shape and processing model (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add comment in W3CImportExpectations. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/html/area-shape-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 setup({explicit_done: true});
2
3 var img = document.getElementById('img');
4 var area = document.getElementById('area');
5
6 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]];
7 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]];
8 var hitAll = [[area, 1, 1], [area, 1, 299], [area, 299, 1], [area, 299, 299], [a rea, 21, 41], [area, 101, 101]];
9 var hitCircle = [[area, 11, 40], [area, 29, 40], [area, 20, 31], [area, 20, 49], [img, 12, 32], [img, 28, 48], [img, 101, 101]];
10 var hitPoly = [[area, 101, 101], [area, 119, 101], [area, 101, 119], [img, 118, 118], [img, 3, 3], [img, 21, 41]];
11 var hitStar = [[area, 101, 101], [area, 199, 101], [area, 150, 51], [img, 150, 1 25], [img, 3, 3], [img, 21, 41]];
12
13 var tests;
14 // The test file should have `tests` defined as follows:
15 // tests = [
16 // {desc: string, shape: string?, coords: string?, hit: [[element, x, y], ...]},
17 // ...
18 // ];
19
20 onload = function() {
21 tests.forEach(function(t) {
22 test(function(t_obj) {
23 if (area.shape === null) {
24 area.removeAttribute('shape');
25 } else {
26 area.shape = t.shape;
27 }
28 if (area.coords === null) {
29 area.removeAttribute('coords');
30 } else {
31 area.coords = t.coords;
32 }
33 t.hit.forEach(function(arr) {
34 var expected = arr[0];
35 var x = arr[1];
36 var y = arr[2];
37 assert_equals(document.elementFromPoint(x, y), expected, 'elementFromPoi nt('+x+', '+y+')');
38 });
39 }, t.desc + ': ' + format_value(t.coords) + ' (' + t.shape + ')');
40 });
41 done();
42 };
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/html/area-shape-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698