aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquickgridview
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@theqtcompany.com>2015-06-04 10:11:57 +0200
committerSimon Hausmann <simon.hausmann@theqtcompany.com>2015-06-05 05:51:33 +0000
commit868edc2691c1af621776fb4e594020beb199f482 (patch)
treeacb47714aba6247f9f0f5e286ff8a18d15ae6594 /tests/auto/quick/qquickgridview
parentca7ac4f1751500042abc7ec93b47333ed97d5ffb (diff)
Make QQuickGridView test independent of mouse speed
In order to prevent it from accidentally hitting the end of the grid prematurely we insert another mouse click. Change-Id: I3f1ecc65af4b60aebf383192cde9a3a6fdeb5c8a Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'tests/auto/quick/qquickgridview')
-rw-r--r--tests/auto/quick/qquickgridview/tst_qquickgridview.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp
index 9472407e01..f9262fb074 100644
--- a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp
+++ b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp
@@ -4315,8 +4315,19 @@ void tst_QQuickGridView::snapToRow()
QQuickItem *contentItem = gridview->contentItem();
QTRY_VERIFY(contentItem != 0);
+ qreal origContentY = gridview->contentY();
+ qreal origContentX = gridview->contentX();
// confirm that a flick hits an item boundary
flick(window, flickStart, flickEnd, 180);
+
+ // wait until it's at least one cell further
+ QTRY_VERIFY(qAbs(gridview->contentX() - origContentX) > 80 ||
+ qAbs(gridview->contentY() - origContentY) > 80);
+
+ // click to stop it. Otherwise we wouldn't know how much further it will go. We don't want to it
+ // to hit the endExtent, yet.
+ QTest::mouseClick(window, Qt::LeftButton, 0, flickEnd);
+
QTRY_VERIFY(gridview->isMoving() == false); // wait until it stops
if (flow == QQuickGridView::FlowLeftToRight)
QCOMPARE(qreal(fmod(gridview->contentY(),80.0)), snapAlignment);