diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-01-13 00:29:08 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-01-13 00:29:08 +0300 |
commit | 99208e8f8aba695a6fb0e4ed9f5c51108dd539f4 (patch) | |
tree | aa4bbc7dcb656259e94daf907d339d264f1bcaa0 /src/resources/dye/dyepalette_unittest.cc | |
parent | 1cde3ae4001db3e9bd1d233c64b299a65d55b8b4 (diff) | |
download | plus-99208e8f8aba695a6fb0e4ed9f5c51108dd539f4.tar.gz plus-99208e8f8aba695a6fb0e4ed9f5c51108dd539f4.tar.bz2 plus-99208e8f8aba695a6fb0e4ed9f5c51108dd539f4.tar.xz plus-99208e8f8aba695a6fb0e4ed9f5c51108dd539f4.zip |
Add support for hex colors in dye palettes from GIMP file.
Diffstat (limited to 'src/resources/dye/dyepalette_unittest.cc')
-rw-r--r-- | src/resources/dye/dyepalette_unittest.cc | 123 |
1 files changed, 119 insertions, 4 deletions
diff --git a/src/resources/dye/dyepalette_unittest.cc b/src/resources/dye/dyepalette_unittest.cc index 348f9124b..e0a8599ce 100644 --- a/src/resources/dye/dyepalette_unittest.cc +++ b/src/resources/dye/dyepalette_unittest.cc @@ -140,7 +140,7 @@ TEST_CASE("DyePalette tests") REQUIRE(palette.mColors[1].value[3] == 0x33); } - SECTION("palette test 1") + SECTION("palette test 8") { DyePalette palette("@Untitled1", 6); REQUIRE(palette.mColors.size() == 1); @@ -150,7 +150,7 @@ TEST_CASE("DyePalette tests") REQUIRE(palette.mColors[0].value[3] == 255); } - SECTION("palette test 2") + SECTION("palette test 9") { DyePalette palette("@Untitled1,Untitled8", 6); REQUIRE(palette.mColors.size() == 2); @@ -165,7 +165,7 @@ TEST_CASE("DyePalette tests") REQUIRE(palette.mColors[1].value[3] == 255); } - SECTION("palette test 3") + SECTION("palette test 10") { DyePalette palette("@Untitled1,", 6); REQUIRE(palette.mColors.size() == 1); @@ -175,7 +175,7 @@ TEST_CASE("DyePalette tests") REQUIRE(palette.mColors[0].value[3] == 255); } - SECTION("palette test 4") + SECTION("palette test 11") { DyePalette palette("@,,,Untitled1,,Untitled8", 6); REQUIRE(palette.mColors.size() == 2); @@ -189,4 +189,119 @@ TEST_CASE("DyePalette tests") REQUIRE(palette.mColors[1].value[2] == 255); REQUIRE(palette.mColors[1].value[3] == 255); } + + SECTION("palette test 12") + { + DyePalette palette("@12ff34", 6); + REQUIRE(palette.mColors.size() == 1); + REQUIRE(palette.mColors[0].value[0] == 0x12); + REQUIRE(palette.mColors[0].value[1] == 0xff); + REQUIRE(palette.mColors[0].value[2] == 0x34); + REQUIRE(palette.mColors[0].value[3] == 0x00); + } + + SECTION("palette test 13") + { + DyePalette palette("@12ff3456", 8); + REQUIRE(palette.mColors.size() == 1); + REQUIRE(palette.mColors[0].value[0] == 0x12); + REQUIRE(palette.mColors[0].value[1] == 0xff); + REQUIRE(palette.mColors[0].value[2] == 0x34); + REQUIRE(palette.mColors[0].value[3] == 0x56); + } + + SECTION("palette test 14") + { + DyePalette palette("@12ff34,002211", 6); + REQUIRE(palette.mColors.size() == 2); + REQUIRE(palette.mColors[0].value[0] == 0x12); + REQUIRE(palette.mColors[0].value[1] == 0xff); + REQUIRE(palette.mColors[0].value[2] == 0x34); + REQUIRE(palette.mColors[0].value[3] == 0x00); + + REQUIRE(palette.mColors[1].value[0] == 0x00); + REQUIRE(palette.mColors[1].value[1] == 0x22); + REQUIRE(palette.mColors[1].value[2] == 0x11); + REQUIRE(palette.mColors[1].value[3] == 0x00); + } + + SECTION("palette test 15") + { + DyePalette palette("@12ff3412,00221133", 8); + REQUIRE(palette.mColors.size() == 2); + REQUIRE(palette.mColors[0].value[0] == 0x12); + REQUIRE(palette.mColors[0].value[1] == 0xff); + REQUIRE(palette.mColors[0].value[2] == 0x34); + REQUIRE(palette.mColors[0].value[3] == 0x12); + + REQUIRE(palette.mColors[1].value[0] == 0x00); + REQUIRE(palette.mColors[1].value[1] == 0x22); + REQUIRE(palette.mColors[1].value[2] == 0x11); + REQUIRE(palette.mColors[1].value[3] == 0x33); + } + + SECTION("palette test 16") + { + DyePalette palette("@12ff34,", 6); + REQUIRE(palette.mColors.size() == 1); + REQUIRE(palette.mColors[0].value[0] == 0x12); + REQUIRE(palette.mColors[0].value[1] == 0xff); + REQUIRE(palette.mColors[0].value[2] == 0x34); + REQUIRE(palette.mColors[0].value[3] == 0x00); + } + + SECTION("palette test 17") + { + DyePalette palette("@12ff3456,", 8); + REQUIRE(palette.mColors.size() == 1); + REQUIRE(palette.mColors[0].value[0] == 0x12); + REQUIRE(palette.mColors[0].value[1] == 0xff); + REQUIRE(palette.mColors[0].value[2] == 0x34); + REQUIRE(palette.mColors[0].value[3] == 0x56); + } + + SECTION("palette test 18") + { + DyePalette palette("@,,,12ff3412,,00221133", 8); + REQUIRE(palette.mColors.size() == 2); + REQUIRE(palette.mColors[0].value[0] == 0x12); + REQUIRE(palette.mColors[0].value[1] == 0xff); + REQUIRE(palette.mColors[0].value[2] == 0x34); + REQUIRE(palette.mColors[0].value[3] == 0x12); + + REQUIRE(palette.mColors[1].value[0] == 0x00); + REQUIRE(palette.mColors[1].value[1] == 0x22); + REQUIRE(palette.mColors[1].value[2] == 0x11); + REQUIRE(palette.mColors[1].value[3] == 0x33); + } + + SECTION("palette test 19") + { + DyePalette palette("@Untitled1,334455", 6); + REQUIRE(palette.mColors.size() == 2); + REQUIRE(palette.mColors[0].value[0] == 47); + REQUIRE(palette.mColors[0].value[1] == 56); + REQUIRE(palette.mColors[0].value[2] == 46); + REQUIRE(palette.mColors[0].value[3] == 255); + + REQUIRE(palette.mColors[1].value[0] == 0x33); + REQUIRE(palette.mColors[1].value[1] == 0x44); + REQUIRE(palette.mColors[1].value[2] == 0x55); + REQUIRE(palette.mColors[1].value[3] == 0x00); + } + + SECTION("palette test 20") + { + DyePalette palette("@Untitled1,33445566", 8); + REQUIRE(palette.mColors.size() == 2); + REQUIRE(palette.mColors[0].value[0] == 47); + REQUIRE(palette.mColors[0].value[1] == 56); + REQUIRE(palette.mColors[0].value[2] == 46); + REQUIRE(palette.mColors[0].value[3] == 255); + + REQUIRE(palette.mColors[1].value[0] == 0x33); + REQUIRE(palette.mColors[1].value[1] == 0x44); + REQUIRE(palette.mColors[1].value[2] == 0x55); + REQUIRE(palette.mColors[1].value[3] == 0x66); + } } |