[1/2] oleaut32: Add PICTYPE_NONE and PICTYPE_UNINITIALIZED to IPicture_get_Attributes

Nikolay Sivov bunglehead at gmail.com
Mon Jan 5 15:50:23 CST 2009


Changelog:
    - added PICTYPE_NONE and PICTYPE_UNINITIALIZED to IPicture_get_Attributes with test.
      This also removes fixme meaningless output for these type values.

>From e6c6669b1524b1bb1b03655a510af78ac192bce8 Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <bunglehead at gmail.com>
Date: Tue, 6 Jan 2009 00:25:43 +0300
Subject:  Add PICTYPE_NONE and PICTYPE_UNINITIALIZED to IPicture_get_Attributes

---
 dlls/oleaut32/olepicture.c       |    2 ++
 dlls/oleaut32/tests/olepicture.c |   27 +++++++++++++++++++++++++++
 2 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/dlls/oleaut32/olepicture.c b/dlls/oleaut32/olepicture.c
index bdce729..e57effe 100644
--- a/dlls/oleaut32/olepicture.c
+++ b/dlls/oleaut32/olepicture.c
@@ -844,6 +844,8 @@ static HRESULT WINAPI OLEPictureImpl_get_Attributes(IPicture *iface,
   TRACE("(%p)->(%p).\n", This, pdwAttr);
   *pdwAttr = 0;
   switch (This->desc.picType) {
+  case PICTYPE_UNINITIALIZED:
+  case PICTYPE_NONE: break;
   case PICTYPE_BITMAP: 	if (This->hbmMask) *pdwAttr = PICTURE_TRANSPARENT; break;	/* not 'truly' scalable, see MSDN. */
   case PICTYPE_ICON: *pdwAttr     = PICTURE_TRANSPARENT;break;
   case PICTYPE_ENHMETAFILE: /* fall through */
diff --git a/dlls/oleaut32/tests/olepicture.c b/dlls/oleaut32/tests/olepicture.c
index 2b5b8bb..ba59b50 100644
--- a/dlls/oleaut32/tests/olepicture.c
+++ b/dlls/oleaut32/tests/olepicture.c
@@ -324,6 +324,7 @@ static void test_empty_image(void) {
 	ULARGE_INTEGER	newpos1;
 	LARGE_INTEGER	seekto;
 	short		type;
+	DWORD		attr;
 
 	/* Empty image. Happens occasionally in VB programs. */
 	hglob = GlobalAlloc (0, 8);
@@ -347,6 +348,11 @@ static void test_empty_image(void) {
 	ok (hres == S_OK,"empty picture get type failed with hres 0x%08x\n", hres);
 	ok (type == PICTYPE_NONE,"type is %d, but should be PICTYPE_NONE(0)\n", type);
 
+	attr = 0xdeadbeef;
+	hres = IPicture_get_Attributes (pic, &attr);
+	ok (hres == S_OK,"empty picture get attributes failed with hres 0x%08x\n", hres);
+	ok (attr == 0,"attr is %d, but should be 0\n", attr);
+
 	hres = IPicture_get_Handle (pic, &handle);
 	ok (hres == S_OK,"empty picture get handle failed with hres 0x%08x\n", hres);
 	ok (handle == 0, "empty picture get handle did not return 0, but 0x%08x\n", handle);
@@ -645,6 +651,26 @@ static void test_Render(void)
     ReleaseDC(NULL, hdc);
 }
 
+static void test_get_Attributes(void)
+{
+    IPicture *pic;
+    HRESULT hres;
+    short type;
+    DWORD attr;
+
+    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);
+
+    attr = 0xdeadbeef;
+    hres = IPicture_get_Attributes(pic, &attr);
+    ole_expect(hres, S_OK);
+    ok(attr == 0, "IPicture_get_Attributes does not reset attr to zero, got %d\n", attr);
+
+    IPicture_Release(pic);
+}
+
 START_TEST(olepicture)
 {
 	hOleaut32 = GetModuleHandleA("oleaut32.dll");
@@ -672,6 +698,7 @@ START_TEST(olepicture)
 	test_Invoke();
         test_OleCreatePictureIndirect();
         test_Render();
+        test_get_Attributes();
 }
 

-- 
1.5.6.5






More information about the wine-patches mailing list