oleaut32: Add PICTYPE_NONE and PICTYPE_UNINITIALIZED to IPicture_get_Attributes.

This commit is contained in:
Nikolay Sivov 2009-01-06 00:25:43 +03:00 committed by Alexandre Julliard
parent e46d25a661
commit 5b88f0d916
2 changed files with 29 additions and 0 deletions

View File

@ -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 */

View File

@ -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();
}