Evan Stade : gdiplus/tests: Added GdipCreateBitmapFromScan0 test.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Aug 9 08:23:15 CDT 2007


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

Author: Evan Stade <estade at gmail.com>
Date:   Wed Aug  8 19:42:20 2007 -0700

gdiplus/tests: Added GdipCreateBitmapFromScan0 test.

---

 dlls/gdiplus/tests/Makefile.in |    1 +
 dlls/gdiplus/tests/image.c     |   83 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 84 insertions(+), 0 deletions(-)

diff --git a/dlls/gdiplus/tests/Makefile.in b/dlls/gdiplus/tests/Makefile.in
index 421bd4e..3771da2 100644
--- a/dlls/gdiplus/tests/Makefile.in
+++ b/dlls/gdiplus/tests/Makefile.in
@@ -9,6 +9,7 @@ CTESTS = \
 	brush.c \
 	graphics.c \
 	graphicspath.c \
+	image.c \
 	matrix.c \
 	pen.c
 
diff --git a/dlls/gdiplus/tests/image.c b/dlls/gdiplus/tests/image.c
new file mode 100644
index 0000000..ac86fb7
--- /dev/null
+++ b/dlls/gdiplus/tests/image.c
@@ -0,0 +1,83 @@
+/*
+ * Unit test suite for images
+ *
+ * Copyright (C) 2007 Google (Evan Stade)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include "windows.h"
+#include "gdiplus.h"
+#include "wine/test.h"
+
+#define expect(expected, got) ok(((UINT)got) == ((UINT)expected), "Expected %.8x, got %.8x\n", (UINT)expected, (UINT)got)
+
+static void test_Scan0()
+{
+    GpBitmap *bm;
+    GpStatus stat;
+    BYTE buff[360];
+
+    bm = NULL;
+    stat = GdipCreateBitmapFromScan0(10, 10, 10, PixelFormat24bppRGB, NULL, &bm);
+    todo_wine{
+        expect(Ok, stat);
+        ok(NULL != bm, "Expected bitmap to be initialized\n");
+    }
+    GdipDisposeImage((GpImage*)bm);
+
+    bm = (GpBitmap*)0xdeadbeef;
+    stat = GdipCreateBitmapFromScan0(10, -10, 10, PixelFormat24bppRGB, NULL, &bm);
+    expect(InvalidParameter, stat);
+    todo_wine
+        expect(NULL, bm);
+
+    bm = (GpBitmap*)0xdeadbeef;
+    stat = GdipCreateBitmapFromScan0(-10, 10, 10, PixelFormat24bppRGB, NULL, &bm);
+    expect(InvalidParameter, stat);
+    todo_wine
+        expect(NULL, bm);
+
+    bm = (GpBitmap*)0xdeadbeef;
+    stat = GdipCreateBitmapFromScan0(10, 0, 10, PixelFormat24bppRGB, NULL, &bm);
+    expect(InvalidParameter, stat);
+    todo_wine
+        expect(NULL, bm);
+
+    bm = NULL;
+    stat = GdipCreateBitmapFromScan0(10, 10, 12, PixelFormat24bppRGB, buff, &bm);
+    expect(Ok, stat);
+    ok(NULL != bm, "Expected bitmap to be initialized\n");
+    GdipDisposeImage((GpImage*)bm);
+
+    bm = (GpBitmap*) 0xdeadbeef;
+    stat = GdipCreateBitmapFromScan0(10, 10, 10, PixelFormat24bppRGB, buff, &bm);
+    todo_wine{
+        expect(InvalidParameter, stat);
+        expect(NULL, bm);
+    }
+
+    bm = (GpBitmap*)0xdeadbeef;
+    stat = GdipCreateBitmapFromScan0(10, 10, 0, PixelFormat24bppRGB, buff, &bm);
+    todo_wine{
+        expect(InvalidParameter, stat);
+        expect(0xdeadbeef, bm);
+    }
+}
+
+START_TEST(image)
+{
+    test_Scan0();
+}




More information about the wine-cvs mailing list