Nikolay Sivov : gdiplus/tests: Add some invalid arguments tests for GdipLoadImageFromStream().

Alexandre Julliard julliard at winehq.org
Mon May 14 06:54:23 CDT 2018


Module: wine
Branch: stable
Commit: 3e6f8b3e804cbd937c3be4d2ef2fac4aeb1fbb27
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=3e6f8b3e804cbd937c3be4d2ef2fac4aeb1fbb27

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Wed Feb 28 09:34:35 2018 +0300

gdiplus/tests: Add some invalid arguments tests for GdipLoadImageFromStream().

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Vincent Povirk <vincent at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
(cherry picked from commit 279cad235242dd0d34aa1993dfd8c24d479a3130)
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>

---

 dlls/gdiplus/tests/image.c | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/dlls/gdiplus/tests/image.c b/dlls/gdiplus/tests/image.c
index 28f0fce..34222e7 100644
--- a/dlls/gdiplus/tests/image.c
+++ b/dlls/gdiplus/tests/image.c
@@ -5161,6 +5161,37 @@ static void test_png_color_formats(void)
     }
 }
 
+static void test_GdipLoadImageFromStream(void)
+{
+    IStream *stream;
+    GpStatus status;
+    GpImage *image;
+    HGLOBAL hglob;
+    BYTE *data;
+    HRESULT hr;
+
+    status = GdipLoadImageFromStream(NULL, NULL);
+    ok(status == InvalidParameter, "Unexected return value %d.\n", status);
+
+    image = (void *)0xdeadbeef;
+    status = GdipLoadImageFromStream(NULL, &image);
+    ok(status == InvalidParameter, "Unexected return value %d.\n", status);
+    ok(image == (void *)0xdeadbeef, "Unexpected image pointer.\n");
+
+    hglob = GlobalAlloc(0, sizeof(pngimage));
+    data = GlobalLock (hglob);
+    memcpy(data, pngimage, sizeof(pngimage));
+    GlobalUnlock(hglob);
+
+    hr = CreateStreamOnHGlobal(hglob, TRUE, &stream);
+    ok(hr == S_OK, "Failed to create a stream.\n");
+
+    status = GdipLoadImageFromStream(stream, NULL);
+    ok(status == InvalidParameter, "Unexpected return value %d.\n", status);
+
+    IStream_Release(stream);
+}
+
 START_TEST(image)
 {
     HMODULE mod = GetModuleHandleA("gdiplus.dll");
@@ -5234,6 +5265,7 @@ START_TEST(image)
     test_getadjustedpalette();
     test_histogram();
     test_imageabort();
+    test_GdipLoadImageFromStream();
 
     GdiplusShutdown(gdiplusToken);
 }




More information about the wine-cvs mailing list