summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-11-25 01:00:25 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2019-11-25 11:30:04 +0100
commit58c69df4d38324644bc49ec5f42ee8343a454b2d (patch)
treede0a1ce603292dcaff134d4e1e8ab064295515a2 /tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
parent03b1d2c44940322208c12c7bceee376b51d8e852 (diff)
parent59a705e3710b0ba93bb698e3223241cfac932948 (diff)
Merge remote-tracking branch 'origin/5.15' into dev
Conflicts: src/corelib/tools/qhash.h src/gui/kernel/qevent.h src/widgets/kernel/qshortcut.cpp src/widgets/kernel/qshortcut.h Change-Id: If61c206ee43ad1d97f5b07f58ac93c4583ce5620
Diffstat (limited to 'tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp')
-rw-r--r--tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp25
1 files changed, 14 insertions, 11 deletions
diff --git a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
index 744e047c45..ebb9a0a44c 100644
--- a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
+++ b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
@@ -1813,19 +1813,22 @@ void tst_QFileInfo::ntfsJunctionPointsAndSymlinks()
QVERIFY2(creationResult == ERROR_SUCCESS, qPrintable(errorMessage));
QFileInfo fi(path);
- const bool actualIsSymLink = fi.isSymbolicLink();
+ auto guard = qScopeGuard([&fi, this]() {
+ // Ensure that junctions, mountpoints are removed. If this fails, do not remove
+ // temporary directory to prevent it from trashing the system.
+ if (fi.isDir()) {
+ if (!QDir().rmdir(fi.filePath())) {
+ qWarning("Unable to remove NTFS junction '%ls', keeping '%ls'.",
+ qUtf16Printable(fi.fileName()),
+ qUtf16Printable(QDir::toNativeSeparators(m_dir.path())));
+ m_dir.setAutoRemove(false);
+ }
+ }
+ });
const QString actualSymLinkTarget = isSymLink ? fi.symLinkTarget() : QString();
const QString actualCanonicalFilePath = isSymLink ? fi.canonicalFilePath() : QString();
- // Ensure that junctions, mountpoints are removed. If this fails, do not remove
- // temporary directory to prevent it from trashing the system.
- if (fi.isDir()) {
- if (!QDir().rmdir(fi.filePath())) {
- qWarning("Unable to remove NTFS junction '%s'', keeping '%s'.",
- qPrintable(fi.fileName()), qPrintable(QDir::toNativeSeparators(m_dir.path())));
- m_dir.setAutoRemove(false);
- }
- }
- QCOMPARE(actualIsSymLink, isSymLink);
+ QCOMPARE(fi.isJunction(), resource.type == NtfsTestResource::Junction);
+ QCOMPARE(fi.isSymbolicLink(), isSymLink);
if (isSymLink) {
QCOMPARE(actualSymLinkTarget, linkTarget);
QCOMPARE(actualCanonicalFilePath, canonicalFilePath);