176
183
scrollbar_trailingAlign_anchors.flickableItem.top, "top anchor")
179
function test_indicatorWhileFlicking() {
186
function test_indicatorStyleWhileFlicking_shortContent() {
180
187
var freshTestItem = getFreshFlickable()
181
188
if (!freshTestItem) return
183
190
var flickable = freshTestItem.flickable
184
191
var scrollbar = freshTestItem.scrollbar
186
setupSignalSpy(signalSpy, flickable, "movementEnded")
188
flick(flickable, 1, 2, units.gu(2), units.gu(3))
189
compare(flickable.moving, true, "not moving")
190
compare(scrollbar.__styleInstance.state, "indicator", "wrong style while flicking")
193
compare(signalSpy.count, 1, "flick not completed")
195
compare(scrollbar.__styleInstance.state, "hidden", "wrong style while flicking short item")
193
compare(scrollbar.__styleInstance.veryLongContentItem, false, "Scrollable item should be short.")
195
setupSignalSpy(signalSpy, flickable, "movingChanged")
197
flick(flickable, 1, 2, units.gu(2), -units.gu(10))
200
compare(signalSpy.count, 1, "No movingChanged signal after simulating a flick.")
201
compare(flickable.moving, true, "Flickable not moving after simulating a flick.")
202
compare(scrollbar.__styleInstance.state, "indicator", "Wrong style while flicking.")
204
//we don't set it up before because the hinting feature already changes the style to thumb
206
setupSignalSpy(anotherSignalSpy, scrollbar.__styleInstance, "stateChanged")
208
//make sure the flickable stops
209
mousePress(flickable, 0, 0)
210
mouseMove(flickable, 0, 0)
211
mouseRelease(flickable, 0, 0)
214
compare(flickable.moving, false, "Flickable still moving after simulating mouse click.")
215
compare(signalSpy.count, 2, "No movingChanged signal after Flickable stopped moving.")
217
anotherSignalSpy.wait()
218
compare(anotherSignalSpy.count, 1, "State unchanged after Flickable stopped moving.")
219
compare(scrollbar.__styleInstance.state, "hidden", "Wrong style after the item stopped moving.")
196
221
freshTestItem.destroy()
199
function test_thumbStyleVeryLongContent() {
224
function test_thumbStyleWhileFlicking_veryLongContent() {
200
225
var freshTestItem = getFreshFlickable()
201
226
if (!freshTestItem) return
203
228
var flickable = freshTestItem.flickable
204
229
var scrollbar = freshTestItem.scrollbar
231
setupSignalSpy(signalSpy, scrollbar.__styleInstance, "veryLongContentItemChanged")
206
232
setVeryLongContentItem(flickable)
207
compare(scrollbar.__styleInstance.veryLongContentItem, true, "very long content item not detected")
209
setupSignalSpy(signalSpy, flickable, "movementEnded")
211
flick(flickable, 1, 2, units.gu(2), units.gu(3))
212
compare(flickable.moving, true, "not moving")
213
compare(scrollbar.__styleInstance.state, "thumb", "wrong style while flicking a very long item")
216
compare(signalSpy.count, 1, "flick not completed")
218
compare(scrollbar.__styleInstance.state, "hidden", "wrong style while flicking a very long item")
235
compare(scrollbar.__styleInstance.veryLongContentItem, true, "Very long content item not detected")
237
setupSignalSpy(signalSpy, flickable, "movingChanged")
238
flick(flickable, 1, 2, units.gu(2), -units.gu(10))
241
compare(signalSpy.count, 1, "No movingChanged signal after simulating a flick.")
242
compare(flickable.moving, true, "Flickable not moving after simulating a flick.")
243
compare(scrollbar.__styleInstance.state, "thumb", "Wrong style while flicking a very long item")
245
//we don't set it up before because the hinting feature already changes the style to thumb
247
setupSignalSpy(anotherSignalSpy, scrollbar.__styleInstance, "stateChanged")
249
//make sure the flickable stops
250
mousePress(flickable, 0, 0)
251
mouseMove(flickable, 0, 0)
252
mouseRelease(flickable, 0, 0)
255
compare(flickable.moving, false, "Flickable still moving after simulating mouse click.")
256
compare(signalSpy.count, 2, "No movingChanged signal after Flickable stopped moving.")
258
anotherSignalSpy.wait()
259
compare(anotherSignalSpy.count, 1, "State unchanged after Flickable stopped moving.")
260
compare(scrollbar.__styleInstance.state, "hidden", "Wrong style after a the item stopped moving.")
219
261
freshTestItem.destroy()