OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../../../../resources/js-test.js"></script> | 4 <script src="../../../../resources/js-test.js"></script> |
5 <script src="resources/gesture-helpers.js"></script> | 5 <script src="resources/gesture-helpers.js"></script> |
6 | 6 |
7 </head> | 7 </head> |
8 | 8 |
9 <body style="margin:0" onload="runTest()"> | 9 <body style="margin:0" onload="runTest()"> |
10 <div id="container" style="width: 500px; height: 200px; overflow-y: scroll
; overflow-x: scroll"> | 10 <div id="container" style="width: 500px; height: 200px; overflow-y: scroll
; overflow-x: scroll"> |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 | 47 |
48 function testFlingGestureScroll() | 48 function testFlingGestureScroll() |
49 { | 49 { |
50 debug("===Testing fling behavior==="); | 50 debug("===Testing fling behavior==="); |
51 resetScroll(); | 51 resetScroll(); |
52 | 52 |
53 shouldBe('box.scrollLeft', '0'); | 53 shouldBe('box.scrollLeft', '0'); |
54 shouldBe('container.scrollLeft', '0'); | 54 shouldBe('container.scrollLeft', '0'); |
55 | 55 |
56 eventSender.gestureScrollBegin(gestureX, gestureY); | 56 eventSender.gestureScrollBegin(gestureX, gestureY); |
57 eventSender.gestureScrollUpdateWithoutPropagation(-10, 0); | 57 // Prevent scroll to propagate by passing true for third parameter |
58 eventSender.gestureScrollUpdateWithoutPropagation(-10, 0); | 58 eventSender.gestureScrollUpdate(-10, 0, true); |
59 eventSender.gestureScrollUpdateWithoutPropagation(-10, 0); | 59 eventSender.gestureScrollUpdate(-10, 0, true); |
60 eventSender.gestureScrollUpdateWithoutPropagation(-10, 0); | 60 eventSender.gestureScrollUpdate(-10, 0, true); |
| 61 eventSender.gestureScrollUpdate(-10, 0, true); |
61 eventSender.gestureScrollEnd(0, 0); | 62 eventSender.gestureScrollEnd(0, 0); |
62 | 63 |
63 debug("Flinging input text should scroll text by the specified amoun
t"); | 64 debug("Flinging input text should scroll text by the specified amoun
t"); |
64 shouldBe('box.scrollLeft', '40'); | 65 shouldBe('box.scrollLeft', '40'); |
65 shouldBe('container.scrollLeft', '0'); | 66 shouldBe('container.scrollLeft', '0'); |
66 | 67 |
67 resetScroll(); | 68 resetScroll(); |
68 | 69 |
69 eventSender.gestureScrollBegin(gestureX, gestureY); | 70 eventSender.gestureScrollBegin(gestureX, gestureY); |
70 eventSender.gestureScrollUpdateWithoutPropagation(-fullyScrolled, 0)
; | 71 eventSender.gestureScrollUpdate(-fullyScrolled, 0, true); |
71 eventSender.gestureScrollUpdateWithoutPropagation(-300, 0); | 72 eventSender.gestureScrollUpdate(-100, 0, true); |
72 eventSender.gestureScrollUpdateWithoutPropagation(-100, 0); | 73 eventSender.gestureScrollUpdate(-100, 0, true); |
73 eventSender.gestureScrollUpdateWithoutPropagation(-100, 0); | 74 eventSender.gestureScrollUpdate(-300, 0, true); |
74 eventSender.gestureScrollEnd(0, 0); | 75 eventSender.gestureScrollEnd(0, 0); |
75 | 76 |
76 debug("Flinging input text past the scrollable width shouldn't scrol
l containing div"); | 77 debug("Flinging input text past the scrollable width shouldn't scrol
l containing div"); |
77 | 78 |
78 shouldBe('box.scrollLeft', 'fullyScrolled'); | 79 shouldBe('box.scrollLeft', 'fullyScrolled'); |
79 shouldBe('container.scrollLeft', '0'); | 80 shouldBe('container.scrollLeft', '0'); |
80 | 81 |
81 eventSender.gestureScrollBegin(gestureX, gestureY); | 82 eventSender.gestureScrollBegin(gestureX, gestureY); |
82 eventSender.gestureScrollUpdateWithoutPropagation(-30, 0); | 83 eventSender.gestureScrollUpdate(-30, 0, true); |
83 eventSender.gestureScrollUpdateWithoutPropagation(-30, 0); | 84 eventSender.gestureScrollUpdate(-30, 0, true); |
84 eventSender.gestureScrollEnd(0, 0); | 85 eventSender.gestureScrollEnd(0, 0); |
85 | 86 |
86 debug("Flinging fully scrolled input text should fling containing di
v"); | 87 debug("Flinging fully scrolled input text should fling containing di
v"); |
87 shouldBe('box.scrollLeft', 'fullyScrolled'); | 88 shouldBe('box.scrollLeft', 'fullyScrolled'); |
88 shouldBe('container.scrollLeft', '60'); | 89 shouldBe('container.scrollLeft', '60'); |
89 } | 90 } |
90 | 91 |
91 function testGestureScroll() | 92 function testGestureScroll() |
92 { | 93 { |
93 debug("===Testing scroll behavior==="); | 94 debug("===Testing scroll behavior==="); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 debug("Vertically gesture scrolling input text should scroll contain
ing div the specified amount"); | 134 debug("Vertically gesture scrolling input text should scroll contain
ing div the specified amount"); |
134 shouldBe('box.scrollTop', '0'); | 135 shouldBe('box.scrollTop', '0'); |
135 shouldBe('container.scrollTop', '60'); | 136 shouldBe('container.scrollTop', '60'); |
136 | 137 |
137 resetScroll(); | 138 resetScroll(); |
138 | 139 |
139 shouldBe('box.scrollTop', '0'); | 140 shouldBe('box.scrollTop', '0'); |
140 shouldBe('container.scrollTop', '0'); | 141 shouldBe('container.scrollTop', '0'); |
141 | 142 |
142 eventSender.gestureScrollBegin(gestureX, gestureY); | 143 eventSender.gestureScrollBegin(gestureX, gestureY); |
143 eventSender.gestureScrollUpdateWithoutPropagation(0, -30); | 144 eventSender.gestureScrollUpdate(0, -30, true); |
144 eventSender.gestureScrollUpdateWithoutPropagation(0, -30); | 145 eventSender.gestureScrollUpdate(0, -30, true); |
145 eventSender.gestureScrollEnd(0, 0); | 146 eventSender.gestureScrollEnd(0, 0); |
146 | 147 |
147 debug("Vertically flinging input text should scroll the containing d
iv the specified amount"); | 148 debug("Vertically flinging input text should scroll the containing d
iv the specified amount"); |
148 shouldBe('box.scrollTop', '0'); | 149 shouldBe('box.scrollTop', '0'); |
149 shouldBe('container.scrollTop', '60'); | 150 shouldBe('container.scrollTop', '60'); |
150 } | 151 } |
151 | 152 |
152 function testNonOverflowingText() | 153 function testNonOverflowingText() |
153 { | 154 { |
154 debug("===Testing non-overflow scroll behavior==="); | 155 debug("===Testing non-overflow scroll behavior==="); |
155 box.value = "short"; | 156 box.value = "short"; |
156 | 157 |
157 debug("Input box without overflow should not scroll"); | 158 debug("Input box without overflow should not scroll"); |
158 shouldBe('box.scrollLeft', '0'); | 159 shouldBe('box.scrollLeft', '0'); |
159 shouldBe('container.scrollLeft', '0'); | 160 shouldBe('container.scrollLeft', '0'); |
160 shouldBeGreaterThanOrEqual('box.clientWidth', 'box.scrollWidth'); | 161 shouldBeGreaterThanOrEqual('box.clientWidth', 'box.scrollWidth'); |
161 | 162 |
162 eventSender.gestureScrollBegin(gestureX, gestureY); | 163 eventSender.gestureScrollBegin(gestureX, gestureY); |
163 eventSender.gestureScrollUpdate(-30, 0); | 164 eventSender.gestureScrollUpdate(-30, 0); |
164 eventSender.gestureScrollUpdateWithoutPropagation(-30, 0); | 165 eventSender.gestureScrollUpdate(-30, 0, true); |
165 eventSender.gestureScrollEnd(0, 0); | 166 eventSender.gestureScrollEnd(0, 0); |
166 | 167 |
167 shouldBe('box.scrollLeft', '0'); | 168 shouldBe('box.scrollLeft', '0'); |
168 shouldBe('container.scrollLeft', '60'); | 169 shouldBe('container.scrollLeft', '60'); |
169 } | 170 } |
170 | 171 |
171 if (window.testRunner) | 172 if (window.testRunner) |
172 testRunner.waitUntilDone(); | 173 testRunner.waitUntilDone(); |
173 | 174 |
174 function runTest() | 175 function runTest() |
175 { | 176 { |
176 box = document.getElementById("box"); | 177 box = document.getElementById("box"); |
177 container = document.getElementById("container"); | 178 container = document.getElementById("container"); |
178 | 179 |
179 if (window.eventSender) { | 180 if (window.eventSender) { |
180 description('This tests that an input text field can be properly
scrolled with touch gestures'); | 181 description('This tests that an input text field can be properly
scrolled with touch gestures'); |
181 | 182 |
182 if (checkTestDependencies() && window.eventSender.gestureScrollU
pdateWithoutPropagation) { | 183 if (checkTestDependencies() && window.eventSender.gestureScrollU
pdate) { |
183 calculateFullScroll(); | 184 calculateFullScroll(); |
184 testFlingGestureScroll(); | 185 testFlingGestureScroll(); |
185 testGestureScroll(); | 186 testGestureScroll(); |
186 testVerticalScroll(); | 187 testVerticalScroll(); |
187 testNonOverflowingText(); | 188 testNonOverflowingText(); |
188 testRunner.notifyDone(); | 189 testRunner.notifyDone(); |
189 } else | 190 } else |
190 exitIfNecessary(); | 191 exitIfNecessary(); |
191 } else { | 192 } else { |
192 debug("This test requires DumpRenderTree. Gesture-scroll the pa
ge to validate the implementation."); | 193 debug("This test requires DumpRenderTree. Gesture-scroll the pa
ge to validate the implementation."); |
193 } | 194 } |
194 } | 195 } |
195 </script> | 196 </script> |
196 </body> | 197 </body> |
197 </html> | 198 </html> |
OLD | NEW |