diff options
author | Molly Lloyd <molly@mapbox.com> | 2018-10-01 13:00:25 -0400 |
---|---|---|
committer | Molly Lloyd <mollymerp@users.noreply.github.com> | 2018-10-03 13:09:23 -0700 |
commit | 32107d9d2280f2fc167518eac7ab5a80f127ca69 (patch) | |
tree | bdbade0431ca8289f3d4662bc0fe6a77a6255ce1 | |
parent | fb75247ccf664f638575feebc3e800b100b836d8 (diff) | |
download | qtlocation-mapboxgl-32107d9d2280f2fc167518eac7ab5a80f127ca69.tar.gz |
[test] add test checking that unclipped tiles are not used by ClipIDGenerator
-rw-r--r-- | test/algorithm/generate_clip_ids.test.cpp | 41 |
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 }, {} }, |