From 788508984fa35b97129cd4ef310986c5d15f30a8 Mon Sep 17 00:00:00 2001 From: Bruno de Oliveira Abinader Date: Wed, 11 Sep 2019 13:40:40 +0300 Subject: [test] Added style light setProperty tests --- test/style/conversion/light.test.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/test/style/conversion/light.test.cpp b/test/style/conversion/light.test.cpp index 092c476277..e49667f319 100644 --- a/test/style/conversion/light.test.cpp +++ b/test/style/conversion/light.test.cpp @@ -5,8 +5,10 @@ #include #include #include +#include #include #include +#include #include @@ -24,6 +26,27 @@ TEST(StyleConversion, Light) { { auto light = parseLight("{}"); ASSERT_TRUE((bool) light); + + const mbgl::JSValue colorValue("blue"); + light->setProperty("color", &colorValue); + + ASSERT_FALSE(light->getColor().isUndefined()); + ASSERT_TRUE(light->getColor().isConstant()); + ASSERT_EQ(light->getColor().asConstant(), mbgl::Color::blue()); + + const mbgl::JSValue intensityValue(0.5); + light->setProperty("intensity", &intensityValue); + ASSERT_FALSE(light->getIntensity().isUndefined()); + ASSERT_TRUE(light->getIntensity().isConstant()); + ASSERT_EQ(light->getIntensity().asConstant(), 0.5); + + mbgl::JSValue::AllocatorType allocator; + const mbgl::JSValue positionValue(std::move(mbgl::JSValue(rapidjson::kArrayType).PushBack(1.f, allocator).PushBack(2.f, allocator).PushBack(3.f, allocator).Move())); + light->setProperty("position", &positionValue); + ASSERT_FALSE(light->getPosition().isUndefined()); + ASSERT_TRUE(light->getPosition().isConstant()); + std::array expected{{ 1.f, 2.f, 3.f }}; + ASSERT_EQ(light->getPosition().asConstant(), mbgl::style::Position({ expected })); } { -- cgit v1.2.1