summaryrefslogtreecommitdiffstats
path: root/tests/auto/qabstractxmlnodemodel
diff options
context:
space:
mode:
authorJason McDonald <jason.mcdonald@nokia.com>2011-05-05 07:36:59 (GMT)
committerJason McDonald <jason.mcdonald@nokia.com>2011-05-06 02:50:28 (GMT)
commit416d45caa9feefe8337795adc4b93a8148d57a3a (patch)
tree7e37bb39e61056cf4b58e449a570076d95a35d9e /tests/auto/qabstractxmlnodemodel
parent22e99d92a71645d643ebd54c6209bced80f7c5b8 (diff)
downloadQt-416d45caa9feefe8337795adc4b93a8148d57a3a.zip
Qt-416d45caa9feefe8337795adc4b93a8148d57a3a.tar.gz
Qt-416d45caa9feefe8337795adc4b93a8148d57a3a.tar.bz2
Remove Q_ASSERT from qabstractxmlnodemodel test
When no content can be loaded to create the model, return a null model (which will make the test fail gracefully) rather than aborting in a debug build and failing silently in a release build. Change-Id: I28f0bb92c617c8dafd1089d0b3dafcfef0c0da53 Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern
Diffstat (limited to 'tests/auto/qabstractxmlnodemodel')
-rw-r--r--tests/auto/qabstractxmlnodemodel/LoadingModel.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/auto/qabstractxmlnodemodel/LoadingModel.cpp b/tests/auto/qabstractxmlnodemodel/LoadingModel.cpp
index 054fd69..cf85486 100644
--- a/tests/auto/qabstractxmlnodemodel/LoadingModel.cpp
+++ b/tests/auto/qabstractxmlnodemodel/LoadingModel.cpp
@@ -53,7 +53,6 @@ LoadingModel::LoadingModel(const Node::Vector &content,
const QXmlNamePool &np) : QSimpleXmlNodeModel(np)
, m_nodes(content)
{
- Q_ASSERT(!content.isEmpty());
/*
foreach(const Node *n, content)
qDebug() << "this:" << n
@@ -354,6 +353,11 @@ QAbstractXmlNodeModel::Ptr LoadingModel::create(const QXmlNamePool &np)
{
Loader loader(np);
loader.load();
+ if (loader.m_result.isEmpty()) {
+ qWarning("%s: attempt to create model with no content", Q_FUNC_INFO);
+ return Ptr(0);
+ }
+
return Ptr(new LoadingModel(loader.m_result, np));
}
#endif //QTEST_XMLPATTERNS