From 291b578a7759d87f6be9766718ac206a48565285 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Mon, 9 May 2011 18:21:18 +1000 Subject: Remove Q_ASSERT from qxmlquery autotest Make stream validity check part of the regular test logic rather than aborting in debug builds and ignoring the error in release builds. Change-Id: I07dcba079eecd88bf16672c6019a8d6f5a829fee Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern (cherry picked from commit b841d30f25a87f8aafc4624fe09a3503ddc6ccda) --- tests/auto/qxmlquery/PushBaseliner.h | 7 ++++++- tests/auto/qxmlquery/tst_qxmlquery.cpp | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'tests/auto') diff --git a/tests/auto/qxmlquery/PushBaseliner.h b/tests/auto/qxmlquery/PushBaseliner.h index 0648c90..8478a6a 100644 --- a/tests/auto/qxmlquery/PushBaseliner.h +++ b/tests/auto/qxmlquery/PushBaseliner.h @@ -65,9 +65,9 @@ public: const QXmlNamePool &namePool) : m_out(out) , m_namePool(namePool) { - Q_ASSERT(m_out.codec()); } + bool isValid() const; virtual void startElement(const QXmlName&); virtual void endElement(); virtual void attribute(const QXmlName&, const QStringRef&); @@ -86,6 +86,11 @@ private: const QXmlNamePool m_namePool; }; +bool PushBaseliner::isValid() const +{ + return m_out.codec(); +} + void PushBaseliner::startElement(const QXmlName &name) { m_out << "startElement(" << name.toClarkName(m_namePool) << ')'<< endl; diff --git a/tests/auto/qxmlquery/tst_qxmlquery.cpp b/tests/auto/qxmlquery/tst_qxmlquery.cpp index e3c97d2..e22f528 100644 --- a/tests/auto/qxmlquery/tst_qxmlquery.cpp +++ b/tests/auto/qxmlquery/tst_qxmlquery.cpp @@ -967,6 +967,7 @@ void tst_QXmlQuery::evaluateToReceiver() QString produced; QTextStream stream(&produced, QIODevice::WriteOnly); PushBaseliner push(stream, query.namePool()); + QVERIFY(push.isValid()); query.evaluateTo(&push); const QString baselineName(inputFile(QLatin1String(SRCDIR "pushBaselines/") + inputQuery.left(inputQuery.length() - 2) + QString::fromLatin1("ref"))); @@ -1685,6 +1686,7 @@ void tst_QXmlQuery::constCorrectness() const QString dummyString; QTextStream dummyStream(&dummyString); PushBaseliner dummy(dummyStream, query.namePool()); + QVERIFY(dummy.isValid()); query.evaluateTo(&dummy); } } -- cgit v1.2.1