summaryrefslogtreecommitdiff
path: root/test/util
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2016-09-13 14:07:43 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2016-09-16 09:00:55 -0700
commit32fac7cbe4d6b9c9434ffe0b2676df6dcf9931ee (patch)
treef30c4ca5763b5ab796e11b4ecfc1ec5f98e82a37 /test/util
parenta8dd1bbbb8f9053923179fd45b2dfcbb86e3f474 (diff)
downloadqtlocation-mapboxgl-32fac7cbe4d6b9c9434ffe0b2676df6dcf9931ee.tar.gz
[core] Use optional to represent possible absence, not empty strings
Diffstat (limited to 'test/util')
-rw-r--r--test/util/merge_lines.cpp49
1 files changed, 25 insertions, 24 deletions
diff --git a/test/util/merge_lines.cpp b/test/util/merge_lines.cpp
index 4b8b0c4e79..db81d8b209 100644
--- a/test/util/merge_lines.cpp
+++ b/test/util/merge_lines.cpp
@@ -1,6 +1,7 @@
#include <mbgl/test/util.hpp>
#include <mbgl/layout/merge_lines.hpp>
+#include <mbgl/layout/symbol_feature.hpp>
const std::u32string aaa = U"a";
const std::u32string bbb = U"b";
@@ -8,21 +9,21 @@ const std::u32string bbb = U"b";
TEST(MergeLines, SameText) {
// merges lines with the same text
std::vector<mbgl::SymbolFeature> input1 = {
- { {{{0, 0}, {1, 0}, {2, 0}}}, aaa, "", 0 },
- { {{{4, 0}, {5, 0}, {6, 0}}}, bbb, "", 0 },
- { {{{8, 0}, {9, 0}}}, aaa, "", 0 },
- { {{{2, 0}, {3, 0}, {4, 0}}}, aaa, "", 0 },
- { {{{6, 0}, {7, 0}, {8, 0}}}, aaa, "", 0 },
- { {{{5, 0}, {6, 0}}}, aaa, "", 0 }
+ { {{{0, 0}, {1, 0}, {2, 0}}}, aaa, {}, 0 },
+ { {{{4, 0}, {5, 0}, {6, 0}}}, bbb, {}, 0 },
+ { {{{8, 0}, {9, 0}}}, aaa, {}, 0 },
+ { {{{2, 0}, {3, 0}, {4, 0}}}, aaa, {}, 0 },
+ { {{{6, 0}, {7, 0}, {8, 0}}}, aaa, {}, 0 },
+ { {{{5, 0}, {6, 0}}}, aaa, {}, 0 }
};
const std::vector<mbgl::SymbolFeature> expected1 = {
- { {{{0, 0}, {1, 0}, {2, 0}, {3, 0}, {4, 0}}}, aaa, "", 0 },
- { {{{4, 0}, {5, 0}, {6, 0}}}, bbb, "", 0 },
- { {{{5, 0}, {6, 0}, {7, 0}, {8, 0}, {9, 0}}}, aaa, "", 0 },
- { {{}}, aaa, "", 0 },
- { {{}}, aaa, "", 0 },
- { {{}}, aaa, "", 0 }
+ { {{{0, 0}, {1, 0}, {2, 0}, {3, 0}, {4, 0}}}, aaa, {}, 0 },
+ { {{{4, 0}, {5, 0}, {6, 0}}}, bbb, {}, 0 },
+ { {{{5, 0}, {6, 0}, {7, 0}, {8, 0}, {9, 0}}}, aaa, {}, 0 },
+ { {{}}, aaa, {}, 0 },
+ { {{}}, aaa, {}, 0 },
+ { {{}}, aaa, {}, 0 }
};
mbgl::util::mergeLines(input1);
@@ -35,15 +36,15 @@ TEST(MergeLines, SameText) {
TEST(MergeLines, BothEnds) {
// mergeLines handles merge from both ends
std::vector<mbgl::SymbolFeature> input2 = {
- { {{{0, 0}, {1, 0}, {2, 0}}}, aaa, "", 0 },
- { {{{4, 0}, {5, 0}, {6, 0}}}, aaa, "", 0 },
- { {{{2, 0}, {3, 0}, {4, 0}}}, aaa, "", 0 }
+ { {{{0, 0}, {1, 0}, {2, 0}}}, aaa, {}, 0 },
+ { {{{4, 0}, {5, 0}, {6, 0}}}, aaa, {}, 0 },
+ { {{{2, 0}, {3, 0}, {4, 0}}}, aaa, {}, 0 }
};
const std::vector<mbgl::SymbolFeature> expected2 = {
- { {{{0, 0}, {1, 0}, {2, 0}, {3, 0}, {4, 0}, {5, 0}, {6, 0}}}, aaa, "", 0 },
- { {{}}, aaa, "", 0 },
- { {{}}, aaa, "", 0 }
+ { {{{0, 0}, {1, 0}, {2, 0}, {3, 0}, {4, 0}, {5, 0}, {6, 0}}}, aaa, {}, 0 },
+ { {{}}, aaa, {}, 0 },
+ { {{}}, aaa, {}, 0 }
};
mbgl::util::mergeLines(input2);
@@ -56,15 +57,15 @@ TEST(MergeLines, BothEnds) {
TEST(MergeLines, CircularLines) {
// mergeLines handles circular lines
std::vector<mbgl::SymbolFeature> input3 = {
- { {{{0, 0}, {1, 0}, {2, 0}}}, aaa, "", 0 },
- { {{{2, 0}, {3, 0}, {4, 0}}}, aaa, "", 0 },
- { {{{4, 0}, {0, 0}}}, aaa, "", 0 }
+ { {{{0, 0}, {1, 0}, {2, 0}}}, aaa, {}, 0 },
+ { {{{2, 0}, {3, 0}, {4, 0}}}, aaa, {}, 0 },
+ { {{{4, 0}, {0, 0}}}, aaa, {}, 0 }
};
const std::vector<mbgl::SymbolFeature> expected3 = {
- { {{{0, 0}, {1, 0}, {2, 0}, {3, 0}, {4, 0}, {0, 0}}}, aaa, "", 0 },
- { {{}}, aaa, "", 0 },
- { {{}}, aaa, "", 0 }
+ { {{{0, 0}, {1, 0}, {2, 0}, {3, 0}, {4, 0}, {0, 0}}}, aaa, {}, 0 },
+ { {{}}, aaa, {}, 0 },
+ { {{}}, aaa, {}, 0 }
};
mbgl::util::mergeLines(input3);