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-21 12:14:22 +0300 |
commit | 343df18954be90c26ace7bcf1c21cf434737693a (patch) | |
tree | 4d5f2591c714931970b95970426d7e5d24c5dab8 /src | |
parent | 33cfd080c2ce0f2ed0c9ee3102cedc4baedf0d8c (diff) | |
download | qtlocation-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.
Diffstat (limited to 'src')
-rw-r--r-- | src/mbgl/style/conversion/function.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
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)); } |