ddraw/tests: Use ULONG instead of unsigned long.

This commit is contained in:
Michael Stefaniuc 2009-03-19 11:22:15 +01:00 committed by Alexandre Julliard
parent 2df012a01a
commit 58f2a01e23
2 changed files with 63 additions and 63 deletions

View File

@ -693,7 +693,7 @@ static void QueryInterface(void)
* partially in the refcount test
*/
static unsigned long getref(IUnknown *iface)
static ULONG getref(IUnknown *iface)
{
IUnknown_AddRef(iface);
return IUnknown_Release(iface);
@ -708,7 +708,7 @@ static void GetDDInterface_1(void)
IDirectDraw2 *dd2;
IDirectDraw4 *dd4;
IDirectDraw7 *dd7;
unsigned long ref1, ref2, ref4, ref7;
ULONG ref1, ref2, ref4, ref7;
void *dd;
/* Create a surface */
@ -733,21 +733,21 @@ static void GetDDInterface_1(void)
ok(ret == DD_OK, "IDirectDraw7_QueryInterface returned %08x\n", ret);
ref1 = getref((IUnknown *) lpDD);
ok(ref1 == 1, "IDirectDraw refcount is %ld\n", ref1);
ok(ref1 == 1, "IDirectDraw refcount is %d\n", ref1);
ref2 = getref((IUnknown *) dd2);
ok(ref2 == 1, "IDirectDraw2 refcount is %ld\n", ref2);
ok(ref2 == 1, "IDirectDraw2 refcount is %d\n", ref2);
ref4 = getref((IUnknown *) dd4);
ok(ref4 == 1, "IDirectDraw4 refcount is %ld\n", ref4);
ok(ref4 == 1, "IDirectDraw4 refcount is %d\n", ref4);
ref7 = getref((IUnknown *) dd7);
ok(ref7 == 1, "IDirectDraw7 refcount is %ld\n", ref7);
ok(ref7 == 1, "IDirectDraw7 refcount is %d\n", ref7);
ret = IDirectDrawSurface2_GetDDInterface(dsurface2, &dd);
ok(ret == DD_OK, "IDirectDrawSurface7_GetDDInterface returned %08x\n", ret);
ok(getref((IUnknown *) lpDD) == ref1 + 1, "IDirectDraw refcount was increased by %ld\n", getref((IUnknown *) lpDD) - ref1);
ok(getref((IUnknown *) dd2) == ref2 + 0, "IDirectDraw2 refcount was increased by %ld\n", getref((IUnknown *) dd2) - ref2);
ok(getref((IUnknown *) dd4) == ref4 + 0, "IDirectDraw4 refcount was increased by %ld\n", getref((IUnknown *) dd4) - ref4);
ok(getref((IUnknown *) dd7) == ref7 + 0, "IDirectDraw7 refcount was increased by %ld\n", getref((IUnknown *) dd7) - ref7);
ok(getref((IUnknown *) lpDD) == ref1 + 1, "IDirectDraw refcount was increased by %d\n", getref((IUnknown *) lpDD) - ref1);
ok(getref((IUnknown *) dd2) == ref2 + 0, "IDirectDraw2 refcount was increased by %d\n", getref((IUnknown *) dd2) - ref2);
ok(getref((IUnknown *) dd4) == ref4 + 0, "IDirectDraw4 refcount was increased by %d\n", getref((IUnknown *) dd4) - ref4);
ok(getref((IUnknown *) dd7) == ref7 + 0, "IDirectDraw7 refcount was increased by %d\n", getref((IUnknown *) dd7) - ref7);
ok(dd == lpDD, "Returned interface pointer is not equal to the creation interface\n");
IUnknown_Release((IUnknown *) dd);
@ -772,7 +772,7 @@ static void GetDDInterface_2(void)
IDirectDraw2 *dd2;
IDirectDraw4 *dd4;
IDirectDraw7 *dd7;
unsigned long ref1, ref2, ref4, ref7;
ULONG ref1, ref2, ref4, ref7;
void *dd;
ret = IDirectDraw_QueryInterface(lpDD, &IID_IDirectDraw2, (void **) &dd2);
@ -798,21 +798,21 @@ static void GetDDInterface_2(void)
ok(ret == DD_OK, "IDirectDrawSurface_QueryInterface returned %08x\n", ret);
ref1 = getref((IUnknown *) lpDD);
ok(ref1 == 1, "IDirectDraw refcount is %ld\n", ref1);
ok(ref1 == 1, "IDirectDraw refcount is %d\n", ref1);
ref2 = getref((IUnknown *) dd2);
ok(ref2 == 1, "IDirectDraw2 refcount is %ld\n", ref2);
ok(ref2 == 1, "IDirectDraw2 refcount is %d\n", ref2);
ref4 = getref((IUnknown *) dd4);
ok(ref4 == 1, "IDirectDraw4 refcount is %ld\n", ref4);
ok(ref4 == 1, "IDirectDraw4 refcount is %d\n", ref4);
ref7 = getref((IUnknown *) dd7);
ok(ref7 == 1, "IDirectDraw7 refcount is %ld\n", ref7);
ok(ref7 == 1, "IDirectDraw7 refcount is %d\n", ref7);
ret = IDirectDrawSurface2_GetDDInterface(dsurface2, &dd);
ok(ret == DD_OK, "IDirectDrawSurface7_GetDDInterface returned %08x\n", ret);
ok(getref((IUnknown *) lpDD) == ref1 + 0, "IDirectDraw refcount was increased by %ld\n", getref((IUnknown *) lpDD) - ref1);
ok(getref((IUnknown *) dd2) == ref2 + 1, "IDirectDraw2 refcount was increased by %ld\n", getref((IUnknown *) dd2) - ref2);
ok(getref((IUnknown *) dd4) == ref4 + 0, "IDirectDraw4 refcount was increased by %ld\n", getref((IUnknown *) dd4) - ref4);
ok(getref((IUnknown *) dd7) == ref7 + 0, "IDirectDraw7 refcount was increased by %ld\n", getref((IUnknown *) dd7) - ref7);
ok(getref((IUnknown *) lpDD) == ref1 + 0, "IDirectDraw refcount was increased by %d\n", getref((IUnknown *) lpDD) - ref1);
ok(getref((IUnknown *) dd2) == ref2 + 1, "IDirectDraw2 refcount was increased by %d\n", getref((IUnknown *) dd2) - ref2);
ok(getref((IUnknown *) dd4) == ref4 + 0, "IDirectDraw4 refcount was increased by %d\n", getref((IUnknown *) dd4) - ref4);
ok(getref((IUnknown *) dd7) == ref7 + 0, "IDirectDraw7 refcount was increased by %d\n", getref((IUnknown *) dd7) - ref7);
ok(dd == dd2, "Returned interface pointer is not equal to the creation interface\n");
IUnknown_Release((IUnknown *) dd);
@ -833,7 +833,7 @@ static void GetDDInterface_4(void)
IDirectDraw2 *dd2;
IDirectDraw4 *dd4;
IDirectDraw7 *dd7;
unsigned long ref1, ref2, ref4, ref7;
ULONG ref1, ref2, ref4, ref7;
void *dd;
ret = IDirectDraw_QueryInterface(lpDD, &IID_IDirectDraw2, (void **) &dd2);
@ -859,20 +859,20 @@ static void GetDDInterface_4(void)
ok(ret == DD_OK, "IDirectDrawSurface_QueryInterface returned %08x\n", ret);
ref1 = getref((IUnknown *) lpDD);
ok(ref1 == 1, "IDirectDraw refcount is %ld\n", ref1);
ok(ref1 == 1, "IDirectDraw refcount is %d\n", ref1);
ref2 = getref((IUnknown *) dd2);
ok(ref2 == 1, "IDirectDraw2 refcount is %ld\n", ref2);
ok(ref2 == 1, "IDirectDraw2 refcount is %d\n", ref2);
ref4 = getref((IUnknown *) dd4);
ok(ref4 == 2, "IDirectDraw4 refcount is %ld\n", ref4);
ok(ref4 == 2, "IDirectDraw4 refcount is %d\n", ref4);
ref7 = getref((IUnknown *) dd7);
ok(ref7 == 1, "IDirectDraw7 refcount is %ld\n", ref7);
ok(ref7 == 1, "IDirectDraw7 refcount is %d\n", ref7);
ret = IDirectDrawSurface4_GetDDInterface(dsurface4, &dd);
ok(ret == DD_OK, "IDirectDrawSurface7_GetDDInterface returned %08x\n", ret);
ok(getref((IUnknown *) lpDD) == ref1 + 0, "IDirectDraw refcount was increased by %ld\n", getref((IUnknown *) lpDD) - ref1);
ok(getref((IUnknown *) dd2) == ref2 + 0, "IDirectDraw2 refcount was increased by %ld\n", getref((IUnknown *) dd2) - ref2);
ok(getref((IUnknown *) dd4) == ref4 + 1, "IDirectDraw4 refcount was increased by %ld\n", getref((IUnknown *) dd4) - ref4);
ok(getref((IUnknown *) dd7) == ref7 + 0, "IDirectDraw7 refcount was increased by %ld\n", getref((IUnknown *) dd7) - ref7);
ok(getref((IUnknown *) lpDD) == ref1 + 0, "IDirectDraw refcount was increased by %d\n", getref((IUnknown *) lpDD) - ref1);
ok(getref((IUnknown *) dd2) == ref2 + 0, "IDirectDraw2 refcount was increased by %d\n", getref((IUnknown *) dd2) - ref2);
ok(getref((IUnknown *) dd4) == ref4 + 1, "IDirectDraw4 refcount was increased by %d\n", getref((IUnknown *) dd4) - ref4);
ok(getref((IUnknown *) dd7) == ref7 + 0, "IDirectDraw7 refcount was increased by %d\n", getref((IUnknown *) dd7) - ref7);
ok(dd == dd4, "Returned interface pointer is not equal to the creation interface\n");
IUnknown_Release((IUnknown *) dd);
@ -880,10 +880,10 @@ static void GetDDInterface_4(void)
/* Now test what happens if we QI the surface for some other version - It should still return the creation interface */
ret = IDirectDrawSurface2_GetDDInterface(dsurface2, &dd);
ok(ret == DD_OK, "IDirectDrawSurface7_GetDDInterface returned %08x\n", ret);
ok(getref((IUnknown *) lpDD) == ref1 + 0, "IDirectDraw refcount was increased by %ld\n", getref((IUnknown *) lpDD) - ref1);
ok(getref((IUnknown *) dd2) == ref2 + 0, "IDirectDraw2 refcount was increased by %ld\n", getref((IUnknown *) dd2) - ref2);
ok(getref((IUnknown *) dd4) == ref4 + 1, "IDirectDraw4 refcount was increased by %ld\n", getref((IUnknown *) dd4) - ref4);
ok(getref((IUnknown *) dd7) == ref7 + 0, "IDirectDraw7 refcount was increased by %ld\n", getref((IUnknown *) dd7) - ref7);
ok(getref((IUnknown *) lpDD) == ref1 + 0, "IDirectDraw refcount was increased by %d\n", getref((IUnknown *) lpDD) - ref1);
ok(getref((IUnknown *) dd2) == ref2 + 0, "IDirectDraw2 refcount was increased by %d\n", getref((IUnknown *) dd2) - ref2);
ok(getref((IUnknown *) dd4) == ref4 + 1, "IDirectDraw4 refcount was increased by %d\n", getref((IUnknown *) dd4) - ref4);
ok(getref((IUnknown *) dd7) == ref7 + 0, "IDirectDraw7 refcount was increased by %d\n", getref((IUnknown *) dd7) - ref7);
ok(dd == dd4, "Returned interface pointer is not equal to the creation interface\n");
IUnknown_Release((IUnknown *) dd);
@ -904,7 +904,7 @@ static void GetDDInterface_7(void)
IDirectDraw2 *dd2;
IDirectDraw4 *dd4;
IDirectDraw7 *dd7;
unsigned long ref1, ref2, ref4, ref7;
ULONG ref1, ref2, ref4, ref7;
void *dd;
ret = IDirectDraw_QueryInterface(lpDD, &IID_IDirectDraw2, (void **) &dd2);
@ -930,20 +930,20 @@ static void GetDDInterface_7(void)
ok(ret == DD_OK, "IDirectDrawSurface_QueryInterface returned %08x\n", ret);
ref1 = getref((IUnknown *) lpDD);
ok(ref1 == 1, "IDirectDraw refcount is %ld\n", ref1);
ok(ref1 == 1, "IDirectDraw refcount is %d\n", ref1);
ref2 = getref((IUnknown *) dd2);
ok(ref2 == 1, "IDirectDraw2 refcount is %ld\n", ref2);
ok(ref2 == 1, "IDirectDraw2 refcount is %d\n", ref2);
ref4 = getref((IUnknown *) dd4);
ok(ref4 == 1, "IDirectDraw4 refcount is %ld\n", ref4);
ok(ref4 == 1, "IDirectDraw4 refcount is %d\n", ref4);
ref7 = getref((IUnknown *) dd7);
ok(ref7 == 2, "IDirectDraw7 refcount is %ld\n", ref7);
ok(ref7 == 2, "IDirectDraw7 refcount is %d\n", ref7);
ret = IDirectDrawSurface7_GetDDInterface(dsurface7, &dd);
ok(ret == DD_OK, "IDirectDrawSurface7_GetDDInterface returned %08x\n", ret);
ok(getref((IUnknown *) lpDD) == ref1 + 0, "IDirectDraw refcount was increased by %ld\n", getref((IUnknown *) lpDD) - ref1);
ok(getref((IUnknown *) dd2) == ref2 + 0, "IDirectDraw2 refcount was increased by %ld\n", getref((IUnknown *) dd2) - ref2);
ok(getref((IUnknown *) dd4) == ref4 + 0, "IDirectDraw4 refcount was increased by %ld\n", getref((IUnknown *) dd4) - ref4);
ok(getref((IUnknown *) dd7) == ref7 + 1, "IDirectDraw7 refcount was increased by %ld\n", getref((IUnknown *) dd7) - ref7);
ok(getref((IUnknown *) lpDD) == ref1 + 0, "IDirectDraw refcount was increased by %d\n", getref((IUnknown *) lpDD) - ref1);
ok(getref((IUnknown *) dd2) == ref2 + 0, "IDirectDraw2 refcount was increased by %d\n", getref((IUnknown *) dd2) - ref2);
ok(getref((IUnknown *) dd4) == ref4 + 0, "IDirectDraw4 refcount was increased by %d\n", getref((IUnknown *) dd4) - ref4);
ok(getref((IUnknown *) dd7) == ref7 + 1, "IDirectDraw7 refcount was increased by %d\n", getref((IUnknown *) dd7) - ref7);
ok(dd == dd7, "Returned interface pointer is not equal to the creation interface\n");
IUnknown_Release((IUnknown *) dd);
@ -951,10 +951,10 @@ static void GetDDInterface_7(void)
/* Now test what happens if we QI the surface for some other version - It should still return the creation interface */
ret = IDirectDrawSurface4_GetDDInterface(dsurface4, &dd);
ok(ret == DD_OK, "IDirectDrawSurface7_GetDDInterface returned %08x\n", ret);
ok(getref((IUnknown *) lpDD) == ref1 + 0, "IDirectDraw refcount was increased by %ld\n", getref((IUnknown *) lpDD) - ref1);
ok(getref((IUnknown *) dd2) == ref2 + 0, "IDirectDraw2 refcount was increased by %ld\n", getref((IUnknown *) dd2) - ref2);
ok(getref((IUnknown *) dd4) == ref4 + 0, "IDirectDraw4 refcount was increased by %ld\n", getref((IUnknown *) dd4) - ref4);
ok(getref((IUnknown *) dd7) == ref7 + 1, "IDirectDraw7 refcount was increased by %ld\n", getref((IUnknown *) dd7) - ref7);
ok(getref((IUnknown *) lpDD) == ref1 + 0, "IDirectDraw refcount was increased by %d\n", getref((IUnknown *) lpDD) - ref1);
ok(getref((IUnknown *) dd2) == ref2 + 0, "IDirectDraw2 refcount was increased by %d\n", getref((IUnknown *) dd2) - ref2);
ok(getref((IUnknown *) dd4) == ref4 + 0, "IDirectDraw4 refcount was increased by %d\n", getref((IUnknown *) dd4) - ref4);
ok(getref((IUnknown *) dd7) == ref7 + 1, "IDirectDraw7 refcount was increased by %d\n", getref((IUnknown *) dd7) - ref7);
ok(dd == dd7, "Returned interface pointer is not equal to the creation interface\n");
IUnknown_Release((IUnknown *) dd);

View File

@ -33,7 +33,7 @@ static void init_function_pointers(void)
pDirectDrawCreateEx = (void*)GetProcAddress(hmod, "DirectDrawCreateEx");
}
static unsigned long getRefcount(IUnknown *iface)
static ULONG getRefcount(IUnknown *iface)
{
IUnknown_AddRef(iface);
return IUnknown_Release(iface);
@ -42,7 +42,7 @@ static unsigned long getRefcount(IUnknown *iface)
static void test_ddraw_objects(void)
{
HRESULT hr;
unsigned long ref;
ULONG ref;
IDirectDraw7 *DDraw7;
IDirectDraw4 *DDraw4;
IDirectDraw2 *DDraw2;
@ -70,7 +70,7 @@ static void test_ddraw_objects(void)
ok(hr == DD_OK, "IDirectDraw7_QueryInterface returned %08x\n", hr);
ref = getRefcount( (IUnknown *) DDraw7);
ok(ref == 1, "Got refcount %ld, expected 1\n", ref);
ok(ref == 1, "Got refcount %d, expected 1\n", ref);
/* Fails without a cooplevel */
hr = IDirectDraw7_CreatePalette(DDraw7, DDPCAPS_ALLOW256 | DDPCAPS_8BIT, Table, &palette, NULL);
@ -104,22 +104,22 @@ static void test_ddraw_objects(void)
/* DDraw refcount increased by 1 */
ref = getRefcount( (IUnknown *) DDraw7);
ok(ref == 2, "Got refcount %ld, expected 2\n", ref);
ok(ref == 2, "Got refcount %d, expected 2\n", ref);
/* Surface refcount starts with 1 */
ref = getRefcount( (IUnknown *) surface);
ok(ref == 1, "Got refcount %ld, expected 1\n", ref);
ok(ref == 1, "Got refcount %d, expected 1\n", ref);
hr = IDirectDraw7_CreatePalette(DDraw7, DDPCAPS_ALLOW256 | DDPCAPS_8BIT, Table, &palette, NULL);
ok(hr == DD_OK, "CreatePalette returned %08x\n", hr);
/* DDraw refcount increased by 1 */
ref = getRefcount( (IUnknown *) DDraw7);
ok(ref == 3, "Got refcount %ld, expected 3\n", ref);
ok(ref == 3, "Got refcount %d, expected 3\n", ref);
/* Palette starts with 1 */
ref = getRefcount( (IUnknown *) palette);
ok(ref == 1, "Got refcount %ld, expected 1\n", ref);
ok(ref == 1, "Got refcount %d, expected 1\n", ref);
/* Test attaching a palette to a surface */
hr = IDirectDrawSurface7_SetPalette(surface, palette);
@ -127,64 +127,64 @@ static void test_ddraw_objects(void)
/* Palette refcount increased, surface stays the same */
ref = getRefcount( (IUnknown *) palette);
ok(ref == 2, "Got refcount %ld, expected 2\n", ref);
ok(ref == 2, "Got refcount %d, expected 2\n", ref);
ref = getRefcount( (IUnknown *) surface);
ok(ref == 1, "Got refcount %ld, expected 1\n", ref);
ok(ref == 1, "Got refcount %d, expected 1\n", ref);
IDirectDrawSurface7_Release(surface);
/* Increased before - decrease now */
ref = getRefcount( (IUnknown *) DDraw7);
ok(ref == 2, "Got refcount %ld, expected 2\n", ref);
ok(ref == 2, "Got refcount %d, expected 2\n", ref);
/* Releasing the surface detaches the palette */
ref = getRefcount( (IUnknown *) palette);
ok(ref == 1, "Got refcount %ld, expected 1\n", ref);
ok(ref == 1, "Got refcount %d, expected 1\n", ref);
IDirectDrawPalette_Release(palette);
/* Increased before - decrease now */
ref = getRefcount( (IUnknown *) DDraw7);
ok(ref == 1, "Got refcount %ld, expected 1\n", ref);
ok(ref == 1, "Got refcount %d, expected 1\n", ref);
/* Not all interfaces are AddRefed when a palette is created */
hr = IDirectDraw4_CreatePalette(DDraw4, DDPCAPS_ALLOW256 | DDPCAPS_8BIT, Table, &palette, NULL);
ok(hr == DD_OK, "CreatePalette returned %08x\n", hr);
ref = getRefcount( (IUnknown *) DDraw4);
ok(ref == 2, "Got refcount %ld, expected 2\n", ref);
ok(ref == 2, "Got refcount %d, expected 2\n", ref);
IDirectDrawPalette_Release(palette);
/* No addref here */
hr = IDirectDraw2_CreatePalette(DDraw2, DDPCAPS_ALLOW256 | DDPCAPS_8BIT, Table, &palette, NULL);
ok(hr == DD_OK, "CreatePalette returned %08x\n", hr);
ref = getRefcount( (IUnknown *) DDraw2);
ok(ref == 1, "Got refcount %ld, expected 1\n", ref);
ok(ref == 1, "Got refcount %d, expected 1\n", ref);
IDirectDrawPalette_Release(palette);
/* No addref here */
hr = IDirectDraw_CreatePalette(DDraw1, DDPCAPS_ALLOW256 | DDPCAPS_8BIT, Table, &palette, NULL);
ok(hr == DD_OK, "CreatePalette returned %08x\n", hr);
ref = getRefcount( (IUnknown *) DDraw1);
ok(ref == 1, "Got refcount %ld, expected 1\n", ref);
ok(ref == 1, "Got refcount %d, expected 1\n", ref);
IDirectDrawPalette_Release(palette);
/* Similar for surfaces */
hr = IDirectDraw4_CreateSurface(DDraw4, &ddsd, &surface4, NULL);
ok(hr == DD_OK, "CreateSurface returned %08x\n", hr);
ref = getRefcount( (IUnknown *) DDraw4);
ok(ref == 2, "Got refcount %ld, expected 2\n", ref);
ok(ref == 2, "Got refcount %d, expected 2\n", ref);
IDirectDrawSurface4_Release(surface4);
ddsd.dwSize = sizeof(DDSURFACEDESC);
hr = IDirectDraw2_CreateSurface(DDraw2, (DDSURFACEDESC *) &ddsd, &surface1, NULL);
ok(hr == DD_OK, "CreateSurface returned %08x\n", hr);
ref = getRefcount( (IUnknown *) DDraw2);
ok(ref == 1, "Got refcount %ld, expected 1\n", ref);
ok(ref == 1, "Got refcount %d, expected 1\n", ref);
IDirectDrawSurface_Release(surface1);
hr = IDirectDraw_CreateSurface(DDraw1, (DDSURFACEDESC *) &ddsd, &surface1, NULL);
ok(hr == DD_OK, "CreateSurface returned %08x\n", hr);
ref = getRefcount( (IUnknown *) DDraw1);
ok(ref == 1, "Got refcount %ld, expected 1\n", ref);
ok(ref == 1, "Got refcount %d, expected 1\n", ref);
IDirectDrawSurface_Release(surface1);
IDirectDraw7_Release(DDraw7);