Skip to content

Commit

Permalink
Add test testCreateLocalPathsWithLeadingAndTrailingSpaces_syncOnSuppo…
Browse files Browse the repository at this point in the history
…rtingOs.

Signed-off-by: Camila Ayres <[email protected]>
  • Loading branch information
camilasan committed Jul 9, 2024
1 parent a200ba4 commit a01cd43
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions test/testlocaldiscovery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -383,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.
Expand Down

0 comments on commit a01cd43

Please sign in to comment.