diff options
author | Stian Sandvik Thomassen <stian.thomassen@nokia.com> | 2009-09-28 02:49:53 (GMT) |
---|---|---|
committer | Stian Sandvik Thomassen <stian.thomassen@nokia.com> | 2009-09-28 02:49:53 (GMT) |
commit | 3e23d922c6547f7295c425b28a9c9fc0791dbfa5 (patch) | |
tree | a6fac04f1767d516bdf019e5a979c2e3d7fe529b /tests | |
parent | 8c3169c487fc863c59b58699b3c570cde3a37bd9 (diff) | |
download | Qt-3e23d922c6547f7295c425b28a9c9fc0791dbfa5.zip Qt-3e23d922c6547f7295c425b28a9c9fc0791dbfa5.tar.gz Qt-3e23d922c6547f7295c425b28a9c9fc0791dbfa5.tar.bz2 |
Added test for QTBUG-4595.
QDomDocument::toString() should not cause an assertion if the document
specifies an encoding that is not supported by QTextCodec.
Task-number: QTBUG-4595
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qdom/tst_qdom.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/auto/qdom/tst_qdom.cpp b/tests/auto/qdom/tst_qdom.cpp index 0cad45e..e06ef21 100644 --- a/tests/auto/qdom/tst_qdom.cpp +++ b/tests/auto/qdom/tst_qdom.cpp @@ -126,6 +126,8 @@ private slots: void setContentWhitespace() const; void setContentWhitespace_data() const; + void taskQTBUG4595_dontAssertWhenDocumentSpecifiesUnknownEncoding() const; + void cleanupTestCase() const; private: @@ -1893,5 +1895,18 @@ void tst_QDom::setContentWhitespace_data() const QTest::newRow("") << QString::fromLatin1("\t\t\t\t<?xml version='1.0' ?><e/>") << false; } +void tst_QDom::taskQTBUG4595_dontAssertWhenDocumentSpecifiesUnknownEncoding() const +{ + QString xmlWithUnknownEncoding("<?xml version='1.0' encoding='unknown-encoding'?>" + "<foo>" + " <bar>How will this sentence be handled?</bar>" + "</foo>"); + QDomDocument d; + QVERIFY(d.setContent(xmlWithUnknownEncoding)); + + QString dontAssert = d.toString(); // this should not assert + QVERIFY(true); +} + QTEST_MAIN(tst_QDom) #include "tst_qdom.moc" |