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/ColorTest.cpp | |
parent | 34739cd02557bdecb0c3f1b35ffc5816eb3133ac (diff) | |
download | cru-ae5042599688af2d8b462e49e3cd103b6ec92fe9.tar.gz cru-ae5042599688af2d8b462e49e3cd103b6ec92fe9.tar.bz2 cru-ae5042599688af2d8b462e49e3cd103b6ec92fe9.zip |
...
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); +} |