summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason McDonald <jason.mcdonald@nokia.com>2011-05-03 05:55:30 (GMT)
committerJason McDonald <jason.mcdonald@nokia.com>2011-05-04 05:38:34 (GMT)
commitcb126ff7ad08e9801e2911511aa9aeb728faa8f3 (patch)
tree90b9c1c2f22708714ed7bd10cdde117fb266df6a
parent8e12d9e322ec7d8f7eece09b6f15cba640615f9e (diff)
downloadQt-cb126ff7ad08e9801e2911511aa9aeb728faa8f3.zip
Qt-cb126ff7ad08e9801e2911511aa9aeb728faa8f3.tar.gz
Qt-cb126ff7ad08e9801e2911511aa9aeb728faa8f3.tar.bz2
Remove Q_ASSERT's from QTreeView autotest
Issue a meaningful fatal error in preference to aborting in debug mode builds and crashing in release mode builds. Change-Id: I7bb04e1e222fd6167be19b5d88caac27b43d88df Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern
-rw-r--r--tests/auto/qtreeview/tst_qtreeview.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/tests/auto/qtreeview/tst_qtreeview.cpp b/tests/auto/qtreeview/tst_qtreeview.cpp
index c07c471..551b63f 100644
--- a/tests/auto/qtreeview/tst_qtreeview.cpp
+++ b/tests/auto/qtreeview/tst_qtreeview.cpp
@@ -2536,7 +2536,7 @@ void tst_QTreeView::sortByColumn()
/*
This is a model that every time kill() is called it will completely change
- all of its nodes for new nodes. It then asserts if you later use a dead node.
+ all of its nodes for new nodes. It then qFatal's if you later use a dead node.
*/
class EvilModel: public QAbstractItemModel
{
@@ -2624,7 +2624,8 @@ public:
Node *parentNode = root;
if (parent.isValid()) {
parentNode = static_cast<Node*>(parent.internalPointer());
- Q_ASSERT(!parentNode->isDead);
+ if (parentNode->isDead)
+ qFatal("%s: parentNode is dead!", Q_FUNC_INFO);
}
return parentNode->children.count();
}
@@ -2639,9 +2640,11 @@ public:
Node *grandparentNode = static_cast<Node*>(parent.internalPointer());
Node *parentNode = root;
if (parent.isValid()) {
- Q_ASSERT(!grandparentNode->isDead);
+ if (grandparentNode->isDead)
+ qFatal("%s: grandparentNode is dead!", Q_FUNC_INFO);
parentNode = grandparentNode->children[parent.row()];
- Q_ASSERT(!parentNode->isDead);
+ if (parentNode->isDead)
+ qFatal("%s: grandparentNode is dead!", Q_FUNC_INFO);
}
return createIndex(row, column, parentNode);
}
@@ -2661,7 +2664,8 @@ public:
Node *parentNode = root;
if (idx.isValid()) {
parentNode = static_cast<Node*>(idx.internalPointer());
- Q_ASSERT(!parentNode->isDead);
+ if (parentNode->isDead)
+ qFatal("%s: grandparentNode is dead!", Q_FUNC_INFO);
}
return QString("[%1,%2,%3]").arg(idx.row()).arg(idx.column())
.arg(parentNode->isDead ? "dead" : "alive");