diff options
author | Alexander Shalamov <alexander.shalamov@mapbox.com> | 2019-03-04 08:43:00 +0200 |
---|---|---|
committer | Alexander Shalamov <alexander.shalamov@mapbox.com> | 2019-03-04 08:43:00 +0200 |
commit | f72b2add0cf523ee1b69cffc03a24b1f18c0df74 (patch) | |
tree | 0d881c782a5f1da5c33476f07fcf95900419280c | |
parent | c7c4f990366739e66bcea6ed8cb2539268527c43 (diff) | |
download | qtlocation-mapboxgl-f72b2add0cf523ee1b69cffc03a24b1f18c0df74.tar.gz |
[core] Unit test for text-section compound expression
-rw-r--r-- | test/style/property_expression.test.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
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<double> ts1(textSection()); + EXPECT_DOUBLE_EQ(42.0, ts1.evaluate(expression::EvaluationContext().withFormattedSection(&formattedSection1))); + + expression::Value formattedSection2{"header"s}; + PropertyExpression<std::string> ts2(textSection()); + EXPECT_EQ("header"s, ts2.evaluate(expression::EvaluationContext().withFormattedSection(&formattedSection2))); + + // Evaluates to default, T(). + PropertyExpression<Color> ts3(textSection()); + EXPECT_EQ(Color(), ts3.evaluate(expression::EvaluationContext().withFormattedSection(&formattedSection1))); +} |