Remove Q_ASSERT from qabstractxmlnodemodel test
authorJason McDonald <jason.mcdonald@nokia.com>
Fri, 6 May 2011 04:16:48 +0000 (14:16 +1000)
committerRohan McGovern <rohan.mcgovern@nokia.com>
Wed, 18 May 2011 01:04:38 +0000 (11:04 +1000)
If new "axis" enum values are added in the future, the test should
report a meaningful warning in the test output rather than aborting with
a meaningless message in debug builds and failing silently in release
builds.

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

tests/auto/qabstractxmlnodemodel/LoadingModel.cpp

index 2ce9466..052c781 100644 (file)
@@ -173,10 +173,10 @@ QXmlNodeModelIndex LoadingModel::nextFromSimpleAxis(QAbstractXmlNodeModel::Simpl
             return internal->precedingSibling ? createIndex(internal->precedingSibling) : QXmlNodeModelIndex();
         case NextSibling:
             return internal->followingSibling ? createIndex(internal->followingSibling) : QXmlNodeModelIndex();
+        default:
+            qWarning("%s: unknown axis enum value %d", Q_FUNC_INFO, static_cast<int>(axis));
+            return QXmlNodeModelIndex();
     }
-
-    Q_ASSERT(false);
-    return QXmlNodeModelIndex();
 }
 
 QVector<QXmlNodeModelIndex> LoadingModel::attributes(const QXmlNodeModelIndex &ni) const