From 4d67b9dcfbb379d9d65a5a1fec74600273941637 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Tue, 28 Apr 2020 18:15:54 +0200 Subject: Get rid of QTextCodec in QTextStream Use QStringConverter instead. Also change the default encoding of QTextStream to utf8. Change-Id: I30682e75fe0462d1a937539f773640c83a2d82e1 Reviewed-by: Thiago Macieira --- .../dom/qdom/testdata/toString_01/doc_euc-jp.xml | 78 ---------------------- .../qdom/testdata/toString_01/doc_iso-2022-jp.xml | 78 ---------------------- tests/auto/xml/dom/qdom/tst_qdom.cpp | 65 +++++++----------- 3 files changed, 25 insertions(+), 196 deletions(-) delete mode 100644 tests/auto/xml/dom/qdom/testdata/toString_01/doc_euc-jp.xml delete mode 100644 tests/auto/xml/dom/qdom/testdata/toString_01/doc_iso-2022-jp.xml (limited to 'tests/auto/xml') diff --git a/tests/auto/xml/dom/qdom/testdata/toString_01/doc_euc-jp.xml b/tests/auto/xml/dom/qdom/testdata/toString_01/doc_euc-jp.xml deleted file mode 100644 index 887ab5ec30..0000000000 --- a/tests/auto/xml/dom/qdom/testdata/toString_01/doc_euc-jp.xml +++ /dev/null @@ -1,78 +0,0 @@ - - - -<週報> - <年月週> - <年度>1997 - <月度>1 - <週>1 - - - <氏名> - <氏>山田 - <名>太郎 - - - <業務報告リスト> - <業務報告> - <業務名>XMLエディターの作成 - <業務コード>X3355-23 - <工数管理> - <見積もり工数>1600 - <実績工数>320 - <当月見積もり工数>160 - <当月実績工数>24 - - <予定項目リスト> - <予定項目> -

XMLエディターの基本仕様の作成

- - - <実施事項リスト> - <実施事項> -

XMLエディターの基本仕様の作成

- - <実施事項> -

競合他社製品の機能調査

- - - <上長への要請事項リスト> - <上長への要請事項> -

特になし

- - - <問題点対策> -

XMLとは何かわからない。

- - - - <業務報告> - <業務名>検索エンジンの開発 - <業務コード>S8821-76 - <工数管理> - <見積もり工数>120 - <実績工数>6 - <当月見積もり工数>32 - <当月実績工数>2 - - <予定項目リスト> - <予定項目> -

gooの機能を調べてみる

- - - <実施事項リスト> - <実施事項> -

更に、どういう検索エンジンがあるか調査する

- - - <上長への要請事項リスト> - <上長への要請事項> -

開発をするのはめんどうなので、Yahoo!を買収して下さい。

- - - <問題点対策> -

検索エンジンで車を走らせることができない。(要調査)

