gdiplus: Add pixel format test for transparent non-animated gif.

This commit is contained in:
Piotr Caban 2015-03-12 10:19:05 +01:00 committed by Alexandre Julliard
parent 02d4c6b5ac
commit 3ece08ff4d
1 changed files with 30 additions and 0 deletions

View File

@ -1335,6 +1335,12 @@ static const unsigned char gifimage[35] = {
0xff,0xff,0xff,0x2c,0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x00,0x02,0x02,0x44, 0xff,0xff,0xff,0x2c,0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x00,0x02,0x02,0x44,
0x01,0x00,0x3b 0x01,0x00,0x3b
}; };
/* 1x1 pixel transparent gif */
static const unsigned char transparentgif[] = {
0x47,0x49,0x46,0x38,0x39,0x61,0x01,0x00,0x01,0x00,0xf0,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x21,0xf9,0x04,0x01,0x00,0x00,0x00,0x00,0x2c,0x00,0x00,0x00,0x00,
0x01,0x00,0x01,0x00,0x00,0x02,0x02,0x44,0x01,0x00,0x3b
};
/* 1x1 pixel bmp */ /* 1x1 pixel bmp */
static const unsigned char bmpimage[66] = { static const unsigned char bmpimage[66] = {
0x42,0x4d,0x42,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3e,0x00,0x00,0x00,0x28,0x00, 0x42,0x4d,0x42,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3e,0x00,0x00,0x00,0x28,0x00,
@ -2621,6 +2627,30 @@ static void test_multiframegif(void)
GdipDisposeImage((GpImage*)bmp); GdipDisposeImage((GpImage*)bmp);
IStream_Release(stream); IStream_Release(stream);
/* Test with a non-animated transparent gif */
hglob = GlobalAlloc (0, sizeof(transparentgif));
data = GlobalLock (hglob);
memcpy(data, transparentgif, sizeof(transparentgif));
GlobalUnlock(hglob);
hres = CreateStreamOnHGlobal(hglob, TRUE, &stream);
ok(hres == S_OK, "Failed to create a stream\n");
stat = GdipCreateBitmapFromStream(stream, &bmp);
IStream_Release(stream);
ok(stat == Ok, "Failed to create a Bitmap\n");
stat = GdipGetImagePixelFormat((GpImage*)bmp, &pixel_format);
expect(Ok, stat);
expect(PixelFormat8bppIndexed, pixel_format);
count = 12345;
stat = GdipImageGetFrameCount((GpImage*)bmp, &dimension, &count);
expect(Ok, stat);
expect(1, count);
GdipDisposeImage((GpImage*)bmp);
/* Test frame dispose methods */ /* Test frame dispose methods */
hglob = GlobalAlloc (0, sizeof(gifanimation2)); hglob = GlobalAlloc (0, sizeof(gifanimation2));
data = GlobalLock (hglob); data = GlobalLock (hglob);