Skip to content

Commit

Permalink
Add test for correct handling of live photo mov deletion
Browse files Browse the repository at this point in the history
Signed-off-by: Claudio Cambra <[email protected]>
  • Loading branch information
claucambra authored and backportbot[bot] committed Nov 20, 2024
1 parent 736d064 commit 5a63744
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions test/testlocaldiscovery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,41 @@ private slots:
QVERIFY(!fakeFolder.currentRemoteState().find("C/filename.ext"));
}

void testRedownloadDeletedLivePhotoMov()
{
FakeFolder fakeFolder{FileInfo{}};
QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState());
const auto livePhotoImg = QStringLiteral("IMG_0001.heic");
const auto livePhotoMov = QStringLiteral("IMG_0001.mov");
fakeFolder.localModifier().insert(livePhotoImg);
fakeFolder.localModifier().insert(livePhotoMov);

ItemCompletedSpy completeSpy(fakeFolder);
QVERIFY(fakeFolder.syncOnce());

QCOMPARE(completeSpy.findItem(livePhotoImg)->_status, SyncFileItem::Status::Success);
QCOMPARE(completeSpy.findItem(livePhotoMov)->_status, SyncFileItem::Status::Success);

fakeFolder.remoteModifier().setIsLivePhoto(livePhotoImg, true);
fakeFolder.remoteModifier().setIsLivePhoto(livePhotoMov, true);
QVERIFY(fakeFolder.syncOnce());

SyncJournalFileRecord imgRecord;
QVERIFY(fakeFolder.syncJournal().getFileRecord(livePhotoImg, &imgRecord));
QVERIFY(imgRecord._isLivePhoto);

SyncJournalFileRecord movRecord;
QVERIFY(fakeFolder.syncJournal().getFileRecord(livePhotoMov, &movRecord));
QVERIFY(movRecord._isLivePhoto);

completeSpy.clear();
fakeFolder.localModifier().remove(livePhotoMov);
QVERIFY(fakeFolder.syncOnce());
QCOMPARE(completeSpy.findItem(livePhotoMov)->_status, SyncFileItem::Status::Success);
QCOMPARE(completeSpy.findItem(livePhotoMov)->_instruction, CSYNC_INSTRUCTION_SYNC);
QCOMPARE(completeSpy.findItem(livePhotoMov)->_direction, SyncFileItem::Direction::Down);
}

void testCreateFileWithTrailingSpaces_localAndRemoteTrimmedDoNotExist_renameAndUploadFile()
{
FakeFolder fakeFolder{FileInfo{}};
Expand Down

0 comments on commit 5a63744

Please sign in to comment.