summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/global
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/corelib/global
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/corelib/global')
-rw-r--r--tests/auto/corelib/global/qglobal/tst_qglobal.cpp59
1 files changed, 0 insertions, 59 deletions
diff --git a/tests/auto/corelib/global/qglobal/tst_qglobal.cpp b/tests/auto/corelib/global/qglobal/tst_qglobal.cpp
index 047130d5ea..cde4ea9633 100644
--- a/tests/auto/corelib/global/qglobal/tst_qglobal.cpp
+++ b/tests/auto/corelib/global/qglobal/tst_qglobal.cpp
@@ -30,7 +30,6 @@
#include <QtTest/QtTest>
#include <QPair>
-#include <QTextCodec>
#include <QSysInfo>
#include <QLatin1String>
@@ -50,8 +49,6 @@ private slots:
void qCoreAppStartupFunction();
void qCoreAppStartupFunctionRestart();
void integerForSize();
- void qprintable();
- void qprintable_data();
void buildAbiEndianness();
void testqOverload();
};
@@ -450,62 +447,6 @@ void tst_QGlobal::integerForSize()
typedef QPair<const char *, const char *> stringpair;
Q_DECLARE_METATYPE(stringpair)
-void tst_QGlobal::qprintable()
-{
- QFETCH(QVector<stringpair>, localestrings);
- QFETCH(int, utf8index);
-
- QVERIFY(utf8index >= 0 && utf8index < localestrings.count());
- if (utf8index < 0 || utf8index >= localestrings.count())
- return;
-
- const char *const utf8string = localestrings.at(utf8index).second;
-
- QString string = QString::fromUtf8(utf8string);
-
- for (const stringpair &pair : qAsConst(localestrings)) {
- QTextCodec *codec = QTextCodec::codecForName(pair.first);
- if (!codec)
- continue;
- QTextCodec::setCodecForLocale(codec);
- // test qPrintable()
- QVERIFY(qstrcmp(qPrintable(string), pair.second) == 0);
- for (const stringpair &pair2 : qAsConst(localestrings)) {
- if (pair2.second == pair.second)
- continue;
- QVERIFY(qstrcmp(qPrintable(string), pair2.second) != 0);
- }
- // test qUtf8Printable()
- QVERIFY(qstrcmp(qUtf8Printable(string), utf8string) == 0);
- for (const stringpair &pair2 : qAsConst(localestrings)) {
- if (qstrcmp(pair2.second, utf8string) == 0)
- continue;
- QVERIFY(qstrcmp(qUtf8Printable(string), pair2.second) != 0);
- }
- }
-
- QTextCodec::setCodecForLocale(0);
-}
-
-void tst_QGlobal::qprintable_data()
-{
- QTest::addColumn<QVector<stringpair> >("localestrings");
- QTest::addColumn<int>("utf8index"); // index of utf8 string
-
- // Unicode: HIRAGANA LETTER A, I, U, E, O (U+3442, U+3444, U+3446, U+3448, U+344a)
- static const char *const utf8string = "\xe3\x81\x82\xe3\x81\x84\xe3\x81\x86\xe3\x81\x88\xe3\x81\x8a";
- static const char *const eucjpstring = "\xa4\xa2\xa4\xa4\xa4\xa6\xa4\xa8\xa4\xaa";
- static const char *const sjisstring = "\x82\xa0\x82\xa2\x82\xa4\x82\xa6\x82\xa8";
-
- QVector<stringpair> japanesestrings;
- japanesestrings << stringpair("UTF-8", utf8string)
- << stringpair("EUC-JP", eucjpstring)
- << stringpair("Shift_JIS", sjisstring);
-
- QTest::newRow("Japanese") << japanesestrings << 0;
-
-}
-
void tst_QGlobal::buildAbiEndianness()
{
#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN