Remove Q_ASSERT from QDeclarativeListModel autotest.
authorJason McDonald <jason.mcdonald@nokia.com>
Fri, 15 Apr 2011 06:15:39 +0000 (16:15 +1000)
committerRohan McGovern <rohan.mcgovern@nokia.com>
Wed, 18 May 2011 00:59:11 +0000 (10:59 +1000)
Change-Id: Ic15b747fa50bcec54df748b173b299058f69c681
Task-number: QTBUG-17582
Reviewed-by: Rohan McGovern
(cherry picked from commit 59a6e6200984ccbb862b8758436a5e88b8c40bbc)

tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp

index cf053e5..fa5dcc4 100644 (file)
@@ -115,7 +115,6 @@ int tst_qdeclarativelistmodel::roleFromName(const QDeclarativeListModel *model,
         if (model->toString(roles[i]) == roleName)
             return roles[i];
     }
-    Q_ASSERT(false);
     return -1;
 }
 
@@ -741,6 +740,7 @@ void tst_qdeclarativelistmodel::get()
          "}", QUrl());
     QDeclarativeListModel *model = qobject_cast<QDeclarativeListModel*>(component.create());
     int role = roleFromName(model, roleName);
+    QVERIFY(role >= 0);
 
     QSignalSpy spy(model, SIGNAL(itemsChanged(int, int, QList<int>)));
     QDeclarativeExpression expr(eng.rootContext(), model, expression);
@@ -804,6 +804,7 @@ void tst_qdeclarativelistmodel::get_worker()
     model.append(sv);
     model.append(sv);
     int role = roleFromName(&model, roleName);
+    QVERIFY(role >= 0);
 
     const char *warning = "<Unknown File>: QML ListModel: Cannot add list-type data when modifying or after modification from a worker script";
     if (roleValue.type() == QVariant::List || roleValue.type() == QVariant::Map)
@@ -895,6 +896,7 @@ void tst_qdeclarativelistmodel::get_nested()
         int outerListIndex = testData[i].first;
         QString outerListRoleName = testData[i].second;
         int outerListRole = roleFromName(model, outerListRoleName);
+        QVERIFY(outerListRole >= 0);
 
         childModel = qobject_cast<QDeclarativeListModel*>(model->data(outerListIndex, outerListRole).value<QObject*>());
         QVERIFY(childModel);
@@ -907,6 +909,7 @@ void tst_qdeclarativelistmodel::get_nested()
         QVERIFY(!expr.hasError());
 
         int role = roleFromName(childModel, roleName);
+        QVERIFY(role >= 0);
         QCOMPARE(childModel->data(index, role), roleValue);
         QCOMPARE(spy.count(), 1);