diff options
author | crupest <crupest@outlook.com> | 2021-05-10 17:09:15 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2021-05-10 17:09:15 +0800 |
commit | ae5042599688af2d8b462e49e3cd103b6ec92fe9 (patch) | |
tree | fb910abe7afb65621e52f2c23ce151cb1ff45baa /test/platform | |
parent | 34739cd02557bdecb0c3f1b35ffc5816eb3133ac (diff) | |
download | cru-ae5042599688af2d8b462e49e3cd103b6ec92fe9.tar.gz cru-ae5042599688af2d8b462e49e3cd103b6ec92fe9.tar.bz2 cru-ae5042599688af2d8b462e49e3cd103b6ec92fe9.zip |
...
Diffstat (limited to 'test/platform')
-rw-r--r-- | test/platform/CMakeLists.txt | 1 | ||||
-rw-r--r-- | test/platform/ColorTest.cpp | 14 |
2 files changed, 15 insertions, 0 deletions
diff --git a/test/platform/CMakeLists.txt b/test/platform/CMakeLists.txt index 9ad8fb51..9414e2b8 100644 --- a/test/platform/CMakeLists.txt +++ b/test/platform/CMakeLists.txt @@ -1,4 +1,5 @@ add_executable(cru_platform_base_test + ColorTest.cpp MatrixTest.cpp ) target_link_libraries(cru_platform_base_test PRIVATE cru_platform_base cru_test_base) diff --git a/test/platform/ColorTest.cpp b/test/platform/ColorTest.cpp new file mode 100644 index 00000000..c197779b --- /dev/null +++ b/test/platform/ColorTest.cpp @@ -0,0 +1,14 @@ +#include "cru/platform/Color.hpp" + +#include <gtest/gtest.h> + +using cru::platform::Color; + +TEST(Color, Parse) { + ASSERT_EQ(Color::Parse(u"blue"), Color::Parse(u"#0000ff")); + ASSERT_EQ(Color::Parse(u"#12abAB"), Color::FromHex(0x12abAB)); + ASSERT_EQ(Color::Parse(u"#8812abAB"), Color::FromHexAlpha(0x8812abAB)); + ASSERT_EQ(Color::Parse(u"averystrangestring"), std::nullopt); + ASSERT_EQ(Color::Parse(u"112233"), std::nullopt); + ASSERT_EQ(Color::Parse(u"#7777777"), std::nullopt); +} |