Remove Q_ASSERT from QDom autotest
authorJason McDonald <jason.mcdonald@nokia.com>
Wed, 20 Apr 2011 06:27:07 +0000 (16:27 +1000)
committerRohan McGovern <rohan.mcgovern@nokia.com>
Wed, 18 May 2011 00:46:41 +0000 (10:46 +1000)
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)

tests/auto/qdom/tst_qdom.cpp

index 18aa84a..f3b3e00 100644 (file)
@@ -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
         "  <Title displayLabel='Title' >>>> SIMPLE BASIC OP - SEND - DUT AS SINK</Title>\n"
         "</xan:td>\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));
 }