diff options
author | Jason McDonald <jason.mcdonald@nokia.com> | 2011-05-06 04:00:00 (GMT) |
---|---|---|
committer | Jason McDonald <jason.mcdonald@nokia.com> | 2011-05-06 07:21:53 (GMT) |
commit | a80ecc34565d6efc474bca2322046f4200ad51db (patch) | |
tree | d4523b18c2cd209af73ffd4f629c481b41fa3122 /tests/auto/qabstractxmlnodemodel | |
parent | 68027b186fe547a5579d07480e097bfb69c79de9 (diff) | |
download | Qt-a80ecc34565d6efc474bca2322046f4200ad51db.zip Qt-a80ecc34565d6efc474bca2322046f4200ad51db.tar.gz Qt-a80ecc34565d6efc474bca2322046f4200ad51db.tar.bz2 |
Remove Q_ASSERT from qabstractxmlnodemodel test
Rather than aborting in a debug build and failing silently in a release
build, report a warning and return a null model index if the first
(root) node of the model is not a document. The null return value will
cause initTestCase() to fail gracefully.
Change-Id: I15e9456929bbb3f0bd50d30333c49143b6f0aad7
Task-number: QTBUG-17582
Reviewed-by: Rohan McGovern
Diffstat (limited to 'tests/auto/qabstractxmlnodemodel')
-rw-r--r-- | tests/auto/qabstractxmlnodemodel/LoadingModel.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/tests/auto/qabstractxmlnodemodel/LoadingModel.cpp b/tests/auto/qabstractxmlnodemodel/LoadingModel.cpp index c68857b..01d3164 100644 --- a/tests/auto/qabstractxmlnodemodel/LoadingModel.cpp +++ b/tests/auto/qabstractxmlnodemodel/LoadingModel.cpp @@ -113,7 +113,10 @@ QXmlNodeModelIndex::DocumentOrder LoadingModel::compareOrder(const QXmlNodeModel QXmlNodeModelIndex LoadingModel::root(const QXmlNodeModelIndex &) const { - Q_ASSERT(kind(createIndex(m_nodes.first())) == QXmlNodeModelIndex::Document); + if (kind(createIndex(m_nodes.first())) != QXmlNodeModelIndex::Document) { + qWarning("%s: first node must be a Document node", Q_FUNC_INFO); + return QXmlNodeModelIndex(); + } return createIndex(m_nodes.first()); } |