mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-22 21:15:55 +03:00
SyncEngineTest: Fix test reliability
There was a rounding issue in the mtimes which sometimes resulted in an off-by-one error. Caused by storing a full QDateTime in the FileInfo but the mtime saved to the disk being truncated to seconds.
This commit is contained in:
parent
30095a0c3f
commit
0db095e02a
1 changed files with 10 additions and 3 deletions
|
@ -392,9 +392,7 @@ private slots:
|
|||
*/
|
||||
void testSyncFileItemProperties()
|
||||
{
|
||||
FakeFolder fakeFolder{ FileInfo::A12_B12_C12_S12() };
|
||||
|
||||
auto initialMtime = fakeFolder.currentLocalState().find("A/a1")->lastModified;
|
||||
auto initialMtime = QDateTime::currentDateTime().addDays(-7);
|
||||
auto changedMtime = QDateTime::currentDateTime().addDays(-4);
|
||||
auto changedMtime2 = QDateTime::currentDateTime().addDays(-3);
|
||||
|
||||
|
@ -403,6 +401,15 @@ private slots:
|
|||
changedMtime.setMSecsSinceEpoch(changedMtime.toMSecsSinceEpoch() / 1000 * 1000);
|
||||
changedMtime2.setMSecsSinceEpoch(changedMtime2.toMSecsSinceEpoch() / 1000 * 1000);
|
||||
|
||||
// Ensure the initial mtimes are as expected
|
||||
auto initialFileInfo = FileInfo::A12_B12_C12_S12();
|
||||
initialFileInfo.setModTime("A/a1", initialMtime);
|
||||
initialFileInfo.setModTime("B/b1", initialMtime);
|
||||
initialFileInfo.setModTime("C/c1", initialMtime);
|
||||
|
||||
FakeFolder fakeFolder{ initialFileInfo };
|
||||
|
||||
|
||||
// upload a
|
||||
fakeFolder.localModifier().appendByte("A/a1");
|
||||
fakeFolder.localModifier().setModTime("A/a1", changedMtime);
|
||||
|
|
Loading…
Reference in a new issue