Skip to content

Commit

Permalink
Fix extra collator dependency (#2330)
Browse files Browse the repository at this point in the history
  • Loading branch information
TimSylvester authored Apr 25, 2024
1 parent d22362a commit 51a77b4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/mbgl/style/expression/collator_expression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ CollatorExpression::CollatorExpression(std::unique_ptr<Expression> caseSensitive
std::optional<std::unique_ptr<Expression>> locale_)
: Expression(Kind::CollatorExpression,
type::Collator,
depsOf(caseSensitive_) | depsOf(diacriticSensitive_) | depsOf(locale_)),
depsOf(caseSensitive_) | depsOf(diacriticSensitive_) | depsOf(locale_) |
// Collations are treated as feature-dependent. See `style::expression::isFeatureConstant`
Dependency::Feature),
caseSensitive(std::move(caseSensitive_)),
diacriticSensitive(std::move(diacriticSensitive_)),
locale(std::move(locale_)) {}
Expand Down
6 changes: 6 additions & 0 deletions test/style/expression/dependency.test.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include <mbgl/style/expression/collator_expression.hpp>
#include <mbgl/style/expression/dsl.hpp>
#include <mbgl/style/expression/format_section_override.hpp>
#include <mbgl/style/layers/custom_layer_impl.hpp>
Expand Down Expand Up @@ -77,3 +78,8 @@ TEST(ExpressionDependencies, CustomLayer) {
auto impl = makeMutable<CustomLayer::Impl>("", nullptr);
EXPECT_EQ(Dependency::None, CustomLayerProperties{std::move(impl)}.getDependencies());
}

TEST(ExpressionDependencies, Collation) {
auto collator = CollatorExpression(gt(literal(1.), zoom()), literal(true), literal("en-us"));
EXPECT_EQ(Dependency::Feature | Dependency::Zoom, collator.dependencies);
}

0 comments on commit 51a77b4

Please sign in to comment.