diff options
author | Christian Kamm <mail@ckamm.de> | 2018-02-21 15:22:54 +0300 |
---|---|---|
committer | Camila San <hello@camila.codes> | 2018-05-16 17:46:40 +0300 |
commit | 75194d1821641892b6ec8bf72f8cfd3787e46a2b (patch) | |
tree | d3cfb255e006a89483d311bb58259d20f16fd913 /test | |
parent | 2defaf099db5e139e2d243aca04b7907a8d59282 (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.cpp | 32 |
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() }; |