on xenial help sign in
Test: More stubborn flick to the end

Approved by: Michał Sawicz

commit488b30e2cf623ff97c5dde2c73c1983d97b6fec0 authorAlbert Astals Cid <albert.astals@canonical.com> dateWed 18 Mar 2015, 10:18 (12 years ago) parentf74aa050af68ff
3 files changed+15−6
tests/qmltests/Dash/Previews/tst_Preview.qml+1−3 tests/qmltests/Dash/tst_Dash.qml+1−3 tests/utils/modules/Unity/Test/UnityTestCase.qml+13
tests/qmltests/Dash/Previews/tst_Preview.qml+1−3
@@ -113,9 +113,7 @@ Rectangle {
113113
114114 // Scroll down
115115 var previewListRow0 = findChild(preview, "previewListRow0");
116− touchFlick(preview, preview.width / 2, units.gu(20), preview.width / 2, units.gu(1));
117− tryCompare(previewListRow0, "atYEnd", true);
118− tryCompare(previewListRow0, "moving", false);
116+ flickToYEnd(previewListRow0);
119117
120118 // Click on the combo
121119 var widget = findChild(preview, "widget-21");
tests/qmltests/Dash/tst_Dash.qml+1−3
@@ -497,9 +497,7 @@ Item {
497497 tryCompare(subPageLoader, "x", 0);
498498 tryCompare(findChild(dashTempScopeItem, "categoryListView"), "visible", false);
499499 var previewListRow0 = findChild(subPageLoader, "previewListRow0");
500− touchFlick(previewListRow0, previewListRow0.width / 2, units.gu(20), previewListRow0.width / 2, units.gu(1));
501− tryCompare(previewListRow0, "atYEnd", true);
502− tryCompare(previewListRow0, "moving", false);
500+ flickToYEnd(previewListRow0);
503501 var widget = findChild(subPageLoader, "widget-21");
504502 var initialWidgetHeight = widget.height;
505503 var openButton = findChild(widget, "buttonopen_click");
tests/utils/modules/Unity/Test/UnityTestCase.qml+13
@@ -221,6 +221,19 @@ TestCase {
221221 }
222222 }
223223
224+ function flickToYEnd(item) {
225+ var i = 0;
226+ var x = item.width / 2;
227+ var y = item.height - units.gu(1);
228+ var toY = units.gu(1);
229+ while (i < 5 && !item.atYEnd) {
230+ touchFlick(item, x, y, x, toY);
231+ tryCompare(item, "moving", false);
232+ ++i;
233+ }
234+ tryCompare(item, "atYEnd", true);
235+ }
236+
224237 function touchEvent(item) {
225238 return UT.Util.touchEvent(item)
226239 }