diff options
author | J-P Nurmi <jpnurmi@theqtcompany.com> | 2015-10-21 17:04:16 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@theqtcompany.com> | 2015-10-22 09:44:55 +0000 |
commit | 9880e74a0c01a6af6c6ab2facc2ad683d3281c90 (patch) | |
tree | 1275d9f1bb389b6a5af75c5fd793c0510b39c229 /tests | |
parent | ddc8537ec17591e4b51293523c1369823ecd8a83 (diff) |
Fix QQuickPathViewPrivate::snapToIndex()
QQuickPathView::setCurrentIndex() set moveReason to "SetIndex", but
snapToIndex() overrode it to "Other". This caused updateCurrent() to
change the current index during snap animation and caused binding
loops in Qt Quick Controls 2.
Change-Id: I6c5f34c69886cb5c234ed78535bb356fbb38b3a6
Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/quick/qquickpathview/tst_qquickpathview.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp b/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp index eed947bfcd..fc5dd3bbca 100644 --- a/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp +++ b/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp @@ -1113,6 +1113,15 @@ void tst_QQuickPathView::setCurrentIndex() QCOMPARE(pathview->currentItem(), firstItem); QCOMPARE(firstItem->property("onPath"), QVariant(true)); + // check for bogus currentIndexChanged() signals + QSignalSpy currentIndexSpy(pathview, SIGNAL(currentIndexChanged())); + QVERIFY(currentIndexSpy.isValid()); + pathview->setHighlightMoveDuration(100); + pathview->setHighlightRangeMode(QQuickPathView::StrictlyEnforceRange); + pathview->setSnapMode(QQuickPathView::SnapToItem); + pathview->setCurrentIndex(3); + QTRY_COMPARE(pathview->currentIndex(), 3); + QCOMPARE(currentIndexSpy.count(), 1); } void tst_QQuickPathView::resetModel() |