Skip to content

Commit 2bd2162

Browse files
committed
test(cfapi): check for spurious attribute changes.
Signed-off-by: Camila Ayres <[email protected]>
1 parent 95249e1 commit 2bd2162

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

test/testsynccfapi.cpp

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1449,6 +1449,43 @@ private slots:
14491449
QVERIFY(fakeFolder.syncOnce());
14501450
QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState());
14511451
}
1452+
1453+
void testDetectSpuriousNotification() {
1454+
#if !defined Q_OS_WIN
1455+
QSKIP("not applicable");
1456+
#endif
1457+
FakeFolder fakeFolder{FileInfo{}};
1458+
auto vfs = setupVfs(fakeFolder);
1459+
1460+
QVERIFY(fakeFolder.syncOnce());
1461+
QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState());
1462+
1463+
const QString odpFile("odp/presentation.odp");
1464+
const QString odtFile("odt/document.odt");
1465+
fakeFolder.localModifier().mkdir("odp");
1466+
fakeFolder.localModifier().insert(odpFile);
1467+
fakeFolder.localModifier().mkdir("odt");
1468+
fakeFolder.localModifier().insert(odtFile);
1469+
1470+
QVERIFY(fakeFolder.syncOnce());
1471+
QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState());
1472+
ItemCompletedSpy completeSpy(fakeFolder);
1473+
1474+
QFile odp(fakeFolder.localPath() + odpFile);
1475+
QVERIFY(odp.open(QIODevice::ReadWrite));
1476+
odp.write(odpFile.toLatin1(), qstrlen(odpFile.toLatin1()));
1477+
odp.close();
1478+
QVERIFY(fakeFolder.syncOnce());
1479+
QVERIFY(itemInstruction(completeSpy, odpFile, CSYNC_INSTRUCTION_SYNC));
1480+
QCOMPARE(*vfs->pinState(odpFile), PinState::Unspecified);
1481+
1482+
QFile odt(fakeFolder.localPath() + odtFile);
1483+
QVERIFY(odt.open(QIODevice::ReadWrite));
1484+
odt.close();
1485+
QVERIFY(fakeFolder.syncOnce());
1486+
QVERIFY(itemInstruction(completeSpy, odtFile, CSYNC_INSTRUCTION_UPDATE_METADATA));
1487+
QCOMPARE(*vfs->pinState(odtFile), PinState::Unspecified);
1488+
}
14521489
};
14531490

14541491
QTEST_GUILESS_MAIN(TestSyncCfApi)

0 commit comments

Comments
 (0)