From 3e23d922c6547f7295c425b28a9c9fc0791dbfa5 Mon Sep 17 00:00:00 2001 From: Stian Sandvik Thomassen Date: Mon, 28 Sep 2009 12:49:53 +1000 Subject: 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 --- tests/auto/qdom/tst_qdom.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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") << false; } +void tst_QDom::taskQTBUG4595_dontAssertWhenDocumentSpecifiesUnknownEncoding() const +{ + QString xmlWithUnknownEncoding("" + "" + " How will this sentence be handled?" + ""); + QDomDocument d; + QVERIFY(d.setContent(xmlWithUnknownEncoding)); + + QString dontAssert = d.toString(); // this should not assert + QVERIFY(true); +} + QTEST_MAIN(tst_QDom) #include "tst_qdom.moc" -- cgit v0.12