From f72b2add0cf523ee1b69cffc03a24b1f18c0df74 Mon Sep 17 00:00:00 2001 From: Alexander Shalamov Date: Mon, 4 Mar 2019 08:43:00 +0200 Subject: [core] Unit test for text-section compound expression --- test/style/property_expression.test.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/style/property_expression.test.cpp b/test/style/property_expression.test.cpp index e4ee5f115f..a7d1d25660 100644 --- a/test/style/property_expression.test.cpp +++ b/test/style/property_expression.test.cpp @@ -121,3 +121,17 @@ TEST(PropertyExpression, Issue8460) { EXPECT_NEAR(600.0f, fn2.evaluate(18.0f, oneInteger, -1.0f), 0.00); EXPECT_NEAR(600.0f, fn2.evaluate(19.0f, oneInteger, -1.0f), 0.00); } + +TEST(PropertyExpression, TextSection) { + expression::Value formattedSection1 = 42.0; + PropertyExpression ts1(textSection()); + EXPECT_DOUBLE_EQ(42.0, ts1.evaluate(expression::EvaluationContext().withFormattedSection(&formattedSection1))); + + expression::Value formattedSection2{"header"s}; + PropertyExpression ts2(textSection()); + EXPECT_EQ("header"s, ts2.evaluate(expression::EvaluationContext().withFormattedSection(&formattedSection2))); + + // Evaluates to default, T(). + PropertyExpression ts3(textSection()); + EXPECT_EQ(Color(), ts3.evaluate(expression::EvaluationContext().withFormattedSection(&formattedSection1))); +} -- cgit v1.2.1