Remove Q_ASSERT from QItemModel autotest
authorJason McDonald <jason.mcdonald@nokia.com>
Tue, 10 May 2011 01:48:36 +0000 (11:48 +1000)
committerRohan McGovern <rohan.mcgovern@nokia.com>
Wed, 18 May 2011 00:46:47 +0000 (10:46 +1000)
If populateTestData() would return an invalid model index, report a
meaningful fatal error rather than failing silently in a release build
and aborting with an uninformative error message in a debug build.

Change-Id: I96820429a25ce5c4eb375d50e7e1f672851e26e6
Task-number: QTBUG-17582
Reviewed-by: Rohan McGovern
(cherry picked from commit 984a72a8bbf853059f0eb7e1054538b48d5f3bc8)

tests/auto/qitemmodel/modelstotest.cpp

index 7ebf2c7..df06c95 100644 (file)
@@ -308,7 +308,8 @@ QModelIndex ModelsToTest::populateTestArea(QAbstractItemModel *model)
             */
         }
         QModelIndex returnIndex = model->index(0,0);
-        Q_ASSERT(returnIndex.isValid());
+        if (!returnIndex.isValid())
+            qFatal("%s: model index to be returned is invalid", Q_FUNC_INFO);
         return returnIndex;
     }