summaryrefslogtreecommitdiff
path: root/test/style/conversion/property_value.test.cpp
diff options
context:
space:
mode:
authorAnand Thakker <anandthakker@users.noreply.github.com>2018-05-24 09:06:20 -0400
committerGitHub <noreply@github.com>2018-05-24 09:06:20 -0400
commit40da4dadedfcff8e5dc071a25fc4d0d7dbfa507c (patch)
treec1a7af4b4e56431fade952f79470b4e2c3f069a1 /test/style/conversion/property_value.test.cpp
parent755a58ca82310e2ba9bee392225fe796488ddc21 (diff)
downloadqtlocation-mapboxgl-40da4dadedfcff8e5dc071a25fc4d0d7dbfa507c.tar.gz
Accept constant expressions in non-dds properties (#11961)
Closes #11940
Diffstat (limited to 'test/style/conversion/property_value.test.cpp')
-rw-r--r--test/style/conversion/property_value.test.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/style/conversion/property_value.test.cpp b/test/style/conversion/property_value.test.cpp
new file mode 100644
index 0000000000..dcb08bcec7
--- /dev/null
+++ b/test/style/conversion/property_value.test.cpp
@@ -0,0 +1,21 @@
+#include <mbgl/test/util.hpp>
+
+#include <mbgl/style/conversion/json.hpp>
+#include <mbgl/style/conversion/property_value.hpp>
+#include <mbgl/util/rapidjson.hpp>
+
+using namespace mbgl;
+using namespace mbgl::style;
+using namespace mbgl::style::conversion;
+
+TEST(StyleConversion, PropertyValue) {
+ // PropertyValue<T> accepts a constant expression: https://github.com/mapbox/mapbox-gl-native/issues/11940
+ Error error;
+ JSDocument doc;
+ doc.Parse<0>(R"(["literal", [1, 2]])");
+ auto expected = std::array<float, 2>{{1, 2}};
+ auto result = convert<PropertyValue<std::array<float, 2>>>(doc, error);
+ ASSERT_TRUE(result);
+ ASSERT_TRUE(result->isConstant());
+ ASSERT_EQ(result->asConstant(), expected);
+}