summaryrefslogtreecommitdiffstats
path: root/tests/auto/xml
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2020-04-28 18:15:54 +0200
committerLars Knoll <lars.knoll@qt.io>2020-05-14 07:50:19 +0200
commit4d67b9dcfbb379d9d65a5a1fec74600273941637 (patch)
treeae56788e3613bc164ec7bd3f8e38e8ba9c86d64f /tests/auto/xml
parent33bb695a2895fb7199b256a4fd76923c32a8587a (diff)
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 <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/xml')
-rw-r--r--tests/auto/xml/dom/qdom/testdata/toString_01/doc_euc-jp.xml78
-rw-r--r--tests/auto/xml/dom/qdom/testdata/toString_01/doc_iso-2022-jp.xml78
-rw-r--r--tests/auto/xml/dom/qdom/tst_qdom.cpp65
3 files changed, 25 insertions, 196 deletions
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 @@
-<?xml version="1.0" encoding="euc-jp"?>
-<!DOCTYPE 週報 SYSTEM "weekly-euc-jp.dtd">
-<!-- 週報サンプル -->
-<週報>
- <年月週>
- <年度>1997</年度>
- <月度>1</月度>
- <週>1</週>
- </年月週>
-
- <氏名>
- <氏>山田</氏>
- <名>太郎</名>
- </氏名>
-
- <業務報告リスト>
- <業務報告>
- <業務名>XMLエディターの作成</業務名>
- <業務コード>X3355-23</業務コード>
- <工数管理>
- <見積もり工数>1600</見積もり工数>
- <実績工数>320</実績工数>
- <当月見積もり工数>160</当月見積もり工数>
- <当月実績工数>24</当月実績工数>
- </工数管理>
- <予定項目リスト>
- <予定項目>
- <P>XMLエディターの基本仕様の作成</P>
- </予定項目>
- </予定項目リスト>
- <実施事項リスト>
- <実施事項>
- <P>XMLエディターの基本仕様の作成</P>
- </実施事項>
- <実施事項>
- <P>競合他社製品の機能調査</P>
- </実施事項>
- </実施事項リスト>
- <上長への要請事項リスト>
- <上長への要請事項>
- <P>特になし</P>
- </上長への要請事項>
- </上長への要請事項リスト>
- <問題点対策>
- <P>XMLとは何かわからない。</P>
- </問題点対策>
- </業務報告>
-
- <業務報告>
- <業務名>検索エンジンの開発</業務名>
- <業務コード>S8821-76</業務コード>
- <工数管理>
- <見積もり工数>120</見積もり工数>
- <実績工数>6</実績工数>
- <当月見積もり工数>32</当月見積もり工数>
- <当月実績工数>2</当月実績工数>
- </工数管理>
- <予定項目リスト>
- <予定項目>
- <P><A href="http://www.goo.ne.jp">goo</A>の機能を調べてみる</P>
- </予定項目>
- </予定項目リスト>
- <実施事項リスト>
- <実施事項>
- <P>更に、どういう検索エンジンがあるか調査する</P>
- </実施事項>
- </実施事項リスト>
- <上長への要請事項リスト>
- <上長への要請事項>
- <P>開発をするのはめんどうなので、Yahoo!を買収して下さい。</P>
- </上長への要請事項>
- </上長への要請事項リスト>
- <問題点対策>
- <P>検索エンジンで車を走らせることができない。(要調査)</P>
- </問題点対策>
- </業務報告>
- </業務報告リスト>
-</週報>
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 @@
-<?xml version="1.0" encoding="iso-2022-jp"?>
-<!DOCTYPE $B=5Js(B SYSTEM "weekly-iso-2022-jp.dtd">
-<!-- $B=5Js%5%s%W%k(B -->
-<$B=5Js(B>
- <$BG/7n=5(B>
- <$BG/EY(B>1997</$BG/EY(B>
- <$B7nEY(B>1</$B7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HL3%3!<%I(B>S8821-76</$B6HL3%3!<%I(B>
- <$B9)?t4IM}(B>
- <$B8+@Q$b$j9)?t(B>120</$B8+@Q$b$j9)?t(B>
- <$B<B@S9)?t(B>6</$B<B@S9)?t(B>
- <$BEv7n8+@Q$b$j9)?t(B>32</$BEv7n8+@Q$b$j9)?t(B>
- <$BEv7n<B@S9)?t(B>2</$BEv7n<B@S9)?t(B>
- </$B9)?t4IM}(B>
- <$BM=Dj9`L\%j%9%H(B>
- <$BM=Dj9`L\(B>
- <P><A href="http://www.goo.ne.jp">goo</A>$B$N5!G=$rD4$Y$F$_$k(B</P>
- </$BM=Dj9`L\(B>
- </$BM=Dj9`L\%j%9%H(B>
- <$B<B;\;v9`%j%9%H(B>
- <$B<B;\;v9`(B>
- <P>$B99$K!"$I$&$$$&8!:w%(%s%8%s$,$"$k$+D4::$9$k(B</P>
- </$B<B;\;v9`(B>
- </$B<B;\;v9`%j%9%H(B>
- <$B>eD9$X$NMW@A;v9`%j%9%H(B>
- <$B>eD9$X$NMW@A;v9`(B>
- <P>$B3+H/$r$9$k$N$O$a$s$I$&$J$N$G!"(BYahoo!$B$rGc<}$7$F2<$5$$!#(B</P>
- </$B>eD9$X$NMW@A;v9`(B>
- </$B>eD9$X$NMW@A;v9`%j%9%H(B>
- <$BLdBjE@BP:v(B>
- <P>$B8!:w%(%s%8%s$G<V$rAv$i$;$k$3$H$,$G$-$J$$!#!JMWD4::!K(B</P>
- </$BLdBjE@BP:v(B>
- </$B6HL3Js9p(B>
- </$B6HL3Js9p%j%9%H(B>
-</$B=5Js(B>
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();