summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/io/qtemporarydir
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2016-07-26 10:43:29 +0200
committerEdward Welbourne <edward.welbourne@qt.io>2016-07-26 10:43:29 +0200
commit6c5de416c9e77433b20b95621c75666a47fbffbd (patch)
tree313690f41f9d6a1d8dd569b47156305463e3d615 /tests/auto/corelib/io/qtemporarydir
parent091e61b3525c700ce4198086bbd0d95a59fcb31f (diff)
parent8ea6e8d525b9dd8703ebdd0938706bd9785858a4 (diff)
Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts: src/corelib/io/qtemporarydir.cpp One side encapsulated a repeated piece of #if-ery in a local define; the other added to the #if-ery. Made its addition to the other's. src/corelib/kernel/qeventdispatcher_unix_p.h One side moved some members into a struct; this collided with a #undef check that neither side now has. Discarded the #undef part. src/gui/opengl/qopengltexturehelper_p.h 5.7 deleted a bunch of methods; not clear why merge got confused. src/tools/moc/moc.cpp One added a name to the copyright header; another changed its URL. Change-Id: I9e9032b819f030d67f1915445acf2793e98713fa
Diffstat (limited to 'tests/auto/corelib/io/qtemporarydir')
-rw-r--r--tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp b/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp
index 72a57c5905..0e73ea7862 100644
--- a/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp
+++ b/tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp
@@ -34,6 +34,7 @@
#include <qfile.h>
#include <qdir.h>
#include <qset.h>
+#include <qtextcodec.h>
#ifdef Q_OS_WIN
# include <windows.h>
#endif
@@ -108,6 +109,38 @@ void tst_QTemporaryDir::getSetCheck()
QCOMPARE(true, obj1.autoRemove());
}
+static inline bool canHandleUnicodeFileNames()
+{
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+ return true;
+#else
+ // Check for UTF-8 by converting the Euro symbol (see tst_utf8)
+ return QFile::encodeName(QString(QChar(0x20AC))) == QByteArrayLiteral("\342\202\254");
+#endif
+}
+
+static QString hanTestText()
+{
+ QString text;
+ text += QChar(0x65B0);
+ text += QChar(0x5E10);
+ text += QChar(0x6237);
+ return text;
+}
+
+static QString umlautTestText()
+{
+ QString text;
+ text += QChar(0xc4);
+ text += QChar(0xe4);
+ text += QChar(0xd6);
+ text += QChar(0xf6);
+ text += QChar(0xdc);
+ text += QChar(0xfc);
+ text += QChar(0xdf);
+ return text;
+}
+
void tst_QTemporaryDir::fileTemplate_data()
{
QTest::addColumn<QString>("constructorTemplate");
@@ -124,6 +157,14 @@ void tst_QTemporaryDir::fileTemplate_data()
QTest::newRow("constructor with XXXX suffix") << "qt_XXXXXX_XXXX" << "qt_";
QTest::newRow("constructor with XXXX prefix") << "qt_XXXX" << "qt_";
QTest::newRow("constructor with XXXXX prefix") << "qt_XXXXX" << "qt_";
+ if (canHandleUnicodeFileNames()) {
+ // Test Umlauts (contained in Latin1)
+ QString prefix = "qt_" + umlautTestText();
+ QTest::newRow("Umlauts") << (prefix + "XXXXXX") << prefix;
+ // Test Chinese
+ prefix = "qt_" + hanTestText();
+ QTest::newRow("Chinese characters") << (prefix + "XXXXXX") << prefix;
+ }
}
void tst_QTemporaryDir::fileTemplate()