mirror of
git://source.winehq.org/git/wine.git
synced 2024-07-22 11:44:11 +00:00
ddrawex/tests: Simplify refcount helper.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
5a0f483641
commit
0666950b38
|
@ -37,10 +37,11 @@ static IDirectDraw *createDDraw(void)
|
||||||
return SUCCEEDED(hr) ? dd : NULL;
|
return SUCCEEDED(hr) ? dd : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ULONG get_ref(IUnknown *o)
|
static ULONG get_refcount(void *iface)
|
||||||
{
|
{
|
||||||
IUnknown_AddRef(o);
|
IUnknown *unknown = iface;
|
||||||
return IUnknown_Release(o);
|
IUnknown_AddRef(unknown);
|
||||||
|
return IUnknown_Release(unknown);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void RefCountTest(void)
|
static void RefCountTest(void)
|
||||||
|
@ -52,11 +53,11 @@ static void RefCountTest(void)
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
ULONG ref;
|
ULONG ref;
|
||||||
|
|
||||||
ref = get_ref((IUnknown *) dd1);
|
ref = get_refcount(dd1);
|
||||||
ok(ref == 1, "Unexpected refcount %lu.\n", ref);
|
ok(ref == 1, "Unexpected refcount %lu.\n", ref);
|
||||||
|
|
||||||
IDirectDraw_AddRef(dd1);
|
IDirectDraw_AddRef(dd1);
|
||||||
ref = get_ref((IUnknown *) dd1);
|
ref = get_refcount(dd1);
|
||||||
if (ref == 1)
|
if (ref == 1)
|
||||||
{
|
{
|
||||||
win_skip("Refcounting is broken\n");
|
win_skip("Refcounting is broken\n");
|
||||||
|
@ -65,15 +66,15 @@ static void RefCountTest(void)
|
||||||
}
|
}
|
||||||
ok(ref == 2, "Unexpected refcount %lu.\n", ref);
|
ok(ref == 2, "Unexpected refcount %lu.\n", ref);
|
||||||
IDirectDraw_Release(dd1);
|
IDirectDraw_Release(dd1);
|
||||||
ref = get_ref((IUnknown *) dd1);
|
ref = get_refcount(dd1);
|
||||||
ok(ref == 1, "Unexpected refcount %lu.\n", ref);
|
ok(ref == 1, "Unexpected refcount %lu.\n", ref);
|
||||||
|
|
||||||
IDirectDraw_QueryInterface(dd1, &IID_IDirectDraw2, (void **) &dd2);
|
IDirectDraw_QueryInterface(dd1, &IID_IDirectDraw2, (void **) &dd2);
|
||||||
ref = get_ref((IUnknown *) dd2);
|
ref = get_refcount(dd2);
|
||||||
ok(ref == 2, "Unexpected refcount %lu.\n", ref);
|
ok(ref == 2, "Unexpected refcount %lu.\n", ref);
|
||||||
|
|
||||||
IDirectDraw_QueryInterface(dd1, &IID_IDirectDraw3, (void **) &dd3);
|
IDirectDraw_QueryInterface(dd1, &IID_IDirectDraw3, (void **) &dd3);
|
||||||
ref = get_ref((IUnknown *) dd3);
|
ref = get_refcount(dd3);
|
||||||
ok(ref == 3, "Unexpected refcount %lu.\n", ref);
|
ok(ref == 3, "Unexpected refcount %lu.\n", ref);
|
||||||
|
|
||||||
hr = IDirectDraw_QueryInterface(dd1, &IID_IDirectDraw4, (void **) &dd4);
|
hr = IDirectDraw_QueryInterface(dd1, &IID_IDirectDraw4, (void **) &dd4);
|
||||||
|
@ -85,14 +86,14 @@ static void RefCountTest(void)
|
||||||
IDirectDraw3_Release(dd3);
|
IDirectDraw3_Release(dd3);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ref = get_ref((IUnknown *) dd4);
|
ref = get_refcount(dd4);
|
||||||
ok(ref == 4, "Unexpected refcount %lu.\n", ref);
|
ok(ref == 4, "Unexpected refcount %lu.\n", ref);
|
||||||
|
|
||||||
IDirectDraw_Release(dd1);
|
IDirectDraw_Release(dd1);
|
||||||
IDirectDraw2_Release(dd2);
|
IDirectDraw2_Release(dd2);
|
||||||
IDirectDraw3_Release(dd3);
|
IDirectDraw3_Release(dd3);
|
||||||
|
|
||||||
ref = get_ref((IUnknown *) dd4);
|
ref = get_refcount(dd4);
|
||||||
ok(ref == 1, "Unexpected refcount %lu.\n", ref);
|
ok(ref == 1, "Unexpected refcount %lu.\n", ref);
|
||||||
|
|
||||||
IDirectDraw4_Release(dd4);
|
IDirectDraw4_Release(dd4);
|
||||||
|
|
Loading…
Reference in a new issue