gdiplus: Add some tests for ARGB conversions.
This commit is contained in:
parent
eab914b968
commit
ada3aea736
@ -4107,6 +4107,77 @@ static void test_gif_properties(void)
|
|||||||
GdipDisposeImage(image);
|
GdipDisposeImage(image);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_ARGB_conversion(void)
|
||||||
|
{
|
||||||
|
BYTE argb[8] = { 0x11,0x22,0x33,0x80, 0xff,0xff,0xff,0 };
|
||||||
|
BYTE pargb[8] = { 0x09,0x11,0x1a,0x80, 0,0,0,0 };
|
||||||
|
BYTE rgb32_xp[8] = { 0x11,0x22,0x33,0xff, 0xff,0xff,0xff,0xff };
|
||||||
|
BYTE rgb24[6] = { 0x11,0x22,0x33, 0xff,0xff,0xff };
|
||||||
|
BYTE *bits;
|
||||||
|
GpBitmap *bitmap;
|
||||||
|
BitmapData data;
|
||||||
|
GpStatus status;
|
||||||
|
int match;
|
||||||
|
|
||||||
|
status = GdipCreateBitmapFromScan0(2, 1, 8, PixelFormat32bppARGB, argb, &bitmap);
|
||||||
|
expect(Ok, status);
|
||||||
|
|
||||||
|
status = GdipBitmapLockBits(bitmap, NULL, ImageLockModeRead, PixelFormat32bppPARGB, &data);
|
||||||
|
expect(Ok, status);
|
||||||
|
ok(data.Width == 2, "expected 2, got %d\n", data.Width);
|
||||||
|
ok(data.Height == 1, "expected 1, got %d\n", data.Height);
|
||||||
|
ok(data.Stride == 8, "expected 8, got %d\n", data.Stride);
|
||||||
|
ok(data.PixelFormat == PixelFormat32bppPARGB, "expected PixelFormat32bppPARGB, got %d\n", data.PixelFormat);
|
||||||
|
match = !memcmp(data.Scan0, pargb, sizeof(pargb));
|
||||||
|
todo_wine
|
||||||
|
ok(match, "bits don't match\n");
|
||||||
|
if (!match)
|
||||||
|
{
|
||||||
|
bits = data.Scan0;
|
||||||
|
trace("format %#x, bits %02x,%02x,%02x,%02x %02x,%02x,%02x,%02x\n", PixelFormat32bppPARGB,
|
||||||
|
bits[0], bits[1], bits[2], bits[3], bits[4], bits[5], bits[6], bits[7]);
|
||||||
|
}
|
||||||
|
status = GdipBitmapUnlockBits(bitmap, &data);
|
||||||
|
expect(Ok, status);
|
||||||
|
|
||||||
|
status = GdipBitmapLockBits(bitmap, NULL, ImageLockModeRead, PixelFormat32bppRGB, &data);
|
||||||
|
expect(Ok, status);
|
||||||
|
ok(data.Width == 2, "expected 2, got %d\n", data.Width);
|
||||||
|
ok(data.Height == 1, "expected 1, got %d\n", data.Height);
|
||||||
|
ok(data.Stride == 8, "expected 8, got %d\n", data.Stride);
|
||||||
|
ok(data.PixelFormat == PixelFormat32bppRGB, "expected PixelFormat32bppRGB, got %d\n", data.PixelFormat);
|
||||||
|
match = !memcmp(data.Scan0, argb, sizeof(argb)) ||
|
||||||
|
!memcmp(data.Scan0, rgb32_xp, sizeof(rgb32_xp));
|
||||||
|
ok(match, "bits don't match\n");
|
||||||
|
if (!match)
|
||||||
|
{
|
||||||
|
bits = data.Scan0;
|
||||||
|
trace("format %#x, bits %02x,%02x,%02x,%02x %02x,%02x,%02x,%02x\n", PixelFormat32bppRGB,
|
||||||
|
bits[0], bits[1], bits[2], bits[3], bits[4], bits[5], bits[6], bits[7]);
|
||||||
|
}
|
||||||
|
status = GdipBitmapUnlockBits(bitmap, &data);
|
||||||
|
expect(Ok, status);
|
||||||
|
|
||||||
|
status = GdipBitmapLockBits(bitmap, NULL, ImageLockModeRead, PixelFormat24bppRGB, &data);
|
||||||
|
expect(Ok, status);
|
||||||
|
ok(data.Width == 2, "expected 2, got %d\n", data.Width);
|
||||||
|
ok(data.Height == 1, "expected 1, got %d\n", data.Height);
|
||||||
|
ok(data.Stride == 8, "expected 8, got %d\n", data.Stride);
|
||||||
|
ok(data.PixelFormat == PixelFormat24bppRGB, "expected PixelFormat24bppRGB, got %d\n", data.PixelFormat);
|
||||||
|
match = !memcmp(data.Scan0, rgb24, sizeof(rgb24));
|
||||||
|
ok(match, "bits don't match\n");
|
||||||
|
if (!match)
|
||||||
|
{
|
||||||
|
bits = data.Scan0;
|
||||||
|
trace("format %#x, bits %02x,%02x,%02x,%02x %02x,%02x,%02x,%02x\n", PixelFormat24bppRGB,
|
||||||
|
bits[0], bits[1], bits[2], bits[3], bits[4], bits[5], bits[6], bits[7]);
|
||||||
|
}
|
||||||
|
status = GdipBitmapUnlockBits(bitmap, &data);
|
||||||
|
expect(Ok, status);
|
||||||
|
|
||||||
|
GdipDisposeImage((GpImage *)bitmap);
|
||||||
|
}
|
||||||
|
|
||||||
START_TEST(image)
|
START_TEST(image)
|
||||||
{
|
{
|
||||||
struct GdiplusStartupInput gdiplusStartupInput;
|
struct GdiplusStartupInput gdiplusStartupInput;
|
||||||
@ -4119,6 +4190,7 @@ START_TEST(image)
|
|||||||
|
|
||||||
GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
|
GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
|
||||||
|
|
||||||
|
test_ARGB_conversion();
|
||||||
test_DrawImage_scale();
|
test_DrawImage_scale();
|
||||||
test_image_format();
|
test_image_format();
|
||||||
test_DrawImage();
|
test_DrawImage();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user