summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp
diff options
context:
space:
mode:
authorGatis Paeglis <gatis.paeglis@qt.io>2017-10-30 13:45:18 +0100
committerGatis Paeglis <gatis.paeglis@qt.io>2017-11-04 20:11:22 +0000
commitad36da8ff416501e249beb098e5b84eaa2fba43d (patch)
tree48926e9edb976a5e804748a70ddb15d537e69e54 /tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp
parent01f5f77c66dd6e4c15e0e0d8445e3560543e1973 (diff)
testlib: start sharing common helper functions
... by moving them in QTestPrivate namespace (qtesthelpers_p.h). This header file is a convenient staging area for helper APIs, eventually some could be moved to public QTest API. This header file utilizes the same pattern as other qtestlib header files - wrapping functions with QT_${LIBNAME}_LIB to automatically enable certain APIs based on what is in the projects dependencies, e.g. QT += widgets. Change-Id: Ic0266429939c1f3788912ad8b84fc6e0d5edd68b Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp')
-rw-r--r--tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp16
1 files changed, 4 insertions, 12 deletions
diff --git a/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp b/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp
index ab6b435125..64b61839c1 100644
--- a/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp
+++ b/tests/auto/corelib/io/qtemporaryfile/tst_qtemporaryfile.cpp
@@ -36,6 +36,8 @@
#include <qset.h>
#include <qtextcodec.h>
+#include <QtTest/private/qtesthelpers_p.h>
+
#if defined(Q_OS_WIN)
# include <windows.h>
#endif
@@ -141,16 +143,6 @@ void tst_QTemporaryFile::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;
@@ -199,7 +191,7 @@ void tst_QTemporaryFile::fileTemplate_data()
QTest::newRow("set template, with xxx") << "" << "qt_" << ".xxx" << "qt_XXXXXX.xxx";
QTest::newRow("set template, with >6 X's") << "" << "qt_" << ".xxx" << "qt_XXXXXXXXXXXXXX.xxx";
QTest::newRow("set template, with >6 X's, no suffix") << "" << "qt_" << "" << "qt_XXXXXXXXXXXXXX";
- if (canHandleUnicodeFileNames()) {
+ if (QTestPrivate::canHandleUnicodeFileNames()) {
// Test Umlauts (contained in Latin1)
QString prefix = "qt_" + umlautTestText();
QTest::newRow("Umlauts") << (prefix + "XXXXXX") << prefix << QString() << QString();
@@ -761,7 +753,7 @@ void tst_QTemporaryFile::QTBUG_4796_data()
QTest::newRow("XXXXXXbla") << QString() << QString("bla") << true;
QTest::newRow("does-not-exist/qt_temp.XXXXXX") << QString("does-not-exist/qt_temp") << QString() << false;
- if (canHandleUnicodeFileNames()) {
+ if (QTestPrivate::canHandleUnicodeFileNames()) {
QTest::newRow("XXXXXX<unicode>") << QString() << unicode << true;
QTest::newRow("<unicode>XXXXXX") << unicode << QString() << true;
QTest::newRow("<unicode>XXXXXX<unicode>") << unicode << unicode << true;