static void test_apm() { OLE_HANDLE handle; LPSTREAM stream; IPicture *pict; HGLOBAL hglob; LPBYTE *data; LONG cxy; BOOL keep; short type; hglob = GlobalAlloc (0, sizeof(apmdata)); data = GlobalLock(hglob); memcpy(data, apmdata, sizeof(apmdata)); ole_check(CreateStreamOnHGlobal(hglob, TRUE, &stream)); ole_check(OleLoadPictureEx(stream, sizeof(apmdata), TRUE, &IID_IPicture, 100, 100, 0, (LPVOID *)&pict)); ole_check(IPicture_get_Handle(pict, &handle)); ok(handle != 0, "handle is null\n"); ole_check(IPicture_get_Type(pict, &type)); expect_eq(type, PICTYPE_METAFILE, short, "%d"); ole_check(IPicture_get_Height(pict, &cxy)); expect_eq(cxy, 1667, LONG, "%d"); ole_check(IPicture_get_Width(pict, &cxy)); expect_eq(cxy, 1323, LONG, "%d"); ole_check(IPicture_get_KeepOriginalFormat(pict, &keep)); todo_wine expect_eq(keep, FALSE, LONG, "%d"); ole_expect(IPicture_get_hPal(pict, &handle), E_FAIL); IPicture_Release(pict); IStream_Release(stream); }
static void test_pic_with_stream(LPSTREAM stream, unsigned int imgsize) { IPicture* pic = NULL; HRESULT hres; LPVOID pvObj = NULL; OLE_HANDLE handle, hPal; OLE_XSIZE_HIMETRIC width; OLE_YSIZE_HIMETRIC height; short type; DWORD attr; ULONG res; pvObj = NULL; hres = pOleLoadPicture(stream, imgsize, TRUE, &IID_IPicture, &pvObj); pic = pvObj; ok(hres == S_OK,"OLP (NULL,..) does not return 0, but 0x%08lx\n",hres); ok(pic != NULL,"OLP (NULL,..) returns NULL, instead of !NULL\n"); if (pic == NULL) return; pvObj = NULL; hres = IPicture_QueryInterface (pic, &IID_IPicture, &pvObj); ok(hres == S_OK,"IPicture_QI does not return S_OK, but 0x%08lx\n", hres); ok(pvObj != NULL,"IPicture_QI does return NULL, instead of a ptr\n"); IPicture_Release ((IPicture*)pvObj); handle = 0; hres = IPicture_get_Handle (pic, &handle); ok(hres == S_OK,"IPicture_get_Handle does not return S_OK, but 0x%08lx\n", hres); ok(handle != 0, "IPicture_get_Handle returns a NULL handle, but it should be non NULL\n"); width = 0; hres = IPicture_get_Width (pic, &width); ok(hres == S_OK,"IPicture_get_Width does not return S_OK, but 0x%08lx\n", hres); ok(width != 0, "IPicture_get_Width returns 0, but it should not be 0.\n"); height = 0; hres = IPicture_get_Height (pic, &height); ok(hres == S_OK,"IPicture_get_Height does not return S_OK, but 0x%08lx\n", hres); ok(height != 0, "IPicture_get_Height returns 0, but it should not be 0.\n"); type = 0; hres = IPicture_get_Type (pic, &type); ok(hres == S_OK,"IPicture_get_Type does not return S_OK, but 0x%08lx\n", hres); ok(type == PICTYPE_BITMAP, "IPicture_get_Type returns %d, but it should be PICTYPE_BITMAP(%d).\n", type, PICTYPE_BITMAP); attr = 0; hres = IPicture_get_Attributes (pic, &attr); ok(hres == S_OK,"IPicture_get_Attributes does not return S_OK, but 0x%08lx\n", hres); ok(attr == 0, "IPicture_get_Attributes returns %ld, but it should be 0.\n", attr); hPal = 0; hres = IPicture_get_hPal (pic, &hPal); ok(hres == S_OK,"IPicture_get_hPal does not return S_OK, but 0x%08lx\n", hres); /* a single pixel b/w image has no palette */ ok(hPal == 0, "IPicture_get_hPal returns %ld, but it should be 0.\n", (long)hPal); res = IPicture_Release (pic); ok (res == 0, "refcount after release is %ld, but should be 0?\n", res); }