From 55a20b378026702808723aa8cb546b6c40992c27 Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Tue, 18 Jul 2023 17:19:39 +0800 Subject: [PATCH] Add test for correct reporting of existing folder overcoming size limit Signed-off-by: Claudio Cambra --- test/testsyncengine.cpp | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/test/testsyncengine.cpp b/test/testsyncengine.cpp index 746ccde3dc32..06041bab6e8c 100644 --- a/test/testsyncengine.cpp +++ b/test/testsyncengine.cpp @@ -7,9 +7,10 @@ #include "syncenginetestutils.h" -#include "syncengine.h" -#include "propagatorjobs.h" #include "caseclashconflictsolver.h" +#include "configfile.h" +#include "propagatorjobs.h" +#include "syncengine.h" #include @@ -1658,6 +1659,30 @@ private slots: fakeFolder.remoteModifier().remove(testUpperCaseFile); QVERIFY(fakeFolder.syncOnce()); } + + void testExistingFolderBecameBig() + { + constexpr auto testFolder = "folder"; + constexpr auto testSmallFile = "folder/small_file.txt"; + constexpr auto testLargeFile = "folder/large_file.txt"; + + FakeFolder fakeFolder{FileInfo{}}; + QSignalSpy spy(&fakeFolder.syncEngine(), &SyncEngine::existingFolderNowBig); + + auto syncOptions = fakeFolder.syncEngine().syncOptions(); + syncOptions._newBigFolderSizeLimit = 128; // 128 bytes + fakeFolder.syncEngine().setSyncOptions(syncOptions); + + fakeFolder.remoteModifier().mkdir(testFolder); + fakeFolder.remoteModifier().insert(testSmallFile, 64); + fakeFolder.syncEngine().setLocalDiscoveryOptions(OCC::LocalDiscoveryStyle::DatabaseAndFilesystem); + QVERIFY(fakeFolder.syncOnce()); + QCOMPARE(spy.count(), 0); + + fakeFolder.remoteModifier().insert(testLargeFile, 128); + QVERIFY(fakeFolder.syncOnce()); + QCOMPARE(spy.count(), 1); + } }; QTEST_GUILESS_MAIN(TestSyncEngine)