Module: wine Branch: master Commit: 9b42e7f7e32dcde26a50c3dde200ee8d4927f24e URL: http://source.winehq.org/git/wine.git/?a=commit;h=9b42e7f7e32dcde26a50c3dde2...
Author: Henri Verbeet hverbeet@codeweavers.com Date: Wed Oct 6 12:01:31 2010 +0200
d3d9/tests: Add window proc tests for switching between fullscreen and windowed.
---
dlls/d3d9/tests/device.c | 95 ++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 95 insertions(+), 0 deletions(-)
diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c index 41718f8..e4a7b99 100644 --- a/dlls/d3d9/tests/device.c +++ b/dlls/d3d9/tests/device.c @@ -75,6 +75,22 @@ static IDirect3DDevice9 *create_device(IDirect3D9 *d3d9, HWND device_window, HWN return NULL; }
+static HRESULT reset_device(IDirect3DDevice9 *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 IDirect3DDevice9_Reset(device, &present_parameters); +} + #define CHECK_CALL(r,c,d,rc) \ if (SUCCEEDED(r)) {\ int tmp1 = get_refcount( (IUnknown *)d ); \ @@ -2550,6 +2566,7 @@ static void test_wndproc_windowed(void) IDirect3D9 *d3d9; HANDLE thread; LONG_PTR proc; + HRESULT hr; ULONG ref; DWORD res, tid;
@@ -2617,6 +2634,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 = IDirect3DDevice9_Release(device); ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref);
@@ -2629,6 +2672,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 = IDirect3DDevice9_Release(device); ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref);
@@ -2639,6 +2708,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 = IDirect3DDevice9_Release(device); ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref);