Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/desktop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorChristian Kamm <mail@ckamm.de>2018-02-21 15:22:54 +0300
committerCamila San <hello@camila.codes>2018-05-16 17:46:40 +0300
commit75194d1821641892b6ec8bf72f8cfd3787e46a2b (patch)
treed3cfb255e006a89483d311bb58259d20f16fd913 /test
parent2defaf099db5e139e2d243aca04b7907a8d59282 (diff)
SyncEngine: Make "local discovery?" question available
Also fix the minor bug that was mentioned and add tests.
Diffstat (limited to 'test')
-rw-r--r--test/testsyncengine.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/testsyncengine.cpp b/test/testsyncengine.cpp
index ff291cc39..79dcea9dc 100644
--- a/test/testsyncengine.cpp
+++ b/test/testsyncengine.cpp
@@ -597,6 +597,38 @@ private slots:
QCOMPARE(fakeFolder.syncEngine().lastLocalDiscoveryStyle(), LocalDiscoveryStyle::FilesystemOnly);
}
+ void testLocalDiscoveryDecision()
+ {
+ FakeFolder fakeFolder{ FileInfo::A12_B12_C12_S12() };
+ auto &engine = fakeFolder.syncEngine();
+
+ QVERIFY(engine.shouldDiscoverLocally(""));
+ QVERIFY(engine.shouldDiscoverLocally("A"));
+ QVERIFY(engine.shouldDiscoverLocally("A/X"));
+
+ fakeFolder.syncEngine().setLocalDiscoveryOptions(
+ LocalDiscoveryStyle::DatabaseAndFilesystem,
+ { "A/X", "foo bar space/touch", "foo/", "zzz" });
+
+ QVERIFY(engine.shouldDiscoverLocally(""));
+ QVERIFY(engine.shouldDiscoverLocally("A"));
+ QVERIFY(engine.shouldDiscoverLocally("A/X"));
+ QVERIFY(!engine.shouldDiscoverLocally("B"));
+ QVERIFY(!engine.shouldDiscoverLocally("A B"));
+ QVERIFY(!engine.shouldDiscoverLocally("B/X"));
+ QVERIFY(!engine.shouldDiscoverLocally("A/X/Y"));
+ QVERIFY(engine.shouldDiscoverLocally("foo bar space"));
+ QVERIFY(engine.shouldDiscoverLocally("foo"));
+ QVERIFY(!engine.shouldDiscoverLocally("foo bar"));
+ QVERIFY(!engine.shouldDiscoverLocally("foo bar/touch"));
+
+ fakeFolder.syncEngine().setLocalDiscoveryOptions(
+ LocalDiscoveryStyle::DatabaseAndFilesystem,
+ {});
+
+ QVERIFY(!engine.shouldDiscoverLocally(""));
+ }
+
void testDiscoveryHiddenFile()
{
FakeFolder fakeFolder{ FileInfo::A12_B12_C12_S12() };