summaryrefslogtreecommitdiff
path: root/src/resources
diff options
context:
space:
mode:
Diffstat (limited to 'src/resources')
-rw-r--r--src/resources/dye/dye_unittest.cc198
1 files changed, 198 insertions, 0 deletions
diff --git a/src/resources/dye/dye_unittest.cc b/src/resources/dye/dye_unittest.cc
index 924ac39fd..36e398343 100644
--- a/src/resources/dye/dye_unittest.cc
+++ b/src/resources/dye/dye_unittest.cc
@@ -89,6 +89,55 @@ TEST_CASE("Dye replaceSOGLColor 3")
REQUIRE(data[0] == buildHex(0x40, 0x30, 0x20, 0x10));
}
+TEST_CASE("Dye replaceSOGLColor 4")
+{
+ DyePalette palette("#01ff02,030411", 6);
+ uint32_t data[2];
+ data[0] = buildHex(0x20, 0x02, 0xff, 0x01);
+ data[1] = buildHex(0x30, 0x02, 0xff, 0x01);
+ palette.replaceSOGLColor(&data[0], 2);
+ REQUIRE(data[0] == buildHex(0x20, 0x11, 0x04, 0x03));
+ REQUIRE(data[1] == buildHex(0x30, 0x11, 0x04, 0x03));
+}
+
+TEST_CASE("Dye replaceSOGLColor 5")
+{
+ DyePalette palette("#01ff02,030411", 6);
+ uint32_t data[4];
+ data[0] = buildHex(0x20, 0x02, 0xff, 0x01);
+ data[1] = buildHex(0x30, 0x02, 0xff, 0x01);
+ data[2] = buildHex(0x40, 0x02, 0xff, 0x01);
+ data[3] = buildHex(0x50, 0x02, 0xff, 0x02);
+ palette.replaceSOGLColor(&data[0], 4);
+ REQUIRE(data[0] == buildHex(0x20, 0x11, 0x04, 0x03));
+ REQUIRE(data[1] == buildHex(0x30, 0x11, 0x04, 0x03));
+ REQUIRE(data[2] == buildHex(0x40, 0x11, 0x04, 0x03));
+ REQUIRE(data[3] == buildHex(0x50, 0x02, 0xff, 0x02));
+}
+
+TEST_CASE("Dye replaceSOGLColor 6")
+{
+ DyePalette palette("#01ff02,030411,01ee02,010203", 6);
+ uint32_t data[8];
+ data[0] = buildHex(0x20, 0x02, 0xff, 0x01);
+ data[1] = buildHex(0x30, 0x02, 0xff, 0x01);
+ data[2] = buildHex(0x40, 0x02, 0xff, 0x01);
+ data[3] = buildHex(0x50, 0x02, 0xff, 0x02);
+ data[4] = buildHex(0x20, 0x02, 0xff, 0x01);
+ data[5] = buildHex(0x30, 0x02, 0xff, 0x01);
+ data[6] = buildHex(0x40, 0x02, 0xff, 0x01);
+ data[7] = buildHex(0x60, 0x02, 0xff, 0x02);
+ palette.replaceSOGLColor(&data[0], 8);
+ REQUIRE(data[0] == buildHex(0x20, 0x11, 0x04, 0x03));
+ REQUIRE(data[1] == buildHex(0x30, 0x11, 0x04, 0x03));
+ REQUIRE(data[2] == buildHex(0x40, 0x11, 0x04, 0x03));
+ REQUIRE(data[3] == buildHex(0x50, 0x02, 0xff, 0x02));
+ REQUIRE(data[4] == buildHex(0x20, 0x11, 0x04, 0x03));
+ REQUIRE(data[5] == buildHex(0x30, 0x11, 0x04, 0x03));
+ REQUIRE(data[6] == buildHex(0x40, 0x11, 0x04, 0x03));
+ REQUIRE(data[7] == buildHex(0x60, 0x02, 0xff, 0x02));
+}
+
TEST_CASE("Dye replaceAOGLColor 1")
{
@@ -117,6 +166,55 @@ TEST_CASE("Dye replaceAOGLColor 3")
REQUIRE(data[0] == buildHex(0xff, 0x30, 0x20, 0x10));
}
+TEST_CASE("Dye replaceAOGLColor 4")
+{
+ DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
+ uint32_t data[2];
+ data[0] = buildHex(0x40, 0xee, 0x00, 0x01);
+ data[1] = buildHex(0x40, 0xee, 0x00, 0x01);
+ palette.replaceAOGLColor(&data[0], 2);
+ REQUIRE(data[0] == buildHex(0xff, 0x30, 0x20, 0x10));
+ REQUIRE(data[1] == buildHex(0xff, 0x30, 0x20, 0x10));
+}
+
+TEST_CASE("Dye replaceAOGLColor 5")
+{
+ DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
+ uint32_t data[4];
+ data[0] = buildHex(0x40, 0xee, 0x00, 0x01);
+ data[1] = buildHex(0x40, 0xee, 0x00, 0x01);
+ data[2] = buildHex(0x41, 0xee, 0x00, 0x01);
+ data[3] = buildHex(0x40, 0xee, 0x00, 0x01);
+ palette.replaceAOGLColor(&data[0], 4);
+ REQUIRE(data[0] == buildHex(0xff, 0x30, 0x20, 0x10));
+ REQUIRE(data[1] == buildHex(0xff, 0x30, 0x20, 0x10));
+ REQUIRE(data[2] == buildHex(0x41, 0xee, 0x00, 0x01));
+ REQUIRE(data[3] == buildHex(0xff, 0x30, 0x20, 0x10));
+}
+
+TEST_CASE("Dye replaceAOGLColor 6")
+{
+ DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
+ uint32_t data[8];
+ data[0] = buildHex(0x40, 0xee, 0x00, 0x01);
+ data[1] = buildHex(0x40, 0xee, 0x00, 0x01);
+ data[2] = buildHex(0x41, 0xee, 0x00, 0x01);
+ data[3] = buildHex(0x40, 0xee, 0x00, 0x01);
+ data[4] = buildHex(0x40, 0xee, 0x00, 0x01);
+ data[5] = buildHex(0x40, 0x40, 0x40, 0x40);
+ data[6] = buildHex(0x41, 0xe0, 0x00, 0x01);
+ data[7] = buildHex(0x40, 0xee, 0x00, 0x01);
+ palette.replaceAOGLColor(&data[0], 8);
+ REQUIRE(data[0] == buildHex(0xff, 0x30, 0x20, 0x10));
+ REQUIRE(data[1] == buildHex(0xff, 0x30, 0x20, 0x10));
+ REQUIRE(data[2] == buildHex(0x41, 0xee, 0x00, 0x01));
+ REQUIRE(data[3] == buildHex(0xff, 0x30, 0x20, 0x10));
+ REQUIRE(data[4] == buildHex(0xff, 0x30, 0x20, 0x10));
+ REQUIRE(data[5] == buildHex(0x00, 0x00, 0x00, 0x20));
+ REQUIRE(data[6] == buildHex(0x41, 0xe0, 0x00, 0x01));
+ REQUIRE(data[7] == buildHex(0xff, 0x30, 0x20, 0x10));
+}
+
TEST_CASE("Dye replaceSColor 1")
{
@@ -145,6 +243,55 @@ TEST_CASE("Dye replaceSColor 3")
REQUIRE(data[0] == buildHex(0x70, 0x60, 0x50, 0x10));
}
+TEST_CASE("Dye replaceSColor 4")
+{
+ DyePalette palette("#123456,000000,ff3020,706050", 6);
+ uint32_t data[2];
+ data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
+ data[1] = buildHex(0xff, 0x30, 0x20, 0x20);
+ palette.replaceSColor(&data[0], 2);
+ REQUIRE(data[0] == buildHex(0x70, 0x60, 0x50, 0x10));
+ REQUIRE(data[1] == buildHex(0x70, 0x60, 0x50, 0x20));
+}
+
+TEST_CASE("Dye replaceSColor 5")
+{
+ DyePalette palette("#123456,000000,ff3020,706050", 6);
+ uint32_t data[4];
+ data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
+ data[1] = buildHex(0xff, 0x30, 0x20, 0x20);
+ data[2] = buildHex(0xff, 0x40, 0x20, 0x10);
+ data[3] = buildHex(0xff, 0x30, 0x20, 0x20);
+ palette.replaceSColor(&data[0], 4);
+ REQUIRE(data[0] == buildHex(0x70, 0x60, 0x50, 0x10));
+ REQUIRE(data[1] == buildHex(0x70, 0x60, 0x50, 0x20));
+ REQUIRE(data[2] == buildHex(0xff, 0x40, 0x20, 0x10));
+ REQUIRE(data[3] == buildHex(0x70, 0x60, 0x50, 0x20));
+}
+
+TEST_CASE("Dye replaceSColor 6")
+{
+ DyePalette palette("#123456,000000,ff3020,706050", 6);
+ uint32_t data[8];
+ data[0] = buildHex(0xff, 0x30, 0x20, 0x10);
+ data[1] = buildHex(0xff, 0x30, 0x20, 0x20);
+ data[2] = buildHex(0xff, 0x40, 0x20, 0x10);
+ data[3] = buildHex(0xff, 0x30, 0x20, 0x20);
+ data[4] = buildHex(0xff, 0x30, 0x20, 0x10);
+ data[5] = buildHex(0xff, 0x30, 0x20, 0x40);
+ data[6] = buildHex(0xff, 0x40, 0x20, 0x50);
+ data[7] = buildHex(0xff, 0x30, 0x20, 0x60);
+ palette.replaceSColor(&data[0], 8);
+ REQUIRE(data[0] == buildHex(0x70, 0x60, 0x50, 0x10));
+ REQUIRE(data[1] == buildHex(0x70, 0x60, 0x50, 0x20));
+ REQUIRE(data[2] == buildHex(0xff, 0x40, 0x20, 0x10));
+ REQUIRE(data[3] == buildHex(0x70, 0x60, 0x50, 0x20));
+ REQUIRE(data[4] == buildHex(0x70, 0x60, 0x50, 0x10));
+ REQUIRE(data[5] == buildHex(0x70, 0x60, 0x50, 0x40));
+ REQUIRE(data[6] == buildHex(0xff, 0x40, 0x20, 0x50));
+ REQUIRE(data[7] == buildHex(0x70, 0x60, 0x50, 0x60));
+}
+
TEST_CASE("Dye replaceAColor 1")
{
@@ -173,6 +320,56 @@ TEST_CASE("Dye replaceAColor 3")
REQUIRE(data[0] == buildHex(0x10, 0x20, 0x30, 0xff));
}
+TEST_CASE("Dye replaceAColor 4")
+{
+ DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
+ uint32_t data[2];
+ data[0] = buildHex(0x01, 0x00, 0xee, 0x40);
+ data[1] = buildHex(0x40, 0x40, 0x40, 0x40);
+ palette.replaceAColor(&data[0], 2);
+ REQUIRE(data[0] == buildHex(0x10, 0x20, 0x30, 0xff));
+ REQUIRE(data[1] == buildHex(0x20, 0x00, 0x00, 0x00));
+}
+
+TEST_CASE("Dye replaceAColor 5")
+{
+ DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
+ uint32_t data[4];
+ data[0] = buildHex(0x01, 0x00, 0xee, 0x40);
+ data[1] = buildHex(0x40, 0x40, 0x40, 0x40);
+ data[2] = buildHex(0x01, 0x00, 0xee, 0x50);
+ data[3] = buildHex(0x40, 0x40, 0x40, 0x40);
+ palette.replaceAColor(&data[0], 4);
+ REQUIRE(data[0] == buildHex(0x10, 0x20, 0x30, 0xff));
+ REQUIRE(data[1] == buildHex(0x20, 0x00, 0x00, 0x00));
+ REQUIRE(data[2] == buildHex(0x01, 0x00, 0xee, 0x50));
+ REQUIRE(data[3] == buildHex(0x20, 0x00, 0x00, 0x00));
+}
+
+TEST_CASE("Dye replaceAColor 6")
+{
+ DyePalette palette("#40404040,20000000,0100ee40,102030ff", 8);
+ uint32_t data[8];
+ data[0] = buildHex(0x01, 0x00, 0xee, 0x40);
+ data[1] = buildHex(0x40, 0x40, 0x40, 0x40);
+ data[2] = buildHex(0x01, 0x00, 0xee, 0x50);
+ data[3] = buildHex(0x40, 0x40, 0x40, 0x40);
+ data[4] = buildHex(0x01, 0x00, 0xee, 0x40);
+ data[5] = buildHex(0x40, 0x40, 0x41, 0x40);
+ data[6] = buildHex(0x01, 0x00, 0xee, 0x50);
+ data[7] = buildHex(0x40, 0x40, 0x40, 0x40);
+ palette.replaceAColor(&data[0], 8);
+ REQUIRE(data[0] == buildHex(0x10, 0x20, 0x30, 0xff));
+ REQUIRE(data[1] == buildHex(0x20, 0x00, 0x00, 0x00));
+ REQUIRE(data[2] == buildHex(0x01, 0x00, 0xee, 0x50));
+ REQUIRE(data[3] == buildHex(0x20, 0x00, 0x00, 0x00));
+ REQUIRE(data[4] == buildHex(0x10, 0x20, 0x30, 0xff));
+ REQUIRE(data[5] == buildHex(0x40, 0x40, 0x41, 0x40));
+ REQUIRE(data[6] == buildHex(0x01, 0x00, 0xee, 0x50));
+ REQUIRE(data[7] == buildHex(0x20, 0x00, 0x00, 0x00));
+}
+
+
TEST_CASE("Dye normalDye 1")
{
Dye dye("R:#203040,506070");
@@ -191,6 +388,7 @@ TEST_CASE("Dye normalDye 2")
REQUIRE(data[0] == buildHex(0x14, 0x1e, 0x28, 0x60));
}
+
TEST_CASE("Dye normalOGLDye 1")
{
Dye dye("R:#203040,506070");