From ae5042599688af2d8b462e49e3cd103b6ec92fe9 Mon Sep 17 00:00:00 2001 From: crupest Date: Mon, 10 May 2021 17:09:15 +0800 Subject: ... --- test/platform/ColorTest.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 test/platform/ColorTest.cpp (limited to 'test/platform/ColorTest.cpp') 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 + +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); +} -- cgit v1.2.3