diff --git a/dlls/gdiplus/tests/image.c b/dlls/gdiplus/tests/image.c index ebdd3f9fe7..522e5de443 100644 --- a/dlls/gdiplus/tests/image.c +++ b/dlls/gdiplus/tests/image.c @@ -30,25 +30,31 @@ #define expect(expected, got) ok((UINT)(got) == (UINT)(expected), "Expected %.8x, got %.8x\n", (UINT)(expected), (UINT)(got)) #define expectf(expected, got) ok(fabs(expected - got) < 0.0001, "Expected %.2f, got %.2f\n", expected, got) -static void expect_rawformat(REFGUID expected, GpImage *img, int line, BOOL todo) +static void expect_guid(REFGUID expected, REFGUID got, int line, BOOL todo) { - GUID raw; WCHAR bufferW[39]; char buffer[39]; char buffer2[39]; + + StringFromGUID2(got, bufferW, sizeof(bufferW)/sizeof(bufferW[0])); + WideCharToMultiByte(CP_ACP, 0, bufferW, sizeof(bufferW)/sizeof(bufferW[0]), buffer, sizeof(buffer), NULL, NULL); + StringFromGUID2(expected, bufferW, sizeof(bufferW)/sizeof(bufferW[0])); + WideCharToMultiByte(CP_ACP, 0, bufferW, sizeof(bufferW)/sizeof(bufferW[0]), buffer2, sizeof(buffer2), NULL, NULL); + if(todo) + todo_wine ok_(__FILE__, line)(IsEqualGUID(expected, got), "Expected %s, got %s\n", buffer2, buffer); + else + ok_(__FILE__, line)(IsEqualGUID(expected, got), "Expected %s, got %s\n", buffer2, buffer); +} + +static void expect_rawformat(REFGUID expected, GpImage *img, int line, BOOL todo) +{ + GUID raw; GpStatus stat; stat = GdipGetImageRawFormat(img, &raw); ok_(__FILE__, line)(stat == Ok, "GdipGetImageRawFormat failed with %d\n", stat); if(stat != Ok) return; - StringFromGUID2(&raw, bufferW, sizeof(bufferW)/sizeof(bufferW[0])); - WideCharToMultiByte(CP_ACP, 0, bufferW, sizeof(bufferW)/sizeof(bufferW[0]), buffer, sizeof(buffer), NULL, NULL); - StringFromGUID2(expected, bufferW, sizeof(bufferW)/sizeof(bufferW[0])); - WideCharToMultiByte(CP_ACP, 0, bufferW, sizeof(bufferW)/sizeof(bufferW[0]), buffer2, sizeof(buffer2), NULL, NULL); - if(todo) - todo_wine ok_(__FILE__, line)(IsEqualGUID(&raw, expected), "Expected format %s, got %s\n", buffer2, buffer); - else - ok_(__FILE__, line)(IsEqualGUID(&raw, expected), "Expected format %s, got %s\n", buffer2, buffer); + expect_guid(expected, &raw, line, todo); } static void test_bufferrawformat(void* buff, int size, REFGUID expected, int line, BOOL todo) @@ -177,6 +183,9 @@ static void test_GdipImageGetFrameDimensionsCount(void) GpStatus stat; const REAL WIDTH = 10.0, HEIGHT = 20.0; UINT w; + GUID dimension = {0}; + UINT count; + ARGB color; bm = (GpBitmap*)0xdeadbeef; stat = GdipCreateBitmapFromScan0(WIDTH, HEIGHT, 0, PixelFormat24bppRGB,NULL, &bm); @@ -194,6 +203,26 @@ static void test_GdipImageGetFrameDimensionsCount(void) stat = GdipImageGetFrameDimensionsCount((GpImage*)bm,&w); expect(Ok, stat); expect(1, w); + + stat = GdipImageGetFrameDimensionsList((GpImage*)bm, &dimension, 1); + expect(Ok, stat); + expect_guid(&FrameDimensionPage, &dimension, __LINE__, TRUE); + + count = 12345; + stat = GdipImageGetFrameCount((GpImage*)bm, &dimension, &count); + todo_wine expect(Ok, stat); + todo_wine expect(1, count); + + GdipBitmapSetPixel(bm, 0, 0, 0xffffffff); + + stat = GdipImageSelectActiveFrame((GpImage*)bm, &dimension, 0); + expect(Ok, stat); + + /* SelectActiveFrame has no effect on image data of memory bitmaps */ + color = 0xdeadbeef; + GdipBitmapGetPixel(bm, 0, 0, &color); + expect(0xffffffff, color); + GdipDisposeImage((GpImage*)bm); } diff --git a/include/gdiplusimaging.h b/include/gdiplusimaging.h index 51a60ba9a4..42a00cbef4 100644 --- a/include/gdiplusimaging.h +++ b/include/gdiplusimaging.h @@ -31,6 +31,10 @@ DEFINE_GUID(ImageFormatTIFF, 0xb96b3cb1, 0x728, 0x11d3, 0x9d, 0x7b, 0, 0, 0 DEFINE_GUID(ImageFormatEXIF, 0xb96b3cb2, 0x728, 0x11d3, 0x9d, 0x7b, 0, 0, 0xf8, 0x1e, 0xf3, 0x2e); DEFINE_GUID(ImageFormatIcon, 0xb96b3cb5, 0x728, 0x11d3, 0x9d, 0x7b, 0, 0, 0xf8, 0x1e, 0xf3, 0x2e); +DEFINE_GUID(FrameDimensionTime, 0x6aedbd6d, 0x3fb5, 0x418a, 0x83, 0xa6, 0x7f, 0x45, 0x22, 0x9d, 0xc8, 0x72); +DEFINE_GUID(FrameDimensionPage, 0x7462dc86, 0x6180, 0x4c7e, 0x8e, 0x3f, 0xee, 0x73, 0x33, 0xa7, 0xa4, 0x83); +DEFINE_GUID(FrameDimensionResolution, 0x84236f7b, 0x3bd3, 0x428f, 0x8d, 0xab, 0x4e, 0xa1, 0x43, 0x9c, 0xa3, 0x15); + enum ImageLockMode { ImageLockModeRead = 1,