summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnder Conselvan de Oliveira <ander.deoliveira@mapbox.com>2019-04-02 12:32:29 +0300
committerAnder Conselvan de Oliveira <ander.deoliveira@mapbox.com>2019-05-21 12:14:22 +0300
commit343df18954be90c26ace7bcf1c21cf434737693a (patch)
tree4d5f2591c714931970b95970426d7e5d24c5dab8
parent33cfd080c2ce0f2ed0c9ee3102cedc4baedf0d8c (diff)
downloadqtlocation-mapboxgl-343df18954be90c26ace7bcf1c21cf434737693a.tar.gz
[core] Fix some of the legacy interval function expression tests
The tests for conversion of legacy interval functions to expressions expects that the first stop in the "step" expression be omitted.
-rw-r--r--platform/node/test/ignores.json7
-rw-r--r--src/mbgl/style/conversion/function.cpp12
2 files changed, 12 insertions, 7 deletions
diff --git a/platform/node/test/ignores.json b/platform/node/test/ignores.json
index d7cbe0782e..4cdd7795e6 100644
--- a/platform/node/test/ignores.json
+++ b/platform/node/test/ignores.json
@@ -23,19 +23,12 @@
"expression-tests/legacy/exponential/number-default": "https://github.com/mapbox/mapbox-gl-native/issues/12747",
"expression-tests/legacy/identity/color-default": "https://github.com/mapbox/mapbox-gl-native/issues/12747",
"expression-tests/legacy/identity/enum-default": "https://github.com/mapbox/mapbox-gl-native/issues/12747",
- "expression-tests/legacy/interval/array": "https://github.com/mapbox/mapbox-gl-native/issues/12747",
"expression-tests/legacy/interval/array-default": "https://github.com/mapbox/mapbox-gl-native/issues/12747",
- "expression-tests/legacy/interval/color": "https://github.com/mapbox/mapbox-gl-native/issues/12747",
"expression-tests/legacy/interval/color-default": "https://github.com/mapbox/mapbox-gl-native/issues/12747",
"expression-tests/legacy/interval/composite": "https://github.com/mapbox/mapbox-gl-native/issues/12747",
"expression-tests/legacy/interval/composite-default": "https://github.com/mapbox/mapbox-gl-native/issues/12747",
- "expression-tests/legacy/interval/duplicate-stops": "https://github.com/mapbox/mapbox-gl-native/issues/12747",
- "expression-tests/legacy/interval/implicit": "https://github.com/mapbox/mapbox-gl-native/issues/12747",
- "expression-tests/legacy/interval/number": "https://github.com/mapbox/mapbox-gl-native/issues/12747",
"expression-tests/legacy/interval/number-default": "https://github.com/mapbox/mapbox-gl-native/issues/12747",
- "expression-tests/legacy/interval/string": "https://github.com/mapbox/mapbox-gl-native/issues/12747",
"expression-tests/legacy/interval/string-default": "https://github.com/mapbox/mapbox-gl-native/issues/12747",
- "expression-tests/legacy/interval/tokens-property": "https://github.com/mapbox/mapbox-gl-native/issues/12747",
"expression-tests/legacy/interval/tokens-zoom": "https://github.com/mapbox/mapbox-gl-native/issues/12747",
"query-tests/geometry/multilinestring": "needs investigation",
"query-tests/geometry/multipolygon": "needs investigation",
diff --git a/src/mbgl/style/conversion/function.cpp b/src/mbgl/style/conversion/function.cpp
index 179ad0e437..33ed7c9856 100644
--- a/src/mbgl/style/conversion/function.cpp
+++ b/src/mbgl/style/conversion/function.cpp
@@ -356,6 +356,17 @@ static optional<std::map<double, std::unique_ptr<Expression>>> convertStops(type
return { std::move(stops) };
}
+static void omitFirstStop(std::map<double, std::unique_ptr<Expression>>& stops) {
+ double min = std::numeric_limits<double>::max();
+ for (auto& s : stops) {
+ if (s.first < min) {
+ min = s.first;
+ }
+ }
+ stops.emplace(-std::numeric_limits<double>::infinity(), std::move(stops[min]));
+ stops.erase(min);
+}
+
template <class T>
optional<std::map<T, std::unique_ptr<Expression>>> convertBranches(type::Type type,
const Convertible& value,
@@ -472,6 +483,7 @@ static optional<std::unique_ptr<Expression>> convertIntervalFunction(type::Type
if (!stops) {
return nullopt;
}
+ omitFirstStop(*stops);
return step(type, std::move(input), std::move(*stops));
}