From: Jason McDonald Date: Wed, 20 Apr 2011 06:27:07 +0000 (+1000) Subject: Remove Q_ASSERT from QDom autotest X-Git-Tag: qt-v5.0.0-alpha1~4297^2~64 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2d471a2bef76237e6796e011d06a96b34c4ca96e;p=profile%2Fivi%2Fqtbase.git Remove Q_ASSERT from QDom autotest The Q_ASSERT here should really be a QVERIFY. Expanded the trivial helper function to make it more obvious what the test does. Change-Id: Ia6017fe820a83b4d6101e5edcfcb68993eef233a Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern (cherry picked from commit 6181805f9ea66b37ee164bd67bdac2ac9d53fb65) --- diff --git a/tests/auto/qdom/tst_qdom.cpp b/tests/auto/qdom/tst_qdom.cpp index 18aa84a..f3b3e00 100644 --- a/tests/auto/qdom/tst_qdom.cpp +++ b/tests/auto/qdom/tst_qdom.cpp @@ -137,7 +137,6 @@ private slots: private: static QDomDocument generateRequest(); - static QDomDocument doc(const QString &title, const QByteArray &ba); static int hasAttributesHelper( const QDomNode& node ); static bool compareDocuments( const QDomDocument &doc1, const QDomDocument &doc2 ); static bool compareNodes( const QDomNode &node1, const QDomNode &node2, bool deep ); @@ -1591,14 +1590,6 @@ void tst_QDom::reportDuplicateAttributes() const QVERIFY2(!isSuccess, "Duplicate attributes are well-formedness errors, and should be reported as such."); } -QDomDocument tst_QDom::doc(const QString &title, const QByteArray &ba) -{ - QDomDocument doc(title); - const bool ret = doc.setContent(ba, true); - Q_ASSERT(ret); - return doc; -} - void tst_QDom::namespacedAttributes() const { static const char *const xml = @@ -1611,8 +1602,13 @@ void tst_QDom::namespacedAttributes() const " >>> SIMPLE BASIC OP - SEND - DUT AS SINK\n" "\n"; - QDomDocument one = doc("document", xml); - QDomDocument two = doc("document2", one.toByteArray(2)); + QDomDocument one("document"); + QString error; + bool docParsed = one.setContent(QByteArray(xml), true, &error); + QVERIFY2(docParsed, qPrintable(error)); + QDomDocument two("document2"); + docParsed = two.setContent(one.toByteArray(2), true, &error); + QVERIFY2(docParsed, qPrintable(error)); QVERIFY(isDeepEqual(one, two)); }