From 1b007ad38d2d01f7c8830f9f33d3cec69dc5cc4b Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Thu, 9 Feb 2017 12:52:35 +0100 Subject: [PATCH] d3d8/tests: Add a test for resource creation with D3DFMT_UNKNOWN. Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/d3d8/tests/device.c | 102 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c index 87d2433126e..da67fb3fb43 100644 --- a/dlls/d3d8/tests/device.c +++ b/dlls/d3d8/tests/device.c @@ -8149,6 +8149,107 @@ static void test_render_target_device_mismatch(void) DestroyWindow(window); } +static void test_format_unknown(void) +{ + IDirect3DDevice8 *device; + IDirect3D8 *d3d; + UINT refcount; + HWND window; + void *iface; + HRESULT hr; + + window = CreateWindowA("static", "d3d8_test", WS_OVERLAPPEDWINDOW, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + d3d = Direct3DCreate8(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window, NULL))) + { + skip("Failed to create a D3D device.\n"); + IDirect3D8_Release(d3d); + DestroyWindow(window); + return; + } + + if (SUCCEEDED(IDirect3D8_CheckDeviceFormat(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, + D3DFMT_X8R8G8B8, 0, D3DRTYPE_TEXTURE, D3DFMT_P8))) + { + skip("P8 textures are supported, skipping some tests.\n"); + } + else + { + iface = (void *)0xdeadbeef; + hr = IDirect3DDevice8_CreateRenderTarget(device, 64, 64, + D3DFMT_P8, D3DMULTISAMPLE_NONE, FALSE, (IDirect3DSurface8 **)&iface); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr); + ok(!iface, "Got unexpected iface %p.\n", iface); + + iface = (void *)0xdeadbeef; + hr = IDirect3DDevice8_CreateDepthStencilSurface(device, 64, 64, + D3DFMT_P8, D3DMULTISAMPLE_NONE, (IDirect3DSurface8 **)&iface); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr); + ok(!iface, "Got unexpected iface %p.\n", iface); + + iface = (void *)0xdeadbeef; + hr = IDirect3DDevice8_CreateTexture(device, 64, 64, 1, 0, + D3DFMT_P8, D3DPOOL_DEFAULT, (IDirect3DTexture8 **)&iface); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr); + ok(!iface, "Got unexpected iface %p.\n", iface); + + iface = (void *)0xdeadbeef; + hr = IDirect3DDevice8_CreateCubeTexture(device, 64, 1, 0, + D3DFMT_P8, D3DPOOL_DEFAULT, (IDirect3DCubeTexture8 **)&iface); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr); + ok(!iface, "Got unexpected iface %p.\n", iface); + + iface = (void *)0xdeadbeef; + hr = IDirect3DDevice8_CreateVolumeTexture(device, 64, 64, 1, 1, 0, + D3DFMT_P8, D3DPOOL_DEFAULT, (IDirect3DVolumeTexture8 **)&iface); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr); + ok(!iface, "Got unexpected iface %p.\n", iface); + } + + iface = (void *)0xdeadbeef; + hr = IDirect3DDevice8_CreateRenderTarget(device, 64, 64, + D3DFMT_UNKNOWN, D3DMULTISAMPLE_NONE, FALSE, (IDirect3DSurface8 **)&iface); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr); + todo_wine ok(iface == (void *)0xdeadbeef, "Got unexpected iface %p.\n", iface); + + iface = (void *)0xdeadbeef; + hr = IDirect3DDevice8_CreateDepthStencilSurface(device, 64, 64, + D3DFMT_UNKNOWN, D3DMULTISAMPLE_NONE, (IDirect3DSurface8 **)&iface); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr); + todo_wine ok(iface == (void *)0xdeadbeef, "Got unexpected iface %p.\n", iface); + + iface = (void *)0xdeadbeef; + hr = IDirect3DDevice8_CreateImageSurface(device, 64, 64, + D3DFMT_UNKNOWN, (IDirect3DSurface8 **)&iface); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr); + ok(!iface, "Got unexpected iface %p.\n", iface); + + iface = (void *)0xdeadbeef; + hr = IDirect3DDevice8_CreateTexture(device, 64, 64, 1, 0, + D3DFMT_UNKNOWN, D3DPOOL_DEFAULT, (IDirect3DTexture8 **)&iface); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr); + todo_wine ok(iface == (void *)0xdeadbeef, "Got unexpected iface %p.\n", iface); + + iface = (void *)0xdeadbeef; + hr = IDirect3DDevice8_CreateCubeTexture(device, 64, 1, 0, + D3DFMT_UNKNOWN, D3DPOOL_DEFAULT, (IDirect3DCubeTexture8 **)&iface); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr); + todo_wine ok(iface == (void *)0xdeadbeef, "Got unexpected iface %p.\n", iface); + + iface = (void *)0xdeadbeef; + hr = IDirect3DDevice8_CreateVolumeTexture(device, 64, 64, 1, 1, 0, + D3DFMT_UNKNOWN, D3DPOOL_DEFAULT, (IDirect3DVolumeTexture8 **)&iface); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr); + todo_wine ok(iface == (void *)0xdeadbeef, "Got unexpected iface %p.\n", iface); + + refcount = IDirect3DDevice8_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); + IDirect3D8_Release(d3d); + DestroyWindow(window); +} + START_TEST(device) { HMODULE d3d8_handle = LoadLibraryA( "d3d8.dll" ); @@ -8254,6 +8355,7 @@ START_TEST(device) test_check_device_format(); test_miptree_layout(); test_render_target_device_mismatch(); + test_format_unknown(); UnregisterClassA("d3d8_test_wc", GetModuleHandleA(NULL)); } -- 2.11.4.GIT