This repository has been archived by the owner on Aug 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Accept constant expressions in non-dds properties
Closes #11940
- Loading branch information
Anand Thakker
committed
May 21, 2018
1 parent
a84ac4c
commit 1bda842
Showing
3 changed files
with
33 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} |