aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-03-28 01:00:54 +0100
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-03-28 01:00:54 +0100
commit4407f1f81813216bf64021eab7dcecc88d3056fe (patch)
treeaba2c7ed9a8f8d04898faced151c30b9dfbe0508 /tests/auto/quick
parent187b2e0efccb9e803a72fc87a3659d8b76a73ca9 (diff)
parent3507c29e8d9ea42e63fd0c01e27ee9263d939256 (diff)
Merge remote-tracking branch 'origin/5.12' into 5.13
Diffstat (limited to 'tests/auto/quick')
-rw-r--r--tests/auto/quick/qquickpathview/data/pathview5.qml65
-rw-r--r--tests/auto/quick/qquickpathview/tst_qquickpathview.cpp23
2 files changed, 88 insertions, 0 deletions
diff --git a/tests/auto/quick/qquickpathview/data/pathview5.qml b/tests/auto/quick/qquickpathview/data/pathview5.qml
new file mode 100644
index 0000000000..479c5dc500
--- /dev/null
+++ b/tests/auto/quick/qquickpathview/data/pathview5.qml
@@ -0,0 +1,65 @@
+import QtQuick 2.0
+
+PathView {
+ property int countclick: 0
+ id: pathview
+ y: 0
+ width: 348
+ height: 480
+
+ interactive: false
+
+ cacheItemCount: 10
+ currentIndex: 2
+ pathItemCount: 4
+ highlightMoveDuration: 1000
+ highlightRangeMode : PathView.StrictlyEnforceRange
+ preferredHighlightBegin: 0.5
+ preferredHighlightEnd: 0.5
+ snapMode : PathView.SnapOneItem
+
+ path: Path {
+ id: leftPath
+ startX: pathview.width / 2 - 800
+ startY: pathview.height / 2 - 800
+
+ PathArc {
+ x: pathview.width / 2 - 800
+ y: pathview.height / 2 + 800
+ radiusX: 800
+ radiusY: 800
+ direction: PathArc.Clockwise
+ }
+ }
+
+ model: ListModel {
+ id: model
+ ListElement { objectName:"aqua"; name: "aqua" ;mycolor:"aqua"}
+ ListElement { objectName:"blue"; name: "blue" ;mycolor:"blue"}
+ ListElement { objectName:"blueviolet"; name: "blueviolet" ;mycolor:"blueviolet"}
+ ListElement { objectName:"brown"; name: "brown" ;mycolor:"brown"}
+ ListElement { objectName:"chartreuse"; name: "chartreuse" ;mycolor:"chartreuse"}
+ }
+
+ delegate: Item {
+ id: revolveritem
+ objectName: model.objectName
+
+ width: pathview.width
+ height: pathview.height
+
+ Rectangle
+ {
+ id:myRectangle
+ color: mycolor
+ width: pathview.width -20
+ height: pathview.height -20
+
+ Text {
+ anchors.centerIn: parent
+ text: "index:"+index
+ color: "white"
+ }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp b/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp
index bf38d2d926..1a5ce39318 100644
--- a/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp
+++ b/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp
@@ -104,6 +104,7 @@ private slots:
void offset_data();
void offset();
void setCurrentIndex();
+ void setCurrentIndexWrap();
void resetModel();
void propertyChanges();
void pathChanges();
@@ -1138,6 +1139,28 @@ void tst_QQuickPathView::setCurrentIndex()
QCOMPARE(currentIndexSpy.count(), 1);
}
+void tst_QQuickPathView::setCurrentIndexWrap()
+{
+ QScopedPointer<QQuickView> window(createView());
+ window->setSource(testFileUrl("pathview5.qml"));
+ window->show();
+ qApp->processEvents();
+
+ QQuickPathView *pathview = qobject_cast<QQuickPathView*>(window->rootObject());
+ QVERIFY(pathview);
+
+ // set current index to last item
+ pathview->setCurrentIndex(4);
+ // set currentIndex to first item, then quickly set it back (QTBUG-74508)
+ QSignalSpy currentIndexSpy(pathview, SIGNAL(currentIndexChanged()));
+ QSignalSpy movementStartedSpy(pathview, SIGNAL(movementStarted()));
+ pathview->setCurrentIndex(0);
+ pathview->setCurrentIndex(4);
+ QCOMPARE(pathview->currentIndex(), 4);
+ QCOMPARE(currentIndexSpy.count(), 2);
+ QCOMPARE(movementStartedSpy.count(), 0);
+}
+
void tst_QQuickPathView::resetModel()
{
QScopedPointer<QQuickView> window(createView());