Remove Q_ASSERT's from QTreeView autotest
authorJason McDonald <jason.mcdonald@nokia.com>
Mon, 9 May 2011 07:14:39 +0000 (17:14 +1000)
committerRohan McGovern <rohan.mcgovern@nokia.com>
Wed, 18 May 2011 00:46:47 +0000 (10:46 +1000)
Report fatal errors instead of failing silently in non-debug builds.

Change-Id: Ieaff30b71dba2a385a5fffc93d2a8c0f5864aa18
Task-number: QTBUG-17582
Reviewed-by: Rohan McGovern
(cherry picked from commit e12b912de89088a307c3519a01198a5314b8dd1a)

tests/auto/qtreeview/tst_qtreeview.cpp

index 551b63f..1f0c2ce 100644 (file)
@@ -277,7 +277,8 @@ public:
     }
 
     int rowCount(const QModelIndex& parent = QModelIndex()) const {
-        Q_ASSERT(fetched);
+        if (!fetched)
+            qFatal("%s: rowCount should not be called before fetching", Q_FUNC_INFO);
         if ((parent.column() > 0) || (level(parent) > levels))
             return 0;
         return rows;
@@ -2567,7 +2568,8 @@ public:
                 }
             }
             if (parent == 0) {
-                Q_ASSERT(children.isEmpty());
+                if (!children.isEmpty())
+                    qFatal("%s: children should be empty when parent is null", Q_FUNC_INFO);
                 populate();
             } else {
                 isDead = true;