aboutsummaryrefslogtreecommitdiff
path: root/test/platform/ColorTest.cpp
blob: 451fb06907934fe4e5bccc83f22802f2f35ce053 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include "cru/platform/Color.h"

#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);
}