diff options
author | Jason McDonald <jason.mcdonald@nokia.com> | 2011-05-06 04:08:10 (GMT) |
---|---|---|
committer | Jason McDonald <jason.mcdonald@nokia.com> | 2011-05-06 07:22:54 (GMT) |
commit | a0496d1db09dfaa6a2b31a5c23e154de7b4a2eb7 (patch) | |
tree | 335364bf8c647a404b2181c315040eec50286b54 /tests/auto/qabstractxmlnodemodel | |
parent | a80ecc34565d6efc474bca2322046f4200ad51db (diff) | |
download | Qt-a0496d1db09dfaa6a2b31a5c23e154de7b4a2eb7.zip Qt-a0496d1db09dfaa6a2b31a5c23e154de7b4a2eb7.tar.gz Qt-a0496d1db09dfaa6a2b31a5c23e154de7b4a2eb7.tar.bz2 |
Remove Q_ASSERT from qabstractxmlnodemodel test
Instead of aborting in debug builds and failing silently in release
builds, print a meaningful warning message into the test output and
return a null QVariant.
Change-Id: Idcd70f5cb01528b522d84e391f6f8692a189f420
Task-number: QTBUG-17582
Reviewed-by: Rohan McGovern
Diffstat (limited to 'tests/auto/qabstractxmlnodemodel')
-rw-r--r-- | tests/auto/qabstractxmlnodemodel/LoadingModel.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/tests/auto/qabstractxmlnodemodel/LoadingModel.cpp b/tests/auto/qabstractxmlnodemodel/LoadingModel.cpp index 01d3164..2ce9466 100644 --- a/tests/auto/qabstractxmlnodemodel/LoadingModel.cpp +++ b/tests/auto/qabstractxmlnodemodel/LoadingModel.cpp @@ -129,8 +129,11 @@ QVariant LoadingModel::typedValue(const QXmlNodeModelIndex &ni) const { const Node *const internal = toInternal(ni); - Q_ASSERT(internal->kind == QXmlNodeModelIndex::Attribute - || internal->kind == QXmlNodeModelIndex::Element); + if (internal->kind != QXmlNodeModelIndex::Attribute + && internal->kind != QXmlNodeModelIndex::Element) { + qWarning("%s: node must be an attribute or element", Q_FUNC_INFO); + return QVariant(); + } return internal->value; } |