diff options
author | Bea Lam <bea.lam@nokia.com> | 2010-07-14 01:51:04 (GMT) |
---|---|---|
committer | Jason McDonald <jason.mcdonald@nokia.com> | 2010-07-18 04:17:17 (GMT) |
commit | ea41b2b74f1c9656dec9b58fa91189b94ff1eb6f (patch) | |
tree | 77dd99d650f9332afda57a6f972a3200fee5bcac /tests | |
parent | aa7bdea48d8006a272d080af3805836a1a4c540d (diff) | |
download | Qt-ea41b2b74f1c9656dec9b58fa91189b94ff1eb6f.zip Qt-ea41b2b74f1c9656dec9b58fa91189b94ff1eb6f.tar.gz Qt-ea41b2b74f1c9656dec9b58fa91189b94ff1eb6f.tar.bz2 |
Fix test for get() to check for undefined return values
Task-number: QTBUG-10658
(cherry picked from commit 237bc693a527f9cb2b6bbe7c518018cbf56b0eb6)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp | 10 |
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")); |