[core] use stale and refreshing TileJSON/GeoJSON data
We're now supporting using stale TileJSON and GeoJSON data. When we receive a new answer with an updated TileJSON file, we're replacing the Source's metadata with the new one and trigger updates to make sure we're loading the correct tiles. Similarly, GeoJSON data will be reparsed.
This commit is contained in:
@@ -49,3 +49,26 @@ TEST_F(Storage, CacheStaleStyle) {
|
||||
|
||||
checkRendering(map, "stale_style", 1000ms);
|
||||
}
|
||||
|
||||
TEST_F(Storage, CacheStaleStyleAndTileJSON) {
|
||||
HeadlessView view(display, 1);
|
||||
|
||||
auto cache = SQLiteCache::getShared(":memory:");
|
||||
|
||||
// Rig the cache with an expired stylesheet.
|
||||
const std::string stylePath = "stale/style_and_tilejson.json";
|
||||
const Resource styleResource{ Resource::Kind::Style, prefix + "/" + stylePath };
|
||||
cache->put(styleResource, expiredItem(stylePath));
|
||||
|
||||
// Rig the cache with an expired TileJSON.
|
||||
const std::string tilejsonPath = "stale/streets.json";
|
||||
const Resource tilejsonResource{ Resource::Kind::Source, prefix + "/" + tilejsonPath };
|
||||
cache->put(tilejsonResource, expiredItem(tilejsonPath));
|
||||
|
||||
DefaultFileSource fileSource(":memory:", ".");
|
||||
|
||||
Map map(view, fileSource, MapMode::Still);
|
||||
map.setStyleURL(styleResource.url);
|
||||
|
||||
checkRendering(map, "stale_style_and_tilejson", 1000ms);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user