diff options
author | Christian Kamm <mail@ckamm.de> | 2018-02-21 15:22:54 +0300 |
---|---|---|
committer | ckamm <mail@ckamm.de> | 2018-03-06 15:02:54 +0300 |
commit | f82d61ea19b39b846ae1a451015fb72515ed8a52 (patch) | |
tree | bf73d9b332723207d78e6ac50bba6a98926903c3 /test/testsyncengine.cpp | |
parent | ec281654ae165b11cb50d76d8e3dad5578dddb2d (diff) |
SyncEngine: Make "local discovery?" question available
Also fix the minor bug that was mentioned and add tests.
Diffstat (limited to 'test/testsyncengine.cpp')
-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 6ac5ed549..10644abd0 100644 --- a/test/testsyncengine.cpp +++ b/test/testsyncengine.cpp @@ -605,6 +605,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() }; |