summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMolly Lloyd <molly@mapbox.com>2018-10-01 13:00:25 -0400
committerMolly Lloyd <mollymerp@users.noreply.github.com>2018-10-03 11:46:49 -0700
commitced996ec469399934d11b5fe28bd90c245c7b931 (patch)
treecc0c0ebc04aa89ef4b4bdeb96352af95923ea5d2
parent3b9c404233ff91bc7038fdb0e3c5d0976276caaf (diff)
downloadqtlocation-mapboxgl-ced996ec469399934d11b5fe28bd90c245c7b931.tar.gz
[test] add test checking that unclipped tiles are not used by ClipIDGenerator
-rw-r--r--test/algorithm/generate_clip_ids.test.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/test/algorithm/generate_clip_ids.test.cpp b/test/algorithm/generate_clip_ids.test.cpp
index 9dc86305af..f01c2da80a 100644
--- a/test/algorithm/generate_clip_ids.test.cpp
+++ b/test/algorithm/generate_clip_ids.test.cpp
@@ -335,6 +335,47 @@ TEST(GenerateClipIDs, MultipleSources) {
clipIDs);
}
+TEST(GenerateClipIDs, SomeUnclippedTiles) {
+ std::vector<Renderable> renderables1{
+ Renderable { UnwrappedTileID { 7, 36, 49 }, {}, true, true },
+ Renderable { UnwrappedTileID { 7, 36, 48 }, {}, true, true },
+ Renderable { UnwrappedTileID { 7, 35, 48 }, {}, true, false },
+ Renderable { UnwrappedTileID { 7, 35, 49 }, {}, true, false },
+ Renderable { UnwrappedTileID { 7, 37, 48 }, {}, true, false },
+ Renderable { UnwrappedTileID { 7, 37, 49 }, {}, true, false }
+ };
+ std::vector<Renderable> renderables2{
+ Renderable { UnwrappedTileID { 7, 36, 49 }, {}, true, true },
+ Renderable { UnwrappedTileID { 7, 36, 48 }, {}, true, true }
+ };
+
+ algorithm::ClipIDGenerator generator;
+ generator.update<Renderable>({ renderables1.begin(), renderables1.end() });
+ generator.update<Renderable>({ renderables2.begin(), renderables2.end() });
+ EXPECT_EQ(decltype(renderables1)({
+ Renderable { UnwrappedTileID { 7, 36, 49 }, ClipID {"00000011","00000010"} },
+ Renderable { UnwrappedTileID { 7, 36, 48 }, ClipID {"00000011","00000001"} },
+ Renderable { UnwrappedTileID { 7, 35, 48 }, ClipID {"00000000","00000000"} },
+ Renderable { UnwrappedTileID { 7, 35, 49 }, ClipID {"00000000","00000000"} },
+ Renderable { UnwrappedTileID { 7, 37, 48 }, ClipID {"00000000","00000000"} },
+ Renderable { UnwrappedTileID { 7, 37, 49 }, ClipID {"00000000","00000000"} }
+ }),
+ renderables1);
+ EXPECT_EQ(decltype(renderables2)({
+ Renderable { UnwrappedTileID { 7, 36, 49 }, ClipID {"00000011","00000010"} },
+ Renderable { UnwrappedTileID { 7, 36, 48 }, ClipID {"00000011","00000001"} }
+ }),
+ renderables2);
+
+ const auto clipIDs = generator.getClipIDs();
+
+ EXPECT_EQ(decltype(clipIDs)({
+ { UnwrappedTileID { 7, 36, 48 }, ClipID {"00000011","00000001"} },
+ { UnwrappedTileID { 7, 36, 49 }, ClipID {"00000011","00000010"} }
+ }),
+ clipIDs);
+}
+
TEST(GenerateClipIDs, DuplicateIDs) {
std::vector<Renderable> renderables1{
Renderable{ UnwrappedTileID{ 2, 0, 0 }, {} },