aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/quick')
-rw-r--r--tests/auto/quick/qquickrepeater/data/asynchronousMove.qml51
-rw-r--r--tests/auto/quick/qquickrepeater/tst_qquickrepeater.cpp25
2 files changed, 76 insertions, 0 deletions
diff --git a/tests/auto/quick/qquickrepeater/data/asynchronousMove.qml b/tests/auto/quick/qquickrepeater/data/asynchronousMove.qml
new file mode 100644
index 0000000000..02499c8531
--- /dev/null
+++ b/tests/auto/quick/qquickrepeater/data/asynchronousMove.qml
@@ -0,0 +1,51 @@
+import QtQuick 2.3
+import QtQuick.Window 2.2
+
+Item {
+ property bool finished: loader.status === Loader.Ready && loader.progress === 1
+
+ ListModel {
+ id: listModel
+ ListElement { i:0 }
+ ListElement { i:1 }
+ ListElement { i:2 }
+ ListElement { i:3 }
+ }
+
+ Timer {
+ running: true
+ interval: 1
+ repeat: count < 5
+ property int count : 0
+
+ onTriggered: {
+ listModel.move(listModel.count - 1, listModel.count - 2, 1)
+ ++count
+ }
+ }
+
+ Loader {
+ id: loader
+ asynchronous: true
+ sourceComponent: Row {
+ spacing: 4
+ Repeater {
+ model: listModel
+ delegate: Column {
+ spacing: 4
+ Repeater {
+ model: 4
+ delegate: Rectangle {
+ width: 30
+ height: 30
+ color: "blue"
+ Component.onCompleted: {
+ ctrl.wait()
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickrepeater/tst_qquickrepeater.cpp b/tests/auto/quick/qquickrepeater/tst_qquickrepeater.cpp
index f7b04e9a30..3519c53cb7 100644
--- a/tests/auto/quick/qquickrepeater/tst_qquickrepeater.cpp
+++ b/tests/auto/quick/qquickrepeater/tst_qquickrepeater.cpp
@@ -75,6 +75,7 @@ private slots:
void destroyCount();
void stackingOrder();
void objectModel();
+ void QTBUG54859_asynchronousMove();
};
class TestObject : public QObject
@@ -989,6 +990,30 @@ void tst_QQuickRepeater::objectModel()
delete positioner;
}
+class Ctrl : public QObject
+{
+ Q_OBJECT
+public:
+
+ Q_INVOKABLE void wait()
+ {
+ QTest::qWait(200);
+ }
+};
+
+void tst_QQuickRepeater::QTBUG54859_asynchronousMove()
+{
+ Ctrl ctrl;
+ QQuickView* view = createView();
+ view->rootContext()->setContextProperty("ctrl", &ctrl);
+ view->setSource(testFileUrl("asynchronousMove.qml"));
+ view->show();
+ QQuickItem* item = view->rootObject();
+
+
+ QTRY_COMPARE(item->property("finished"), QVariant(true));
+}
+
QTEST_MAIN(tst_QQuickRepeater)
#include "tst_qquickrepeater.moc"