diff options
author | Sudarsana Babu Nagineni <sudarsana.babu@mapbox.com> | 2019-04-08 11:51:46 +0300 |
---|---|---|
committer | Sudarsana Babu Nagineni <sudarsana.babu@mapbox.com> | 2019-04-29 17:09:58 +0300 |
commit | a31734ddada70d9bab144a564a9508726e046480 (patch) | |
tree | ee140449f2123e04485d295765ad5507e5e8a213 /test | |
parent | 2604991b2b0090ed69893f6b156a6e640a789c9f (diff) | |
download | qtlocation-mapboxgl-a31734ddada70d9bab144a564a9508726e046480.tar.gz |
[test] Add unit test for clearCache API
Diffstat (limited to 'test')
-rw-r--r-- | test/storage/offline_database.test.cpp | 14 |
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()); +} |