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

#include <catch2/catch_test_macros.hpp>

using cru::platform::Color;

TEST_CASE("Color Parse", "[color]") {
  REQUIRE(Color::Parse("blue") == Color::Parse("#0000ff"));
  REQUIRE(Color::Parse("#12abAB") == Color::FromHex(0x12abAB));
  REQUIRE(Color::Parse("#8812abAB") == Color::FromHexAlpha(0x8812abAB));
  REQUIRE(Color::Parse("averystrangestring") == std::nullopt);
  REQUIRE(Color::Parse("112233") == std::nullopt);
  REQUIRE(Color::Parse("#7777777") == std::nullopt);
}