summaryrefslogtreecommitdiff
path: root/test/tile/raster_tile.test.cpp
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2017-09-15 23:35:26 +0200
committerKonstantin Käfer <mail@kkaefer.com>2017-09-21 12:21:18 +0200
commit6dfb4ecc439b2a50b65f396142885c47161af28b (patch)
treee93e25e3b725110b51b8e81e7e1243f6cf294948 /test/tile/raster_tile.test.cpp
parent9613582417dd32c6e943eb23b3aad620a5404f1e (diff)
downloadqtlocation-mapboxgl-6dfb4ecc439b2a50b65f396142885c47161af28b.tar.gz
[core] keep tiles renderable even if a subsequent error occurs
Since 9a9408e8111bcdcd0fcb9a93112d61ab8fce0601, we marked tiles as non-renderable if an error occured. This lead to situations where a tile was loaded + parsed successfully, then a revalidation attempt occured (e.g. because the resource was stale) which failed. In this case, we used to mark the tile as non-renderable although we could've used the perfectly parsed (stale) resource.
Diffstat (limited to 'test/tile/raster_tile.test.cpp')
-rw-r--r--test/tile/raster_tile.test.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/tile/raster_tile.test.cpp b/test/tile/raster_tile.test.cpp
index f841a82e68..596f97884c 100644
--- a/test/tile/raster_tile.test.cpp
+++ b/test/tile/raster_tile.test.cpp
@@ -60,6 +60,20 @@ TEST(RasterTile, onParsed) {
EXPECT_TRUE(tile.isRenderable());
EXPECT_TRUE(tile.isLoaded());
EXPECT_TRUE(tile.isComplete());
+
+ // Make sure that once we've had a renderable tile and then receive erroneous data, we retain
+ // the previously rendered data and keep the tile renderable.
+ tile.setError(std::make_exception_ptr(std::runtime_error("Connection offline")));
+ EXPECT_TRUE(tile.isRenderable());
+ EXPECT_TRUE(tile.isLoaded());
+ EXPECT_TRUE(tile.isComplete());
+
+ // Then simulate a parsing failure and make sure that we keep it renderable in this situation
+ // as well.
+ tile.onError(std::make_exception_ptr(std::runtime_error("Parse error")), 0);
+ ASSERT_TRUE(tile.isRenderable());
+ EXPECT_TRUE(tile.isLoaded());
+ EXPECT_TRUE(tile.isComplete());
}
TEST(RasterTile, onParsedEmpty) {