Module: wine Branch: master Commit: 4fa4ea7335eec887f48aee5920bb9f89dc270f82 URL: http://source.winehq.org/git/wine.git/?a=commit;h=4fa4ea7335eec887f48aee5920...
Author: Henri Verbeet hverbeet@codeweavers.com Date: Wed Oct 6 12:01:30 2010 +0200
d3d8/tests: Add window proc tests for switching between fullscreen and windowed.
---
dlls/d3d8/tests/device.c | 95 ++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 95 insertions(+), 0 deletions(-)
diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c index bf6f11a..663dc91 100644 --- a/dlls/d3d8/tests/device.c +++ b/dlls/d3d8/tests/device.c @@ -89,6 +89,22 @@ static IDirect3DDevice8 *create_device(IDirect3D8 *d3d8, HWND device_window, HWN return NULL; }
+static HRESULT reset_device(IDirect3DDevice8 *device, HWND device_window, BOOL windowed) +{ + D3DPRESENT_PARAMETERS present_parameters = {0}; + + present_parameters.Windowed = windowed; + present_parameters.hDeviceWindow = device_window; + present_parameters.SwapEffect = D3DSWAPEFFECT_DISCARD; + present_parameters.BackBufferWidth = 640; + present_parameters.BackBufferHeight = 480; + present_parameters.BackBufferFormat = D3DFMT_A8R8G8B8; + present_parameters.EnableAutoDepthStencil = TRUE; + present_parameters.AutoDepthStencilFormat = D3DFMT_D24S8; + + return IDirect3DDevice8_Reset(device, &present_parameters); +} + #define CHECK_CALL(r,c,d,rc) \ if (SUCCEEDED(r)) {\ int tmp1 = get_refcount( (IUnknown *)d ); \ @@ -1707,6 +1723,7 @@ static void test_wndproc_windowed(void) IDirect3D8 *d3d8; HANDLE thread; LONG_PTR proc; + HRESULT hr; ULONG ref; DWORD res, tid;
@@ -1774,6 +1791,32 @@ static void test_wndproc_windowed(void) ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", (LONG_PTR)test_proc, proc);
+ filter_messages = NULL; + + hr = reset_device(device, device_window, FALSE); + ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); + + proc = GetWindowLongPtrA(device_window, GWLP_WNDPROC); + ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", + (LONG_PTR)test_proc, proc); + + proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); + ok(proc != (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", + (LONG_PTR)test_proc, proc); + + hr = reset_device(device, device_window, TRUE); + ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); + + proc = GetWindowLongPtrA(device_window, GWLP_WNDPROC); + ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", + (LONG_PTR)test_proc, proc); + + proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); + ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", + (LONG_PTR)test_proc, proc); + + filter_messages = focus_window; + ref = IDirect3DDevice8_Release(device); ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref);
@@ -1786,6 +1829,32 @@ static void test_wndproc_windowed(void) goto done; }
+ filter_messages = NULL; + + hr = reset_device(device, focus_window, FALSE); + ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); + + proc = GetWindowLongPtrA(device_window, GWLP_WNDPROC); + ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", + (LONG_PTR)test_proc, proc); + + proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); + ok(proc != (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", + (LONG_PTR)test_proc, proc); + + hr = reset_device(device, focus_window, TRUE); + ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); + + proc = GetWindowLongPtrA(device_window, GWLP_WNDPROC); + ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", + (LONG_PTR)test_proc, proc); + + proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); + ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", + (LONG_PTR)test_proc, proc); + + filter_messages = device_window; + ref = IDirect3DDevice8_Release(device); ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref);
@@ -1796,6 +1865,32 @@ static void test_wndproc_windowed(void) goto done; }
+ filter_messages = NULL; + + hr = reset_device(device, device_window, FALSE); + ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); + + proc = GetWindowLongPtrA(device_window, GWLP_WNDPROC); + ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", + (LONG_PTR)test_proc, proc); + + proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); + ok(proc != (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", + (LONG_PTR)test_proc, proc); + + hr = reset_device(device, device_window, TRUE); + ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); + + proc = GetWindowLongPtrA(device_window, GWLP_WNDPROC); + ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", + (LONG_PTR)test_proc, proc); + + proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); + ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", + (LONG_PTR)test_proc, proc); + + filter_messages = device_window; + ref = IDirect3DDevice8_Release(device); ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref);