summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2016-12-14 14:58:06 -0800
committerJohn Firebaugh <john.firebaugh@gmail.com>2016-12-20 08:30:39 -0800
commitdad57df38ef86363da9bff2e62f3fddc5688f0cf (patch)
tree361bff89dbee074d9c6313142a0df3de2b1dc69b /test
parent3dcff6c3e11caa454893f44a300a3be0120325a3 (diff)
downloadqtlocation-mapboxgl-dad57df38ef86363da9bff2e62f3fddc5688f0cf.tar.gz
[core] Fix symbol rendering for multipoints
Ports https://github.com/mapbox/mapbox-gl-js/pull/3763 and https://github.com/mapbox/mapbox-gl-js/pull/3806.
Diffstat (limited to 'test')
-rw-r--r--test/util/merge_lines.test.cpp50
1 files changed, 26 insertions, 24 deletions
diff --git a/test/util/merge_lines.test.cpp b/test/util/merge_lines.test.cpp
index 30cd1af068..4856a734fe 100644
--- a/test/util/merge_lines.test.cpp
+++ b/test/util/merge_lines.test.cpp
@@ -6,24 +6,26 @@
const std::u16string aaa = u"a";
const std::u16string bbb = u"b";
+using namespace mbgl;
+
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 }
+ { FeatureType::LineString, {{{0, 0}, {1, 0}, {2, 0}}}, aaa, {}, 0 },
+ { FeatureType::LineString, {{{4, 0}, {5, 0}, {6, 0}}}, bbb, {}, 0 },
+ { FeatureType::LineString, {{{8, 0}, {9, 0}}}, aaa, {}, 0 },
+ { FeatureType::LineString, {{{2, 0}, {3, 0}, {4, 0}}}, aaa, {}, 0 },
+ { FeatureType::LineString, {{{6, 0}, {7, 0}, {8, 0}}}, aaa, {}, 0 },
+ { FeatureType::LineString, {{{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 }
+ { FeatureType::LineString, {{{0, 0}, {1, 0}, {2, 0}, {3, 0}, {4, 0}}}, aaa, {}, 0 },
+ { FeatureType::LineString, {{{4, 0}, {5, 0}, {6, 0}}}, bbb, {}, 0 },
+ { FeatureType::LineString, {{{5, 0}, {6, 0}, {7, 0}, {8, 0}, {9, 0}}}, aaa, {}, 0 },
+ { FeatureType::LineString, {{}}, aaa, {}, 0 },
+ { FeatureType::LineString, {{}}, aaa, {}, 0 },
+ { FeatureType::LineString, {{}}, aaa, {}, 0 }
};
mbgl::util::mergeLines(input1);
@@ -36,15 +38,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 }
+ { FeatureType::LineString, {{{0, 0}, {1, 0}, {2, 0}}}, aaa, {}, 0 },
+ { FeatureType::LineString, {{{4, 0}, {5, 0}, {6, 0}}}, aaa, {}, 0 },
+ { FeatureType::LineString, {{{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 }
+ { FeatureType::LineString, {{{0, 0}, {1, 0}, {2, 0}, {3, 0}, {4, 0}, {5, 0}, {6, 0}}}, aaa, {}, 0 },
+ { FeatureType::LineString, {{}}, aaa, {}, 0 },
+ { FeatureType::LineString, {{}}, aaa, {}, 0 }
};
mbgl::util::mergeLines(input2);
@@ -57,15 +59,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 }
+ { FeatureType::LineString, {{{0, 0}, {1, 0}, {2, 0}}}, aaa, {}, 0 },
+ { FeatureType::LineString, {{{2, 0}, {3, 0}, {4, 0}}}, aaa, {}, 0 },
+ { FeatureType::LineString, {{{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 }
+ { FeatureType::LineString, {{{0, 0}, {1, 0}, {2, 0}, {3, 0}, {4, 0}, {0, 0}}}, aaa, {}, 0 },
+ { FeatureType::LineString, {{}}, aaa, {}, 0 },
+ { FeatureType::LineString, {{}}, aaa, {}, 0 }
};
mbgl::util::mergeLines(input3);