static void test_metafile(void) { LPSTREAM stream; IPicture *pict; HGLOBAL hglob; LPBYTE *data; hglob = GlobalAlloc (0, sizeof(metafile)); data = GlobalLock(hglob); memcpy(data, metafile, sizeof(metafile)); ole_check(CreateStreamOnHGlobal(hglob, TRUE, &stream)); /* Windows does not load simple metafiles */ ole_expect(OleLoadPictureEx(stream, sizeof(metafile), TRUE, &IID_IPicture, 100, 100, 0, (LPVOID *)&pict), E_FAIL); IStream_Release(stream); }
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_dump_typelib(const char *name) { WCHAR wszName[MAX_PATH]; ITypeLib *typelib; int ifcount = sizeof(info)/sizeof(info[0]); int iface, func; MultiByteToWideChar(CP_UTF8, 0, name, -1, wszName, MAX_PATH); ole_check(LoadTypeLibEx(wszName, REGKIND_NONE, &typelib)); expect_eq(ITypeLib_GetTypeInfoCount(typelib), ifcount, UINT, "%d"); for (iface = 0; iface < ifcount; iface++) { const interface_info *if_info = &info[iface]; ITypeInfo *typeinfo; TYPEATTR *typeattr; BSTR bstrIfName; trace("Interface %s\n", if_info->name); ole_check(ITypeLib_GetTypeInfo(typelib, iface, &typeinfo)); ole_check(ITypeLib_GetDocumentation(typelib, iface, &bstrIfName, NULL, NULL, NULL)); expect_wstr_utf8val(bstrIfName, if_info->name); SysFreeString(bstrIfName); ole_check(ITypeInfo_GetTypeAttr(typeinfo, &typeattr)); expect_int(typeattr->typekind, if_info->type); expect_hex(typeattr->wTypeFlags, if_info->wTypeFlags); expect_int(typeattr->cbAlignment, if_info->cbAlignment); expect_int(typeattr->cbSizeInstance, if_info->cbSizeInstance); expect_int(typeattr->cbSizeVft, if_info->cbSizeVft); expect_int(typeattr->cFuncs, if_info->cFuncs); for (func = 0; func < typeattr->cFuncs; func++) { function_info *fn_info = (function_info *)&if_info->funcs[func]; FUNCDESC *desc; BSTR namesTab[256]; UINT cNames; int i; trace("Function %s\n", fn_info->names[0]); ole_check(ITypeInfo_GetFuncDesc(typeinfo, func, &desc)); expect_int(desc->memid, fn_info->memid); expect_int(desc->funckind, fn_info->funckind); expect_int(desc->invkind, fn_info->invkind); expect_int(desc->callconv, fn_info->callconv); expect_int(desc->cParams, fn_info->cParams); expect_int(desc->cParamsOpt, fn_info->cParamsOpt); expect_int(desc->oVft, fn_info->oVft); expect_int(desc->cScodes, fn_info->cScodes); expect_int(desc->wFuncFlags, fn_info->wFuncFlags); ole_check(ITypeInfo_GetNames(typeinfo, desc->memid, namesTab, 256, &cNames)); for (i = 0; i < cNames; i++) { expect_wstr_utf8val(namesTab[i], fn_info->names[i]); SysFreeString(namesTab[i]); } expect_null(fn_info->names[cNames]); check_type(&desc->elemdescFunc, &fn_info->ret_type); for (i = 0 ; i < desc->cParams; i++) { check_type(&desc->lprgelemdescParam[i], &fn_info->params[i]); } expect_int(fn_info->params[desc->cParams].vt, (VARTYPE)-1); ITypeInfo_ReleaseFuncDesc(typeinfo, desc); } ITypeInfo_ReleaseTypeAttr(typeinfo, typeattr); ITypeInfo_Release(typeinfo); } ITypeLib_Release(typelib); }