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="height: 500px; overflow-x: scroll; overflow-y:
scroll"> | 10 <div id="container" style="height: 500px; overflow-x: scroll; overflow-y:
scroll"> |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 | 45 |
46 // Fling to scroll the inner text a little but not all the way | 46 // Fling to scroll the inner text a little but not all the way |
47 function testFlingGestures() | 47 function testFlingGestures() |
48 { | 48 { |
49 debug("===Testing fling gestures==="); | 49 debug("===Testing fling gestures==="); |
50 resetScroll(); | 50 resetScroll(); |
51 shouldBe('box.scrollTop', '0'); | 51 shouldBe('box.scrollTop', '0'); |
52 shouldBe('container.scrollTop', '0'); | 52 shouldBe('container.scrollTop', '0'); |
53 | 53 |
54 eventSender.gestureScrollBegin(gestureX, gestureY); | 54 eventSender.gestureScrollBegin(gestureX, gestureY); |
55 eventSender.gestureScrollUpdateWithoutPropagation(0, -itemHeight); | 55 // Prevent scroll to propagate by passing true for third parameter |
56 eventSender.gestureScrollUpdateWithoutPropagation(0, -itemHeight); | 56 eventSender.gestureScrollUpdate(0, -itemHeight, true); |
57 eventSender.gestureScrollUpdateWithoutPropagation(0, -10); | 57 eventSender.gestureScrollUpdate(0, -itemHeight, true); |
| 58 eventSender.gestureScrollUpdate(0, -10, true); |
58 eventSender.gestureScrollEnd(0, 0); | 59 eventSender.gestureScrollEnd(0, 0); |
59 | 60 |
60 debug("Flinging the list box should scroll the list, the scrolls sho
uld be locked to item boundaries"); | 61 debug("Flinging the list box should scroll the list, the scrolls sho
uld be locked to item boundaries"); |
61 shouldBe('box.scrollTop', '2*itemHeight+10'); | 62 shouldBe('box.scrollTop', '2*itemHeight+10'); |
62 shouldBe('container.scrollTop', '0'); | 63 shouldBe('container.scrollTop', '0'); |
63 | 64 |
64 resetScroll(); | 65 resetScroll(); |
65 | 66 |
66 eventSender.gestureScrollBegin(gestureX, gestureY); | 67 eventSender.gestureScrollBegin(gestureX, gestureY); |
67 eventSender.gestureScrollUpdateWithoutPropagation(0, -fullyScrolled)
; | 68 eventSender.gestureScrollUpdate(0, -fullyScrolled, true); |
68 eventSender.gestureScrollUpdateWithoutPropagation(0, -300); | 69 eventSender.gestureScrollUpdate(0, -300, true); |
69 eventSender.gestureScrollUpdateWithoutPropagation(0, -100); | 70 eventSender.gestureScrollUpdate(0, -100, true); |
70 eventSender.gestureScrollUpdateWithoutPropagation(0, -100); | 71 eventSender.gestureScrollUpdate(0, -100, true); |
71 eventSender.gestureScrollEnd(0, 0); | 72 eventSender.gestureScrollEnd(0, 0); |
72 | 73 |
73 debug("Flinging the list past the end shouldn't scroll containing di
v"); | 74 debug("Flinging the list past the end shouldn't scroll containing di
v"); |
74 shouldBe('box.scrollTop', 'fullyScrolled'); | 75 shouldBe('box.scrollTop', 'fullyScrolled'); |
75 shouldBe('container.scrollTop', '0'); | 76 shouldBe('container.scrollTop', '0'); |
76 | 77 |
77 eventSender.gestureScrollBegin(gestureX, gestureY); | 78 eventSender.gestureScrollBegin(gestureX, gestureY); |
78 eventSender.gestureScrollUpdateWithoutPropagation(0, -30); | 79 eventSender.gestureScrollUpdate(0, -30, true); |
79 eventSender.gestureScrollUpdateWithoutPropagation(0, -30); | 80 eventSender.gestureScrollUpdate(0, -30, true); |
80 eventSender.gestureScrollEnd(0, 0); | 81 eventSender.gestureScrollEnd(0, 0); |
81 | 82 |
82 debug("Flinging fully scrolled list should fling containing div"); | 83 debug("Flinging fully scrolled list should fling containing div"); |
83 shouldBe('box.scrollTop', 'fullyScrolled'); | 84 shouldBe('box.scrollTop', 'fullyScrolled'); |
84 shouldBe('container.scrollTop', '60'); | 85 shouldBe('container.scrollTop', '60'); |
85 } | 86 } |
86 | 87 |
87 function testGestureScroll() | 88 function testGestureScroll() |
88 { | 89 { |
89 debug("===Testing gesture scroll==="); | 90 debug("===Testing gesture scroll==="); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 function testHorizontalScroll() | 124 function testHorizontalScroll() |
124 { | 125 { |
125 debug("===Testing horizontal scroll==="); | 126 debug("===Testing horizontal scroll==="); |
126 | 127 |
127 resetScroll(); | 128 resetScroll(); |
128 shouldBe('box.scrollLeft', '0'); | 129 shouldBe('box.scrollLeft', '0'); |
129 shouldBe('container.scrollLeft', '0'); | 130 shouldBe('container.scrollLeft', '0'); |
130 | 131 |
131 eventSender.gestureScrollBegin(gestureX, gestureY); | 132 eventSender.gestureScrollBegin(gestureX, gestureY); |
132 eventSender.gestureScrollUpdate(-30, 0); | 133 eventSender.gestureScrollUpdate(-30, 0); |
133 eventSender.gestureScrollUpdateWithoutPropagation(-30, 0); | 134 eventSender.gestureScrollUpdate(-30, 0, true); |
134 eventSender.gestureScrollEnd(0, 0); | 135 eventSender.gestureScrollEnd(0, 0); |
135 | 136 |
136 debug("Horizontal scrolls should not affect listbox"); | 137 debug("Horizontal scrolls should not affect listbox"); |
137 shouldBe('box.scrollLeft', '0'); | 138 shouldBe('box.scrollLeft', '0'); |
138 shouldBe('container.scrollLeft', '60'); | 139 shouldBe('container.scrollLeft', '60'); |
139 } | 140 } |
140 | 141 |
141 if (window.testRunner) | 142 if (window.testRunner) |
142 testRunner.waitUntilDone(); | 143 testRunner.waitUntilDone(); |
143 | 144 |
144 function runTest() | 145 function runTest() |
145 { | 146 { |
146 box = document.getElementById("box"); | 147 box = document.getElementById("box"); |
147 container = document.getElementById("container"); | 148 container = document.getElementById("container"); |
148 itemHeight = box.clientHeight / box.size; | 149 itemHeight = box.clientHeight / box.size; |
149 | 150 |
150 fullyScrolled = box.scrollHeight - box.clientHeight; | 151 fullyScrolled = box.scrollHeight - box.clientHeight; |
151 | 152 |
152 if (window.eventSender) { | 153 if (window.eventSender) { |
153 description('This tests that an input text field can be properly
scrolled with touch gestures'); | 154 description('This tests that an input text field can be properly
scrolled with touch gestures'); |
154 | 155 |
155 if (checkTestDependencies() && window.eventSender.gestureScrollU
pdateWithoutPropagation) { | 156 if (checkTestDependencies() && window.eventSender.gestureScrollU
pdate) { |
156 testFlingGestures(); | 157 testFlingGestures(); |
157 testGestureScroll(); | 158 testGestureScroll(); |
158 testHorizontalScroll(); | 159 testHorizontalScroll(); |
159 testRunner.notifyDone(); | 160 testRunner.notifyDone(); |
160 } else | 161 } else |
161 exitIfNecessary(); | 162 exitIfNecessary(); |
162 } else { | 163 } else { |
163 debug("This test requires DumpRenderTree. Gesture-scroll the pa
ge to validate the implementation."); | 164 debug("This test requires DumpRenderTree. Gesture-scroll the pa
ge to validate the implementation."); |
164 } | 165 } |
165 } | 166 } |
166 </script> | 167 </script> |
167 </body> | 168 </body> |
168 </html> | 169 </html> |
OLD | NEW |