Skip to content

Commit

Permalink
Add test for correct reporting of existing folder overcoming size limit
Browse files Browse the repository at this point in the history
Signed-off-by: Claudio Cambra <[email protected]>
  • Loading branch information
claucambra committed Jul 18, 2023
1 parent 5cca71c commit 55a20b3
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions test/testsyncengine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <QtTest>

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 55a20b3

Please sign in to comment.