on xenial help sign in
Need the stubborness in another place, so generalize it
commit8fff1ddfc5ece1e9247cb9c246e67b8aaa3e8dc8 authorAlbert Astals Cid <albert.astals@canonical.com> dateThu 12 Mar 2015, 10:08 (12 years ago) parent567453a
3 files changed+12−10
tests/qmltests/Dash/Previews/tst_Preview.qml+1−7 tests/qmltests/Dash/tst_Dash.qml+1−3 tests/utils/modules/Unity/Test/UnityTestCase.qml+10
tests/qmltests/Dash/Previews/tst_Preview.qml+1−7
@@ -113,13 +113,7 @@ Rectangle {
113113
114114 // Scroll down
115115 var previewListRow0 = findChild(preview, "previewListRow0");
116− var i = 0;
117− while (i < 5 && !previewListRow0.atYEnd) {
118− touchFlick(preview, preview.width / 2, units.gu(20), preview.width / 2, units.gu(1));
119− tryCompare(previewListRow0, "moving", false);
120− ++i;
121− }
122− tryCompare(previewListRow0, "atYEnd", true);
116+ tryTouchFlickToYEnd(previewListRow0, previewListRow0.width / 2, units.gu(20), previewListRow0.width / 2, units.gu(1));
123117
124118 // Click on the combo
125119 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+ tryTouchFlickToYEnd(previewListRow0, previewListRow0.width / 2, units.gu(20), previewListRow0.width / 2, units.gu(1));
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+10
@@ -221,6 +221,16 @@ TestCase {
221221 }
222222 }
223223
224+ function tryTouchFlickToYEnd(item, x, y, toX, toY) {
225+ var i = 0;
226+ while (i < 5 && !item.atYEnd) {
227+ touchFlick(item, x, y, toX, toY);
228+ tryCompare(item, "moving", false);
229+ ++i;
230+ }
231+ tryCompare(item, "atYEnd", true);
232+ }
233+
224234 function touchEvent(item) {
225235 return UT.Util.touchEvent(item)
226236 }