on xenial help sign in
setting the launcher's extensionSize delayed to position the view correctly at the beginning

. Approved by PS Jenkins bot, Albert Astals Cid.

commite0b237a6e7226a6251fd8e77e2b50944a6d150a7 authorMichael Zanetti <michael.zanetti@canonical.com> dateWed 28 Aug 2013, 11:58 (13 years ago) parente74a251676932d
2 files changed+18−7
Launcher/LauncherPanel.qml+14−1 tests/qmltests/Launcher/tst_Launcher.qml+4−6
Launcher/LauncherPanel.qml+14−1
@@ -110,7 +110,20 @@ Item {
110110 // destroyed when dragging them outside the list. This needs to be at least
111111 // itemHeight to prevent folded items from disappearing and DragArea limits
112112 // need to be smaller than this size to avoid breakage.
113− property int extensionSize: itemHeight * 3
113+ property int extensionSize: 0
114+
115+ // Setting extensionSize after the list has been populated because it has
116+ // the potential to mess up with the intial positioning in combination
117+ // with snapping to the center of the list. This catches all the cases
118+ // where the item would be outside the list for more than itemHeight / 2.
119+ // For the rest, give it a flick to scroll to the beginning. Note that
120+ // the flicking alone isn't enough because in some cases it's not strong
121+ // enough to overcome the snapping.
122+ // https://bugreports.qt-project.org/browse/QTBUG-32251
123+ Component.onCompleted: {
124+ extensionSize = itemHeight * 3
125+ flick(0, clickFlickSpeed)
126+ }
114127
115128 // The height of the area where icons start getting folded
116129 property int foldingStartHeight: units.gu(6.5)
tests/qmltests/Launcher/tst_Launcher.qml+4−6
@@ -249,11 +249,10 @@ Item {
249249 name: "LauncherInit"
250250 when: windowShown
251251
252− /*
253− * FIXME: There is a bug in ListView which makes it snap to an item
254− * instead of the edge at startup. Enable this test once our patch for
255− * ListView has landed upstream.
256− * https://bugreports.qt-project.org/browse/QTBUG-32251
252+ function initTestCase() {
253+ var listView = findChild(launcher, "launcherListView");
254+ tryCompare(listView, "flicking", false)
255+ }
257256
258257 function test_initFirstUnfolded() {
259258
@@ -267,7 +266,6 @@ Item {
267266 // Now do check that snapping is in fact enabled
268267 compare(listView.snapMode, ListView.SnapToItem, "Snapping is not enabled");
269268 }
270− */
271269 }
272270
273271 UT.UnityTestCase {