summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSudarsana Babu Nagineni <sudarsana.babu@mapbox.com>2019-04-08 11:51:46 +0300
committerSudarsana Babu Nagineni <sudarsana.babu@mapbox.com>2019-04-29 12:32:09 +0300
commit31899e2456bd4eeffbaf2b48be4d4dd8cfe97ef1 (patch)
tree826b54b3437e0aee2f3fa49ed657d27b7685b4ec
parent2bd6855b1f39457e498095d8f2959771e3fd9a07 (diff)
downloadqtlocation-mapboxgl-upstream/nagineni-clearcache.tar.gz
[test] Add unit test for clearCache APIupstream/nagineni-clearcache
-rw-r--r--test/storage/offline_database.test.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/storage/offline_database.test.cpp b/test/storage/offline_database.test.cpp
index 90cdc13d7c..0351ef2531 100644
--- a/test/storage/offline_database.test.cpp
+++ b/test/storage/offline_database.test.cpp
@@ -1360,3 +1360,17 @@ TEST(OfflineDatabse, ChangePath) {
util::deleteFile(newPath);
}
+TEST(OfflineDatabse, resetCache) {
+ FixtureLog log;
+ deleteDatabaseFiles();
+ util::copyFile(filename, "test/fixtures/offline_database/satellite_test.db");
+
+ OfflineDatabase db(filename);
+ auto result = db.resetCache();
+ EXPECT_FALSE(result);
+
+ auto regions = db.listRegions().value();
+ EXPECT_EQ(0u, regions.size());
+ EXPECT_EQ(1u, log.count({ EventSeverity::Warning, Event::Database, -1, "Removing existing incompatible offline database" }));
+ EXPECT_EQ(0u, log.uncheckedCount());
+}