diff options
Diffstat (limited to 'test/platform/ColorTest.cpp')
-rw-r--r-- | test/platform/ColorTest.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
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); +} |