diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2017-09-16 00:44:33 +0200 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2017-09-21 12:20:54 +0200 |
commit | f659aa4eda4cf2be743c7ad229ffcc4b62d4be6d (patch) | |
tree | e4af5854833d2eb19cd864d9d4622cc125c037b9 /test | |
parent | 1a684c1f48ef9fdc40ffcaacf1abe33b28370562 (diff) | |
download | qtlocation-mapboxgl-f659aa4eda4cf2be743c7ad229ffcc4b62d4be6d.tar.gz |
[core] make sure tiles are not treated as complete until all worker operations completed
Previously, when we started a worker operation that eventually throws an exception (e.g. due to the tile not being parseable), and then enqueue another worker operation while the first one is processing, we treated the worker as idle once the first operation's error callback fired, even though the second operation was still in progress. Due to our use of coalescing, I was unable to come up with a reliable test since we'd need to reproduce the behavior described above, which is timing dependent.
Diffstat (limited to 'test')
-rw-r--r-- | test/tile/annotation_tile.test.cpp | 9 | ||||
-rw-r--r-- | test/tile/geojson_tile.test.cpp | 5 | ||||
-rw-r--r-- | test/tile/raster_tile.test.cpp | 6 | ||||
-rw-r--r-- | test/tile/vector_tile.test.cpp | 9 |
4 files changed, 13 insertions, 16 deletions
diff --git a/test/tile/annotation_tile.test.cpp b/test/tile/annotation_tile.test.cpp index 86ede07089..8f3f903925 100644 --- a/test/tile/annotation_tile.test.cpp +++ b/test/tile/annotation_tile.test.cpp @@ -60,8 +60,7 @@ TEST(AnnotationTile, Issue8289) { std::unordered_map<std::string, std::shared_ptr<Bucket>>(), std::make_unique<FeatureIndex>(), std::move(data), - 0 - }); + }, 0); auto collisionTile = std::make_unique<CollisionTile>(PlacementConfig()); @@ -75,16 +74,14 @@ TEST(AnnotationTile, Issue8289) { std::move(collisionTile), {}, {}, - 0 - }); + }, 0); // Simulate a second layout with empty data. tile.onLayout(GeometryTile::LayoutResult { std::unordered_map<std::string, std::shared_ptr<Bucket>>(), std::make_unique<FeatureIndex>(), std::make_unique<AnnotationTileData>(), - 0 - }); + }, 0); std::unordered_map<std::string, std::vector<Feature>> result; GeometryCoordinates queryGeometry {{ Point<int16_t>(0, 0) }}; diff --git a/test/tile/geojson_tile.test.cpp b/test/tile/geojson_tile.test.cpp index bb2da1ec62..953c3b8a5f 100644 --- a/test/tile/geojson_tile.test.cpp +++ b/test/tile/geojson_tile.test.cpp @@ -109,8 +109,9 @@ TEST(GeoJSONTile, Issue9927) { ASSERT_NE(nullptr, tile.getBucket(*layer.baseImpl)); // 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"))); + // as well. We're using 3 as a correlationID since we've done two three calls that increment + // this counter (as part of the GeoJSONTile constructor, setLayers, and setPlacementConfig). + tile.onError(std::make_exception_ptr(std::runtime_error("Parse error")), 3); ASSERT_TRUE(tile.isRenderable()); ASSERT_NE(nullptr, tile.getBucket(*layer.baseImpl)); } diff --git a/test/tile/raster_tile.test.cpp b/test/tile/raster_tile.test.cpp index efdc4767d9..8b2b3dee61 100644 --- a/test/tile/raster_tile.test.cpp +++ b/test/tile/raster_tile.test.cpp @@ -53,7 +53,7 @@ TEST(RasterTile, setError) { TEST(RasterTile, onError) { RasterTileTest test; RasterTile tile(OverscaledTileID(0, 0, 0), test.tileParameters, test.tileset); - tile.onError(std::make_exception_ptr(std::runtime_error("test"))); + tile.onError(std::make_exception_ptr(std::runtime_error("test")), 0); EXPECT_FALSE(tile.isRenderable()); EXPECT_TRUE(tile.isLoaded()); EXPECT_TRUE(tile.isComplete()); @@ -62,7 +62,7 @@ TEST(RasterTile, onError) { TEST(RasterTile, onParsed) { RasterTileTest test; RasterTile tile(OverscaledTileID(0, 0, 0), test.tileParameters, test.tileset); - tile.onParsed(std::make_unique<RasterBucket>(PremultipliedImage{})); + tile.onParsed(std::make_unique<RasterBucket>(PremultipliedImage{}), 0); EXPECT_TRUE(tile.isRenderable()); EXPECT_TRUE(tile.isLoaded()); EXPECT_TRUE(tile.isComplete()); @@ -85,7 +85,7 @@ TEST(RasterTile, onParsed) { TEST(RasterTile, onParsedEmpty) { RasterTileTest test; RasterTile tile(OverscaledTileID(0, 0, 0), test.tileParameters, test.tileset); - tile.onParsed(nullptr); + tile.onParsed(nullptr, 0); 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 45eab21576..7e8b659b7a 100644 --- a/test/tile/vector_tile.test.cpp +++ b/test/tile/vector_tile.test.cpp @@ -59,7 +59,8 @@ TEST(VectorTile, setError) { TEST(VectorTile, onError) { VectorTileTest test; VectorTile tile(OverscaledTileID(0, 0, 0), "source", test.tileParameters, test.tileset); - tile.onError(std::make_exception_ptr(std::runtime_error("test"))); + tile.onError(std::make_exception_ptr(std::runtime_error("test")), 0); + EXPECT_FALSE(tile.isRenderable()); EXPECT_TRUE(tile.isLoaded()); EXPECT_TRUE(tile.isComplete()); @@ -86,16 +87,14 @@ TEST(VectorTile, Issue7615) { nullptr, {}, {}, - 0 - }); + }, 0); // Subsequent onLayout should not cause the existing symbol bucket to be discarded. tile.onLayout(GeometryTile::LayoutResult { std::unordered_map<std::string, std::shared_ptr<Bucket>>(), nullptr, nullptr, - 0 - }); + }, 0); EXPECT_EQ(symbolBucket.get(), tile.getBucket(*symbolLayer.baseImpl)); } |