summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJason McDonald <jason.mcdonald@nokia.com>2011-05-06 14:08:10 +1000
committerRohan McGovern <rohan.mcgovern@nokia.com>2011-05-18 11:04:38 +1000
commit8a8db4426809fed7b47460003eca98e65603e9e4 (patch)
tree5ecf888793507acad640d1b757fc86eb61fdaa75 /tests
parentcaac04babbfdca7a3ffa604b5bb89bddd60a0d5d (diff)
downloadqtxmlpatterns-8a8db4426809fed7b47460003eca98e65603e9e4.tar.gz
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 (cherry picked from commit a0496d1db09dfaa6a2b31a5c23e154de7b4a2eb7)
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qabstractxmlnodemodel/LoadingModel.cpp7
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;
}