- - - - diff --git a/tests/auto/xml/dom/qdom/testdata/toString_01/doc_iso-2022-jp.xml b/tests/auto/xml/dom/qdom/testdata/toString_01/doc_iso-2022-jp.xml deleted file mode 100644 index 9a8e8545ac..0000000000 --- a/tests/auto/xml/dom/qdom/testdata/toString_01/doc_iso-2022-jp.xml +++ /dev/null @@ -1,78 +0,0 @@ - - - -<$B=5Js(B> - <$BG/7n=5(B> - <$BG/EY(B>1997 - <$B7nEY(B>1 - <$B=5(B>1 - - - <$B;aL>(B> - <$B;a(B>$B;3ED(B - <$BL>(B>$BB@O:(B(B> - (B> - - <$B6HL3Js9p%j%9%H(B> - <$B6HL3Js9p(B> - <$B6HL3L>(B>XML$B%(%G%#%?!<$N:n@.(B(B> - <$B6HL3%3!<%I(B>X3355-23 - <$B9)?t4IM}(B> - <$B8+@Q$b$j9)?t(B>1600 - <$B320 - <$BEv7n8+@Q$b$j9)?t(B>160 - <$BEv7n24 - - <$BM=Dj9`L\%j%9%H(B> - <$BM=Dj9`L\(B> -

XML$B%(%G%#%?!<$N4pK\;EMM$N:n@.(B

- - - <$B - <$B -

XML$B%(%G%#%?!<$N4pK\;EMM$N:n@.(B

- - <$B -

$B6%9gB> - - - <$B>eD9$X$NMW@A;v9`%j%9%H(B> - <$B>eD9$X$NMW@A;v9`(B> -

$BFC$K$J$7(B

- eD9$X$NMW@A;v9`(B> - eD9$X$NMW@A;v9`%j%9%H(B> - <$BLdBjE@BP:v(B> -

XML$B$H$O2?$+$o$+$i$J$$!#(B

- - - - <$B6HL3Js9p(B> - <$B6HL3L>(B>$B8!:w%(%s%8%s$N3+H/(B(B> - <$B6HL3%3!<%I(B>S8821-76 - <$B9)?t4IM}(B> - <$B8+@Q$b$j9)?t(B>120 - <$B6 - <$BEv7n8+@Q$b$j9)?t(B>32 - <$BEv7n2 - - <$BM=Dj9`L\%j%9%H(B> - <$BM=Dj9`L\(B> -

goo$B$N5!G=$rD4$Y$F$_$k(B

- - - <$B - <$B -

$B99$K!"$I$&$$$&8!:w%(%s%8%s$,$"$k$+D4::$9$k(B

- - - <$B>eD9$X$NMW@A;v9`%j%9%H(B> - <$B>eD9$X$NMW@A;v9`(B> -

$B3+H/$r$9$k$N$O$a$s$I$&$J$N$G!"(BYahoo!$B$rGc<}$7$F2<$5$$!#(B

- eD9$X$NMW@A;v9`(B> - eD9$X$NMW@A;v9`%j%9%H(B> - <$BLdBjE@BP:v(B> -

$B8!:w%(%s%8%s$G - - - - diff --git a/tests/auto/xml/dom/qdom/tst_qdom.cpp b/tests/auto/xml/dom/qdom/tst_qdom.cpp index 7cb110eab7..65cdaeb3c6 100644 --- a/tests/auto/xml/dom/qdom/tst_qdom.cpp +++ b/tests/auto/xml/dom/qdom/tst_qdom.cpp @@ -299,8 +299,6 @@ void tst_QDom::toString_01_data() QTest::newRow( "04" ) << QString(prefix + "/doc04.xml"); QTest::newRow( "05" ) << QString(prefix + "/doc05.xml"); - QTest::newRow( "euc-jp" ) << QString(prefix + "/doc_euc-jp.xml"); - QTest::newRow( "iso-2022-jp" ) << QString(prefix + "/doc_iso-2022-jp.xml"); QTest::newRow( "little-endian" ) << QString(prefix + "/doc_little-endian.xml"); QTest::newRow( "utf-16" ) << QString(prefix + "/doc_utf-16.xml"); QTest::newRow( "utf-8" ) << QString(prefix + "/doc_utf-8.xml"); @@ -576,48 +574,39 @@ void tst_QDom::saveWithSerialization() const // Read the document QVERIFY(doc.setContent(&f)); - QByteArray codecName; - - foreach (codecName, m_testCodecs) { - /* Write out doc in the specified codec. */ - QByteArray storage; - QBuffer writeDevice(&storage); - QVERIFY(writeDevice.open(QIODevice::WriteOnly)); + QByteArray storage; + QBuffer writeDevice(&storage); + QVERIFY(writeDevice.open(QIODevice::WriteOnly)); - QTextStream s(&writeDevice); - QTextCodec *codec = QTextCodec::codecForName(codecName); - QVERIFY2(codec, qPrintable(QString::fromLatin1("Failed to load codec %1").arg(QString::fromLatin1(codecName.constData())))); - s.setCodec(codec); + QTextStream s(&writeDevice); - doc.save(s, 0, QDomNode::EncodingFromTextStream); - s.flush(); - writeDevice.close(); + doc.save(s, 0, QDomNode::EncodingFromTextStream); + s.flush(); + writeDevice.close(); - QBuffer readDevice(&storage); - QVERIFY(readDevice.open(QIODevice::ReadOnly)); + QBuffer readDevice(&storage); + QVERIFY(readDevice.open(QIODevice::ReadOnly)); - QDomDocument result; + QDomDocument result; - QString msg; - int line = 0; - int column = 0; + QString msg; + int line = 0; + int column = 0; - QVERIFY2(result.setContent(&readDevice, &msg, &line, &column), - qPrintable(QString::fromLatin1("Failed for codec %1: line %2, column %3: %4, content: %5") - .arg(QString::fromLatin1(codecName.constData()), - QString::number(line), - QString::number(column), - msg, - codec->toUnicode(storage)))); - if(!compareDocuments(doc, result)) - { - QCOMPARE(doc.toString(), result.toString()); + QVERIFY2(result.setContent(&readDevice, &msg, &line, &column), + qPrintable(QString::fromLatin1("Failed: line %2, column %3: %4, content: %5") + .arg(QString::number(line), + QString::number(column), + msg, + QString::fromUtf8(storage)))); + if (!compareDocuments(doc, result)) + { + QCOMPARE(doc.toString(), result.toString()); - /* We put this one here as well, in case the QCOMPARE above for some strange reason - * nevertheless succeeds. */ - QVERIFY2(false, qPrintable(QString::fromLatin1("Failed for codec %1").arg(QString::fromLatin1(codecName.constData())))); - } + /* We put this one here as well, in case the QCOMPARE above for some strange reason + * nevertheless succeeds. */ + QVERIFY2(false, qPrintable(QString::fromLatin1("Failed to serialize test data"))); } } @@ -633,8 +622,6 @@ void tst_QDom::saveWithSerialization_data() const QTest::newRow("doc04.xml") << QString(prefix + "/doc04.xml"); QTest::newRow("doc05.xml") << QString(prefix + "/doc05.xml"); - QTest::newRow("doc_euc-jp.xml") << QString(prefix + "/doc_euc-jp.xml"); - QTest::newRow("doc_iso-2022-jp.xml") << QString(prefix + "/doc_iso-2022-jp.xml"); QTest::newRow("doc_little-endian.xml") << QString(prefix + "/doc_little-endian.xml"); QTest::newRow("doc_utf-16.xml") << QString(prefix + "/doc_utf-16.xml"); QTest::newRow("doc_utf-8.xml") << QString(prefix + "/doc_utf-8.xml"); @@ -1800,7 +1787,6 @@ void tst_QDom::germanUmlautToByteArray() const QBuffer buffer(&data); QVERIFY(buffer.open(QIODevice::WriteOnly)); QTextStream ts(&buffer); - ts.setCodec("UTF-8"); ts << d.toString(); buffer.close(); @@ -1832,7 +1818,6 @@ void tst_QDom::germanUmlautToFile() const QTemporaryFile file; QVERIFY(file.open()); QTextStream ts(&file); - ts.setCodec("UTF-8"); ts << d.toString(); file.close(); -- cgit v1.2.3