diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2016-08-23 09:30:14 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2016-08-23 09:55:32 -0700 |
commit | eb9fe89612d0effca9e547deedcbe702953570b8 (patch) | |
tree | 393f174614c73a3819057606fa263e506be2d4ca /test | |
parent | 86cccc4d24804d40ea9d15d47ee1edb975bbf2e3 (diff) | |
download | qtlocation-mapboxgl-eb9fe89612d0effca9e547deedcbe702953570b8.tar.gz |
[tests] Test that style mutations due to annotations don't cancel style revalidation
Diffstat (limited to 'test')
-rw-r--r-- | test/map/map.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/map/map.cpp b/test/map/map.cpp index 79c1993cb4..2dc8aad927 100644 --- a/test/map/map.cpp +++ b/test/map/map.cpp @@ -126,6 +126,32 @@ TEST(Map, StyleExpired) { EXPECT_NE(nullptr, map.getLayer("bg")); } +TEST(Map, StyleExpiredWithAnnotations) { + // Adding an annotation should not prevent revalidation of an expired style. + + using namespace std::chrono_literals; + + MapTest test; + FakeFileSource fileSource; + + Map map(test.view, fileSource, MapMode::Still); + map.setStyleURL("mapbox://styles/test"); + EXPECT_EQ(1u, fileSource.requests.size()); + + Response response; + response.data = std::make_shared<std::string>(util::read_file("test/fixtures/api/empty.json")); + response.expires = util::now() - 1h; + + fileSource.respond(Resource::Style, response); + EXPECT_EQ(1u, fileSource.requests.size()); + + map.addAnnotation(LineAnnotation { LineString<double> {{ { 0, 0 }, { 10, 10 } }} }); + EXPECT_EQ(1u, fileSource.requests.size()); + + fileSource.respond(Resource::Style, response); + EXPECT_EQ(1u, fileSource.requests.size()); +} + TEST(Map, StyleEarlyMutation) { // An early mutation should not prevent the initial style load. |