summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/io
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2019-08-15 13:09:55 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2019-08-15 16:53:19 +0200
commitc7ec7cd2a1ae9bec31113fae1f1e549b2bf98e0b (patch)
treefc81fba4e7815ea061da277cf3bcf3102866932f /tests/auto/corelib/io
parent7947032e2d1d68b2c0f79874db7adcf560851f29 (diff)
parent6132260da394a9627947f0fe6a279c20863b6ad2 (diff)
Merge branch 'wip/qt6' into wip/cmake
Diffstat (limited to 'tests/auto/corelib/io')
-rw-r--r--tests/auto/corelib/io/qdebug/tst_qdebug.cpp2
-rw-r--r--tests/auto/corelib/io/qdir/tst_qdir.cpp2
-rw-r--r--tests/auto/corelib/io/qfile/.prev_CMakeLists.txt18
-rw-r--r--tests/auto/corelib/io/qfile/BLACKLIST7
-rw-r--r--tests/auto/corelib/io/qfile/CMakeLists.txt20
-rw-r--r--tests/auto/corelib/io/qfilesystemwatcher/BLACKLIST5
-rw-r--r--tests/auto/corelib/io/qnodebug/tst_qnodebug.cpp2
-rw-r--r--tests/auto/corelib/io/qprocess/BLACKLIST8
-rw-r--r--tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp10
-rw-r--r--tests/auto/corelib/io/qsavefile/tst_qsavefile.cpp34
-rw-r--r--tests/auto/corelib/io/qsettings/tst_qsettings.cpp4
11 files changed, 84 insertions, 28 deletions
diff --git a/tests/auto/corelib/io/qdebug/tst_qdebug.cpp b/tests/auto/corelib/io/qdebug/tst_qdebug.cpp
index a818c6c09d..584e66a7db 100644
--- a/tests/auto/corelib/io/qdebug/tst_qdebug.cpp
+++ b/tests/auto/corelib/io/qdebug/tst_qdebug.cpp
@@ -506,7 +506,7 @@ void tst_QDebug::qDebugQStringView() const
{
QLatin1String file, function;
int line = 0;
- const QStringView inView = QStringViewLiteral("input");
+ const QStringView inView = u"input";
MessageHandlerSetter mhs(myMessageHandler);
{ qDebug() << inView; }
diff --git a/tests/auto/corelib/io/qdir/tst_qdir.cpp b/tests/auto/corelib/io/qdir/tst_qdir.cpp
index 2aebc67dcf..52e7ebadb1 100644
--- a/tests/auto/corelib/io/qdir/tst_qdir.cpp
+++ b/tests/auto/corelib/io/qdir/tst_qdir.cpp
@@ -1268,6 +1268,7 @@ tst_QDir::cleanPath_data()
QTest::newRow("drive-above-root") << "A:/.." << "A:/..";
QTest::newRow("unc-server-up") << "//server/path/.." << "//server";
QTest::newRow("unc-server-above-root") << "//server/.." << "//server/..";
+ QTest::newRow("longpath") << "\\\\?\\d:\\" << "d:/";
#else
QTest::newRow("data15") << "//c:/foo" << "/c:/foo";
#endif // non-windows
@@ -1745,6 +1746,7 @@ void tst_QDir::nativeSeparators()
QCOMPARE(QDir::toNativeSeparators(QLatin1String("\\")), QString("\\"));
QCOMPARE(QDir::fromNativeSeparators(QLatin1String("/")), QString("/"));
QCOMPARE(QDir::fromNativeSeparators(QLatin1String("\\")), QString("/"));
+ QCOMPARE(QDir::fromNativeSeparators(QLatin1String("\\\\?\\C:\\")), QString("C:/"));
#else
QCOMPARE(QDir::toNativeSeparators(QLatin1String("/")), QString("/"));
QCOMPARE(QDir::toNativeSeparators(QLatin1String("\\")), QString("\\"));
diff --git a/tests/auto/corelib/io/qfile/.prev_CMakeLists.txt b/tests/auto/corelib/io/qfile/.prev_CMakeLists.txt
index 57824a82c7..7b5c5bab8c 100644
--- a/tests/auto/corelib/io/qfile/.prev_CMakeLists.txt
+++ b/tests/auto/corelib/io/qfile/.prev_CMakeLists.txt
@@ -30,23 +30,35 @@ add_qt_test(tst_qfile
)
# Resources:
+set(qfile_resource_files
+ "resources/"
+)
+
add_qt_resource(tst_qfile "qfile"
PREFIX
"/tst_qfileinfo/"
FILES
- "resources/"
+ ${qfile_resource_files}
+)
+set(rename-fallback_resource_files
+ "rename-fallback.qrc"
)
+
add_qt_resource(tst_qfile "rename-fallback"
PREFIX
"/"
FILES
- "rename-fallback.qrc"
+ ${rename-fallback_resource_files}
+)
+set(copy-fallback_resource_files
+ "copy-fallback.qrc"
)
+
add_qt_resource(tst_qfile "copy-fallback"
PREFIX
"/"
FILES
- "copy-fallback.qrc"
+ ${copy-fallback_resource_files}
)
diff --git a/tests/auto/corelib/io/qfile/BLACKLIST b/tests/auto/corelib/io/qfile/BLACKLIST
deleted file mode 100644
index 8366667166..0000000000
--- a/tests/auto/corelib/io/qfile/BLACKLIST
+++ /dev/null
@@ -1,7 +0,0 @@
-# QTBUG-48455
-[readLineStdin]
-msvc-2015 ci
-msvc-2017 ci
-[readLineStdin_lineByLine]
-msvc-2015 ci
-msvc-2017 ci
diff --git a/tests/auto/corelib/io/qfile/CMakeLists.txt b/tests/auto/corelib/io/qfile/CMakeLists.txt
index d4fd6e48cf..70c471858c 100644
--- a/tests/auto/corelib/io/qfile/CMakeLists.txt
+++ b/tests/auto/corelib/io/qfile/CMakeLists.txt
@@ -5,7 +5,7 @@
#####################################################################
# Collect test data
-list(APPEND test_data "BLACKLIST")
+# list(APPEND test_data "BLACKLIST") # special case remove
list(APPEND test_data "dosfile.txt")
list(APPEND test_data "noendofline.txt")
list(APPEND test_data "testfile.txt")
@@ -30,23 +30,35 @@ add_qt_test(tst_qfile
)
# Resources:
+set(qfile_resource_files
+ "resources/"
+)
+
add_qt_resource(tst_qfile "qfile"
PREFIX
"/tst_qfileinfo/"
FILES
- "resources/"
+ ${qfile_resource_files}
+)
+set(rename-fallback_resource_files
+ "rename-fallback.qrc"
)
+
add_qt_resource(tst_qfile "rename-fallback"
PREFIX
"/"
FILES
- "rename-fallback.qrc"
+ ${rename-fallback_resource_files}
+)
+set(copy-fallback_resource_files
+ "copy-fallback.qrc"
)
+
add_qt_resource(tst_qfile "copy-fallback"
PREFIX
"/"
FILES
- "copy-fallback.qrc"
+ ${copy-fallback_resource_files}
)
diff --git a/tests/auto/corelib/io/qfilesystemwatcher/BLACKLIST b/tests/auto/corelib/io/qfilesystemwatcher/BLACKLIST
index 90b714758a..9b210b0d5f 100644
--- a/tests/auto/corelib/io/qfilesystemwatcher/BLACKLIST
+++ b/tests/auto/corelib/io/qfilesystemwatcher/BLACKLIST
@@ -1,6 +1,9 @@
# QTBUG-33574 QTBUG-30943
[signalsEmittedAfterFileMoved]
-windows
+windows-10 msvc-2017
+windows-10 msvc-2019
+windows-10 msvc-2015
+windows-7sp1
[watchFileAndItsDirectory:native backend-testfile]
osx
windows
diff --git a/tests/auto/corelib/io/qnodebug/tst_qnodebug.cpp b/tests/auto/corelib/io/qnodebug/tst_qnodebug.cpp
index 569c610e24..b05c89a8bb 100644
--- a/tests/auto/corelib/io/qnodebug/tst_qnodebug.cpp
+++ b/tests/auto/corelib/io/qnodebug/tst_qnodebug.cpp
@@ -65,7 +65,7 @@ void tst_QNoDebug::noDebugOutput() const
void tst_QNoDebug::streaming() const
{
QDateTime dt(QDate(1,2,3),QTime(4,5,6));
- const QByteArray debugString = dt.toString(QStringViewLiteral("yyyy-MM-dd HH:mm:ss.zzz t")).toLatin1();
+ const QByteArray debugString = dt.toString(u"yyyy-MM-dd HH:mm:ss.zzz t").toLatin1();
const QByteArray message = "QDateTime(" + debugString + " Qt::LocalTime)";
QTest::ignoreMessage(QtWarningMsg, message.constData());
qWarning() << dt;
diff --git a/tests/auto/corelib/io/qprocess/BLACKLIST b/tests/auto/corelib/io/qprocess/BLACKLIST
index b355bb0f75..aa9fdab64d 100644
--- a/tests/auto/corelib/io/qprocess/BLACKLIST
+++ b/tests/auto/corelib/io/qprocess/BLACKLIST
@@ -2,8 +2,6 @@
redhatenterpriselinuxworkstation-6.6
# QTBUG-48455
[fileWriterProcess]
-msvc-2015 ci
-msvc-2017 ci
-[softExitInSlots]
-# QTBUG-66903
-windows
+windows-10 msvc-2015
+windows-10 msvc-2017
+
diff --git a/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp b/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp
index df1dbebbf2..44c8c4b681 100644
--- a/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp
+++ b/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Copyright (C) 2018 Intel Corporation.
+** Copyright (C) 2018 The Qt Company Ltd.
+** Copyright (C) 2019 Intel Corporation.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
@@ -563,15 +563,15 @@ void tst_QResourceEngine::setLocale()
// default constructed QResource gets the default locale
QResource resource;
resource.setFileName("aliasdir/aliasdir.txt");
- QVERIFY(!resource.isCompressed());
+ QCOMPARE(resource.compressionAlgorithm(), QResource::NoCompression);
// change the default locale and make sure it doesn't affect the resource
QLocale::setDefault(QLocale("de_CH"));
- QVERIFY(!resource.isCompressed());
+ QCOMPARE(resource.compressionAlgorithm(), QResource::NoCompression);
// then explicitly set the locale on qresource
resource.setLocale(QLocale("de_CH"));
- QVERIFY(resource.isCompressed());
+ QVERIFY(resource.compressionAlgorithm() != QResource::NoCompression);
// the reset the default locale back
QLocale::setDefault(QLocale::system());
diff --git a/tests/auto/corelib/io/qsavefile/tst_qsavefile.cpp b/tests/auto/corelib/io/qsavefile/tst_qsavefile.cpp
index 96970421d3..f1327933c4 100644
--- a/tests/auto/corelib/io/qsavefile/tst_qsavefile.cpp
+++ b/tests/auto/corelib/io/qsavefile/tst_qsavefile.cpp
@@ -72,6 +72,7 @@ public slots:
private slots:
void transactionalWrite();
+ void retryTransactionalWrite();
void textStreamManualFlush();
void textStreamAutoFlush();
void saveTwice();
@@ -129,6 +130,39 @@ void tst_QSaveFile::transactionalWrite()
QCOMPARE(QFile::permissions(targetFile), QFile::permissions(otherFile));
}
+// QTBUG-77007: Simulate the case of an application with a loop prompting
+// to retry saving on failure. Create a read-only file first (Unix only)
+void tst_QSaveFile::retryTransactionalWrite()
+{
+#ifndef Q_OS_UNIX
+ QSKIP("This test is Unix only");
+#endif
+ QTemporaryDir dir;
+ QVERIFY2(dir.isValid(), qPrintable(dir.errorString()));
+
+ QString targetFile = dir.path() + QLatin1String("/outfile");
+ const QString readOnlyName = targetFile + QLatin1String(".ro");
+ {
+ QFile readOnlyFile(readOnlyName);
+ QVERIFY2(readOnlyFile.open(QIODevice::WriteOnly), msgCannotOpen(readOnlyFile).constData());
+ readOnlyFile.write("Hello");
+ readOnlyFile.close();
+ auto permissions = readOnlyFile.permissions();
+ permissions &= ~(QFileDevice::WriteOwner | QFileDevice::WriteGroup | QFileDevice::WriteUser);
+ QVERIFY(readOnlyFile.setPermissions(permissions));
+ }
+
+ QSaveFile file(readOnlyName);
+ QVERIFY(!file.open(QIODevice::WriteOnly));
+
+ file.setFileName(targetFile);
+ QVERIFY2(file.open(QIODevice::WriteOnly), msgCannotOpen(file).constData());
+ QVERIFY(file.isOpen());
+ QCOMPARE(file.write("Hello"), Q_INT64_C(5));
+ QCOMPARE(file.error(), QFile::NoError);
+ QVERIFY(file.commit());
+}
+
void tst_QSaveFile::saveTwice()
{
// Check that we can reuse a QSaveFile object
diff --git a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
index a71a68e457..289590a233 100644
--- a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
+++ b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
@@ -1366,7 +1366,9 @@ void tst_QSettings::testVariantTypes()
if (format >= QSettings::InvalidFormat) {
testVal("keysequence", QKeySequence(Qt::ControlModifier + Qt::Key_F1), QKeySequence, KeySequence);
} else {
- testVal("keysequence", QKeySequence(Qt::ControlModifier + Qt::Key_F1), QString, String);
+ testVal("keysequence",
+ QKeySequence(Qt::ControlModifier + Qt::Key_F1).toString(QKeySequence::NativeText),
+ QString, String);
}
#undef testVal