diff options
author | Christian Kamm <mail@ckamm.de> | 2017-07-04 10:57:22 +0300 |
---|---|---|
committer | Christian Kamm <mail@ckamm.de> | 2017-07-04 10:57:22 +0300 |
commit | 0db095e02a3cc311a1121ab1b427c92c59687db7 (patch) | |
tree | 02b579a53b1d338ab604783d9aff787e48c74cfb /test/testsyncengine.cpp | |
parent | 30095a0c3f54195016f35954e0ca29eec1c03a82 (diff) |
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.
Diffstat (limited to 'test/testsyncengine.cpp')
-rw-r--r-- | test/testsyncengine.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/test/testsyncengine.cpp b/test/testsyncengine.cpp index 1a9ac42d1..8835bd575 100644 --- a/test/testsyncengine.cpp +++ b/test/testsyncengine.cpp @@ -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); |