aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKent Hansen <kent.hansen@nokia.com>2012-03-12 16:02:43 +0100
committerQt by Nokia <qt-info@nokia.com>2012-03-12 17:04:04 +0100
commit255357541d8d6e692e8958dcf905b75642ef6b92 (patch)
tree1436bcbe0b73b89ce53924c98e3ca14e498538e2
parentc787809e8fa89562f83a051c53db5c9839da2db4 (diff)
Fix flakiness in qquicklistmodel autotest
The worker_remove_element test calls processEvents() before calling waitForWorker(). It's possible that the worker actually finishes during the processEvents() call. In such a situation, waitForWorker() should return right away; otherwise it would wait for 10000ms for a signal that had already emitted, and the test would fail. Change-Id: I8e98a3297cf5f360c1c405b1baa7524cc6593d81 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
-rw-r--r--tests/auto/qml/qquicklistmodel/tst_qquicklistmodel.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/auto/qml/qquicklistmodel/tst_qquicklistmodel.cpp b/tests/auto/qml/qquicklistmodel/tst_qquicklistmodel.cpp
index 69a8d2ecd8..8d6237679f 100644
--- a/tests/auto/qml/qquicklistmodel/tst_qquicklistmodel.cpp
+++ b/tests/auto/qml/qquicklistmodel/tst_qquicklistmodel.cpp
@@ -216,17 +216,21 @@ QQuickItem *tst_qquicklistmodel::createWorkerTest(QQmlEngine *eng, QQmlComponent
void tst_qquicklistmodel::waitForWorker(QQuickItem *item)
{
+ QQmlProperty prop(item, "done");
+ QVERIFY(prop.isValid());
+ if (prop.read().toBool())
+ return; // already finished
+
QEventLoop loop;
QTimer timer;
timer.setSingleShot(true);
connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit()));
- QQmlProperty prop(item, "done");
- QVERIFY(prop.isValid());
QVERIFY(prop.connectNotifySignal(&loop, SLOT(quit())));
timer.start(10000);
loop.exec();
QVERIFY(timer.isActive());
+ QVERIFY(prop.read().toBool());
}
void tst_qquicklistmodel::static_types_data()