summaryrefslogtreecommitdiff
path: root/test/map/map.test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/map/map.test.cpp')
-rw-r--r--test/map/map.test.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/map/map.test.cpp b/test/map/map.test.cpp
index 10cd3080c6..80118f41ec 100644
--- a/test/map/map.test.cpp
+++ b/test/map/map.test.cpp
@@ -1529,3 +1529,36 @@ TEST(Map, PlacedSymbolData) {
EXPECT_TRUE(test.frontend.getRenderer()->getPlacedSymbolsData().empty());
}
+
+TEST(Map, VolatileSource) {
+ MapTest<> test{1, MapMode::Continuous};
+
+ std::atomic_int requestedTiles(0);
+ bool isVolatile = true;
+ test.fileSource->tileResponse = [&](const Resource& resource) {
+ auto expectedPolicy = isVolatile ? Resource::StoragePolicy::Volatile : Resource::StoragePolicy::Permanent;
+ EXPECT_EQ(expectedPolicy, resource.storagePolicy);
+ ++requestedTiles;
+ Response res;
+ res.noContent = true;
+ return res;
+ };
+
+ test.map.getStyle().loadJSON(R"STYLE({
+ "version": 8,
+ "layers": [{
+ "id": "water",
+ "type": "fill",
+ "source": "vector",
+ "source-layer": "water"
+ }]
+ })STYLE");
+ auto source = std::make_unique<VectorSource>("vector", Tileset{{"a/{z}/{x}/{y}"}});
+ source->setVolatile(isVolatile);
+ test.map.getStyle().addSource(std::move(source));
+
+ test.map.jumpTo(CameraOptions().withZoom(16.0));
+ test.observer.didFinishLoadingMapCallback = [&] { test.runLoop.stop(); };
+ test.runLoop.run();
+ EXPECT_EQ(8, requestedTiles);
+} \ No newline at end of file