diff options
-rw-r--r-- | cmake/test-files.cmake | 3 | ||||
-rw-r--r-- | test/style/expression/util.test.cpp | 23 |
2 files changed, 26 insertions, 0 deletions
diff --git a/cmake/test-files.cmake b/cmake/test-files.cmake index 1aee6223b3..67c3adcb3d 100644 --- a/cmake/test-files.cmake +++ b/cmake/test-files.cmake @@ -87,6 +87,9 @@ set(MBGL_TEST_FILES test/style/conversion/light.test.cpp test/style/conversion/stringify.test.cpp + # style/expression + test/style/expression/util.test.cpp + # style test/style/filter.test.cpp diff --git a/test/style/expression/util.test.cpp b/test/style/expression/util.test.cpp new file mode 100644 index 0000000000..0337cd871f --- /dev/null +++ b/test/style/expression/util.test.cpp @@ -0,0 +1,23 @@ +#include <mbgl/test/util.hpp> +#include <mbgl/style/expression/util.hpp> + +using namespace mbgl; +using namespace mbgl::style::expression; + +TEST(Expression, Util_rgba) { + Result<Color> valid = rgba(0, 0, 0, 0); + ASSERT_TRUE(valid); + ASSERT_EQ(valid->r, 0); + ASSERT_EQ(valid->g, 0); + ASSERT_EQ(valid->b, 0); + ASSERT_EQ(valid->a, 0); + + ASSERT_FALSE(rgba(0, 0, 0, -0.1)); + ASSERT_FALSE(rgba(0, 0, 0, 1.1)); + ASSERT_FALSE(rgba(0, 0, -1, 1)); + ASSERT_FALSE(rgba(0, 0, 256, 1)); + ASSERT_FALSE(rgba(0, -1, 0, 1)); + ASSERT_FALSE(rgba(0, 256, 0, 1)); + ASSERT_FALSE(rgba(-1, 1, 0, 1)); + ASSERT_FALSE(rgba(-256, 1, 0, 1)); +} |