diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2017-04-19 18:25:50 +0200 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2017-04-20 09:38:18 +0200 |
commit | 9a9408e8111bcdcd0fcb9a93112d61ab8fce0601 (patch) | |
tree | 1498222077d463ad4b8a3b1fb479696de6716512 /test | |
parent | 7ddca3b6116903bae9ecde1d49d29a8f1fedcec3 (diff) | |
download | qtlocation-mapboxgl-9a9408e8111bcdcd0fcb9a93112d61ab8fce0601.tar.gz |
[core] Render parent raster tiles when ideal tile can't be loaded
Diffstat (limited to 'test')
-rw-r--r-- | test/algorithm/mock.hpp | 5 | ||||
-rw-r--r-- | test/algorithm/update_renderables.test.cpp | 33 | ||||
-rw-r--r-- | test/tile/raster_tile.test.cpp | 8 | ||||
-rw-r--r-- | test/tile/vector_tile.test.cpp | 6 |
4 files changed, 51 insertions, 1 deletions
diff --git a/test/algorithm/mock.hpp b/test/algorithm/mock.hpp index efa76f238e..d87f55343b 100644 --- a/test/algorithm/mock.hpp +++ b/test/algorithm/mock.hpp @@ -34,8 +34,13 @@ struct MockTileData { return renderable; } + bool isLoaded() const { + return loaded; + } + bool renderable = false; bool triedOptional = false; + bool loaded = false; const mbgl::OverscaledTileID tileID; }; diff --git a/test/algorithm/update_renderables.test.cpp b/test/algorithm/update_renderables.test.cpp index c284c37475..af90d262de 100644 --- a/test/algorithm/update_renderables.test.cpp +++ b/test/algorithm/update_renderables.test.cpp @@ -1226,3 +1226,36 @@ TEST(UpdateRenderables, RepeatedRenderWithMissingOptionals) { }), log); } + +TEST(UpdateRenderables, LoadRequiredIfIdealTileCantBeFound) { + ActionLog log; + MockSource source; + auto getTileData = getTileDataFn(log, source.dataTiles); + auto createTileData = createTileDataFn(log, source.dataTiles); + auto retainTileData = retainTileDataFn(log); + auto renderTile = renderTileFn(log); + + source.zoomRange.max = 6; + source.idealTiles.emplace(UnwrappedTileID{ 6, 0, 0 }); + + auto tile_6_6_0_0 = source.createTileData(OverscaledTileID{ 6, { 6, 0, 0 } }); + tile_6_6_0_0->triedOptional = true; + tile_6_6_0_0->loaded = true; + + algorithm::updateRenderables(getTileData, createTileData, retainTileData, renderTile, + source.idealTiles, source.zoomRange, 6); + EXPECT_EQ(ActionLog({ + GetTileDataAction{ { 6, { 6, 0, 0 } }, Found }, // ideal tile, not found + RetainTileDataAction{ { 6, { 6, 0, 0 } }, Resource::Necessity::Required }, // + GetTileDataAction{ { 7, { 6, 0, 0 } }, NotFound }, // overzoomed child + GetTileDataAction{ { 5, { 5, 0, 0 } }, NotFound }, // ascent + CreateTileDataAction{ { 5, { 5, 0, 0 } } }, + RetainTileDataAction{ { 5, { 5, 0, 0 } }, Resource::Necessity::Required }, + GetTileDataAction{ { 4, { 4, 0, 0 } }, NotFound }, // ... + GetTileDataAction{ { 3, { 3, 0, 0 } }, NotFound }, // ... + GetTileDataAction{ { 2, { 2, 0, 0 } }, NotFound }, // ... + GetTileDataAction{ { 1, { 1, 0, 0 } }, NotFound }, // ... + GetTileDataAction{ { 0, { 0, 0, 0 } }, NotFound }, // ... + }), + log); +} diff --git a/test/tile/raster_tile.test.cpp b/test/tile/raster_tile.test.cpp index 5cfc274be0..d0252555ac 100644 --- a/test/tile/raster_tile.test.cpp +++ b/test/tile/raster_tile.test.cpp @@ -40,6 +40,8 @@ TEST(RasterTile, setError) { RasterTile tile(OverscaledTileID(0, 0, 0), test.updateParameters, test.tileset); tile.setError(std::make_exception_ptr(std::runtime_error("test"))); EXPECT_FALSE(tile.isRenderable()); + EXPECT_TRUE(tile.isLoaded()); + EXPECT_TRUE(tile.isComplete()); } TEST(RasterTile, onError) { @@ -47,6 +49,8 @@ TEST(RasterTile, onError) { RasterTile tile(OverscaledTileID(0, 0, 0), test.updateParameters, test.tileset); tile.onError(std::make_exception_ptr(std::runtime_error("test"))); EXPECT_FALSE(tile.isRenderable()); + EXPECT_TRUE(tile.isLoaded()); + EXPECT_TRUE(tile.isComplete()); } TEST(RasterTile, onParsed) { @@ -54,6 +58,8 @@ TEST(RasterTile, onParsed) { RasterTile tile(OverscaledTileID(0, 0, 0), test.updateParameters, test.tileset); tile.onParsed(std::make_unique<RasterBucket>(UnassociatedImage{})); EXPECT_TRUE(tile.isRenderable()); + EXPECT_TRUE(tile.isLoaded()); + EXPECT_TRUE(tile.isComplete()); } TEST(RasterTile, onParsedEmpty) { @@ -61,4 +67,6 @@ TEST(RasterTile, onParsedEmpty) { RasterTile tile(OverscaledTileID(0, 0, 0), test.updateParameters, test.tileset); tile.onParsed(nullptr); EXPECT_FALSE(tile.isRenderable()); + EXPECT_TRUE(tile.isLoaded()); + EXPECT_TRUE(tile.isComplete()); } diff --git a/test/tile/vector_tile.test.cpp b/test/tile/vector_tile.test.cpp index a388e8937e..0f43645d49 100644 --- a/test/tile/vector_tile.test.cpp +++ b/test/tile/vector_tile.test.cpp @@ -46,13 +46,17 @@ TEST(VectorTile, setError) { VectorTile tile(OverscaledTileID(0, 0, 0), "source", test.updateParameters, test.tileset); tile.setError(std::make_exception_ptr(std::runtime_error("test"))); EXPECT_FALSE(tile.isRenderable()); + EXPECT_TRUE(tile.isLoaded()); + EXPECT_TRUE(tile.isComplete()); } TEST(VectorTile, onError) { VectorTileTest test; VectorTile tile(OverscaledTileID(0, 0, 0), "source", test.updateParameters, test.tileset); tile.onError(std::make_exception_ptr(std::runtime_error("test"))); - EXPECT_TRUE(tile.isRenderable()); + EXPECT_FALSE(tile.isRenderable()); + EXPECT_TRUE(tile.isLoaded()); + EXPECT_TRUE(tile.isComplete()); } TEST(VectorTile, Issue7615) { |