summaryrefslogtreecommitdiff
path: root/test/style/filter.test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/style/filter.test.cpp')
-rw-r--r--test/style/filter.test.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/style/filter.test.cpp b/test/style/filter.test.cpp
index c59a73eab1..c8f1d3b808 100644
--- a/test/style/filter.test.cpp
+++ b/test/style/filter.test.cpp
@@ -3,6 +3,11 @@
#include <mbgl/util/geometry.hpp>
#include <mbgl/test/stub_geometry_tile_feature.hpp>
+#include <mbgl/util/rapidjson.hpp>
+#include <rapidjson/writer.h>
+#include <rapidjson/stringbuffer.h>
+#include <mbgl/style/conversion/stringify.hpp>
+
#include <mbgl/style/filter.hpp>
#include <mbgl/style/conversion/json.hpp>
#include <mbgl/style/conversion/filter.hpp>
@@ -176,6 +181,13 @@ TEST(Filter, LegacyProperty) {
ASSERT_FALSE(filter("[\"==\", \"two\", 4]", {{"two", std::string("2")}}));
}
+TEST(Filter, ExpressionLegacyMix) {
+ conversion::Error error;
+ optional<Filter> filter = conversion::convertJSON<Filter>(R"(["any", ["all", ["==", ["geometry-type"], "LineString"]], ["==", "x", 1]])", error);
+ EXPECT_FALSE(bool(filter));
+ EXPECT_TRUE(error.message.size() > 0);
+}
+
TEST(Filter, ZoomExpressionNested) {
ASSERT_TRUE(filter(R"(["==", ["get", "two"], ["zoom"]])", {{"two", int64_t(2)}}, {}, FeatureType::Point, {}, 2.0f));
ASSERT_FALSE(filter(R"(["==", ["get", "two"], ["+", ["zoom"], 1]])", {{"two", int64_t(2)}}, {}, FeatureType::Point, {}, 2.0f));