summaryrefslogtreecommitdiff
path: root/test/tile/geojson_tile.test.cpp
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2017-09-16 00:44:33 +0200
committerKonstantin Käfer <mail@kkaefer.com>2017-09-21 12:21:18 +0200
commit82bdd525a38c4beeb8ab35f3c4ca2a24a6107a38 (patch)
treed82a39638de17b0235b97779f4f9f1d2e367023d /test/tile/geojson_tile.test.cpp
parent6dfb4ecc439b2a50b65f396142885c47161af28b (diff)
downloadqtlocation-mapboxgl-82bdd525a38c4beeb8ab35f3c4ca2a24a6107a38.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/tile/geojson_tile.test.cpp')
-rw-r--r--test/tile/geojson_tile.test.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/test/tile/geojson_tile.test.cpp b/test/tile/geojson_tile.test.cpp
index 80e215a98d..18d11c2c14 100644
--- a/test/tile/geojson_tile.test.cpp
+++ b/test/tile/geojson_tile.test.cpp
@@ -76,7 +76,7 @@ TEST(GeoJSONTile, Issue7648) {
TEST(GeoJSONTile, Issue9927) {
GeoJSONTileTest test;
- CircleLayer layer("circle", "source");
+ test.style.addLayer(std::make_unique<CircleLayer>("circle", "source"));
mapbox::geometry::feature_collection<int16_t> features;
features.push_back(mapbox::geometry::feature<int16_t> {
@@ -85,7 +85,6 @@ TEST(GeoJSONTile, Issue9927) {
GeoJSONTile tile(OverscaledTileID(0, 0, 0), "source", test.tileParameters, features);
- tile.setLayers({{ layer.baseImpl }});
tile.setPlacementConfig({});
while (!tile.isComplete()) {
@@ -93,17 +92,18 @@ TEST(GeoJSONTile, Issue9927) {
}
ASSERT_TRUE(tile.isRenderable());
- ASSERT_NE(nullptr, tile.getBucket(*layer.baseImpl));
+ ASSERT_NE(nullptr, tile.getBucket(*test.style.getRenderLayer("circle")));
// 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")));
ASSERT_TRUE(tile.isRenderable());
- ASSERT_NE(nullptr, tile.getBucket(*layer.baseImpl));
+ ASSERT_NE(nullptr, tile.getBucket(*test.style.getRenderLayer("circle")));
// 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));
+ ASSERT_NE(nullptr, tile.getBucket(*test.style.getRenderLayer("circle")));
}