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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/images/script-tests/imagemap-dynamic-area-updates.js

Issue 2255433002: Use testharness.js instead of js-test.js in fast/images. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changed test as per the comments. Created 4 years, 4 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/images/img-dimensions-styled-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 description("Test that when image map areas have their shape or coordinate dynam ically altered, the clickable region changes.");
2
3 if (!window.eventSender)
4 debug("This test will only work properly inside DRT.");
5
6 var image = document.createElement('img');
7 image.setAttribute('usemap', '#m');
8 image.style.width = '400px';
9 image.style.height = '400px';
10 image.style.border = '1px solid red';
11 image.style.position = 'absolute';
12 image.style.left = '0';
13 image.style.top = '0';
14
15 area = document.createElement('area');
16 area.setAttribute('href', '#');
17 area.setAttribute('onclick', 'areaClicked = true; return false;');
18
19 areaClicked = false;
20
21 var map = document.createElement('map');
22 map.setAttribute('name', 'm');
23 map.appendChild(area);
24
25 document.body.appendChild(image);
26 document.body.appendChild(map);
27
28 function setArea(shape, coords)
29 {
30 area.setAttribute('shape', shape);
31 area.setAttribute('coords', coords);
32 }
33
34 function checkForArea(x, y)
35 {
36 if (!window.eventSender)
37 return false;
38
39 areaClicked = false;
40
41 eventSender.mouseMoveTo(x, y);
42 eventSender.mouseDown();
43 eventSender.mouseUp();
44
45 return areaClicked;
46 }
47
48 shouldBe("setArea('default', ''); checkForArea(50, 50)", "true");
49
50 shouldBe("setArea('rect', '0, 0, 100, 100'); checkForArea(50, 50)", "true");
51 shouldBe("setArea('rect', '0, 0, 100, 100'); checkForArea(150, 150)", "false");
52
53 shouldBe("setArea('rect', '200, 200, 300, 300'); checkForArea(50, 50)", "false") ;
54 shouldBe("setArea('rect', '200, 200, 300, 300'); checkForArea(250, 250)", "true" );
55
56 shouldBe("setArea('circle', '100, 100, 50'); checkForArea(100, 100)", "true");
57 shouldBe("setArea('circle', '100, 100, 50'); checkForArea(120, 100)", "true");
58 shouldBe("setArea('circle', '100, 100, 50'); checkForArea(200, 100)", "false");
59
60 shouldBe("setArea('circle', '300, 300, 50'); checkForArea(100, 100)", "false");
61 shouldBe("setArea('circle', '300, 300, 50'); checkForArea(300, 300)", "true");
62 shouldBe("setArea('circle', '300, 300, 50'); checkForArea(320, 300)", "true");
63
64 shouldBe("setArea('poly', '100, 100, 200, 100, 200, 200'); checkForArea(150, 150 )", "true");
65 shouldBe("setArea('poly', '100, 100, 200, 100, 200, 200'); checkForArea(100, 150 )", "false");
66 shouldBe("setArea('poly', '100, 100, 200, 100, 200, 200'); checkForArea(300, 300 )", "false");
67
68 shouldBe("setArea('default', ''); checkForArea(300, 300)", "true");
69
70 document.body.removeChild(image);
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/images/img-dimensions-styled-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698