diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2016-11-01 16:14:33 +0100 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2016-11-08 18:09:58 +0100 |
commit | bcdbbbcac2e331ea3a23085b1e0f5a0f5d25e0a7 (patch) | |
tree | f7961bcbb800b781a980e9e387d8f191d22051ca /test | |
parent | 3b38cf48b706ace413bee44e8d2742710c9425b4 (diff) | |
download | qtlocation-mapboxgl-bcdbbbcac2e331ea3a23085b1e0f5a0f5d25e0a7.tar.gz |
[core] don't assign clip IDs to tiles that aren't rendered
Diffstat (limited to 'test')
-rw-r--r-- | test/algorithm/generate_clip_ids.test.cpp | 1 | ||||
-rw-r--r-- | test/api/annotations.test.cpp | 29 | ||||
-rw-r--r-- | test/fixtures/annotations/debug_empty/expected.png | bin | 0 -> 1238 bytes | |||
-rw-r--r-- | test/fixtures/annotations/debug_sparse/expected.png | bin | 0 -> 2933 bytes |
4 files changed, 30 insertions, 0 deletions
diff --git a/test/algorithm/generate_clip_ids.test.cpp b/test/algorithm/generate_clip_ids.test.cpp index 5b7f4afb26..8ca0191b3a 100644 --- a/test/algorithm/generate_clip_ids.test.cpp +++ b/test/algorithm/generate_clip_ids.test.cpp @@ -6,6 +6,7 @@ using namespace mbgl; struct Renderable { ClipID clip; + bool used = true; bool operator==(const Renderable& rhs) const { return clip == rhs.clip; diff --git a/test/api/annotations.test.cpp b/test/api/annotations.test.cpp index 06a0a61b0a..b143bd961c 100644 --- a/test/api/annotations.test.cpp +++ b/test/api/annotations.test.cpp @@ -419,3 +419,32 @@ TEST(Annotations, VisibleFeatures) { features.erase(std::unique(features.begin(), features.end(), sameID), features.end()); EXPECT_EQ(features.size(), ids.size()); } + + +TEST(Annotations, DebugEmpty) { + // This test should render nothing, not even the tile borders. Tile borders are only rendered + // when there is an actual tile we're trying to render, but since there is no annotation, we + // should not render them. + AnnotationTest test; + + test.map.setStyleJSON(util::read_file("test/fixtures/api/empty.json")); + test.map.setDebug(MapDebugOptions::TileBorders); + test.map.setZoom(1); + + test.checkRendering("debug_empty"); +} + + +TEST(Annotations, DebugSparse) { + // This test should only render the top right tile with the associated tile border, but no other + // tiles because they're all empty. + AnnotationTest test; + + test.map.setStyleJSON(util::read_file("test/fixtures/api/empty.json")); + test.map.setDebug(MapDebugOptions::TileBorders); + test.map.setZoom(1); + test.map.addAnnotationIcon("default_marker", namedMarker("default_marker.png")); + test.map.addAnnotation(SymbolAnnotation { Point<double>(10, 10), "default_marker" }); + + test.checkRendering("debug_sparse"); +} diff --git a/test/fixtures/annotations/debug_empty/expected.png b/test/fixtures/annotations/debug_empty/expected.png Binary files differnew file mode 100644 index 0000000000..04f8682f88 --- /dev/null +++ b/test/fixtures/annotations/debug_empty/expected.png diff --git a/test/fixtures/annotations/debug_sparse/expected.png b/test/fixtures/annotations/debug_sparse/expected.png Binary files differnew file mode 100644 index 0000000000..3c1ad1599c --- /dev/null +++ b/test/fixtures/annotations/debug_sparse/expected.png |