oleaut32: Fixes for the PICTYPE_UNINITIALIZED case.

This commit is contained in:
Huw Davies 2007-06-05 10:33:24 +01:00 committed by Alexandre Julliard
parent f19f4de59e
commit e848f6d539
2 changed files with 32 additions and 0 deletions

View File

@ -365,6 +365,7 @@ static void OLEPictureImpl_Destroy(OLEPictureImpl* Obj)
DeleteEnhMetaFile(Obj->desc.u.emf.hemf);
break;
case PICTYPE_NONE:
case PICTYPE_UNINITIALIZED:
/* Nothing to do */
break;
default:
@ -505,6 +506,7 @@ static HRESULT WINAPI OLEPictureImpl_get_Handle(IPicture *iface,
TRACE("(%p)->(%p)\n", This, phandle);
switch(This->desc.picType) {
case PICTYPE_NONE:
case PICTYPE_UNINITIALIZED:
*phandle = 0;
break;
case PICTYPE_BITMAP:

View File

@ -43,6 +43,7 @@
static HMODULE hOleaut32;
static HRESULT (WINAPI *pOleLoadPicture)(LPSTREAM,LONG,BOOL,REFIID,LPVOID*);
static HRESULT (WINAPI *pOleCreatePictureIndirect)(PICTDESC*,REFIID,BOOL,LPVOID*);
#define ok_ole_success(hr, func) ok(hr == S_OK, func " failed with error 0x%08x\n", hr)
@ -396,10 +397,38 @@ static void test_Invoke(void)
IPictureDisp_Release(picdisp);
}
static void test_OleCreatePictureIndirect(void)
{
IPicture *pict;
HRESULT hr;
short type;
OLE_HANDLE handle;
if(!pOleCreatePictureIndirect)
{
skip("Skipping OleCreatePictureIndirect tests\n");
return;
}
hr = pOleCreatePictureIndirect(NULL, &IID_IPicture, TRUE, (void**)&pict);
ok(hr == S_OK, "hr %08x\n", hr);
hr = IPicture_get_Type(pict, &type);
ok(hr == S_OK, "hr %08x\n", hr);
ok(type == PICTYPE_UNINITIALIZED, "type %d\n", type);
hr = IPicture_get_Handle(pict, &handle);
ok(hr == S_OK, "hr %08x\n", hr);
ok(handle == 0, "handle %08x\n", handle);
IPicture_Release(pict);
}
START_TEST(olepicture)
{
hOleaut32 = LoadLibraryA("oleaut32.dll");
pOleLoadPicture = (void*)GetProcAddress(hOleaut32, "OleLoadPicture");
pOleCreatePictureIndirect = (void*)GetProcAddress(hOleaut32, "OleCreatePictureIndirect");
if (!pOleLoadPicture)
return;
@ -414,6 +443,7 @@ START_TEST(olepicture)
test_empty_image_2();
test_Invoke();
test_OleCreatePictureIndirect();
}