From 24a00231f3f6cf119e3e7e349d1b43ff36750ca9 Mon Sep 17 00:00:00 2001 From: Ivo van Dongen Date: Mon, 26 Jun 2017 08:50:49 -0700 Subject: =?UTF-8?q?[core]=20fix=20render=20doesn=E2=80=99t=20flag=20style?= =?UTF-8?q?=20mutation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/map/map.test.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'test') diff --git a/test/map/map.test.cpp b/test/map/map.test.cpp index bed46f2c3e..a820590fb4 100644 --- a/test/map/map.test.cpp +++ b/test/map/map.test.cpp @@ -280,6 +280,32 @@ TEST(Map, StyleExpiredWithAnnotations) { EXPECT_EQ(1u, fileSource.requests.size()); } +TEST(Map, StyleExpiredWithRender) { + // Rendering should not prevent revalidation of an expired style. + + using namespace std::chrono_literals; + + MapTest test; + FakeFileSource fileSource; + + Map map(test.backend, test.view.getSize(), 1, fileSource, test.threadPool, MapMode::Still); + map.getStyle().loadURL("mapbox://styles/test"); + EXPECT_EQ(1u, fileSource.requests.size()); + + Response response; + response.data = std::make_shared(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.render(test.view); + 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. -- cgit v1.2.1