summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorBea Lam <bea.lam@nokia.com>2010-07-14 01:51:04 (GMT)
committerBea Lam <bea.lam@nokia.com>2010-07-14 01:51:04 (GMT)
commit237bc693a527f9cb2b6bbe7c518018cbf56b0eb6 (patch)
tree08f5d52f0f2a32f2865c88f89b6197c5885f3ecd /tests
parent7bd9e6c5805ab78c68161bec20c225965ea59ddb (diff)
downloadQt-237bc693a527f9cb2b6bbe7c518018cbf56b0eb6.zip
Qt-237bc693a527f9cb2b6bbe7c518018cbf56b0eb6.tar.gz
Qt-237bc693a527f9cb2b6bbe7c518018cbf56b0eb6.tar.bz2
Fix test for get() to check for undefined return values
Task-number: QTBUG-10658
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp
index f15ac8f..858c26d 100644
--- a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp
+++ b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp
@@ -193,8 +193,9 @@ void tst_qdeclarativelistmodel::dynamic_data()
QTest::newRow("count") << "count" << 0 << "";
- QTest::newRow("get1") << "{get(0)}" << 0 << "";
- QTest::newRow("get2") << "{get(-1)}" << 0 << "";
+ QTest::newRow("get1") << "{get(0) === undefined}" << 1 << "";
+ QTest::newRow("get2") << "{get(-1) === undefined}" << 1 << "";
+ QTest::newRow("get3") << "{append({'foo':123});get(0) != undefined}" << 1 << "";
QTest::newRow("append1") << "{append({'foo':123});count}" << 1 << "";
QTest::newRow("append2") << "{append({'foo':123,'bar':456});count}" << 1 << "";
@@ -292,8 +293,6 @@ void tst_qdeclarativelistmodel::dynamic()
if (e.hasError())
qDebug() << e.error(); // errors not expected
- if (QTest::currentDataTag() != QLatin1String("clear3") && QTest::currentDataTag() != QLatin1String("remove3"))
- QVERIFY(!e.hasError());
QCOMPARE(actual,result);
}
@@ -308,6 +307,9 @@ void tst_qdeclarativelistmodel::dynamic_worker()
QFETCH(int, result);
QFETCH(QString, warning);
+ // This is same as dynamic() except it applies the test to a ListModel called
+ // from a WorkerScript (i.e. testing the internal NestedListModel class)
+
QDeclarativeListModel model;
QDeclarativeEngine eng;
QDeclarativeComponent component(&eng, QUrl::fromLocalFile(SRCDIR "/data/model.qml"));