oleaut32: add PICTYPE_NONE and PICTYPE_UNINITIALIZED to IPicture::Render

Nikolay Sivov bunglehead at gmail.com
Tue Dec 9 05:45:25 CST 2008


Changelog:
    - add PICTYPE_NONE and PICTYPE_UNINITIALIZED to IPicture::Render
    - add a test passed on WinXP SP2
    - remove some tabs from testfile

P.S. spotted in traces of bugs 6799 and 10050

>From c085b5d8a6a1cb2950fb0a3c7a0d39d26d05f848 Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <bunglehead at gmail.com>
Date: Tue, 9 Dec 2008 14:42:18 +0300
Subject:  Add PICTYPE_NONE and PICTYPE_UNINITIALIZED to IPicture::Render

---
 dlls/oleaut32/olepicture.c       |    4 +++
 dlls/oleaut32/tests/olepicture.c |   50 ++++++++++++++++++++++++++-----------
 2 files changed, 39 insertions(+), 15 deletions(-)

diff --git a/dlls/oleaut32/olepicture.c b/dlls/oleaut32/olepicture.c
index 498ee53..793eed2 100644
--- a/dlls/oleaut32/olepicture.c
+++ b/dlls/oleaut32/olepicture.c
@@ -644,6 +644,10 @@ static HRESULT WINAPI OLEPictureImpl_Render(IPicture *iface, HDC hdc,
    */
 
   switch(This->desc.picType) {
+  case PICTYPE_NONE:
+  case PICTYPE_UNINITIALIZED:
+      /* undocumented code */
+      return 0x800A017C;
   case PICTYPE_BITMAP:
     {
       HBITMAP hbmpOld;
diff --git a/dlls/oleaut32/tests/olepicture.c b/dlls/oleaut32/tests/olepicture.c
index f81c419..7915aea 100644
--- a/dlls/oleaut32/tests/olepicture.c
+++ b/dlls/oleaut32/tests/olepicture.c
@@ -587,6 +587,25 @@ static void test_enhmetafile(void)
     GlobalFree(hglob);
 }
 
+static void test_Render(void)
+{
+    IPicture *pic;
+    HRESULT hres;
+    short type;
+    HDC hdc = GetDC(0);
+
+    /* test IPicture::Render return code on uninitialized picture */
+    OleCreatePictureIndirect(NULL, &IID_IPicture, TRUE, (VOID**)&pic);
+    hres = IPicture_get_Type(pic, &type);
+    ok(hres == S_OK, "IPicture_get_Type does not return S_OK, but 0x%08x\n", hres);
+    ok(type == PICTYPE_UNINITIALIZED, "Expected type = PICTYPE_UNINITIALIZED, got = %d\n", type);
+    hres = IPicture_Render(pic, hdc, 0, 0, 0, 0, 0, 0, 0, 0, NULL);
+    ole_expect(hres, 0x800A017C); /* WinXP SP2 */
+
+    IPicture_Release(pic);
+    ReleaseDC(NULL, hdc);
+}
+
 START_TEST(olepicture)
 {
 	hOleaut32 = GetModuleHandleA("oleaut32.dll");
@@ -598,21 +617,22 @@ START_TEST(olepicture)
 	    return;
 	}
 
-	/* Test regular 1x1 pixel images of gif, jpg, bmp type */
-        test_pic(gifimage, sizeof(gifimage));
-	test_pic(jpgimage, sizeof(jpgimage));
-	test_pic(bmpimage, sizeof(bmpimage));
-        test_pic(gif4pixel, sizeof(gif4pixel));
-	/* FIXME: No PNG support yet in Wine or in older Windows... */
-	if (0) test_pic(pngimage, sizeof(pngimage));
-	test_empty_image();
-	test_empty_image_2();
-        test_apm();
-        test_metafile();
-        test_enhmetafile();
-
-	test_Invoke();
-        test_OleCreatePictureIndirect();
+    /* Test regular 1x1 pixel images of gif, jpg, bmp type */
+    test_pic(gifimage, sizeof(gifimage));
+    test_pic(jpgimage, sizeof(jpgimage));
+    test_pic(bmpimage, sizeof(bmpimage));
+    test_pic(gif4pixel, sizeof(gif4pixel));
+    /* FIXME: No PNG support yet in Wine or in older Windows... */
+    if (0) test_pic(pngimage, sizeof(pngimage));
+    test_empty_image();
+    test_empty_image_2();
+    test_apm();
+    test_metafile();
+    test_enhmetafile();
+
+    test_Invoke();
+    test_OleCreatePictureIndirect();
+    test_Render();
 }
 
 
-- 
1.4.4.4






More information about the wine-patches mailing list