Henri Verbeet : d3d9/tests: Add a test for resource creation with D3DFMT_UNKNOWN.
Alexandre Julliard
julliard at winehq.org
Thu Feb 9 15:54:25 CST 2017
Module: wine
Branch: master
Commit: b28631f62f2a20c61a656d0f810710407424b899
URL: http://source.winehq.org/git/wine.git/?a=commit;h=b28631f62f2a20c61a656d0f810710407424b899
Author: Henri Verbeet <hverbeet at codeweavers.com>
Date: Thu Feb 9 12:52:36 2017 +0100
d3d9/tests: Add a test for resource creation with D3DFMT_UNKNOWN.
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/d3d9/tests/d3d9ex.c | 76 ++++++++++++++++++++++++++++++++++++++++++++++++
dlls/d3d9/tests/device.c | 64 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 140 insertions(+)
diff --git a/dlls/d3d9/tests/d3d9ex.c b/dlls/d3d9/tests/d3d9ex.c
index f949f5c..6348ee7 100644
--- a/dlls/d3d9/tests/d3d9ex.c
+++ b/dlls/d3d9/tests/d3d9ex.c
@@ -3701,6 +3701,81 @@ static void test_backbuffer_resize(void)
DestroyWindow(window);
}
+static void test_format_unknown(void)
+{
+ IDirect3DDevice9Ex *device;
+ UINT refcount;
+ HWND window;
+ void *iface;
+ HRESULT hr;
+
+ window = create_window();
+ if (!(device = create_device(window, NULL)))
+ {
+ skip("Failed to create a D3D device.\n");
+ DestroyWindow(window);
+ return;
+ }
+
+ iface = (void *)0xdeadbeef;
+ hr = IDirect3DDevice9Ex_CreateRenderTarget(device, 64, 64,
+ D3DFMT_UNKNOWN, D3DMULTISAMPLE_NONE, 0, FALSE, (IDirect3DSurface9 **)&iface, NULL);
+ ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
+ ok(!iface, "Got unexpected iface %p.\n", iface);
+
+ iface = (void *)0xdeadbeef;
+ hr = IDirect3DDevice9Ex_CreateRenderTargetEx(device, 64, 64,
+ D3DFMT_UNKNOWN, D3DMULTISAMPLE_NONE, 0, FALSE, (IDirect3DSurface9 **)&iface, NULL, 0);
+ todo_wine ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
+ ok(!iface, "Got unexpected iface %p.\n", iface);
+
+ iface = (void *)0xdeadbeef;
+ hr = IDirect3DDevice9Ex_CreateDepthStencilSurface(device, 64, 64,
+ D3DFMT_UNKNOWN, D3DMULTISAMPLE_NONE, 0, TRUE, (IDirect3DSurface9 **)&iface, NULL);
+ ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
+ ok(!iface, "Got unexpected iface %p.\n", iface);
+
+ iface = (void *)0xdeadbeef;
+ hr = IDirect3DDevice9Ex_CreateDepthStencilSurfaceEx(device, 64, 64,
+ D3DFMT_UNKNOWN, D3DMULTISAMPLE_NONE, 0, TRUE, (IDirect3DSurface9 **)&iface, NULL, 0);
+ ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
+ todo_wine ok(!iface, "Got unexpected iface %p.\n", iface);
+
+ iface = (void *)0xdeadbeef;
+ hr = IDirect3DDevice9Ex_CreateOffscreenPlainSurface(device, 64, 64,
+ D3DFMT_UNKNOWN, D3DPOOL_DEFAULT, (IDirect3DSurface9 **)&iface, NULL);
+ ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
+ ok(!iface, "Got unexpected iface %p.\n", iface);
+
+ iface = (void *)0xdeadbeef;
+ hr = IDirect3DDevice9Ex_CreateOffscreenPlainSurfaceEx(device, 64, 64,
+ D3DFMT_UNKNOWN, D3DPOOL_DEFAULT, (IDirect3DSurface9 **)&iface, NULL, 9);
+ todo_wine ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
+ todo_wine ok(!iface, "Got unexpected iface %p.\n", iface);
+
+ iface = (void *)0xdeadbeef;
+ hr = IDirect3DDevice9Ex_CreateTexture(device, 64, 64, 1, 0,
+ D3DFMT_UNKNOWN, D3DPOOL_DEFAULT, (IDirect3DTexture9 **)&iface, NULL);
+ ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
+ ok(!iface, "Got unexpected iface %p.\n", iface);
+
+ iface = (void *)0xdeadbeef;
+ hr = IDirect3DDevice9Ex_CreateCubeTexture(device, 64, 1, 0,
+ D3DFMT_UNKNOWN, D3DPOOL_DEFAULT, (IDirect3DCubeTexture9 **)&iface, NULL);
+ ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
+ ok(!iface, "Got unexpected iface %p.\n", iface);
+
+ iface = (void *)0xdeadbeef;
+ hr = IDirect3DDevice9Ex_CreateVolumeTexture(device, 64, 64, 1, 1, 0,
+ D3DFMT_UNKNOWN, D3DPOOL_DEFAULT, (IDirect3DVolumeTexture9 **)&iface, NULL);
+ ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
+ ok(!iface, "Got unexpected iface %p.\n", iface);
+
+ refcount = IDirect3DDevice9Ex_Release(device);
+ ok(!refcount, "Device has %u references left.\n", refcount);
+ DestroyWindow(window);
+}
+
START_TEST(d3d9ex)
{
DEVMODEW current_mode;
@@ -3749,4 +3824,5 @@ START_TEST(d3d9ex)
test_window_style();
test_swapchain_parameters();
test_backbuffer_resize();
+ test_format_unknown();
}
diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c
index e776515..feb1efc 100644
--- a/dlls/d3d9/tests/device.c
+++ b/dlls/d3d9/tests/device.c
@@ -11443,6 +11443,69 @@ static void test_render_target_device_mismatch(void)
DestroyWindow(window);
}
+static void test_format_unknown(void)
+{
+ IDirect3DDevice9 *device;
+ IDirect3D9 *d3d;
+ UINT refcount;
+ HWND window;
+ void *iface;
+ HRESULT hr;
+
+ window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW,
+ 0, 0, 640, 480, NULL, NULL, NULL, NULL);
+ d3d = Direct3DCreate9(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");
+ IDirect3D9_Release(d3d);
+ DestroyWindow(window);
+ return;
+ }
+
+ iface = (void *)0xdeadbeef;
+ hr = IDirect3DDevice9_CreateRenderTarget(device, 64, 64,
+ D3DFMT_UNKNOWN, D3DMULTISAMPLE_NONE, 0, FALSE, (IDirect3DSurface9 **)&iface, NULL);
+ ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
+ ok(!iface, "Got unexpected iface %p.\n", iface);
+
+ iface = (void *)0xdeadbeef;
+ hr = IDirect3DDevice9_CreateDepthStencilSurface(device, 64, 64,
+ D3DFMT_UNKNOWN, D3DMULTISAMPLE_NONE, 0, TRUE, (IDirect3DSurface9 **)&iface, NULL);
+ ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
+ ok(!iface, "Got unexpected iface %p.\n", iface);
+
+ iface = (void *)0xdeadbeef;
+ hr = IDirect3DDevice9_CreateOffscreenPlainSurface(device, 64, 64,
+ D3DFMT_UNKNOWN, D3DPOOL_DEFAULT, (IDirect3DSurface9 **)&iface, NULL);
+ ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
+ ok(!iface, "Got unexpected iface %p.\n", iface);
+
+ iface = (void *)0xdeadbeef;
+ hr = IDirect3DDevice9_CreateTexture(device, 64, 64, 1, 0,
+ D3DFMT_UNKNOWN, D3DPOOL_DEFAULT, (IDirect3DTexture9 **)&iface, NULL);
+ ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
+ ok(!iface, "Got unexpected iface %p.\n", iface);
+
+ iface = (void *)0xdeadbeef;
+ hr = IDirect3DDevice9_CreateCubeTexture(device, 64, 1, 0,
+ D3DFMT_UNKNOWN, D3DPOOL_DEFAULT, (IDirect3DCubeTexture9 **)&iface, NULL);
+ ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
+ ok(!iface, "Got unexpected iface %p.\n", iface);
+
+ iface = (void *)0xdeadbeef;
+ hr = IDirect3DDevice9_CreateVolumeTexture(device, 64, 64, 1, 1, 0,
+ D3DFMT_UNKNOWN, D3DPOOL_DEFAULT, (IDirect3DVolumeTexture9 **)&iface, NULL);
+ ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
+ ok(!iface, "Got unexpected iface %p.\n", iface);
+
+ refcount = IDirect3DDevice9_Release(device);
+ ok(!refcount, "Device has %u references left.\n", refcount);
+ IDirect3D9_Release(d3d);
+ DestroyWindow(window);
+}
+
START_TEST(device)
{
WNDCLASSA wc = {0};
@@ -11560,6 +11623,7 @@ START_TEST(device)
test_miptree_layout();
test_get_render_target_data();
test_render_target_device_mismatch();
+ test_format_unknown();
UnregisterClassA("d3d9_test_wc", GetModuleHandleA(NULL));
}
More information about the wine-cvs
mailing list