diff options
Diffstat (limited to 'tests/auto/qxmlquery')
-rw-r--r-- | tests/auto/qxmlquery/MessageValidator.cpp | 5 | ||||
-rw-r--r-- | tests/auto/qxmlquery/NetworkOverrider.h | 13 | ||||
-rw-r--r-- | tests/auto/qxmlquery/PushBaseliner.h | 7 | ||||
-rw-r--r-- | tests/auto/qxmlquery/tst_qxmlquery.cpp | 4 |
4 files changed, 21 insertions, 8 deletions
diff --git a/tests/auto/qxmlquery/MessageValidator.cpp b/tests/auto/qxmlquery/MessageValidator.cpp index 58b2b31..99a115e 100644 --- a/tests/auto/qxmlquery/MessageValidator.cpp +++ b/tests/auto/qxmlquery/MessageValidator.cpp @@ -51,9 +51,8 @@ MessageValidator::MessageValidator() : m_success(false) MessageValidator::~MessageValidator() { - Q_ASSERT_X(m_hasChecked, - Q_FUNC_INFO, - "You must call success()."); + if (!m_hasChecked) + qFatal("%s: You must call success().", Q_FUNC_INFO); } void MessageValidator::handleMessage(QtMsgType type, diff --git a/tests/auto/qxmlquery/NetworkOverrider.h b/tests/auto/qxmlquery/NetworkOverrider.h index 10a85c1..2f227ea 100644 --- a/tests/auto/qxmlquery/NetworkOverrider.h +++ b/tests/auto/qxmlquery/NetworkOverrider.h @@ -70,6 +70,7 @@ public: virtual QNetworkReply *createRequest(Operation op, const QNetworkRequest &req, QIODevice *outgoingData); + bool isValid() const; private: const QUrl m_rewriteFrom; @@ -77,11 +78,10 @@ private: }; NetworkOverrider::NetworkOverrider(const QUrl &rewriteFrom, - const QUrl &rewriteTo) : m_rewriteFrom(rewriteFrom) - , m_rewriteTo(rewriteTo) + const QUrl &rewriteTo) + : m_rewriteFrom(rewriteFrom) + , m_rewriteTo(rewriteTo) { - Q_ASSERT(m_rewriteFrom.isValid()); - Q_ASSERT(m_rewriteTo.isValid()); } QNetworkReply *NetworkOverrider::createRequest(Operation op, @@ -95,4 +95,9 @@ QNetworkReply *NetworkOverrider::createRequest(Operation op, return QNetworkAccessManager::createRequest(op, newReq, outgoingData); } + +bool NetworkOverrider::isValid() const +{ + return m_rewriteFrom.isValid() && m_rewriteTo.isValid(); +} #endif 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 5828367..01499d3 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); } } @@ -3078,6 +3080,7 @@ void tst_QXmlQuery::setNetworkAccessManager() const { NetworkOverrider networkOverrider(QUrl(QLatin1String("tag:example.com:DOESNOTEXIST")), QUrl(inputFileAsURI(QLatin1String(XMLPATTERNSDIR "/queries/simpleDocument.xml")))); + QVERIFY(networkOverrider.isValid()); QXmlQuery query; query.setNetworkAccessManager(&networkOverrider); @@ -3094,6 +3097,7 @@ void tst_QXmlQuery::setNetworkAccessManager() const { NetworkOverrider networkOverrider(QUrl(QLatin1String("tag:example.com:DOESNOTEXIST")), QUrl(inputFileAsURI(QLatin1String(XMLPATTERNSDIR "/queries/concat.xq")))); + QVERIFY(networkOverrider.isValid()); QXmlQuery query; query.setNetworkAccessManager(&networkOverrider); |