/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #include #include #include namespace facebook::react { TEST(CSSAngle, angle_values) { auto emptyValue = parseCSSProperty(""); EXPECT_TRUE(std::holds_alternative(emptyValue)); auto degreeValue = parseCSSProperty("10deg"); EXPECT_TRUE(std::holds_alternative(degreeValue)); EXPECT_EQ(std::get(degreeValue).degrees, 10.0f); auto spongebobCaseValue = parseCSSProperty("20dEg"); EXPECT_TRUE(std::holds_alternative(spongebobCaseValue)); EXPECT_EQ(std::get(spongebobCaseValue).degrees, 20.0f); auto radianValue = parseCSSProperty("10rad"); EXPECT_TRUE(std::holds_alternative(radianValue)); ASSERT_NEAR(std::get(radianValue).degrees, 572.958f, 0.001f); auto negativeRadianValue = parseCSSProperty("-10rad"); EXPECT_TRUE(std::holds_alternative(negativeRadianValue)); ASSERT_NEAR( std::get(negativeRadianValue).degrees, -572.958f, 0.001f); auto gradianValue = parseCSSProperty("10grad"); EXPECT_TRUE(std::holds_alternative(gradianValue)); ASSERT_NEAR(std::get(gradianValue).degrees, 9.0f, 0.001f); auto turnValue = parseCSSProperty(".25turn"); EXPECT_TRUE(std::holds_alternative(turnValue)); EXPECT_EQ(std::get(turnValue).degrees, 90.0f); } } // namespace facebook::react