summaryrefslogtreecommitdiff
path: root/test/tile
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2017-01-06 13:24:33 -0800
committerJohn Firebaugh <john.firebaugh@gmail.com>2017-01-10 10:15:22 -0800
commit40051fb68ec710c5d83795740d0e3e8c75bb3cb3 (patch)
treee52d31074535b874d4a01b26382ee1ff19e89c14 /test/tile
parentf18c0b8d1e4db52c49f7b5980902b4273b69dc33 (diff)
downloadqtlocation-mapboxgl-40051fb68ec710c5d83795740d0e3e8c75bb3cb3.tar.gz
[core] Keep symbol and non-symbol buckets segregated
Discard prior symbol buckets only when new symbol buckets became available, in order to eliminate flickering when tiles are refreshed.
Diffstat (limited to 'test/tile')
-rw-r--r--test/tile/vector_tile.test.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/test/tile/vector_tile.test.cpp b/test/tile/vector_tile.test.cpp
index 210422feec..9732f23b32 100644
--- a/test/tile/vector_tile.test.cpp
+++ b/test/tile/vector_tile.test.cpp
@@ -8,8 +8,14 @@
#include <mbgl/map/transform.hpp>
#include <mbgl/style/style.hpp>
#include <mbgl/style/update_parameters.hpp>
+#include <mbgl/style/layers/symbol_layer.hpp>
+#include <mbgl/renderer/symbol_bucket.hpp>
+#include <mbgl/text/collision_tile.hpp>
+#include <mbgl/geometry/feature_index.hpp>
#include <mbgl/annotation/annotation_manager.hpp>
+#include <memory>
+
using namespace mbgl;
class VectorTileTest {
@@ -47,3 +53,40 @@ TEST(VectorTile, onError) {
tile.onError(std::make_exception_ptr(std::runtime_error("test")));
EXPECT_TRUE(tile.isRenderable());
}
+
+TEST(VectorTile, Issue7615) {
+ VectorTileTest test;
+ VectorTile tile(OverscaledTileID(0, 0, 0), "source", test.updateParameters, test.tileset);
+
+ style::SymbolLayer symbolLayer("symbol", "source");
+ auto symbolBucket = std::make_shared<SymbolBucket>(
+ MapMode::Continuous, style::SymbolLayoutProperties::Evaluated(), false, false);
+
+ // First onLayout is required so that a non-null FeatureIndex is available.
+ tile.onLayout(GeometryTile::LayoutResult {
+ {},
+ std::make_unique<FeatureIndex>(),
+ nullptr,
+ 0
+ });
+
+ // Simulate placement of a symbol layer.
+ tile.onPlacement(GeometryTile::PlacementResult {
+ {{
+ symbolLayer.getID(),
+ symbolBucket
+ }},
+ nullptr,
+ 0
+ });
+
+ // Second onLayout should not cause the existing symbol bucket to be discarded.
+ tile.onLayout(GeometryTile::LayoutResult {
+ {},
+ nullptr,
+ nullptr,
+ 0
+ });
+
+ EXPECT_EQ(symbolBucket.get(), tile.getBucket(symbolLayer));
+}