diff options
author | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2018-07-11 22:32:51 +0300 |
---|---|---|
committer | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2018-07-24 09:18:19 +0300 |
commit | 1683da3225d0cbed3bb6238fd292fa288f6a32d6 (patch) | |
tree | 5069a3e1e29fc99e27f3a7d7decb6abb8bee9bb7 /test | |
parent | bcc93baeb152bf3f0b5540cfd08e989bc1b032a7 (diff) | |
download | qtlocation-mapboxgl-1683da3225d0cbed3bb6238fd292fa288f6a32d6.tar.gz |
[core] coveredByChildren is false if at least one child is uncovered
Diffstat (limited to 'test')
-rw-r--r-- | test/algorithm/covered_by_children.test.cpp | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/test/algorithm/covered_by_children.test.cpp b/test/algorithm/covered_by_children.test.cpp index b2a219bf29..84f5aa6a21 100644 --- a/test/algorithm/covered_by_children.test.cpp +++ b/test/algorithm/covered_by_children.test.cpp @@ -8,6 +8,48 @@ using namespace mbgl; using List = std::map<UnwrappedTileID, bool>; +TEST(CoveredByChildren, GrandChildren) { + const List list { + { UnwrappedTileID{ 0, 0, 0 }, true }, + // These grandchildren covers 1/0/0, but 1/0/0 only covers a quarter of + // 0/0/0. + { UnwrappedTileID{ 2, 0, 0 }, true }, + { UnwrappedTileID{ 2, 0, 1 }, true }, + { UnwrappedTileID{ 2, 1, 0 }, true }, + { UnwrappedTileID{ 2, 1, 1 }, true }, + }; + EXPECT_FALSE(algorithm::coveredByChildren(UnwrappedTileID{ 0, 0, 0 }, list)); + + const List list2 { + { UnwrappedTileID{ 0, 0, 0 }, true }, + + // Children of 1/0/0 + { UnwrappedTileID{ 2, 0, 0 }, true }, + { UnwrappedTileID{ 2, 0, 1 }, true }, + { UnwrappedTileID{ 2, 1, 0 }, true }, + { UnwrappedTileID{ 2, 1, 1 }, true }, + + // Children of 1/0/1 + { UnwrappedTileID{ 2, 0, 2 }, true }, + { UnwrappedTileID{ 2, 0, 3 }, true }, + { UnwrappedTileID{ 2, 1, 2 }, true }, + { UnwrappedTileID{ 2, 1, 3 }, true }, + + // Children of 1/1/0 + { UnwrappedTileID{ 2, 2, 0 }, true }, + { UnwrappedTileID{ 2, 2, 1 }, true }, + { UnwrappedTileID{ 2, 3, 0 }, true }, + { UnwrappedTileID{ 2, 3, 1 }, true }, + + // Children of 1/0/1 + { UnwrappedTileID{ 2, 2, 2 }, true }, + { UnwrappedTileID{ 2, 2, 3 }, true }, + { UnwrappedTileID{ 2, 3, 2 }, true }, + { UnwrappedTileID{ 2, 3, 3 }, true }, + }; + EXPECT_TRUE(algorithm::coveredByChildren(UnwrappedTileID{ 0, 0, 0 }, list2)); +} + TEST(CoveredByChildren, NotCovered) { const List list1; EXPECT_FALSE(algorithm::coveredByChildren(UnwrappedTileID{ 0, 0, 0 }, list1)); @@ -24,7 +66,7 @@ TEST(CoveredByChildren, NotCovered) { const List list3{ { UnwrappedTileID{ 0, 0, 0 }, true }, - // all four child tiles, with with a different wrap index + // all four child tiles, with a different wrap index { UnwrappedTileID{ 1, { 1, 0, 0 } }, true }, { UnwrappedTileID{ 1, { 1, 0, 1 } }, true }, { UnwrappedTileID{ 1, { 1, 1, 0 } }, true }, |