summaryrefslogtreecommitdiffstats
path: root/tests/auto/qdom
diff options
context:
space:
mode:
authorPeter Hartmann <peter.hartmann@nokia.com>2010-03-05 11:28:32 +0100
committerPeter Hartmann <peter.hartmann@nokia.com>2010-03-05 14:14:26 +0100
commit4b3b9b792dfe2d25a271f042f23df22e8b9684f6 (patch)
treecdb6ab1c5cbc8cbde956600aee7f3a4e8b676f63 /tests/auto/qdom
parent3fdad84b40b62979844c2d37d16093a0b67222df (diff)
QDom: prevent infinite loop when cloning a DTD
we forgot to advance the pointer to the current node. Reviewed-by: Frans Englich Task-number: QTBUG-8398
Diffstat (limited to 'tests/auto/qdom')
-rw-r--r--tests/auto/qdom/tst_qdom.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/auto/qdom/tst_qdom.cpp b/tests/auto/qdom/tst_qdom.cpp
index d1b2ea5479..caf08d6628 100644
--- a/tests/auto/qdom/tst_qdom.cpp
+++ b/tests/auto/qdom/tst_qdom.cpp
@@ -131,6 +131,7 @@ private slots:
void setContentWhitespace_data() const;
void taskQTBUG4595_dontAssertWhenDocumentSpecifiesUnknownEncoding() const;
+ void cloneDTD_QTBUG8398() const;
void cleanupTestCase() const;
@@ -1912,5 +1913,29 @@ void tst_QDom::taskQTBUG4595_dontAssertWhenDocumentSpecifiesUnknownEncoding() co
QVERIFY(true);
}
+void tst_QDom::cloneDTD_QTBUG8398() const
+{
+ QString dtd("<?xml version='1.0' encoding='UTF-8'?>\n"
+ "<!DOCTYPE first [\n"
+ "<!ENTITY secondFile SYSTEM 'second.xml'>\n"
+ "<!ENTITY thirdFile SYSTEM 'third.xml'>\n"
+ "]>\n"
+ "<first/>\n");
+ QDomDocument domDocument;
+ QVERIFY(domDocument.setContent(dtd));
+ QDomDocument domDocument2 = domDocument.cloneNode(true).toDocument();
+
+ // for some reason, our DOM implementation reverts the order of entities
+ QString expected("<?xml version='1.0' encoding='UTF-8'?>\n"
+ "<!DOCTYPE first [\n"
+ "<!ENTITY thirdFile SYSTEM 'third.xml'>\n"
+ "<!ENTITY secondFile SYSTEM 'second.xml'>\n"
+ "]>\n"
+ "<first/>\n");
+ QString output;
+ QTextStream stream(&output);
+ domDocument2.save(stream, 0);
+ QCOMPARE(output, expected);
+}
QTEST_MAIN(tst_QDom)
#include "tst_qdom.moc"