mirror of
https://github.com/nextcloud/desktop.git
synced 2025-10-26 11:17:43 +00:00
fix(moveToTrash): enable use of move to trash in some automated tests
should improve coverage for move to trash feature to ensure this is working as expected by users Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
This commit is contained in:
parent
c62ce64b01
commit
91c8a12d46
@ -97,9 +97,23 @@ private slots:
|
||||
QStandardPaths::setTestModeEnabled(true);
|
||||
}
|
||||
|
||||
void t7pl_data()
|
||||
{
|
||||
QTest::addColumn<bool>("moveToTrashEnabled");
|
||||
QTest::newRow("move to trash") << true;
|
||||
QTest::newRow("delete") << false;
|
||||
}
|
||||
|
||||
void t7pl()
|
||||
{
|
||||
QFETCH(bool, moveToTrashEnabled);
|
||||
|
||||
FakeFolder fakeFolder{ FileInfo() };
|
||||
|
||||
auto syncOptions = fakeFolder.syncEngine().syncOptions();
|
||||
syncOptions._moveFilesToTrash = moveToTrashEnabled;
|
||||
fakeFolder.syncEngine().setSyncOptions(syncOptions);
|
||||
|
||||
QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState());
|
||||
|
||||
// Some of this test depends on the order of discovery. With threading
|
||||
|
||||
@ -219,8 +219,23 @@ private slots:
|
||||
QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState());
|
||||
}
|
||||
|
||||
|
||||
void testLocalDelete_data()
|
||||
{
|
||||
QTest::addColumn<bool>("moveToTrashEnabled");
|
||||
QTest::newRow("move to trash") << true;
|
||||
QTest::newRow("delete") << false;
|
||||
}
|
||||
|
||||
void testLocalDelete() {
|
||||
QFETCH(bool, moveToTrashEnabled);
|
||||
|
||||
FakeFolder fakeFolder{FileInfo::A12_B12_C12_S12()};
|
||||
|
||||
auto syncOptions = fakeFolder.syncEngine().syncOptions();
|
||||
syncOptions._moveFilesToTrash = moveToTrashEnabled;
|
||||
fakeFolder.syncEngine().setSyncOptions(syncOptions);
|
||||
|
||||
ItemCompletedSpy completeSpy(fakeFolder);
|
||||
fakeFolder.remoteModifier().remove("A/a1");
|
||||
fakeFolder.syncOnce();
|
||||
@ -237,10 +252,23 @@ private slots:
|
||||
QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState());
|
||||
}
|
||||
|
||||
void testLocalDeleteWithReuploadForNewLocalFiles_data()
|
||||
{
|
||||
QTest::addColumn<bool>("moveToTrashEnabled");
|
||||
QTest::newRow("move to trash") << true;
|
||||
QTest::newRow("delete") << false;
|
||||
}
|
||||
|
||||
void testLocalDeleteWithReuploadForNewLocalFiles()
|
||||
{
|
||||
QFETCH(bool, moveToTrashEnabled);
|
||||
|
||||
FakeFolder fakeFolder{FileInfo{}};
|
||||
|
||||
auto syncOptions = fakeFolder.syncEngine().syncOptions();
|
||||
syncOptions._moveFilesToTrash = moveToTrashEnabled;
|
||||
fakeFolder.syncEngine().setSyncOptions(syncOptions);
|
||||
|
||||
// create folders hierarchy with some nested dirs and files
|
||||
fakeFolder.localModifier().mkdir("A");
|
||||
fakeFolder.localModifier().insert("A/existingfile_A.txt", 100);
|
||||
@ -1566,9 +1594,23 @@ private slots:
|
||||
QCOMPARE(fileThirdSync->lastModified.toSecsSinceEpoch(), CURRENT_MTIME);
|
||||
}
|
||||
|
||||
void testFolderRemovalWithCaseClash_data()
|
||||
{
|
||||
QTest::addColumn<bool>("moveToTrashEnabled");
|
||||
QTest::newRow("move to trash") << true;
|
||||
QTest::newRow("delete") << false;
|
||||
}
|
||||
|
||||
void testFolderRemovalWithCaseClash()
|
||||
{
|
||||
FakeFolder fakeFolder{ FileInfo{} };
|
||||
QFETCH(bool, moveToTrashEnabled);
|
||||
|
||||
FakeFolder fakeFolder{FileInfo{}};
|
||||
|
||||
auto syncOptions = fakeFolder.syncEngine().syncOptions();
|
||||
syncOptions._moveFilesToTrash = moveToTrashEnabled;
|
||||
fakeFolder.syncEngine().setSyncOptions(syncOptions);
|
||||
|
||||
fakeFolder.remoteModifier().mkdir("A");
|
||||
fakeFolder.remoteModifier().mkdir("toDelete");
|
||||
fakeFolder.remoteModifier().insert("A/file");
|
||||
@ -1851,8 +1893,17 @@ private slots:
|
||||
}
|
||||
}
|
||||
|
||||
void testServer_caseClash_createConflict_thenRemoveOneRemoteFile_data()
|
||||
{
|
||||
QTest::addColumn<bool>("moveToTrashEnabled");
|
||||
QTest::newRow("move to trash") << true;
|
||||
QTest::newRow("delete") << false;
|
||||
}
|
||||
|
||||
void testServer_caseClash_createConflict_thenRemoveOneRemoteFile()
|
||||
{
|
||||
QFETCH(bool, moveToTrashEnabled);
|
||||
|
||||
constexpr auto testLowerCaseFile = "test";
|
||||
constexpr auto testUpperCaseFile = "TEST";
|
||||
|
||||
@ -1864,6 +1915,10 @@ private slots:
|
||||
|
||||
FakeFolder fakeFolder{FileInfo{}};
|
||||
|
||||
auto syncOptions = fakeFolder.syncEngine().syncOptions();
|
||||
syncOptions._moveFilesToTrash = moveToTrashEnabled;
|
||||
fakeFolder.syncEngine().setSyncOptions(syncOptions);
|
||||
|
||||
fakeFolder.remoteModifier().insert("otherFile.txt");
|
||||
fakeFolder.remoteModifier().insert(testLowerCaseFile);
|
||||
fakeFolder.remoteModifier().insert(testUpperCaseFile);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user