Commit 5a0f4836 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

ddrawex/tests: Build without -DWINE_NO_LONG_TYPES.

parent 2df68bd4
EXTRADEFS = -DWINE_NO_LONG_TYPES
TESTDLL = ddrawex.dll
IMPORTS = user32 gdi32
......
......@@ -32,9 +32,8 @@ static IDirectDraw *createDDraw(void)
HRESULT hr;
IDirectDraw *dd;
hr = IDirectDrawFactory_CreateDirectDraw(factory, NULL, NULL, DDSCL_NORMAL, 0,
0, &dd);
ok(hr == DD_OK, "Failed to create an IDirectDraw interface, hr = 0x%08x\n", hr);
hr = IDirectDrawFactory_CreateDirectDraw(factory, NULL, NULL, DDSCL_NORMAL, 0, 0, &dd);
ok(hr == DD_OK, "Unexpected hr %#lx.\n", hr);
return SUCCEEDED(hr) ? dd : NULL;
}
......@@ -54,7 +53,7 @@ static void RefCountTest(void)
ULONG ref;
ref = get_ref((IUnknown *) dd1);
ok(ref == 1, "A new ddraw object's refcount is %u, expected 1\n", ref);
ok(ref == 1, "Unexpected refcount %lu.\n", ref);
IDirectDraw_AddRef(dd1);
ref = get_ref((IUnknown *) dd1);
......@@ -64,18 +63,18 @@ static void RefCountTest(void)
IDirectDraw_Release(dd1);
return;
}
ok(ref == 2, "After AddRef the refcount is %u, expected 2\n", ref);
ok(ref == 2, "Unexpected refcount %lu.\n", ref);
IDirectDraw_Release(dd1);
ref = get_ref((IUnknown *) dd1);
ok(ref == 1, "After Release the refcount is %u, expected 1\n", ref);
ok(ref == 1, "Unexpected refcount %lu.\n", ref);
IDirectDraw_QueryInterface(dd1, &IID_IDirectDraw2, (void **) &dd2);
ref = get_ref((IUnknown *) dd2);
ok(ref == 2, "IDirectDraw2 refcount is %u, expected 2\n", ref);
ok(ref == 2, "Unexpected refcount %lu.\n", ref);
IDirectDraw_QueryInterface(dd1, &IID_IDirectDraw3, (void **) &dd3);
ref = get_ref((IUnknown *) dd3);
ok(ref == 3, "IDirectDraw3 refcount is %u, expected 3\n", ref);
ok(ref == 3, "Unexpected refcount %lu.\n", ref);
hr = IDirectDraw_QueryInterface(dd1, &IID_IDirectDraw4, (void **) &dd4);
if (FAILED(hr))
......@@ -87,14 +86,14 @@ static void RefCountTest(void)
return;
}
ref = get_ref((IUnknown *) dd4);
ok(ref == 4, "IDirectDraw4 refcount is %u, expected 4\n", ref);
ok(ref == 4, "Unexpected refcount %lu.\n", ref);
IDirectDraw_Release(dd1);
IDirectDraw2_Release(dd2);
IDirectDraw3_Release(dd3);
ref = get_ref((IUnknown *) dd4);
ok(ref == 1, "IDirectDraw4 refcount is %u, expected 1\n", ref);
ok(ref == 1, "Unexpected refcount %lu.\n", ref);
IDirectDraw4_Release(dd4);
}
......@@ -128,6 +127,6 @@ START_TEST(ddrawex)
}
if(classfactory) {
ref = IClassFactory_Release(classfactory);
todo_wine ok(ref == 1, "IClassFactory refcount wrong, ref = %u\n", ref);
todo_wine ok(ref == 1, "Unexpected refcount %lu.\n", ref);
}
}
......@@ -34,9 +34,8 @@ static IDirectDraw *createDDraw(void)
HRESULT hr;
IDirectDraw *dd;
hr = IDirectDrawFactory_CreateDirectDraw(factory, NULL, NULL, DDSCL_NORMAL, 0,
0, &dd);
ok(hr == DD_OK, "Failed to create an IDirectDraw interface, hr = 0x%08x\n", hr);
hr = IDirectDrawFactory_CreateDirectDraw(factory, NULL, NULL, DDSCL_NORMAL, 0, 0, &dd);
ok(hr == DD_OK, "Unexpected hr %#lx.\n", hr);
return SUCCEEDED(hr) ? dd : NULL;
}
......@@ -52,19 +51,19 @@ static void dctest_surf(IDirectDrawSurface *surf, int ddsdver) {
ddsd2.dwSize = sizeof(ddsd2);
hr = IDirectDrawSurface_GetDC(surf, &dc);
ok(hr == DD_OK, "IDirectDrawSurface_GetDC failed: 0x%08x\n", hr);
ok(hr == DD_OK, "Unexpected hr %#lx.\n", hr);
hr = IDirectDrawSurface_GetDC(surf, &dc);
ok(hr == DDERR_DCALREADYCREATED, "IDirectDrawSurface_GetDC failed: 0x%08x\n", hr);
ok(hr == DDERR_DCALREADYCREATED, "Unexpected hr %#lx.\n", hr);
ok(dc2 == (HDC) 0x1234, "The failed GetDC call changed the dc: %p\n", dc2);
hr = IDirectDrawSurface_Lock(surf, NULL, ddsdver == 1 ? &ddsd : ((DDSURFACEDESC *) &ddsd2), 0, NULL);
ok(hr == DDERR_SURFACEBUSY, "IDirectDrawSurface_Lock returned 0x%08x, expected DDERR_SURFACEBUSY\n", hr);
ok(hr == DDERR_SURFACEBUSY, "Unexpected hr %#lx.\n", hr);
hr = IDirectDrawSurface_ReleaseDC(surf, dc);
ok(hr == DD_OK, "IDirectDrawSurface_ReleaseDC failed: 0x%08x\n", hr);
ok(hr == DD_OK, "Unexpected hr %#lx.\n", hr);
hr = IDirectDrawSurface_ReleaseDC(surf, dc);
ok(hr == DDERR_NODC, "IDirectDrawSurface_ReleaseDC returned 0x%08x, expected DDERR_NODC\n", hr);
ok(hr == DDERR_NODC, "Unexpected hr %#lx.\n", hr);
}
static void GetDCTest_main(DDSURFACEDESC *ddsd, DDSURFACEDESC2 *ddsd2, void (*testfunc)(IDirectDrawSurface *surf, int ddsdver))
......@@ -84,19 +83,19 @@ static void GetDCTest_main(DDSURFACEDESC *ddsd, DDSURFACEDESC2 *ddsd2, void (*te
win_skip("Unsupported mode\n");
return;
}
ok(hr == DD_OK, "IDirectDraw_CreateSurface failed: 0x%08x\n", hr);
ok(hr == DD_OK, "Unexpected hr %#lx.\n", hr);
testfunc(surf, 1);
IDirectDrawSurface_Release(surf);
hr = IDirectDraw_QueryInterface(dd1, &IID_IDirectDraw2, (void **) &dd2);
ok(hr == DD_OK, "IDirectDraw_QueryInterface failed: 0x%08x\n", hr);
ok(hr == DD_OK, "Unexpected hr %#lx.\n", hr);
hr = IDirectDraw2_CreateSurface(dd2, ddsd, &surf, NULL);
ok(hr == DD_OK, "IDirectDraw2_CreateSurface failed: 0x%08x\n", hr);
ok(hr == DD_OK, "Unexpected hr %#lx.\n", hr);
testfunc(surf, 1);
hr = IDirectDrawSurface_QueryInterface(surf, &IID_IDirectDrawSurface2, (void **) &surf2);
ok(hr == DD_OK, "IDirectDrawSurface_QueryInterface failed: 0x%08x\n", hr);
ok(hr == DD_OK, "Unexpected hr %#lx.\n", hr);
testfunc((IDirectDrawSurface *) surf2, 1);
IDirectDrawSurface2_Release(surf2);
......@@ -104,14 +103,14 @@ static void GetDCTest_main(DDSURFACEDESC *ddsd, DDSURFACEDESC2 *ddsd2, void (*te
IDirectDraw2_Release(dd2);
hr = IDirectDraw_QueryInterface(dd1, &IID_IDirectDraw3, (void **) &dd3);
ok(hr == DD_OK, "IDirectDraw_QueryInterface failed: 0x%08x\n", hr);
ok(hr == DD_OK, "Unexpected hr %#lx.\n", hr);
hr = IDirectDraw3_CreateSurface(dd3, ddsd, &surf, NULL);
ok(hr == DD_OK, "IDirectDraw3_CreateSurface failed: 0x%08x\n", hr);
ok(hr == DD_OK, "Unexpected hr %#lx.\n", hr);
testfunc(surf, 1);
hr = IDirectDrawSurface_QueryInterface(surf, &IID_IDirectDrawSurface3, (void **) &surf3);
ok(hr == DD_OK, "IDirectDrawSurface_QueryInterface failed: 0x%08x\n", hr);
ok(hr == DD_OK, "Unexpected hr %#lx.\n", hr);
testfunc((IDirectDrawSurface *) surf3, 1);
IDirectDrawSurface3_Release(surf3);
......@@ -119,11 +118,11 @@ static void GetDCTest_main(DDSURFACEDESC *ddsd, DDSURFACEDESC2 *ddsd2, void (*te
IDirectDraw3_Release(dd3);
hr = IDirectDraw_QueryInterface(dd1, &IID_IDirectDraw4, (void **) &dd4);
ok(hr == DD_OK, "IDirectDraw_QueryInterface failed: 0x%08x\n", hr);
ok(hr == DD_OK, "Unexpected hr %#lx.\n", hr);
surf = NULL;
hr = IDirectDraw4_CreateSurface(dd4, ddsd2, &surf4, NULL);
ok(hr == DD_OK, "IDirectDraw4_CreateSurface failed: 0x%08x\n", hr);
ok(hr == DD_OK, "Unexpected hr %#lx.\n", hr);
testfunc((IDirectDrawSurface *) surf4, 2);
IDirectDrawSurface4_Release(surf4);
......@@ -171,13 +170,14 @@ static void CapsTest(void)
win_skip("Unsupported mode\n");
return;
}
ok(hr == DD_OK, "Creating a SYSMEM | VIDMEM surface returned 0x%08x, expected DD_OK\n", hr);
ok(hr == DD_OK, "Unexpected hr %#lx.\n", hr);
if(surf) IDirectDrawSurface_Release(surf);
IDirectDraw_Release(dd1);
}
static void dctest_sysvidmem(IDirectDrawSurface *surf, int ddsdver) {
static void dctest_sysvidmem(IDirectDrawSurface *surf, int ddsdver)
{
HRESULT hr;
HDC dc, dc2 = (HDC) 0x1234;
DDSURFACEDESC ddsd;
......@@ -189,30 +189,30 @@ static void dctest_sysvidmem(IDirectDrawSurface *surf, int ddsdver) {
ddsd2.dwSize = sizeof(ddsd2);
hr = IDirectDrawSurface_GetDC(surf, &dc);
ok(hr == DD_OK, "IDirectDrawSurface_GetDC failed: 0x%08x\n", hr);
ok(hr == DD_OK, "Unexpected hr %#lx.\n", hr);
hr = IDirectDrawSurface_GetDC(surf, &dc2);
ok(hr == DD_OK, "IDirectDrawSurface_GetDC failed: 0x%08x\n", hr);
ok(hr == DD_OK, "Unexpected hr %#lx.\n", hr);
ok(dc == dc2, "Got two different DCs\n");
hr = IDirectDrawSurface_Lock(surf, NULL, ddsdver == 1 ? &ddsd : ((DDSURFACEDESC *) &ddsd2), 0, NULL);
ok(hr == DD_OK, "IDirectDrawSurface_Lock returned 0x%08x, expected DD_OK\n", hr);
ok(hr == DD_OK, "Unexpected hr %#lx.\n", hr);
hr = IDirectDrawSurface_Lock(surf, NULL, ddsdver == 1 ? &ddsd : ((DDSURFACEDESC *) &ddsd2), 0, NULL);
ok(hr == DDERR_SURFACEBUSY, "IDirectDrawSurface_Lock returned 0x%08x, expected DDERR_SURFACEBUSY\n", hr);
ok(hr == DDERR_SURFACEBUSY, "Unexpected hr %#lx.\n", hr);
hr = IDirectDrawSurface_Unlock(surf, NULL);
ok(hr == DD_OK, "IDirectDrawSurface_Unlock returned 0x%08x, expected DD_OK\n", hr);
ok(hr == DD_OK, "Unexpected hr %#lx.\n", hr);
hr = IDirectDrawSurface_Unlock(surf, NULL);
ok(hr == DDERR_NOTLOCKED, "IDirectDrawSurface_Unlock returned 0x%08x, expected DDERR_NOTLOCKED\n", hr);
ok(hr == DDERR_NOTLOCKED, "Unexpected hr %#lx.\n", hr);
hr = IDirectDrawSurface_ReleaseDC(surf, dc);
ok(hr == DD_OK, "IDirectDrawSurface_ReleaseDC failed: 0x%08x\n", hr);
ok(hr == DD_OK, "Unexpected hr %#lx.\n", hr);
hr = IDirectDrawSurface_ReleaseDC(surf, dc);
ok(hr == DD_OK, "IDirectDrawSurface_ReleaseDC failed: 0x%08x\n", hr);
ok(hr == DD_OK, "Unexpected hr %#lx.\n", hr);
/* That works any number of times... */
hr = IDirectDrawSurface_ReleaseDC(surf, dc);
ok(hr == DD_OK, "IDirectDrawSurface_ReleaseDC failed: 0x%08x\n", hr);
ok(hr == DD_OK, "Unexpected hr %#lx.\n", hr);
}
static void SysVidMemTest(void)
......@@ -249,7 +249,7 @@ static void test_surface_from_dc3(void)
dd1 = createDDraw();
hr = IDirectDraw_QueryInterface(dd1, &IID_IDirectDraw3, (void **)&dd3);
ok(SUCCEEDED(hr), "IDirectDraw_QueryInterface failed, hr %#x.\n", hr);
ok(SUCCEEDED(hr), "Unexpected hr %#lx.\n", hr);
IDirectDraw_Release(dd1);
memset(&ddsd, 0, sizeof(ddsd));
......@@ -265,33 +265,33 @@ static void test_surface_from_dc3(void)
IDirectDraw3_Release(dd3);
return;
}
ok(SUCCEEDED(hr), "CreateSurface failed, hr %#x.\n", hr);
ok(SUCCEEDED(hr), "Unexpected hr %#lx.\n", hr);
hr = IDirectDrawSurface3_QueryInterface(surf1, &IID_IDirectDrawSurface, (void **)&surf3);
ok(SUCCEEDED(hr), "QueryInterface failed, hr %#x.\n", hr);
ok(SUCCEEDED(hr), "Unexpected hr %#lx.\n", hr);
IDirectDrawSurface_Release(surf1);
hr = IDirectDrawSurface3_GetDC(surf3, &dc);
ok(SUCCEEDED(hr), "GetDC failed, hr %#x.\n", hr);
ok(SUCCEEDED(hr), "Unexpected hr %#lx.\n", hr);
hr = IDirectDraw3_GetSurfaceFromDC(dd3, dc, NULL);
ok(hr == E_POINTER, "Expected E_POINTER, got %#x.\n", hr);
ok(hr == E_POINTER, "Unexpected hr %#lx.\n", hr);
hr = IDirectDraw3_GetSurfaceFromDC(dd3, dc, &tmp);
ok(SUCCEEDED(hr), "GetSurfaceFromDC failed, hr %#x.\n", hr);
ok(SUCCEEDED(hr), "Unexpected hr %#lx.\n", hr);
ok((IDirectDrawSurface3 *)tmp == surf3, "Expected surface != %p.\n", surf3);
IUnknown_Release(tmp);
hr = IDirectDrawSurface3_ReleaseDC(surf3, dc);
ok(SUCCEEDED(hr), "ReleaseDC failed, hr %#x.\n", hr);
ok(SUCCEEDED(hr), "Unexpected hr %#lx.\n", hr);
dc = CreateCompatibleDC(NULL);
ok(!!dc, "CreateCompatibleDC failed.\n");
tmp = (IDirectDrawSurface *)0xdeadbeef;
hr = IDirectDraw3_GetSurfaceFromDC(dd3, dc, &tmp);
ok(hr == DDERR_NOTFOUND, "Expected DDERR_NOTFOUND, got %#x.\n", hr);
ok(hr == DDERR_NOTFOUND, "Unexpected hr %#lx.\n", hr);
ok(!tmp, "Expected surface NULL, got %p.\n", tmp);
ok(DeleteDC(dc), "DeleteDC failed.\n");
......@@ -321,7 +321,7 @@ static void test_surface_from_dc4(void)
IDirectDraw_Release(dd1);
return;
}
ok(SUCCEEDED(hr), "IDirectDraw_QueryInterface failed, hr %#x.\n", hr);
ok(SUCCEEDED(hr), "Unexpected hr %#lx.\n", hr);
IDirectDraw_Release(dd1);
memset(&ddsd2, 0, sizeof(ddsd2));
......@@ -337,65 +337,65 @@ static void test_surface_from_dc4(void)
IDirectDraw3_Release(dd4);
return;
}
ok(SUCCEEDED(hr), "CreateSurface failed, hr %#x.\n", hr);
ok(SUCCEEDED(hr), "Unexpected hr %#lx.\n", hr);
hr = IDirectDrawSurface4_QueryInterface(surf4, &IID_IDirectDrawSurface, (void **)&surf1);
ok(SUCCEEDED(hr), "QueryInterface failed, hr %#x.\n", hr);
ok(SUCCEEDED(hr), "Unexpected hr %#lx.\n", hr);
priv = 0xdeadbeef;
size = sizeof(priv);
hr = IDirectDrawSurface4_SetPrivateData(surf4, &guid, &priv, size, 0);
ok(SUCCEEDED(hr), "SetPrivateData failed, hr %#x.\n", hr);
ok(SUCCEEDED(hr), "Unexpected hr %#lx.\n", hr);
priv = 0;
hr = IDirectDrawSurface4_GetPrivateData(surf4, &guid, &priv, &size);
ok(SUCCEEDED(hr), "GetPrivateData failed, hr %#x.\n", hr);
ok(priv == 0xdeadbeef, "Expected private data 0xdeadbeef, got %#x.\n", priv);
ok(SUCCEEDED(hr), "Unexpected hr %#lx.\n", hr);
ok(priv == 0xdeadbeef, "Unexpected private data %#lx.\n", priv);
hr = IDirectDrawSurface4_GetDC(surf4, &dc);
ok(SUCCEEDED(hr), "GetDC failed, hr %#x.\n", hr);
ok(SUCCEEDED(hr), "Unexpected hr %#lx.\n", hr);
hr = IDirectDraw4_GetSurfaceFromDC(dd4, dc, NULL);
ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %#x.\n", hr);
ok(hr == E_INVALIDARG, "Unexpected hr %#lx.\n", hr);
hr = IDirectDraw4_GetSurfaceFromDC(dd4, dc, (IDirectDrawSurface4 **)&tmp);
ok(SUCCEEDED(hr), "GetSurfaceFromDC failed, hr %#x.\n", hr);
ok(SUCCEEDED(hr), "Unexpected hr %#lx.\n", hr);
ok((IDirectDrawSurface4 *)tmp != surf4, "Expected surface != %p.\n", surf4);
hr = IUnknown_QueryInterface(tmp, &IID_IDirectDrawSurface, (void **)&tmp2);
ok(SUCCEEDED(hr), "QueryInterface failed, hr %#x.\n", hr);
ok(SUCCEEDED(hr), "Unexpected hr %#lx.\n", hr);
ok(tmp2 == tmp, "Expected %p, got %p.\n", tmp, tmp2);
ok((IDirectDrawSurface *)tmp2 != surf1, "Expected surface != %p.\n", surf1);
IUnknown_Release(tmp2);
hr = IUnknown_QueryInterface(tmp, &IID_IDirectDrawSurface4, (void **)&tmp2);
ok(SUCCEEDED(hr), "QueryInterface failed, hr %#x.\n", hr);
ok(SUCCEEDED(hr), "Unexpected hr %#lx.\n", hr);
ok((IDirectDrawSurface4 *)tmp2 != surf4, "Expected surface != %p.\n", surf4);
priv = 0;
hr = IDirectDrawSurface4_GetPrivateData((IDirectDrawSurface4 *)tmp2, &guid, &priv, &size);
ok(SUCCEEDED(hr), "GetPrivateData failed, hr %#x.\n", hr);
ok(priv == 0xdeadbeef, "Expected private data 0xdeadbeef, got %#x.\n", priv);
ok(SUCCEEDED(hr), "Unexpected hr %#lx.\n", hr);
ok(priv == 0xdeadbeef, "Unexpected private data %#lx.\n", priv);
IUnknown_Release(tmp2);
IUnknown_Release(tmp);
hr = IDirectDrawSurface4_ReleaseDC(surf4, dc);
ok(SUCCEEDED(hr), "ReleaseDC failed, hr %#x.\n", hr);
ok(SUCCEEDED(hr), "Unexpected hr %#lx.\n", hr);
dc = CreateCompatibleDC(NULL);
ok(!!dc, "CreateCompatibleDC failed.\n");
tmp = (IUnknown *)0xdeadbeef;
hr = IDirectDraw4_GetSurfaceFromDC(dd4, dc, (IDirectDrawSurface4 **)&tmp);
ok(hr == DDERR_NOTFOUND, "Expected DDERR_NOTFOUND, got %#x.\n", hr);
ok(hr == DDERR_NOTFOUND, "Unexpected hr %#lx.\n", hr);
ok(!tmp, "Expected surface NULL, got %p.\n", tmp);
ok(DeleteDC(dc), "DeleteDC failed.\n");
tmp = (IUnknown *)0xdeadbeef;
hr = IDirectDraw4_GetSurfaceFromDC(dd4, NULL, (IDirectDrawSurface4 **)&tmp);
ok(hr == DDERR_NOTFOUND, "Expected DDERR_NOTFOUND, got %#x.\n", hr);
ok(hr == DDERR_NOTFOUND, "Unexpected hr %#lx.\n", hr);
ok(!tmp, "Expected surface NULL, got %p.\n", tmp);
IDirectDrawSurface_Release(surf1);
......@@ -442,5 +442,5 @@ START_TEST(surface)
ref = IDirectDrawFactory_Release(factory);
ok(ref == 0, "IDirectDrawFactory not cleanly released\n");
ref = IClassFactory_Release(classfactory);
todo_wine ok(ref == 1, "IClassFactory refcount wrong, ref = %u\n", ref);
todo_wine ok(ref == 1, "Unexpected refcount %lu.\n", ref);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment