|
1 <!DOCTYPE HTML> |
|
2 <html> |
|
3 <!-- |
|
4 https://bugzilla.mozilla.org/show_bug.cgi?id=599368 |
|
5 --> |
|
6 <head> |
|
7 <title>Test for Bug 599368</title> |
|
8 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
|
9 <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script> |
|
10 <script type="text/javascript" src="/tests/SimpleTest/WindowSnapshot.js"></script> |
|
11 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
|
12 </head> |
|
13 <body> |
|
14 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=599368">Mozilla Bug 599368</a> |
|
15 <iframe id="display" src="about:blank"></iframe> |
|
16 <div id="content" style="display: none"> |
|
17 |
|
18 </div> |
|
19 <pre id="test"> |
|
20 <script type="application/javascript"> |
|
21 |
|
22 /** Test for Bug 599368 **/ |
|
23 |
|
24 SimpleTest.waitForExplicitFinish(); |
|
25 |
|
26 window.addEventListener("load", step1, false); |
|
27 |
|
28 var gImage; |
|
29 var gIframe; |
|
30 var gBlueNotSelected; |
|
31 var gBlueSelected; |
|
32 var gFuchsiaSelected; |
|
33 |
|
34 function step1() |
|
35 { |
|
36 gIframe = document.getElementById("display"); |
|
37 doc = gIframe.contentDocument; |
|
38 |
|
39 gImage = doc.createElement('img'); |
|
40 var src = String(window.location).split("/"); |
|
41 src.pop(); |
|
42 src.push("blue-32x32.png"); |
|
43 src = src.join("/"); |
|
44 gImage.src = src; |
|
45 gImage.addEventListener("load", step2, false); |
|
46 doc.body.appendChild(gImage); |
|
47 |
|
48 doc.designMode = "on"; |
|
49 } |
|
50 |
|
51 function step2() { |
|
52 gImage.removeEventListener("load", step2, false); |
|
53 |
|
54 gBlueNotSelected = snapshotWindow(gIframe.contentWindow, false); |
|
55 |
|
56 synthesizeMouse(gImage, 5, 5, {}, gIframe.contentWindow); |
|
57 setTimeout(step3, 0); |
|
58 } |
|
59 |
|
60 function step3() { |
|
61 gBlueSelected = snapshotWindow(gIframe.contentWindow, false); |
|
62 |
|
63 var src = String(window.location).split("/"); |
|
64 src.pop(); |
|
65 src.push("fuchsia-32x32.png"); |
|
66 src = src.join("/"); |
|
67 gImage.addEventListener("load", step4, false); |
|
68 gImage.src = src; |
|
69 } |
|
70 |
|
71 function step4() { |
|
72 gImage.removeEventListener("load", step4, false); |
|
73 |
|
74 gFuchsiaSelected = snapshotWindow(gIframe.contentWindow, false); |
|
75 |
|
76 assert_different(gBlueNotSelected, gBlueSelected, |
|
77 "selecting image should add drag points"); |
|
78 assert_different(gBlueSelected, gFuchsiaSelected, |
|
79 "different images should appear different"); |
|
80 |
|
81 SimpleTest.finish(); |
|
82 } |
|
83 |
|
84 function assert_different(shot1, shot2, desc) |
|
85 { |
|
86 var [correct, s1, s2] = compareSnapshots(shot1, shot2, false); |
|
87 ok(correct, desc); |
|
88 } |
|
89 |
|
90 </script> |
|
91 </pre> |
|
92 </body> |
|
93 </html> |