JS Test Harness: Remove successfullyParsed from more tests
[WebKit-https.git] / LayoutTests / fast / events / touch / gesture / gesture-scroll.html
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head>
4 <script src="../../../js/resources/js-test-pre.js"></script>
5 <style type="text/css">
6 #gesturetarget {
7   width: 100px;
8   height: 100px;
9   position: relative;
10   background: white;
11 }
12
13 #movingbox {
14   width: 100%;
15   height: 100%;
16   position: absolute;
17   word-wrap: break-word;
18   overflow-y: scroll;
19   overflow-x: scroll;
20   display: block;
21 }
22
23 #greenbox {
24   width: 100px;
25   height: 100px;
26   background: green;
27   padding: 0px;
28   margin: 0px;
29 }
30
31 #redbox {
32   width: 100px;
33   height: 100px;
34   background: red;
35   padding: 0px;
36   margin: 0px;
37 }
38
39 td {
40   padding: 0px;
41 }
42 </style>
43 </head>
44 <body style="margin:0" onload="runTest();">
45 <div id="gesturetarget">
46   <div id="movingbox">
47     <table border="0" cellspacing="0px">
48       <tr>
49         <td><div id="redbox"></div></td>
50         <td><div id="greenbox"></div></td>
51       </tr>
52       <tr>
53         <td><div id="greenbox"></div></td>
54         <td><div id="greenbox"></div></td>
55       </tr>
56     </table>
57   </div>
58 </div>
59
60 <p id="description"></p>
61 <div id="console"></div>
62 <script type="text/javascript">
63
64 var movingdiv;
65 var expectedScrollsTotal = 2;
66 var scrollsOccurred = 0;
67 var scrollAmountX = ['90', '90'];
68 var scrollAmountY = ['0', '95'];
69
70 function checkScrollOffset()
71 {
72     movingdiv = document.getElementById('movingbox');
73     if (window.eventSender) {
74         shouldBe('movingdiv.scrollTop', scrollAmountY[scrollsOccurred]);
75         shouldBe('movingdiv.scrollLeft', scrollAmountX[scrollsOccurred]);
76         scrollsOccurred++;
77     }
78
79     if (scrollsOccurred == expectedScrollsTotal) {
80         // If we've got here, we've passed.
81         isSuccessfullyParsed();
82         if (window.layoutTestController)
83             layoutTestController.notifyDone();
84     } else {
85         secondGestureScrollSequence();
86     }
87 }
88
89 function firstGestureScrollSequence()
90 {
91     debug("first gesture");
92
93     eventSender.gestureScrollBegin(95, 12);
94     eventSender.gestureScrollUpdate(-90, 0);
95     eventSender.gestureScrollEnd(0, 0);
96
97     // Wait for layout.
98     checkScrollOffset();
99 }
100
101 function secondGestureScrollSequence()
102 {
103     debug("second gesture");
104
105     eventSender.gestureScrollBegin(12, 97);
106     eventSender.gestureScrollUpdate(0, -95);
107     eventSender.gestureScrollEnd(0, 0);
108
109     // Wait for layout.
110     checkScrollOffset();
111 }
112
113 function exitIfNecessary()
114 {
115     debug('Gesture events not implemented on this platform or broken');
116     isSuccessfullyParsed();
117     if (window.layoutTestController)
118         layoutTestController.notifyDone();
119 }
120
121 if (window.layoutTestController)
122     layoutTestController.waitUntilDone();
123
124 function runTest()
125 {
126     var movingdiv = document.getElementById('movingbox');
127
128     if (window.eventSender) {
129         description('This tests scroll gesture events. ' +
130             'Square is (mostly) green on pass');
131
132         if (eventSender.clearTouchPoints)
133             firstGestureScrollSequence();
134         else
135             exitIfNecessary();
136     } else {
137         debug("This test requires DumpRenderTree.");
138     }
139 }
140 </script>
141 </body>
142 </html>