foxygit / fake-08-xbox360 Log in
commit 0f56209b696f5c0ebce500dc12bb455e31d426ee
Author:     jtothebell <j.to.the.bell@gmail.com>
AuthorDate: Sun Aug 23 11:28:07 2020 -0600
Commit:     jtothebell <j.to.the.bell@gmail.com>
CommitDate: Tue Sep 15 17:09:08 2020 -0600

    Update test to check whole palette
---
 test/graphicstests.cpp | 45 ++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 40 insertions(+), 5 deletions(-)

diff --git a/test/graphicstests.cpp b/test/graphicstests.cpp
index a2c13e7..9fd0c7c 100644
--- a/test/graphicstests.cpp
+++ b/test/graphicstests.cpp
@@ -5,6 +5,13 @@
 #include "../source/fontdata.h"
 #include "../source/PicoRam.h"

+bool colorsEqual(Color* lhs, Color* rhs) {
+	return lhs->Alpha == rhs->Alpha &&
+		   lhs->Red == rhs->Red &&
+		   lhs->Green == rhs->Green &&
+		   lhs->Blue == rhs->Blue;
+}
+
 TEST_CASE("graphics class behaves as expected") {
     //general setup
     std::string fontdata = get_font_data();
@@ -14,11 +21,39 @@ TEST_CASE("graphics class behaves as expected") {

     SUBCASE("Palette set up in constructor") {
         Color* palette = graphics->GetPaletteColors();
-
-        CHECK(palette[0].Alpha == 255);
-        CHECK(palette[0].Red ==     0);
-        CHECK(palette[0].Green ==   0);
-        CHECK(palette[0].Blue ==    0);
+        Color testColor;
+        testColor = {  0,   0,   0, 255};
+        CHECK(colorsEqual(& palette[0], & testColor) == true);
+        testColor = { 29,  43,  83, 255};
+        CHECK(colorsEqual(& palette[1], & testColor) == true);
+        testColor = {126,  37,  83, 255};
+        CHECK(colorsEqual(& palette[2], & testColor) == true);
+        testColor = {  0, 135,  81, 255};
+        CHECK(colorsEqual(& palette[3], & testColor) == true);
+        testColor = {171,  82,  54, 255};
+        CHECK(colorsEqual(& palette[4], & testColor) == true);
+        testColor = { 95,  87,  79, 255};
+        CHECK(colorsEqual(& palette[5], & testColor) == true);
+        testColor = {194, 195, 199, 255};
+        CHECK(colorsEqual(& palette[6], & testColor) == true);
+        testColor = {255, 241, 232, 255};
+        CHECK(colorsEqual(& palette[7], & testColor) == true);
+        testColor = {255,   0,  77, 255};
+        CHECK(colorsEqual(& palette[8], & testColor) == true);
+        testColor = {255, 163,   0, 255};
+        CHECK(colorsEqual(& palette[9], & testColor) == true);
+        testColor = {255, 240,  36, 255};
+        CHECK(colorsEqual(& palette[10], & testColor) == true);
+        testColor = {  0, 231,  86, 255};
+        CHECK(colorsEqual(& palette[11], & testColor) == true);
+        testColor = { 41, 173, 255, 255};
+        CHECK(colorsEqual(& palette[12], & testColor) == true);
+        testColor = {131, 118, 156, 255};
+        CHECK(colorsEqual(& palette[13], & testColor) == true);
+        testColor = {255, 119, 168, 255};
+        CHECK(colorsEqual(& palette[14], & testColor) == true);
+        testColor = {255, 204, 170, 255};
+        CHECK(colorsEqual(& palette[15], & testColor) == true);
     }

     //general teardown