diff options
author | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2009-12-18 10:49:51 (GMT) |
---|---|---|
committer | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2010-01-06 15:25:58 (GMT) |
commit | 5529a356368b31998e859e3fb5f94e85c16447aa (patch) | |
tree | a593e4fbd0c91ef183ea0df10640b7a2c9ee2ebe /tests/auto | |
parent | f8780558e3fc68321a0dd6dcef611eeee0805a2e (diff) | |
download | Qt-5529a356368b31998e859e3fb5f94e85c16447aa.zip Qt-5529a356368b31998e859e3fb5f94e85c16447aa.tar.gz Qt-5529a356368b31998e859e3fb5f94e85c16447aa.tar.bz2 |
Temporary hackiesh solution to prevent BOM in the xml data.
We don't want to have byte-order-mark in the middle of the written string.
Task-number: QTBUG-6893
Reviewed-by: Thiago
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/qxmlstream/tst_qxmlstream.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/tests/auto/qxmlstream/tst_qxmlstream.cpp b/tests/auto/qxmlstream/tst_qxmlstream.cpp index 62cb54d..6aa9955 100644 --- a/tests/auto/qxmlstream/tst_qxmlstream.cpp +++ b/tests/auto/qxmlstream/tst_qxmlstream.cpp @@ -559,6 +559,7 @@ private slots: void hasAttributeSignature() const; void hasAttribute() const; void writeWithCodec() const; + void writeWithUtf8Codec() const; void writeWithStandalone() const; void entitiesAndWhitespace_1() const; void entitiesAndWhitespace_2() const; @@ -1303,7 +1304,6 @@ void tst_QXmlStream::hasAttribute() const void tst_QXmlStream::writeWithCodec() const { - QByteArray outarray; QXmlStreamWriter writer(&outarray); writer.setAutoFormatting(true); @@ -1326,6 +1326,20 @@ void tst_QXmlStream::writeWithCodec() const QVERIFY(outarray.contains(codec->name())); } +void tst_QXmlStream::writeWithUtf8Codec() const +{ + QByteArray outarray; + QXmlStreamWriter writer(&outarray); + + QTextCodec *codec = QTextCodec::codecForMib(106); // utf-8 + QVERIFY(codec); + writer.setCodec(codec); + + writer.writeStartDocument("1.0"); + static const char begin[] = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; + QVERIFY(outarray.startsWith(begin)); +} + void tst_QXmlStream::writeWithStandalone() const { { |