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
ed4538b
commit 4704d03
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); | ||
} |