summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativelistmodel
diff options
context:
space:
mode:
authorBea Lam <bea.lam@nokia.com>2010-10-13 06:47:03 (GMT)
committerBea Lam <bea.lam@nokia.com>2010-10-13 06:48:34 (GMT)
commita47835bf8cabffc127c2879b758f6730aca3d52b (patch)
tree7576f73b424f376a670e5419b4eb9adf8b52e41b /tests/auto/declarative/qdeclarativelistmodel
parentdeb92145c5bc69b7ee252687cf5b763b33f17775 (diff)
downloadQt-a47835bf8cabffc127c2879b758f6730aca3d52b.zip
Qt-a47835bf8cabffc127c2879b758f6730aca3d52b.tar.gz
Qt-a47835bf8cabffc127c2879b758f6730aca3d52b.tar.bz2
Fix worker ListModels to property emit countChanged()
Task-number: QT-4094
Diffstat (limited to 'tests/auto/declarative/qdeclarativelistmodel')
-rw-r--r--tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp
index be77f8e..4b8d772 100644
--- a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp
+++ b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp
@@ -320,11 +320,16 @@ void tst_qdeclarativelistmodel::dynamic()
if (!warning.isEmpty())
QTest::ignoreMessage(QtWarningMsg, warning.toLatin1());
+ QSignalSpy spyCount(&model, SIGNAL(countChanged()));
+
int actual = e.evaluate().toInt();
if (e.hasError())
qDebug() << e.error(); // errors not expected
QCOMPARE(actual,result);
+
+ if (model.count() > 0)
+ QVERIFY(spyCount.count() > 0);
}
void tst_qdeclarativelistmodel::dynamic_worker_data()
@@ -351,6 +356,8 @@ void tst_qdeclarativelistmodel::dynamic_worker()
QDeclarativeItem *item = createWorkerTest(&eng, &component, &model);
QVERIFY(item != 0);
+ QSignalSpy spyCount(&model, SIGNAL(countChanged()));
+
if (script[0] == QLatin1Char('{') && script[script.length()-1] == QLatin1Char('}'))
script = script.mid(1, script.length() - 2);
QVariantList operations;
@@ -367,6 +374,9 @@ void tst_qdeclarativelistmodel::dynamic_worker()
waitForWorker(item);
QCOMPARE(QDeclarativeProperty(item, "result").read().toInt(), result);
+ if (model.count() > 0)
+ QVERIFY(spyCount.count() > 0);
+
delete item;
qApp->processEvents();
}