2018-12-15 17:22:05 +08:00
|
|
|
|
#include "tkc/color.h"
|
|
|
|
|
#include "tkc/color_parser.h"
|
2018-08-22 15:51:49 +08:00
|
|
|
|
#include "gtest/gtest.h"
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
|
|
using std::string;
|
|
|
|
|
|
|
|
|
|
TEST(Color, basic) {
|
|
|
|
|
char hex[8];
|
|
|
|
|
const char* str = "#AABBCC";
|
2018-12-27 17:39:26 +08:00
|
|
|
|
color_t c = color_parse(str);
|
2018-08-22 15:51:49 +08:00
|
|
|
|
color_hex_str(c, hex);
|
|
|
|
|
ASSERT_EQ(string(hex), string(str));
|
2018-12-18 09:49:09 +08:00
|
|
|
|
|
|
|
|
|
str = "#AABBCCDD";
|
2018-12-27 17:39:26 +08:00
|
|
|
|
c = color_parse(str);
|
2018-12-18 09:49:09 +08:00
|
|
|
|
ASSERT_EQ(c.color, 0xddccbbaa);
|
2018-08-22 15:51:49 +08:00
|
|
|
|
}
|