diff options
author | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2020-02-07 12:57:28 +0200 |
---|---|---|
committer | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2020-02-07 12:57:54 +0200 |
commit | 4fa109cd6da45b532b9864972699e63e1c12087b (patch) | |
tree | 8100625b53b08667c6adb619e5c595fdc02a19ad | |
parent | 1610440b891531aec5bc205f612efaa293e3d6b0 (diff) | |
download | qtlocation-mapboxgl-upstream/mikhail_readonly_database_api.tar.gz |
Add OfflineDatabase.UpdateDatabaseReadOnlyMode unit testupstream/mikhail_readonly_database_api
-rw-r--r-- | test/storage/offline_database.test.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/storage/offline_database.test.cpp b/test/storage/offline_database.test.cpp index a0b780a4ea..f988457dac 100644 --- a/test/storage/offline_database.test.cpp +++ b/test/storage/offline_database.test.cpp @@ -1902,3 +1902,19 @@ TEST(OfflineDatabase, PutResourceReadOnlyMode) { EXPECT_EQ(0u, log.uncheckedCount()); } + +TEST(OfflineDatabase, TEST_REQUIRES_WRITE(UpdateDatabaseReadOnlyMode)) { + FixtureLog log; + deleteDatabaseFiles(); + + OfflineDatabase db(filename); + db.reopenDatabaseReadOnly(true /*readOnly*/); + db.clearAmbientCache(); + EXPECT_EQ(1u, + log.count({EventSeverity::Error, + Event::Database, + -1, + "Can't clear ambient cache: Cannot modify database in read-only mode"})); + + EXPECT_EQ(0u, log.uncheckedCount()); +} |