From d71d7be710b9431240897d8335ba4cc79ac22e04 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 817b88bdc4793..3c1404aeedde4 100644 --- a/src/libsync/discovery.cpp +++ b/src/libsync/discovery.cpp @@ -260,7 +260,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) { @@ -274,9 +275,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 a091a89be54e372b238904ac3d543e5eb58098f6 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 | 59 ++++++++++++++++++++++++++++++++++++- 1 file changed, 58 insertions(+), 1 deletion(-) diff --git a/test/testlocaldiscovery.cpp b/test/testlocaldiscovery.cpp index 167695f64ec0b..5fcdb7466ed33 100644 --- a/test/testlocaldiscovery.cpp +++ b/test/testlocaldiscovery.cpp @@ -311,6 +311,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); @@ -318,6 +319,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); @@ -332,6 +342,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 QCOMPARE(completeSpy.findItem(fileWithSpaces1)->_status, SyncFileItem::Status::Success); QCOMPARE(completeSpy.findItem(fileWithSpaces2)->_status, SyncFileItem::Status::Success); QCOMPARE(completeSpy.findItem(fileWithSpaces3)->_status, SyncFileItem::Status::Success); @@ -339,6 +350,7 @@ private slots: 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 } void testCreateFileWithTrailingSpaces_remoteDontGetRenamedAutomatically() @@ -371,6 +383,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. @@ -430,7 +479,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 9c9758a140aa6e44fccfd6d416fc37a2d9198c0c 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 c6e9dab8b99d2..042f08908bf2a 100644 --- a/test/testsyncvirtualfiles.cpp +++ b/test/testsyncvirtualfiles.cpp @@ -817,12 +817,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); @@ -835,12 +844,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 1accf0850a087f76b34f5717d50e0211a77677d2 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 5fcdb7466ed33..e5fc9e53fedf5 100644 --- a/test/testlocaldiscovery.cpp +++ b/test/testlocaldiscovery.cpp @@ -311,7 +311,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); @@ -342,7 +342,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); @@ -406,18 +406,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() @@ -480,13 +481,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 042f08908bf2a..d7dadf04ac5f8 100644 --- a/test/testsyncvirtualfiles.cpp +++ b/test/testsyncvirtualfiles.cpp @@ -817,21 +817,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); @@ -844,21 +844,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()