|
1 <?xml version="1.0"?> |
|
2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?> |
|
3 <wizard title="Cursor snapping test" id="wizard" |
|
4 width="600" height="600" |
|
5 onload="onload();" |
|
6 onunload="onunload();" |
|
7 buttons="accept,cancel" |
|
8 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> |
|
9 |
|
10 <wizardpage> |
|
11 <label value="first page"/> |
|
12 </wizardpage> |
|
13 |
|
14 <wizardpage> |
|
15 <label value="second page"/> |
|
16 </wizardpage> |
|
17 |
|
18 <script class="testbody" type="application/javascript"> |
|
19 <![CDATA[ |
|
20 |
|
21 function ok(aCondition, aMessage) |
|
22 { |
|
23 window.opener.wrappedJSObject.SimpleTest.ok(aCondition, aMessage); |
|
24 } |
|
25 |
|
26 function is(aLeft, aRight, aMessage) |
|
27 { |
|
28 window.opener.wrappedJSObject.SimpleTest.is(aLeft, aRight, aMessage); |
|
29 } |
|
30 |
|
31 function isnot(aLeft, aRight, aMessage) |
|
32 { |
|
33 window.opener.wrappedJSObject.SimpleTest.isnot(aLeft, aRight, aMessage); |
|
34 } |
|
35 |
|
36 function canRetryTest() |
|
37 { |
|
38 return window.opener.wrappedJSObject.canRetryTest(); |
|
39 } |
|
40 |
|
41 function getTimeoutTime() |
|
42 { |
|
43 return window.opener.wrappedJSObject.getTimeoutTime(); |
|
44 } |
|
45 |
|
46 var gTimer; |
|
47 var gRetry = false; |
|
48 |
|
49 function finishByTimeout() |
|
50 { |
|
51 var button = document.getElementById("wizard").getButton("next"); |
|
52 if (button.disabled) |
|
53 ok(true, "cursor is NOT snapped to the disabled button (wizard)"); |
|
54 else if (button.hidden) |
|
55 ok(true, "cursor is NOT snapped to the hidden button (wizard)"); |
|
56 else { |
|
57 if (!canRetryTest()) { |
|
58 ok(false, "cursor is NOT snapped to the default button (wizard)"); |
|
59 } else { |
|
60 // otherwise, this may be unexpected timeout, we should retry the test. |
|
61 gRetry = true; |
|
62 } |
|
63 } |
|
64 finish(); |
|
65 } |
|
66 |
|
67 function finish() |
|
68 { |
|
69 window.close(); |
|
70 } |
|
71 |
|
72 function onMouseMove() |
|
73 { |
|
74 var button = document.getElementById("wizard").getButton("next"); |
|
75 if (button.disabled) |
|
76 ok(false, "cursor IS snapped to the disabled button (wizard)"); |
|
77 else if (button.hidden) |
|
78 ok(false, "cursor IS snapped to the hidden button (wizard)"); |
|
79 else |
|
80 ok(true, "cursor IS snapped to the default button (wizard)"); |
|
81 clearTimeout(gTimer); |
|
82 finish(); |
|
83 } |
|
84 |
|
85 function onload() |
|
86 { |
|
87 var button = document.getElementById("wizard").getButton("next"); |
|
88 button.addEventListener("mousemove", onMouseMove, false); |
|
89 |
|
90 if (window.opener.wrappedJSObject.gDisable) { |
|
91 button.disabled = true; |
|
92 } |
|
93 if (window.opener.wrappedJSObject.gHidden) { |
|
94 button.hidden = true; |
|
95 } |
|
96 gTimer = setTimeout(finishByTimeout, getTimeoutTime()); |
|
97 } |
|
98 |
|
99 function onunload() |
|
100 { |
|
101 if (gRetry) { |
|
102 window.opener.wrappedJSObject.retryCurrentTest(); |
|
103 } else { |
|
104 window.opener.wrappedJSObject.runNextTest(); |
|
105 } |
|
106 } |
|
107 |
|
108 ]]> |
|
109 </script> |
|
110 |
|
111 </wizard> |