From 92a7610e16be9b13d54378f9dad68fa498fa6c37 Mon Sep 17 00:00:00 2001 From: Kari Oikarinen Date: Tue, 20 Feb 2018 18:07:34 +0200 Subject: Fix flakiness of tst_QQuickGridView::currentIndex Highlight item is moved with an animation, so the test may need to wait for the animation to finish until the y coordinates of the current item and the highlight item match. Task-number: QTBUG-66549 Change-Id: Id8e329c4a6647ee946da702b489c6f7ea0b7260f Reviewed-by: Sami Nurmenniemi Reviewed-by: Frederik Gladhorn --- tests/auto/quick/qquickgridview/tst_qquickgridview.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tests/auto/quick') diff --git a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp index ce04dc3c80..58c9ffce71 100644 --- a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp +++ b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp @@ -1843,7 +1843,8 @@ void tst_QQuickGridView::currentIndex() // currentItem should be in view QCOMPARE(gridview->currentIndex(), 35); QCOMPARE(gridview->currentItem(), findItem(contentItem, "wrapper", 35)); - QCOMPARE(gridview->currentItem()->y(), gridview->highlightItem()->y()); + // Wait for possible animation to finish + QTRY_COMPARE(gridview->currentItem()->y(), gridview->highlightItem()->y()); QCOMPARE(gridview->contentY(), 400.0); // changing model should reset currentIndex to 0 -- cgit v1.2.3