diff --git a/src/tests/testformats.c b/src/tests/testformats.c index 5200cbe1..de5aef7b 100644 --- a/src/tests/testformats.c +++ b/src/tests/testformats.c @@ -233,6 +233,7 @@ int Test_Save(void) } testpic256 = context.Surface; context.Surface = NULL; + memcpy(testpic256->palette, context.Palette, sizeof(T_Palette)); snprintf(tmpdir, sizeof(tmpdir), "/tmp/grafx2-test.XXXXXX"); if (mkdtemp(tmpdir) == NULL) { @@ -253,6 +254,7 @@ int Test_Save(void) context.Surface = testpic256; context.Target_address = testpic256->pixels; context.Pitch = testpic256->w; + memcpy(context.Palette, testpic256->palette, sizeof(T_Palette)); context.Format = formats[i].format; File_error = 0; formats[i].Save(&context); @@ -283,6 +285,7 @@ int Test_Save(void) ok = 0; } } + memset(context.Palette, -1, sizeof(T_Palette)); // load the saved file formats[i].Load(&context); if (File_error != 0 || context.Surface == NULL) @@ -304,6 +307,11 @@ int Test_Save(void) GFX2_Log(GFX2_ERROR, "Save%s/Load_%s: Pixels mismatch\n", formats[i].name, formats[i].name); ok = 0; } + else if (0 != memcmp(context.Palette, testpic256->palette, sizeof(T_Palette))) + { + GFX2_Log(GFX2_ERROR, "Save%s/Load_%s: Palette mismatch\n", formats[i].name, formats[i].name); + ok = 0; + } else { if (unlink(path) < 0)