qcap/tests: Add some tests for IPersistPropertyBag on the AVI compressor.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
71239f31ad
commit
5f32efcf19
|
@ -330,6 +330,89 @@ static LRESULT CALLBACK driver_proc(DWORD_PTR id, HDRVR driver, UINT msg,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI property_bag_QueryInterface(IPropertyBag *iface, REFIID iid, void **out)
|
||||
{
|
||||
ok(0, "Unexpected call (iid %s).\n", wine_dbgstr_guid(iid));
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
static ULONG WINAPI property_bag_AddRef(IPropertyBag *iface)
|
||||
{
|
||||
ok(0, "Unexpected call.\n");
|
||||
return 2;
|
||||
}
|
||||
|
||||
static ULONG WINAPI property_bag_Release(IPropertyBag *iface)
|
||||
{
|
||||
ok(0, "Unexpected call.\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
static const WCHAR fcchandlerW[] = {'F','c','c','H','a','n','d','l','e','r',0};
|
||||
static BSTR ppb_handler;
|
||||
static unsigned int ppb_got_read;
|
||||
|
||||
static HRESULT WINAPI property_bag_Read(IPropertyBag *iface, const WCHAR *name, VARIANT *var, IErrorLog *log)
|
||||
{
|
||||
ok(!lstrcmpW(name, fcchandlerW), "Got unexpected name %s.\n", wine_dbgstr_w(name));
|
||||
todo_wine ok(V_VT(var) == VT_BSTR, "Got unexpected type %u.\n", V_VT(var));
|
||||
ok(!log, "Got unexpected error log %p.\n", log);
|
||||
V_BSTR(var) = SysAllocString(ppb_handler);
|
||||
ppb_got_read++;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI property_bag_Write(IPropertyBag *iface, const WCHAR *name, VARIANT *var)
|
||||
{
|
||||
ok(0, "Unexpected call (name %s).\n", wine_dbgstr_w(name));
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
static const IPropertyBagVtbl property_bag_vtbl =
|
||||
{
|
||||
property_bag_QueryInterface,
|
||||
property_bag_AddRef,
|
||||
property_bag_Release,
|
||||
property_bag_Read,
|
||||
property_bag_Write,
|
||||
};
|
||||
|
||||
static void test_property_bag(IMoniker *mon)
|
||||
{
|
||||
IPropertyBag property_bag = {&property_bag_vtbl};
|
||||
IPropertyBag *devenum_bag;
|
||||
IPersistPropertyBag *ppb;
|
||||
VARIANT var;
|
||||
HRESULT hr;
|
||||
ULONG ref;
|
||||
|
||||
hr = IMoniker_BindToStorage(mon, NULL, NULL, &IID_IPropertyBag, (void **)&devenum_bag);
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
|
||||
VariantInit(&var);
|
||||
hr = IPropertyBag_Read(devenum_bag, fcchandlerW, &var, NULL);
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
ppb_handler = V_BSTR(&var);
|
||||
|
||||
hr = CoCreateInstance(&CLSID_AVICo, NULL, CLSCTX_INPROC_SERVER,
|
||||
&IID_IPersistPropertyBag, (void **)&ppb);
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
|
||||
hr = IPersistPropertyBag_InitNew(ppb);
|
||||
todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
|
||||
ppb_got_read = 0;
|
||||
hr = IPersistPropertyBag_Load(ppb, &property_bag, NULL);
|
||||
todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
ok(ppb_got_read == 1, "Got %u calls to Read().\n", ppb_got_read);
|
||||
|
||||
ref = IPersistPropertyBag_Release(ppb);
|
||||
ok(!ref, "Got unexpected refcount %d.\n", ref);
|
||||
|
||||
VariantClear(&var);
|
||||
IPropertyBag_Release(devenum_bag);
|
||||
}
|
||||
|
||||
START_TEST(avico)
|
||||
{
|
||||
static const WCHAR test_display_name[] = {'@','d','e','v','i','c','e',':',
|
||||
|
@ -373,8 +456,11 @@ START_TEST(avico)
|
|||
ref = IBaseFilter_Release(filter);
|
||||
ok(!ref, "Got outstanding refcount %d.\n", ref);
|
||||
}
|
||||
CoTaskMemFree(name);
|
||||
|
||||
if (!memcmp(name, test_display_name, 11 * sizeof(WCHAR)))
|
||||
test_property_bag(mon);
|
||||
|
||||
CoTaskMemFree(name);
|
||||
IMoniker_Release(mon);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue