also check the Saving/Loading of picture palette
This commit is contained in:
parent
3555eb86bb
commit
8f25341244
@ -233,6 +233,7 @@ int Test_Save(void)
|
|||||||
}
|
}
|
||||||
testpic256 = context.Surface;
|
testpic256 = context.Surface;
|
||||||
context.Surface = NULL;
|
context.Surface = NULL;
|
||||||
|
memcpy(testpic256->palette, context.Palette, sizeof(T_Palette));
|
||||||
snprintf(tmpdir, sizeof(tmpdir), "/tmp/grafx2-test.XXXXXX");
|
snprintf(tmpdir, sizeof(tmpdir), "/tmp/grafx2-test.XXXXXX");
|
||||||
if (mkdtemp(tmpdir) == NULL)
|
if (mkdtemp(tmpdir) == NULL)
|
||||||
{
|
{
|
||||||
@ -253,6 +254,7 @@ int Test_Save(void)
|
|||||||
context.Surface = testpic256;
|
context.Surface = testpic256;
|
||||||
context.Target_address = testpic256->pixels;
|
context.Target_address = testpic256->pixels;
|
||||||
context.Pitch = testpic256->w;
|
context.Pitch = testpic256->w;
|
||||||
|
memcpy(context.Palette, testpic256->palette, sizeof(T_Palette));
|
||||||
context.Format = formats[i].format;
|
context.Format = formats[i].format;
|
||||||
File_error = 0;
|
File_error = 0;
|
||||||
formats[i].Save(&context);
|
formats[i].Save(&context);
|
||||||
@ -283,6 +285,7 @@ int Test_Save(void)
|
|||||||
ok = 0;
|
ok = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
memset(context.Palette, -1, sizeof(T_Palette));
|
||||||
// load the saved file
|
// load the saved file
|
||||||
formats[i].Load(&context);
|
formats[i].Load(&context);
|
||||||
if (File_error != 0 || context.Surface == NULL)
|
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);
|
GFX2_Log(GFX2_ERROR, "Save%s/Load_%s: Pixels mismatch\n", formats[i].name, formats[i].name);
|
||||||
ok = 0;
|
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
|
else
|
||||||
{
|
{
|
||||||
if (unlink(path) < 0)
|
if (unlink(path) < 0)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user