summaryrefslogtreecommitdiffstats
path: root/tests/auto/qtextstream
diff options
context:
space:
mode:
authorDenis Dzyubenko <denis.dzyubenko@nokia.com>2009-06-10 20:15:00 (GMT)
committerDenis Dzyubenko <denis.dzyubenko@nokia.com>2009-06-11 19:04:14 (GMT)
commit52392292c8fa096e3b0bb692dedce66924ab3305 (patch)
tree5eb54ee501896ffd37473e490580e0072644da87 /tests/auto/qtextstream
parenta2baabcfcb60a7a0e5d3926ad6938983e50dfefc (diff)
downloadQt-52392292c8fa096e3b0bb692dedce66924ab3305.zip
Qt-52392292c8fa096e3b0bb692dedce66924ab3305.tar.gz
Qt-52392292c8fa096e3b0bb692dedce66924ab3305.tar.bz2
Skip the byte order mark when converting the utf16 and utf32 data
When reading one character at a time (as QTextStream::pos does) the byte order mark could be ignored. This happens only with UTF-16 BE/LE and UTF-32 BE/LE codecs. This fixes the qtextstream autotest. Author: Olivier Goffart Author: João Abecasis
Diffstat (limited to 'tests/auto/qtextstream')
-rw-r--r--tests/auto/qtextstream/tst_qtextstream.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/auto/qtextstream/tst_qtextstream.cpp b/tests/auto/qtextstream/tst_qtextstream.cpp
index 358b4b6..cf495d5 100644
--- a/tests/auto/qtextstream/tst_qtextstream.cpp
+++ b/tests/auto/qtextstream/tst_qtextstream.cpp
@@ -552,8 +552,8 @@ void tst_QTextStream::generateLineData(bool for_QString)
QTest::newRow("threelines/crlf/crlf/crlf") << QByteArray("ole\r\ndole\r\ndoffen\r\n") << (QStringList() << "ole" << "dole" << "doffen");
QTest::newRow("threelines/crlf/crlf/nothing") << QByteArray("ole\r\ndole\r\ndoffen") << (QStringList() << "ole" << "dole" << "doffen");
- // utf-16
if (!for_QString) {
+ // utf-16
// one line
QTest::newRow("utf16-BE/nothing")
<< QByteArray("\xfe\xff"
@@ -593,6 +593,18 @@ void tst_QTextStream::generateLineData(bool for_QString)
"\xe5\x00\x67\x00\x65\x00\x0a\x00"
"\xe5\x00\x67\x00\x65\x00\x0a\x00", 26)
<< (QStringList() << "\345ge" << "\345ge" << "\345ge");
+
+ // utf-32
+ QTest::newRow("utf32-BE/twolines")
+ << QByteArray("\x00\x00\xfe\xff"
+ "\x00\x00\x00\xe5\x00\x00\x00\x67\x00\x00\x00\x65\x00\x00\x00\x0a"
+ "\x00\x00\x00\xe5\x00\x00\x00\x67\x00\x00\x00\x65\x00\x00\x00\x0a", 36)
+ << (QStringList() << "\345ge" << "\345ge");
+ QTest::newRow("utf32-LE/twolines")
+ << QByteArray("\xff\xfe\x00\x00"
+ "\xe5\x00\x00\x00\x67\x00\x00\x00\x65\x00\x00\x00\x0a\x00\x00\x00"
+ "\xe5\x00\x00\x00\x67\x00\x00\x00\x65\x00\x00\x00\x0a\x00\x00\x00", 36)
+ << (QStringList() << "\345ge" << "\345ge");
}
// partials