From b8ca1584e38e5aacc770489fe43d0dbf7f71af18 Mon Sep 17 00:00:00 2001 From: Camila Ayres Date: Mon, 1 Jul 2024 16:33:30 +0200 Subject: [PATCH 1/4] Only check leading/trailing spaces for files on Windows. Fix for #6807. Signed-off-by: Camila Ayres --- src/libsync/discovery.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/libsync/discovery.cpp b/src/libsync/discovery.cpp index 0a259360f45e4..277190f460d0f 100644 --- a/src/libsync/discovery.cpp +++ b/src/libsync/discovery.cpp @@ -262,7 +262,8 @@ bool ProcessDirectoryJob::handleExcluded(const QString &path, const Entries &ent const auto fileName = path.mid(path.lastIndexOf('/') + 1); - if (excluded == CSYNC_NOT_EXCLUDED) { + const auto osDoesNotSupportsSpaces = Utility::isWindows(); + if (excluded == CSYNC_NOT_EXCLUDED && osDoesNotSupportsSpaces) { const auto endsWithSpace = fileName.endsWith(QLatin1Char(' ')); const auto startsWithSpace = fileName.startsWith(QLatin1Char(' ')); if (startsWithSpace && endsWithSpace) { @@ -276,9 +277,12 @@ bool ProcessDirectoryJob::handleExcluded(const QString &path, const Entries &ent // we don't need to trigger a warning if trailing/leading space file is already on the server or has already been synced down // only if the OS supports trailing/leading spaces - const auto wasSyncedAlreadyAndOsSupportsSpaces = !Utility::isWindows() && (entries.serverEntry.isValid() || entries.dbEntry.isValid()); - if ((excluded == CSYNC_FILE_EXCLUDE_LEADING_SPACE || excluded == CSYNC_FILE_EXCLUDE_TRAILING_SPACE || excluded == CSYNC_FILE_EXCLUDE_LEADING_AND_TRAILING_SPACE) - && (wasSyncedAlreadyAndOsSupportsSpaces || _discoveryData->_leadingAndTrailingSpacesFilesAllowed.contains(_discoveryData->_localDir + path))) { + const auto wasSyncedAlready = entries.serverEntry.isValid() || entries.dbEntry.isValid(); + const auto hasLeadingOrTrailingSpaces = excluded == CSYNC_FILE_EXCLUDE_LEADING_SPACE + || excluded == CSYNC_FILE_EXCLUDE_TRAILING_SPACE + || excluded == CSYNC_FILE_EXCLUDE_LEADING_AND_TRAILING_SPACE; + const auto leadingAndTrailingSpacesFilesAllowed = _discoveryData->_leadingAndTrailingSpacesFilesAllowed.contains(_discoveryData->_localDir + path); + if (hasLeadingOrTrailingSpaces && ((!osDoesNotSupportsSpaces && wasSyncedAlready) || leadingAndTrailingSpacesFilesAllowed)) { excluded = CSYNC_NOT_EXCLUDED; } From 2e750013be82cfb3615f354f44109e6323bd0c2e Mon Sep 17 00:00:00 2001 From: Camila Ayres Date: Tue, 9 Jul 2024 15:51:22 +0200 Subject: [PATCH 2/4] Add test testCreateLocalPathsWithLeadingAndTrailingSpaces_syncOnSupportingOs. - Fix discovery tests for files with invalid names. - Now leading/trailing spaces trigger an error only on Windows. Signed-off-by: Camila Ayres --- test/testlocaldiscovery.cpp | 61 ++++++++++++++++++++++++++++++++++--- 1 file changed, 57 insertions(+), 4 deletions(-) diff --git a/test/testlocaldiscovery.cpp b/test/testlocaldiscovery.cpp index 11c7d2e0de0f6..b69decf3526fc 100644 --- a/test/testlocaldiscovery.cpp +++ b/test/testlocaldiscovery.cpp @@ -358,6 +358,7 @@ private slots: QVERIFY(fakeFolder.syncOnce()); +#ifdef Q_OS_WINDOWS QCOMPARE(completeSpy.findItem(fileWithSpaces1)->_status, SyncFileItem::Status::FileNameInvalid); QCOMPARE(completeSpy.findItem(fileWithSpaces2)->_status, SyncFileItem::Status::FileNameInvalid); QCOMPARE(completeSpy.findItem(fileWithSpaces3)->_status, SyncFileItem::Status::FileNameInvalid); @@ -365,6 +366,15 @@ private slots: QCOMPARE(completeSpy.findItem(fileWithSpaces5)->_status, SyncFileItem::Status::FileNameInvalid); QCOMPARE(completeSpy.findItem(fileWithSpaces6)->_status, SyncFileItem::Status::FileNameInvalid); QCOMPARE(completeSpy.findItem(QStringLiteral(" with spaces "))->_status, SyncFileItem::Status::FileNameInvalid); +#else + QCOMPARE(completeSpy.findItem(fileWithSpaces1)->_status, SyncFileItem::Status::Success); + QCOMPARE(completeSpy.findItem(fileWithSpaces2)->_status, SyncFileItem::Status::Success); + QCOMPARE(completeSpy.findItem(fileWithSpaces3)->_status, SyncFileItem::Status::Success); + QCOMPARE(completeSpy.findItem(fileWithSpaces4)->_status, SyncFileItem::Status::Success); + QCOMPARE(completeSpy.findItem(fileWithSpaces5)->_status, SyncFileItem::Status::Success); + QCOMPARE(completeSpy.findItem(fileWithSpaces6)->_status, SyncFileItem::Status::Success); + QCOMPARE(completeSpy.findItem(QStringLiteral(" with spaces "))->_status, SyncFileItem::Status::Success); +#endif fakeFolder.syncEngine().addAcceptedInvalidFileName(fakeFolder.localPath() + fileWithSpaces1); fakeFolder.syncEngine().addAcceptedInvalidFileName(fakeFolder.localPath() + fileWithSpaces2); @@ -379,16 +389,14 @@ private slots: fakeFolder.syncEngine().setLocalDiscoveryOptions(LocalDiscoveryStyle::DatabaseAndFilesystem, {QStringLiteral("foo"), QStringLiteral("bar"), QStringLiteral("bla"), QStringLiteral("A/foo"), QStringLiteral("A/bar"), QStringLiteral("A/bla")}); QVERIFY(fakeFolder.syncOnce()); +#ifdef Q_OS_WINDOWS QCOMPARE(completeSpy.findItem(fileWithSpaces1)->_status, SyncFileItem::Status::Success); QCOMPARE(completeSpy.findItem(fileWithSpaces2)->_status, SyncFileItem::Status::Success); QCOMPARE(completeSpy.findItem(fileWithSpaces3)->_status, SyncFileItem::Status::Success); QCOMPARE(completeSpy.findItem(fileWithSpaces4)->_status, SyncFileItem::Status::Success); QCOMPARE(completeSpy.findItem(fileWithSpaces5)->_status, SyncFileItem::Status::Success); QCOMPARE(completeSpy.findItem(fileWithSpaces6)->_status, SyncFileItem::Status::Success); -#ifdef Q_OS_WINDOWS QCOMPARE(completeSpy.findItem(QStringLiteral(" with spaces "))->_status, SyncFileItem::Status::NormalError); -#else - QCOMPARE(completeSpy.findItem(QStringLiteral(" with spaces "))->_status, SyncFileItem::Status::Success); #endif } @@ -422,6 +430,43 @@ private slots: } } + void testCreateLocalPathsWithLeadingAndTrailingSpaces_syncOnSupportingOs() + { + FakeFolder fakeFolder{FileInfo()}; + fakeFolder.localModifier().mkdir("A"); + QVERIFY(fakeFolder.syncOnce()); + QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState()); + + const QString fileWithSpaces1("A/ space"); + const QString fileWithSpaces2("A/ space "); + const QString fileWithSpaces3("A/space "); + const QString folderWithSpaces1("A "); + const QString folderWithSpaces2(" B "); + + fakeFolder.localModifier().insert(fileWithSpaces1); + fakeFolder.localModifier().insert(fileWithSpaces2); + fakeFolder.localModifier().insert(fileWithSpaces3); + fakeFolder.localModifier().mkdir(folderWithSpaces1); + fakeFolder.localModifier().mkdir(folderWithSpaces2); + + ItemCompletedSpy completeSpy(fakeFolder); + completeSpy.clear(); + + QVERIFY(fakeFolder.syncOnce()); + if (!Utility::isWindows()) { + QCOMPARE(completeSpy.findItem(fileWithSpaces1)->_status, SyncFileItem::Status::Success); + QCOMPARE(completeSpy.findItem(fileWithSpaces2)->_status, SyncFileItem::Status::Success); + QCOMPARE(completeSpy.findItem(fileWithSpaces3)->_status, SyncFileItem::Status::Success); + QCOMPARE(completeSpy.findItem(folderWithSpaces1)->_status, SyncFileItem::Status::Success); + QCOMPARE(completeSpy.findItem(folderWithSpaces2)->_status, SyncFileItem::Status::Success); + QVERIFY(fakeFolder.remoteModifier().find(fileWithSpaces1)); + QVERIFY(fakeFolder.remoteModifier().find(fileWithSpaces2)); + QVERIFY(fakeFolder.remoteModifier().find(fileWithSpaces3)); + QVERIFY(fakeFolder.remoteModifier().find(folderWithSpaces1)); + QVERIFY(fakeFolder.remoteModifier().find(folderWithSpaces2)); + } + } + void testCreateFileWithTrailingSpaces_remoteGetRenamedManually() { // On Windows we can't create files/folders with leading/trailing spaces locally. So, we have to fail those items. On other OSs - we just sync them down normally. @@ -481,7 +526,15 @@ private slots: QVERIFY(fakeFolder.syncOnce()); QVERIFY(fakeFolder.currentRemoteState().find(fileTrimmed)); - QVERIFY(!fakeFolder.currentRemoteState().find(fileWithSpaces)); + + if (Utility::isWindows()) { + // no file with spaces on Windows + QVERIFY(!fakeFolder.currentRemoteState().find(fileWithSpaces)); + } else { + //Linux/Mac OS allows spaces + QVERIFY(fakeFolder.currentRemoteState().find(fileWithSpaces)); + } + QVERIFY(fakeFolder.currentLocalState().find(fileWithSpaces)); QVERIFY(fakeFolder.currentLocalState().find(fileTrimmed)); } From 6532d3feeb458154afea9225263822fb789c7903 Mon Sep 17 00:00:00 2001 From: Camila Ayres Date: Thu, 26 Sep 2024 14:21:34 +0200 Subject: [PATCH 3/4] Fix tests for trailing spaces on Linux. Signed-off-by: Camila Ayres --- test/testsyncvirtualfiles.cpp | 42 +++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/test/testsyncvirtualfiles.cpp b/test/testsyncvirtualfiles.cpp index c90a55e322f61..c03e7dbba965d 100644 --- a/test/testsyncvirtualfiles.cpp +++ b/test/testsyncvirtualfiles.cpp @@ -835,12 +835,21 @@ private slots: QVERIFY(fakeFolder.syncOnce()); - QCOMPARE(completeSpy.findItem(fileWithSpaces1)->_status, SyncFileItem::Status::FileNameInvalid); - QCOMPARE(completeSpy.findItem(fileWithSpaces2)->_status, SyncFileItem::Status::FileNameInvalid); - QCOMPARE(completeSpy.findItem(fileWithSpaces3)->_status, SyncFileItem::Status::FileNameInvalid); - QCOMPARE(completeSpy.findItem(fileWithSpaces4)->_status, SyncFileItem::Status::FileNameInvalid); - QCOMPARE(completeSpy.findItem(fileWithSpaces5)->_status, SyncFileItem::Status::FileNameInvalid); - QCOMPARE(completeSpy.findItem(fileWithSpaces6)->_status, SyncFileItem::Status::FileNameInvalid); + if (Utility::isWindows()) { + QCOMPARE(completeSpy.findItem(fileWithSpaces1)->_status, SyncFileItem::Status::FileNameInvalid); + QCOMPARE(completeSpy.findItem(fileWithSpaces2)->_status, SyncFileItem::Status::FileNameInvalid); + QCOMPARE(completeSpy.findItem(fileWithSpaces3)->_status, SyncFileItem::Status::FileNameInvalid); + QCOMPARE(completeSpy.findItem(fileWithSpaces4)->_status, SyncFileItem::Status::FileNameInvalid); + QCOMPARE(completeSpy.findItem(fileWithSpaces5)->_status, SyncFileItem::Status::FileNameInvalid); + QCOMPARE(completeSpy.findItem(fileWithSpaces6)->_status, SyncFileItem::Status::FileNameInvalid); + } else { + QCOMPARE(completeSpy.findItem(fileWithSpaces1)->_status, SyncFileItem::Status::Success); + QCOMPARE(completeSpy.findItem(fileWithSpaces2)->_status, SyncFileItem::Status::Success); + QCOMPARE(completeSpy.findItem(fileWithSpaces3)->_status, SyncFileItem::Status::Success); + QCOMPARE(completeSpy.findItem(fileWithSpaces4)->_status, SyncFileItem::Status::Success); + QCOMPARE(completeSpy.findItem(fileWithSpaces5)->_status, SyncFileItem::Status::Success); + QCOMPARE(completeSpy.findItem(fileWithSpaces6)->_status, SyncFileItem::Status::Success); + } fakeFolder.syncEngine().addAcceptedInvalidFileName(fakeFolder.localPath() + fileWithSpaces1); fakeFolder.syncEngine().addAcceptedInvalidFileName(fakeFolder.localPath() + fileWithSpaces2); @@ -853,12 +862,21 @@ private slots: QVERIFY(fakeFolder.syncOnce()); - QCOMPARE(completeSpy.findItem(fileWithSpaces1)->_status, SyncFileItem::Status::Success); - QCOMPARE(completeSpy.findItem(fileWithSpaces2)->_status, SyncFileItem::Status::Success); - QCOMPARE(completeSpy.findItem(fileWithSpaces3)->_status, SyncFileItem::Status::Success); - QCOMPARE(completeSpy.findItem(fileWithSpaces4)->_status, SyncFileItem::Status::Success); - QCOMPARE(completeSpy.findItem(fileWithSpaces5)->_status, SyncFileItem::Status::Success); - QCOMPARE(completeSpy.findItem(fileWithSpaces6)->_status, SyncFileItem::Status::Success); + if (Utility::isWindows()) { + QCOMPARE(completeSpy.findItem(fileWithSpaces1)->_status, SyncFileItem::Status::Success); + QCOMPARE(completeSpy.findItem(fileWithSpaces2)->_status, SyncFileItem::Status::Success); + QCOMPARE(completeSpy.findItem(fileWithSpaces3)->_status, SyncFileItem::Status::Success); + QCOMPARE(completeSpy.findItem(fileWithSpaces4)->_status, SyncFileItem::Status::Success); + QCOMPARE(completeSpy.findItem(fileWithSpaces5)->_status, SyncFileItem::Status::Success); + QCOMPARE(completeSpy.findItem(fileWithSpaces6)->_status, SyncFileItem::Status::Success); + } else { + QCOMPARE(completeSpy.findItem(fileWithSpaces1)->_status, SyncFileItem::Status::NoStatus); + QCOMPARE(completeSpy.findItem(fileWithSpaces2)->_status, SyncFileItem::Status::NoStatus); + QCOMPARE(completeSpy.findItem(fileWithSpaces3)->_status, SyncFileItem::Status::NoStatus); + QCOMPARE(completeSpy.findItem(fileWithSpaces4)->_status, SyncFileItem::Status::NoStatus); + QCOMPARE(completeSpy.findItem(fileWithSpaces5)->_status, SyncFileItem::Status::NoStatus); + QCOMPARE(completeSpy.findItem(fileWithSpaces6)->_status, SyncFileItem::Status::NoStatus); + } } void testCreateFileWithTrailingSpaces_remoteDontGetRenamedAutomatically() From 1d9b6e2e793a5c16fe3a3f066d5aa014c933f92f Mon Sep 17 00:00:00 2001 From: Camila Ayres Date: Thu, 26 Sep 2024 17:29:55 +0200 Subject: [PATCH 4/4] Use preprocessor directives in tests. Signed-off-by: Camila Ayres --- test/testlocaldiscovery.cpp | 43 +++++++++++++------------ test/testsyncvirtualfiles.cpp | 60 +++++++++++++++++------------------ 2 files changed, 52 insertions(+), 51 deletions(-) diff --git a/test/testlocaldiscovery.cpp b/test/testlocaldiscovery.cpp index b69decf3526fc..687b46d79572d 100644 --- a/test/testlocaldiscovery.cpp +++ b/test/testlocaldiscovery.cpp @@ -358,7 +358,7 @@ private slots: QVERIFY(fakeFolder.syncOnce()); -#ifdef Q_OS_WINDOWS +#if defined Q_OS_WINDOWS QCOMPARE(completeSpy.findItem(fileWithSpaces1)->_status, SyncFileItem::Status::FileNameInvalid); QCOMPARE(completeSpy.findItem(fileWithSpaces2)->_status, SyncFileItem::Status::FileNameInvalid); QCOMPARE(completeSpy.findItem(fileWithSpaces3)->_status, SyncFileItem::Status::FileNameInvalid); @@ -389,7 +389,7 @@ private slots: fakeFolder.syncEngine().setLocalDiscoveryOptions(LocalDiscoveryStyle::DatabaseAndFilesystem, {QStringLiteral("foo"), QStringLiteral("bar"), QStringLiteral("bla"), QStringLiteral("A/foo"), QStringLiteral("A/bar"), QStringLiteral("A/bla")}); QVERIFY(fakeFolder.syncOnce()); -#ifdef Q_OS_WINDOWS +#if defined Q_OS_WINDOWS QCOMPARE(completeSpy.findItem(fileWithSpaces1)->_status, SyncFileItem::Status::Success); QCOMPARE(completeSpy.findItem(fileWithSpaces2)->_status, SyncFileItem::Status::Success); QCOMPARE(completeSpy.findItem(fileWithSpaces3)->_status, SyncFileItem::Status::Success); @@ -453,18 +453,19 @@ private slots: completeSpy.clear(); QVERIFY(fakeFolder.syncOnce()); - if (!Utility::isWindows()) { - QCOMPARE(completeSpy.findItem(fileWithSpaces1)->_status, SyncFileItem::Status::Success); - QCOMPARE(completeSpy.findItem(fileWithSpaces2)->_status, SyncFileItem::Status::Success); - QCOMPARE(completeSpy.findItem(fileWithSpaces3)->_status, SyncFileItem::Status::Success); - QCOMPARE(completeSpy.findItem(folderWithSpaces1)->_status, SyncFileItem::Status::Success); - QCOMPARE(completeSpy.findItem(folderWithSpaces2)->_status, SyncFileItem::Status::Success); - QVERIFY(fakeFolder.remoteModifier().find(fileWithSpaces1)); - QVERIFY(fakeFolder.remoteModifier().find(fileWithSpaces2)); - QVERIFY(fakeFolder.remoteModifier().find(fileWithSpaces3)); - QVERIFY(fakeFolder.remoteModifier().find(folderWithSpaces1)); - QVERIFY(fakeFolder.remoteModifier().find(folderWithSpaces2)); - } + +#if !defined Q_OS_WINDOWS + QCOMPARE(completeSpy.findItem(fileWithSpaces1)->_status, SyncFileItem::Status::Success); + QCOMPARE(completeSpy.findItem(fileWithSpaces2)->_status, SyncFileItem::Status::Success); + QCOMPARE(completeSpy.findItem(fileWithSpaces3)->_status, SyncFileItem::Status::Success); + QCOMPARE(completeSpy.findItem(folderWithSpaces1)->_status, SyncFileItem::Status::Success); + QCOMPARE(completeSpy.findItem(folderWithSpaces2)->_status, SyncFileItem::Status::Success); + QVERIFY(fakeFolder.remoteModifier().find(fileWithSpaces1)); + QVERIFY(fakeFolder.remoteModifier().find(fileWithSpaces2)); + QVERIFY(fakeFolder.remoteModifier().find(fileWithSpaces3)); + QVERIFY(fakeFolder.remoteModifier().find(folderWithSpaces1)); + QVERIFY(fakeFolder.remoteModifier().find(folderWithSpaces2)); +#endif } void testCreateFileWithTrailingSpaces_remoteGetRenamedManually() @@ -527,13 +528,13 @@ private slots: QVERIFY(fakeFolder.currentRemoteState().find(fileTrimmed)); - if (Utility::isWindows()) { - // no file with spaces on Windows - QVERIFY(!fakeFolder.currentRemoteState().find(fileWithSpaces)); - } else { - //Linux/Mac OS allows spaces - QVERIFY(fakeFolder.currentRemoteState().find(fileWithSpaces)); - } +#if defined Q_OS_WINDOWS + // no file with spaces on Windows + QVERIFY(!fakeFolder.currentRemoteState().find(fileWithSpaces)); +#else + //Linux/Mac OS allows spaces + QVERIFY(fakeFolder.currentRemoteState().find(fileWithSpaces)); +#endif QVERIFY(fakeFolder.currentLocalState().find(fileWithSpaces)); QVERIFY(fakeFolder.currentLocalState().find(fileTrimmed)); diff --git a/test/testsyncvirtualfiles.cpp b/test/testsyncvirtualfiles.cpp index c03e7dbba965d..c50d471ce44cc 100644 --- a/test/testsyncvirtualfiles.cpp +++ b/test/testsyncvirtualfiles.cpp @@ -835,21 +835,21 @@ private slots: QVERIFY(fakeFolder.syncOnce()); - if (Utility::isWindows()) { - QCOMPARE(completeSpy.findItem(fileWithSpaces1)->_status, SyncFileItem::Status::FileNameInvalid); - QCOMPARE(completeSpy.findItem(fileWithSpaces2)->_status, SyncFileItem::Status::FileNameInvalid); - QCOMPARE(completeSpy.findItem(fileWithSpaces3)->_status, SyncFileItem::Status::FileNameInvalid); - QCOMPARE(completeSpy.findItem(fileWithSpaces4)->_status, SyncFileItem::Status::FileNameInvalid); - QCOMPARE(completeSpy.findItem(fileWithSpaces5)->_status, SyncFileItem::Status::FileNameInvalid); - QCOMPARE(completeSpy.findItem(fileWithSpaces6)->_status, SyncFileItem::Status::FileNameInvalid); - } else { - QCOMPARE(completeSpy.findItem(fileWithSpaces1)->_status, SyncFileItem::Status::Success); - QCOMPARE(completeSpy.findItem(fileWithSpaces2)->_status, SyncFileItem::Status::Success); - QCOMPARE(completeSpy.findItem(fileWithSpaces3)->_status, SyncFileItem::Status::Success); - QCOMPARE(completeSpy.findItem(fileWithSpaces4)->_status, SyncFileItem::Status::Success); - QCOMPARE(completeSpy.findItem(fileWithSpaces5)->_status, SyncFileItem::Status::Success); - QCOMPARE(completeSpy.findItem(fileWithSpaces6)->_status, SyncFileItem::Status::Success); - } +#if defined Q_OS_WINDOWS + QCOMPARE(completeSpy.findItem(fileWithSpaces1)->_status, SyncFileItem::Status::FileNameInvalid); + QCOMPARE(completeSpy.findItem(fileWithSpaces2)->_status, SyncFileItem::Status::FileNameInvalid); + QCOMPARE(completeSpy.findItem(fileWithSpaces3)->_status, SyncFileItem::Status::FileNameInvalid); + QCOMPARE(completeSpy.findItem(fileWithSpaces4)->_status, SyncFileItem::Status::FileNameInvalid); + QCOMPARE(completeSpy.findItem(fileWithSpaces5)->_status, SyncFileItem::Status::FileNameInvalid); + QCOMPARE(completeSpy.findItem(fileWithSpaces6)->_status, SyncFileItem::Status::FileNameInvalid); +#else + QCOMPARE(completeSpy.findItem(fileWithSpaces1)->_status, SyncFileItem::Status::Success); + QCOMPARE(completeSpy.findItem(fileWithSpaces2)->_status, SyncFileItem::Status::Success); + QCOMPARE(completeSpy.findItem(fileWithSpaces3)->_status, SyncFileItem::Status::Success); + QCOMPARE(completeSpy.findItem(fileWithSpaces4)->_status, SyncFileItem::Status::Success); + QCOMPARE(completeSpy.findItem(fileWithSpaces5)->_status, SyncFileItem::Status::Success); + QCOMPARE(completeSpy.findItem(fileWithSpaces6)->_status, SyncFileItem::Status::Success); +#endif fakeFolder.syncEngine().addAcceptedInvalidFileName(fakeFolder.localPath() + fileWithSpaces1); fakeFolder.syncEngine().addAcceptedInvalidFileName(fakeFolder.localPath() + fileWithSpaces2); @@ -862,21 +862,21 @@ private slots: QVERIFY(fakeFolder.syncOnce()); - if (Utility::isWindows()) { - QCOMPARE(completeSpy.findItem(fileWithSpaces1)->_status, SyncFileItem::Status::Success); - QCOMPARE(completeSpy.findItem(fileWithSpaces2)->_status, SyncFileItem::Status::Success); - QCOMPARE(completeSpy.findItem(fileWithSpaces3)->_status, SyncFileItem::Status::Success); - QCOMPARE(completeSpy.findItem(fileWithSpaces4)->_status, SyncFileItem::Status::Success); - QCOMPARE(completeSpy.findItem(fileWithSpaces5)->_status, SyncFileItem::Status::Success); - QCOMPARE(completeSpy.findItem(fileWithSpaces6)->_status, SyncFileItem::Status::Success); - } else { - QCOMPARE(completeSpy.findItem(fileWithSpaces1)->_status, SyncFileItem::Status::NoStatus); - QCOMPARE(completeSpy.findItem(fileWithSpaces2)->_status, SyncFileItem::Status::NoStatus); - QCOMPARE(completeSpy.findItem(fileWithSpaces3)->_status, SyncFileItem::Status::NoStatus); - QCOMPARE(completeSpy.findItem(fileWithSpaces4)->_status, SyncFileItem::Status::NoStatus); - QCOMPARE(completeSpy.findItem(fileWithSpaces5)->_status, SyncFileItem::Status::NoStatus); - QCOMPARE(completeSpy.findItem(fileWithSpaces6)->_status, SyncFileItem::Status::NoStatus); - } +#if defined Q_OS_WINDOWS + QCOMPARE(completeSpy.findItem(fileWithSpaces1)->_status, SyncFileItem::Status::Success); + QCOMPARE(completeSpy.findItem(fileWithSpaces2)->_status, SyncFileItem::Status::Success); + QCOMPARE(completeSpy.findItem(fileWithSpaces3)->_status, SyncFileItem::Status::Success); + QCOMPARE(completeSpy.findItem(fileWithSpaces4)->_status, SyncFileItem::Status::Success); + QCOMPARE(completeSpy.findItem(fileWithSpaces5)->_status, SyncFileItem::Status::Success); + QCOMPARE(completeSpy.findItem(fileWithSpaces6)->_status, SyncFileItem::Status::Success); +#else + QCOMPARE(completeSpy.findItem(fileWithSpaces1)->_status, SyncFileItem::Status::NoStatus); + QCOMPARE(completeSpy.findItem(fileWithSpaces2)->_status, SyncFileItem::Status::NoStatus); + QCOMPARE(completeSpy.findItem(fileWithSpaces3)->_status, SyncFileItem::Status::NoStatus); + QCOMPARE(completeSpy.findItem(fileWithSpaces4)->_status, SyncFileItem::Status::NoStatus); + QCOMPARE(completeSpy.findItem(fileWithSpaces5)->_status, SyncFileItem::Status::NoStatus); + QCOMPARE(completeSpy.findItem(fileWithSpaces6)->_status, SyncFileItem::Status::NoStatus); +#endif } void testCreateFileWithTrailingSpaces_remoteDontGetRenamedAutomatically()