OLD | NEW |
| (Empty) |
1 <html> | |
2 <head> | |
3 <script> | |
4 function setupTest() { | |
5 var horizontalOverflow = testResults[currentTest][1]; | |
6 if (horizontalOverflow) { | |
7 document.getElementById('child').style.width = '200px'; | |
8 } else { | |
9 document.getElementById('child').style.width = '50px'; | |
10 } | |
11 | |
12 var verticalOverflow = testResults[currentTest][2]; | |
13 if (verticalOverflow) { | |
14 document.getElementById('child').style.height = '200px'; | |
15 } else { | |
16 document.getElementById('child').style.height = '50px'; | |
17 } | |
18 } | |
19 | |
20 function finished(result) | |
21 { | |
22 document.getElementById('result').innerHTML = result; | |
23 | |
24 if (window.testRunner) | |
25 testRunner.notifyDone(); | |
26 } | |
27 | |
28 function nextTest() { | |
29 if (currentTest == testResults.length) { | |
30 finished("SUCCESS"); | |
31 return; | |
32 } | |
33 | |
34 forceLayout(); | |
35 setupTest(); | |
36 forceLayout(); | |
37 } | |
38 | |
39 function overflowChanged(event) { | |
40 var result = [event.orient, event.horizontalOverflow, event.verticalOver
flow]; | |
41 | |
42 if ('' + result == testResults[currentTest]) { | |
43 currentTest++; | |
44 nextTest(); | |
45 } else | |
46 finished("FAILURE: expected " + testResults[currentTest] + " got " +
result); | |
47 } | |
48 | |
49 function forceLayout() { | |
50 document.body.offsetTop; | |
51 } | |
52 | |
53 function runTest() { | |
54 if (window.testRunner) { | |
55 testRunner.dumpAsText(); | |
56 testRunner.waitUntilDone(); | |
57 } | |
58 | |
59 testResults = [[OverflowEvent.HORIZONTAL, true, false], | |
60 [OverflowEvent.HORIZONTAL, false, false], | |
61 [OverflowEvent.VERTICAL, false, true], | |
62 [OverflowEvent.VERTICAL, false, false], | |
63 [OverflowEvent.BOTH, true, true], | |
64 [OverflowEvent.BOTH, false, false], | |
65 [OverflowEvent.VERTICAL, false, true], | |
66 [OverflowEvent.BOTH, true, false], | |
67 [OverflowEvent.BOTH, false, true]]; | |
68 | |
69 currentTest = 0; | |
70 | |
71 var c = document.getElementById('container'); | |
72 c.addEventListener('overflowchanged', overflowChanged, false); | |
73 nextTest(); | |
74 } | |
75 </script> | |
76 </head> | |
77 <body onload="runTest()"> | |
78 <div id="container" style="width:100; height:100px; border: solid red 2px; o
verflow: hidden"> | |
79 <div id="child" style="margin-top: 30px; margin-left: 30px; width:50px;
height:50px; border: solid blue 2px;"></div> | |
80 </div> | |
81 This tests that overflowchanged events are fired correctly. If the test is s
uccessful, the text "SUCCESS" should be shown below. | |
82 <div id="result">FAILURE</div> | |
83 </body> | |
84 </html> | |
OLD | NEW |