diff -r dee5afe5301f -r 3f74d0d4af4c tests/auto/qdom/tst_qdom.cpp --- a/tests/auto/qdom/tst_qdom.cpp Mon Mar 15 12:43:09 2010 +0200 +++ b/tests/auto/qdom/tst_qdom.cpp Thu Apr 08 14:19:33 2010 +0300 @@ -131,6 +131,7 @@ void setContentWhitespace_data() const; void taskQTBUG4595_dontAssertWhenDocumentSpecifiesUnknownEncoding() const; + void cloneDTD_QTBUG8398() const; void cleanupTestCase() const; @@ -1912,5 +1913,29 @@ QVERIFY(true); } +void tst_QDom::cloneDTD_QTBUG8398() const +{ + QString dtd("\n" + "\n" + "\n" + "]>\n" + "\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("\n" + "\n" + "\n" + "]>\n" + "\n"); + QString output; + QTextStream stream(&output); + domDocument2.save(stream, 0); + QCOMPARE(output, expected); +} QTEST_MAIN(tst_QDom) #include "tst_qdom.moc"