Remove Q_ASSERT from qabstractxmlnodemodel test
authorJason McDonald <jason.mcdonald@nokia.com>
Fri, 6 May 2011 03:51:20 +0000 (13:51 +1000)
committerRohan McGovern <rohan.mcgovern@nokia.com>
Wed, 18 May 2011 01:04:38 +0000 (11:04 +1000)
Instead of aborting in a debug build and failing silently in a release
build when the internal state of the model is incorrect, report a
meaningful fatal error in all builds.

Change-Id: I64ca4dde070cb7fbe69684a36092d53e5b84d80a
Task-number: QTBUG-17582
Reviewed-by: Rohan McGovern
(cherry picked from commit 68027b186fe547a5579d07480e097bfb69c79de9)

tests/auto/qabstractxmlnodemodel/LoadingModel.cpp

index 63fad67..c68857b 100644 (file)
@@ -98,8 +98,10 @@ QXmlNodeModelIndex::DocumentOrder LoadingModel::compareOrder(const QXmlNodeModel
 {
     const Node *const in1 = toInternal(n1);
     const Node *const in2 = toInternal(n2);
-    Q_ASSERT(m_nodes.indexOf(in1) != -1);
-    Q_ASSERT(m_nodes.indexOf(in2) != -1);
+    if (m_nodes.indexOf(in1) == -1)
+        qFatal("%s: node n1 is not in internal node list", Q_FUNC_INFO);
+    if (m_nodes.indexOf(in2) == -1)
+        qFatal("%s: node n2 is not in internal node list", Q_FUNC_INFO);
 
     if(in1 == in2)
         return QXmlNodeModelIndex::Is;