gdiplus/tests: Extend DrawImage scaling tests.

Changing the colour of the second pixel of the source bitmap clarifies
the incorrect behaviour of PixelOffsetMode Half and HighQuality.

This also provides better proof that PixelOffsetMode None and Fast are
implemented correctly.
This commit is contained in:
Bartosz Kosiorek 2023-09-08 16:13:53 +02:00 committed by Alexandre Julliard
parent dedbbcd5a0
commit f0d2022b45

View file

@ -4799,30 +4799,32 @@ static void test_image_format(void)
static void test_DrawImage_scale(void) static void test_DrawImage_scale(void)
{ {
static const BYTE back_8x1[24] = { 0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40, static const BYTE back_8x1[24] = { 0x40,0x40,0x40, 0x40,0x40,0x40, 0x40,0x40,0x40, 0x40,0x40,0x40,
0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40 }; 0x40,0x40,0x40, 0x40,0x40,0x40, 0x40,0x40,0x40, 0x40,0x40,0x40 };
static const BYTE image_080[24] = { 0x40,0x40,0x40,0x80,0x80,0x80,0x40,0x40,0x40,0x40,0x40,0x40, static const BYTE image_080[24] = { 0x40,0x40,0x40, 0x80,0x80,0x80, 0x40,0x40,0x40, 0x40,0x40,0x40,
0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40 }; 0x40,0x40,0x40, 0x40,0x40,0x40, 0x40,0x40,0x40, 0x40,0x40,0x40 };
static const BYTE image_100[24] = { 0x40,0x40,0x40,0x80,0x80,0x80,0x80,0x80,0x80,0x40,0x40,0x40, static const BYTE image_100[24] = { 0x40,0x40,0x40, 0x80,0x80,0x80, 0xcc,0xcc,0xcc, 0x40,0x40,0x40,
0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40 }; 0x40,0x40,0x40, 0x40,0x40,0x40, 0x40,0x40,0x40, 0x40,0x40,0x40 };
static const BYTE image_120[24] = { 0x40,0x40,0x40,0x40,0x40,0x40,0x80,0x80,0x80,0x40,0x40,0x40, static const BYTE image_120[24] = { 0x40,0x40,0x40, 0x40,0x40,0x40, 0xcc,0xcc,0xcc, 0x40,0x40,0x40,
0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40 }; 0x40,0x40,0x40, 0x40,0x40,0x40, 0x40,0x40,0x40, 0x40,0x40,0x40 };
static const BYTE image_150[24] = { 0x40,0x40,0x40,0x40,0x40,0x40,0x80,0x80,0x80,0x80,0x80,0x80, static const BYTE image_150[24] = { 0x40,0x40,0x40, 0x40,0x40,0x40, 0x80,0x80,0x80, 0xcc,0xcc,0xcc,
0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40 }; 0x40,0x40,0x40, 0x40,0x40,0x40, 0x40,0x40,0x40, 0x40,0x40,0x40 };
static const BYTE image_180[24] = { 0x40,0x40,0x40,0x40,0x40,0x40,0x80,0x80,0x80,0x80,0x80,0x80, static const BYTE image_180[24] = { 0x40,0x40,0x40, 0x40,0x40,0x40, 0x80,0x80,0x80, 0xcc,0xcc,0xcc,
0x80,0x80,0x80,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40 }; 0xcc,0xcc,0xcc, 0x40,0x40,0x40, 0x40,0x40,0x40, 0x40,0x40,0x40 };
static const BYTE image_200[24] = { 0x40,0x40,0x40,0x40,0x40,0x40,0x80,0x80,0x80,0x80,0x80,0x80, static const BYTE image_200[24] = { 0x40,0x40,0x40, 0x40,0x40,0x40, 0x80,0x80,0x80, 0xcc,0xcc,0xcc,
0x80,0x80,0x80,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40 }; 0xcc,0xcc,0xcc, 0x40,0x40,0x40, 0x40,0x40,0x40, 0x40,0x40,0x40 };
static const BYTE image_250[24] = { 0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x80,0x80,0x80, static const BYTE image_250[24] = { 0x40,0x40,0x40, 0x40,0x40,0x40, 0x40,0x40,0x40, 0x80,0x80,0x80,
0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x40,0x40,0x40 }; 0xcc,0xcc,0xcc, 0xcc,0xcc,0xcc, 0xcc,0xcc,0xcc, 0x40,0x40,0x40 };
static const BYTE image_120_half[24] = { 0x40,0x40,0x40,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, static const BYTE image_120_half[24] = { 0x40,0x40,0x40, 0x80,0x80,0x80, 0xcc,0xcc,0xcc, 0xcc,0xcc,0xcc,
0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40 }; 0x40,0x40,0x40, 0x40,0x40,0x40, 0x40,0x40,0x40, 0x40,0x40,0x40 };
static const BYTE image_150_half[24] = { 0x40,0x40,0x40,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, static const BYTE image_150_half[24] = { 0x40,0x40,0x40, 0x80,0x80,0x80, 0x80,0x80,0x80, 0xcc,0xcc,0xcc,
0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x40 }; 0x40,0x40,0x40, 0x40,0x40,0x40, 0x40,0x40,0x40, 0x40,0x40,0x40 };
static const BYTE image_200_half[24] = { 0x40,0x40,0x40,0x40,0x40,0x40,0x80,0x80,0x80,0x80,0x80,0x80, static const BYTE image_180_half[24] = { 0x40,0x40,0x40, 0x40,0x40,0x40, 0x80,0x80,0x80, 0x80,0x80,0x80,
0x80,0x80,0x80,0x80,0x80,0x80,0x40,0x40,0x40,0x40,0x40,0x40 }; 0xcc,0xcc,0xcc, 0x40,0x40,0x40, 0x40,0x40,0x40, 0x40,0x40,0x40 };
static const BYTE image_250_half[24] = { 0x40,0x40,0x40,0x40,0x40,0x40,0x80,0x80,0x80,0x80,0x80,0x80, static const BYTE image_200_half[24] = { 0x40,0x40,0x40, 0x40,0x40,0x40, 0x80,0x80,0x80, 0x80,0x80,0x80,
0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x40,0x40,0x40 }; 0xcc,0xcc,0xcc, 0xcc,0xcc,0xcc, 0x40,0x40,0x40, 0x40,0x40,0x40 };
static const BYTE image_250_half[24] = { 0x40,0x40,0x40, 0x40,0x40,0x40, 0x80,0x80,0x80, 0x80,0x80,0x80,
0x80,0x80,0x80, 0xcc,0xcc,0xcc, 0xcc,0xcc,0xcc, 0x40,0x40,0x40 };
static const struct test_data static const struct test_data
{ {
REAL scale_x; REAL scale_x;
@ -4851,7 +4853,7 @@ static void test_DrawImage_scale(void)
{ 1.0, PixelOffsetModeHalf, image_100 }, { 1.0, PixelOffsetModeHalf, image_100 },
{ 1.2, PixelOffsetModeHalf, image_120_half, TRUE }, { 1.2, PixelOffsetModeHalf, image_120_half, TRUE },
{ 1.5, PixelOffsetModeHalf, image_150_half, TRUE }, { 1.5, PixelOffsetModeHalf, image_150_half, TRUE },
{ 1.8, PixelOffsetModeHalf, image_180 }, { 1.8, PixelOffsetModeHalf, image_180_half, TRUE },
{ 2.0, PixelOffsetModeHalf, image_200_half, TRUE }, { 2.0, PixelOffsetModeHalf, image_200_half, TRUE },
{ 2.5, PixelOffsetModeHalf, image_250_half, TRUE }, { 2.5, PixelOffsetModeHalf, image_250_half, TRUE },
@ -4859,11 +4861,11 @@ static void test_DrawImage_scale(void)
{ 1.0, PixelOffsetModeHighQuality, image_100 }, { 1.0, PixelOffsetModeHighQuality, image_100 },
{ 1.2, PixelOffsetModeHighQuality, image_120_half, TRUE }, { 1.2, PixelOffsetModeHighQuality, image_120_half, TRUE },
{ 1.5, PixelOffsetModeHighQuality, image_150_half, TRUE }, { 1.5, PixelOffsetModeHighQuality, image_150_half, TRUE },
{ 1.8, PixelOffsetModeHighQuality, image_180 }, { 1.8, PixelOffsetModeHighQuality, image_180_half, TRUE },
{ 2.0, PixelOffsetModeHighQuality, image_200_half, TRUE }, { 2.0, PixelOffsetModeHighQuality, image_200_half, TRUE },
{ 2.5, PixelOffsetModeHighQuality, image_250_half, TRUE }, { 2.5, PixelOffsetModeHighQuality, image_250_half, TRUE },
}; };
BYTE src_2x1[6] = { 0x80,0x80,0x80,0x80,0x80,0x80 }; BYTE src_2x1[6] = { 0x80,0x80,0x80, 0xcc,0xcc,0xcc };
BYTE dst_8x1[24]; BYTE dst_8x1[24];
GpStatus status; GpStatus status;
union union
@ -4908,7 +4910,10 @@ static void test_DrawImage_scale(void)
todo_wine_if (!match && td[i].todo) todo_wine_if (!match && td[i].todo)
ok(match, "%d: data should match\n", i); ok(match, "%d: data should match\n", i);
if (!match) if (!match)
trace("%s\n", dbgstr_hexdata(dst_8x1, sizeof(dst_8x1))); {
trace("Expected: %s\n", dbgstr_hexdata(td[i].image, sizeof(dst_8x1)));
trace("Got: %s\n", dbgstr_hexdata(dst_8x1, sizeof(dst_8x1)));
}
} }
status = GdipDeleteGraphics(graphics); status = GdipDeleteGraphics(graphics);