Vincent Povirk : gdiplus: Add tests for the other frame functions, for memory bitmaps.

Alexandre Julliard julliard at winehq.org
Fri Dec 18 10:49:09 CST 2009


Module: wine
Branch: master
Commit: 6a7fc507082e82e9140e2f92e52d3c187920d5a7
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=6a7fc507082e82e9140e2f92e52d3c187920d5a7

Author: Vincent Povirk <vincent at codeweavers.com>
Date:   Thu Dec 17 19:35:19 2009 -0600

gdiplus: Add tests for the other frame functions, for memory bitmaps.

---

 dlls/gdiplus/tests/image.c |   47 +++++++++++++++++++++++++++++++++++--------
 include/gdiplusimaging.h   |    4 +++
 2 files changed, 42 insertions(+), 9 deletions(-)

diff --git a/dlls/gdiplus/tests/image.c b/dlls/gdiplus/tests/image.c
index ebdd3f9..522e5de 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];
-    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]));
+    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(&raw, expected), "Expected format %s, got %s\n", buffer2, buffer);
+        todo_wine ok_(__FILE__, line)(IsEqualGUID(expected, got), "Expected %s, got %s\n", buffer2, buffer);
     else
-        ok_(__FILE__, line)(IsEqualGUID(&raw, expected), "Expected format %s, got %s\n", buffer2, buffer);
+        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;
+    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 51a60ba..42a00cb 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,




More information about the wine-cvs mailing list