diff options
author | Ander Conselvan de Oliveira <ander.deoliveira@mapbox.com> | 2019-04-02 12:32:29 +0300 |
---|---|---|
committer | Ander Conselvan de Oliveira <ander.deoliveira@mapbox.com> | 2019-05-16 11:12:30 +0300 |
commit | 9a404ad659887fed712f1a01323ef3a653cdc5c8 (patch) | |
tree | 1a31089fdb44a2fe71847948117f2c676c541c75 | |
parent | 1d05f7644d5979dfbef1dcab79dfe1a415d3454e (diff) | |
download | qtlocation-mapboxgl-9a404ad659887fed712f1a01323ef3a653cdc5c8.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.json | 7 | ||||
-rw-r--r-- | src/mbgl/style/conversion/function.cpp | 12 |
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)); } |