summaryrefslogtreecommitdiff
path: root/test/style
diff options
context:
space:
mode:
authorzmiao <miao.zhao@mapbox.com>2019-08-16 15:03:48 +0300
committerGitHub <noreply@github.com>2019-08-16 15:03:48 +0300
commit0f34eb7b253e83b8c4aef7ed6c83cd7b3801fa4c (patch)
treea0e06d1c81b04fca84f8ed8effeaeaefc2e79e13 /test/style
parent9f8696c00c7ef11abb3850e4694bc7375365295e (diff)
downloadqtlocation-mapboxgl-0f34eb7b253e83b8c4aef7ed6c83cd7b3801fa4c.tar.gz
Indroduce clusterProperty option for aggregation (#15287)
* indroduce clusterProperty option for aggregation * remove unnecessary codes * update geojson_option conversion * fix reviewing findings
Diffstat (limited to 'test/style')
-rw-r--r--test/style/conversion/geojson_options.test.cpp12
-rw-r--r--test/style/expression/expression.test.cpp3
2 files changed, 12 insertions, 3 deletions
diff --git a/test/style/conversion/geojson_options.test.cpp b/test/style/conversion/geojson_options.test.cpp
index 181189775b..aa84686dce 100644
--- a/test/style/conversion/geojson_options.test.cpp
+++ b/test/style/conversion/geojson_options.test.cpp
@@ -38,6 +38,7 @@ TEST(GeoJSONOptions, RetainsDefaults) {
ASSERT_EQ(converted.cluster, defaults.cluster);
ASSERT_EQ(converted.clusterRadius, defaults.clusterRadius);
ASSERT_EQ(converted.clusterMaxZoom, defaults.clusterMaxZoom);
+ ASSERT_TRUE(converted.clusterProperties.empty());
}
TEST(GeoJSONOptions, FullConversion) {
@@ -49,7 +50,12 @@ TEST(GeoJSONOptions, FullConversion) {
"cluster": true,
"clusterRadius": 4,
"clusterMaxZoom": 5,
- "lineMetrics": true
+ "lineMetrics": true,
+ "clusterProperties": {
+ "max": ["max", ["get", "scalerank"]],
+ "sum": [["+", ["accumulated"], ["get", "sum"]], ["get", "scalerank"]],
+ "has_island": ["any", ["==", ["get", "featureclass"], "island"]]
+ }
})JSON", error);
// GeoJSON-VT
@@ -63,4 +69,8 @@ TEST(GeoJSONOptions, FullConversion) {
ASSERT_EQ(converted.cluster, true);
ASSERT_EQ(converted.clusterRadius, 4);
ASSERT_EQ(converted.clusterMaxZoom, 5);
+ ASSERT_EQ(converted.clusterProperties.size(), 3);
+ ASSERT_EQ(converted.clusterProperties.count("max"), 1);
+ ASSERT_EQ(converted.clusterProperties.count("sum"), 1);
+ ASSERT_EQ(converted.clusterProperties.count("has_island"), 1);
}
diff --git a/test/style/expression/expression.test.cpp b/test/style/expression/expression.test.cpp
index 8e2acfcd32..dd986c98f5 100644
--- a/test/style/expression/expression.test.cpp
+++ b/test/style/expression/expression.test.cpp
@@ -36,8 +36,7 @@ TEST(Expression, IsExpression) {
// TODO: "feature-state": https://github.com/mapbox/mapbox-gl-native/issues/12613
// TODO: "interpolate-hcl": https://github.com/mapbox/mapbox-gl-native/issues/8720
// TODO: "interpolate-lab": https://github.com/mapbox/mapbox-gl-native/issues/8720
- // TODO: "accumulated": https://github.com/mapbox/mapbox-gl-native/issues/14043
- if (name == "feature-state" || name == "interpolate-hcl" || name == "interpolate-lab" || name == "accumulated") {
+ if (name == "feature-state" || name == "interpolate-hcl" || name == "interpolate-lab") {
if (expression::isExpression(conversion::Convertible(expression))) {
ASSERT_TRUE(false) << "Expression name" << name << "is implemented - please update Expression.IsExpression test.";
}