ddraw/tests: Move test_wndproc() to ddraw7.c.
This commit is contained in:
parent
4905773baf
commit
ef03ac0005
|
@ -3139,240 +3139,6 @@ static LRESULT CALLBACK test_proc(HWND hwnd, UINT message, WPARAM wparam, LPARAM
|
||||||
return DefWindowProcA(hwnd, message, wparam, lparam);
|
return DefWindowProcA(hwnd, message, wparam, lparam);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the wndproc back to what ddraw expects it to be, and release the ddraw
|
|
||||||
* interface. This prevents subsequent SetCooperativeLevel() calls on a
|
|
||||||
* different window from failing with DDERR_HWNDALREADYSET. */
|
|
||||||
static void fix_wndproc(HWND window, LONG_PTR proc)
|
|
||||||
{
|
|
||||||
IDirectDraw7 *ddraw7;
|
|
||||||
HRESULT hr;
|
|
||||||
|
|
||||||
hr = pDirectDrawCreateEx(NULL, (void **)&ddraw7, &IID_IDirectDraw7, NULL);
|
|
||||||
ok(SUCCEEDED(hr), "Failed to create IDirectDraw7 object, hr %#x.\n", hr);
|
|
||||||
if (FAILED(hr)) return;
|
|
||||||
|
|
||||||
SetWindowLongPtrA(window, GWLP_WNDPROC, proc);
|
|
||||||
hr = IDirectDraw7_SetCooperativeLevel(ddraw7, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
|
|
||||||
ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr);
|
|
||||||
hr = IDirectDraw7_SetCooperativeLevel(ddraw7, window, DDSCL_NORMAL);
|
|
||||||
ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr);
|
|
||||||
|
|
||||||
IDirectDraw7_Release(ddraw7);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void test_wndproc(void)
|
|
||||||
{
|
|
||||||
LONG_PTR proc, ddraw_proc;
|
|
||||||
IDirectDraw7 *ddraw7;
|
|
||||||
WNDCLASSA wc = {0};
|
|
||||||
HWND window;
|
|
||||||
HRESULT hr;
|
|
||||||
ULONG ref;
|
|
||||||
|
|
||||||
static const UINT messages[] =
|
|
||||||
{
|
|
||||||
WM_WINDOWPOSCHANGING,
|
|
||||||
WM_MOVE,
|
|
||||||
WM_SIZE,
|
|
||||||
WM_WINDOWPOSCHANGING,
|
|
||||||
WM_ACTIVATE,
|
|
||||||
WM_SETFOCUS,
|
|
||||||
0,
|
|
||||||
};
|
|
||||||
|
|
||||||
/* DDSCL_EXCLUSIVE replaces the window's window proc. */
|
|
||||||
hr = pDirectDrawCreateEx(NULL, (void **)&ddraw7, &IID_IDirectDraw7, NULL);
|
|
||||||
if (FAILED(hr))
|
|
||||||
{
|
|
||||||
skip("Failed to create IDirectDraw7 object (%#x), skipping tests.\n", hr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
wc.lpfnWndProc = test_proc;
|
|
||||||
wc.lpszClassName = "d3d7_test_wndproc_wc";
|
|
||||||
ok(RegisterClassA(&wc), "Failed to register window class.\n");
|
|
||||||
|
|
||||||
window = CreateWindowA("d3d7_test_wndproc_wc", "d3d7_test",
|
|
||||||
WS_MAXIMIZE | WS_CAPTION , 0, 0, 640, 480, 0, 0, 0, 0);
|
|
||||||
|
|
||||||
proc = GetWindowLongPtrA(window, GWLP_WNDPROC);
|
|
||||||
ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n",
|
|
||||||
(LONG_PTR)test_proc, proc);
|
|
||||||
|
|
||||||
expect_messages = messages;
|
|
||||||
|
|
||||||
hr = IDirectDraw7_SetCooperativeLevel(ddraw7, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
|
|
||||||
ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr);
|
|
||||||
if (FAILED(hr))
|
|
||||||
{
|
|
||||||
IDirectDraw7_Release(ddraw7);
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
|
|
||||||
ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages);
|
|
||||||
expect_messages = NULL;
|
|
||||||
|
|
||||||
proc = GetWindowLongPtrA(window, GWLP_WNDPROC);
|
|
||||||
ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx, got %#lx.\n",
|
|
||||||
(LONG_PTR)test_proc, proc);
|
|
||||||
|
|
||||||
ref = IDirectDraw7_Release(ddraw7);
|
|
||||||
ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref);
|
|
||||||
|
|
||||||
proc = GetWindowLongPtrA(window, GWLP_WNDPROC);
|
|
||||||
ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n",
|
|
||||||
(LONG_PTR)test_proc, proc);
|
|
||||||
|
|
||||||
/* DDSCL_NORMAL doesn't. */
|
|
||||||
hr = pDirectDrawCreateEx(NULL, (void **)&ddraw7, &IID_IDirectDraw7, NULL);
|
|
||||||
if (FAILED(hr))
|
|
||||||
{
|
|
||||||
skip("Failed to create IDirectDraw7 object (%#x), skipping tests.\n", hr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
proc = GetWindowLongPtrA(window, GWLP_WNDPROC);
|
|
||||||
ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n",
|
|
||||||
(LONG_PTR)test_proc, proc);
|
|
||||||
|
|
||||||
hr = IDirectDraw7_SetCooperativeLevel(ddraw7, window, DDSCL_NORMAL | DDSCL_FULLSCREEN);
|
|
||||||
ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr);
|
|
||||||
if (FAILED(hr))
|
|
||||||
{
|
|
||||||
IDirectDraw7_Release(ddraw7);
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
|
|
||||||
proc = GetWindowLongPtrA(window, GWLP_WNDPROC);
|
|
||||||
ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n",
|
|
||||||
(LONG_PTR)test_proc, proc);
|
|
||||||
|
|
||||||
ref = IDirectDraw7_Release(ddraw7);
|
|
||||||
ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref);
|
|
||||||
|
|
||||||
proc = GetWindowLongPtrA(window, GWLP_WNDPROC);
|
|
||||||
ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n",
|
|
||||||
(LONG_PTR)test_proc, proc);
|
|
||||||
|
|
||||||
/* The original window proc is only restored by ddraw if the current
|
|
||||||
* window proc matches the one ddraw set. This also affects switching
|
|
||||||
* from DDSCL_NORMAL to DDSCL_EXCLUSIVE. */
|
|
||||||
hr = pDirectDrawCreateEx(NULL, (void **)&ddraw7, &IID_IDirectDraw7, NULL);
|
|
||||||
if (FAILED(hr))
|
|
||||||
{
|
|
||||||
skip("Failed to create IDirectDraw7 object (%#x), skipping tests.\n", hr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
proc = GetWindowLongPtrA(window, GWLP_WNDPROC);
|
|
||||||
ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n",
|
|
||||||
(LONG_PTR)test_proc, proc);
|
|
||||||
|
|
||||||
hr = IDirectDraw7_SetCooperativeLevel(ddraw7, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
|
|
||||||
ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr);
|
|
||||||
if (FAILED(hr))
|
|
||||||
{
|
|
||||||
IDirectDraw7_Release(ddraw7);
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
|
|
||||||
proc = GetWindowLongPtrA(window, GWLP_WNDPROC);
|
|
||||||
ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx, got %#lx.\n",
|
|
||||||
(LONG_PTR)test_proc, proc);
|
|
||||||
ddraw_proc = proc;
|
|
||||||
|
|
||||||
hr = IDirectDraw7_SetCooperativeLevel(ddraw7, window, DDSCL_NORMAL);
|
|
||||||
ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr);
|
|
||||||
if (FAILED(hr))
|
|
||||||
{
|
|
||||||
IDirectDraw7_Release(ddraw7);
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
|
|
||||||
proc = GetWindowLongPtrA(window, GWLP_WNDPROC);
|
|
||||||
ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n",
|
|
||||||
(LONG_PTR)test_proc, proc);
|
|
||||||
|
|
||||||
hr = IDirectDraw7_SetCooperativeLevel(ddraw7, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
|
|
||||||
ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr);
|
|
||||||
if (FAILED(hr))
|
|
||||||
{
|
|
||||||
IDirectDraw7_Release(ddraw7);
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
|
|
||||||
proc = SetWindowLongPtrA(window, GWLP_WNDPROC, (LONG_PTR)DefWindowProcA);
|
|
||||||
ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx, got %#lx.\n",
|
|
||||||
(LONG_PTR)test_proc, proc);
|
|
||||||
|
|
||||||
hr = IDirectDraw7_SetCooperativeLevel(ddraw7, window, DDSCL_NORMAL);
|
|
||||||
ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr);
|
|
||||||
if (FAILED(hr))
|
|
||||||
{
|
|
||||||
IDirectDraw7_Release(ddraw7);
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
|
|
||||||
proc = GetWindowLongPtrA(window, GWLP_WNDPROC);
|
|
||||||
ok(proc == (LONG_PTR)DefWindowProcA, "Expected wndproc %#lx, got %#lx.\n",
|
|
||||||
(LONG_PTR)DefWindowProcA, proc);
|
|
||||||
|
|
||||||
hr = IDirectDraw7_SetCooperativeLevel(ddraw7, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
|
|
||||||
ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr);
|
|
||||||
if (FAILED(hr))
|
|
||||||
{
|
|
||||||
IDirectDraw7_Release(ddraw7);
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
|
|
||||||
proc = SetWindowLongPtrA(window, GWLP_WNDPROC, (LONG_PTR)ddraw_proc);
|
|
||||||
ok(proc == (LONG_PTR)DefWindowProcA, "Expected wndproc %#lx, got %#lx.\n",
|
|
||||||
(LONG_PTR)DefWindowProcA, proc);
|
|
||||||
|
|
||||||
ref = IDirectDraw7_Release(ddraw7);
|
|
||||||
ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref);
|
|
||||||
|
|
||||||
proc = GetWindowLongPtrA(window, GWLP_WNDPROC);
|
|
||||||
ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n",
|
|
||||||
(LONG_PTR)test_proc, proc);
|
|
||||||
|
|
||||||
hr = pDirectDrawCreateEx(NULL, (void **)&ddraw7, &IID_IDirectDraw7, NULL);
|
|
||||||
if (FAILED(hr))
|
|
||||||
{
|
|
||||||
skip("Failed to create IDirectDraw7 object (%#x), skipping tests.\n", hr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
proc = GetWindowLongPtrA(window, GWLP_WNDPROC);
|
|
||||||
ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n",
|
|
||||||
(LONG_PTR)test_proc, proc);
|
|
||||||
|
|
||||||
hr = IDirectDraw7_SetCooperativeLevel(ddraw7, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
|
|
||||||
ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr);
|
|
||||||
if (FAILED(hr))
|
|
||||||
{
|
|
||||||
IDirectDraw7_Release(ddraw7);
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
|
|
||||||
proc = SetWindowLongPtrA(window, GWLP_WNDPROC, (LONG_PTR)DefWindowProcA);
|
|
||||||
ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx, got %#lx.\n",
|
|
||||||
(LONG_PTR)test_proc, proc);
|
|
||||||
|
|
||||||
ref = IDirectDraw7_Release(ddraw7);
|
|
||||||
ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref);
|
|
||||||
|
|
||||||
proc = GetWindowLongPtrA(window, GWLP_WNDPROC);
|
|
||||||
ok(proc == (LONG_PTR)DefWindowProcA, "Expected wndproc %#lx, got %#lx.\n",
|
|
||||||
(LONG_PTR)DefWindowProcA, proc);
|
|
||||||
|
|
||||||
done:
|
|
||||||
fix_wndproc(window, (LONG_PTR)test_proc);
|
|
||||||
expect_messages = NULL;
|
|
||||||
DestroyWindow(window);
|
|
||||||
UnregisterClassA("d3d7_test_wndproc_wc", GetModuleHandleA(NULL));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void VertexBufferLockRest(void)
|
static void VertexBufferLockRest(void)
|
||||||
{
|
{
|
||||||
D3DVERTEXBUFFERDESC desc;
|
D3DVERTEXBUFFERDESC desc;
|
||||||
|
@ -4974,7 +4740,6 @@ START_TEST(d3d)
|
||||||
D3D1_releaseObjects();
|
D3D1_releaseObjects();
|
||||||
}
|
}
|
||||||
|
|
||||||
test_wndproc();
|
|
||||||
test_window_style();
|
test_window_style();
|
||||||
test_redundant_mode_set();
|
test_redundant_mode_set();
|
||||||
test_coop_level_mode_set();
|
test_coop_level_mode_set();
|
||||||
|
|
|
@ -293,6 +293,36 @@ static IDirect3DDevice7 *create_device(HWND window, DWORD coop_level)
|
||||||
return device;
|
return device;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const UINT *expect_messages;
|
||||||
|
|
||||||
|
static LRESULT CALLBACK test_proc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)
|
||||||
|
{
|
||||||
|
if (expect_messages && message == *expect_messages)
|
||||||
|
++expect_messages;
|
||||||
|
|
||||||
|
return DefWindowProcA(hwnd, message, wparam, lparam);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set the wndproc back to what ddraw expects it to be, and release the ddraw
|
||||||
|
* interface. This prevents subsequent SetCooperativeLevel() calls on a
|
||||||
|
* different window from failing with DDERR_HWNDALREADYSET. */
|
||||||
|
static void fix_wndproc(HWND window, LONG_PTR proc)
|
||||||
|
{
|
||||||
|
IDirectDraw7 *ddraw;
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
|
if (!(ddraw = create_ddraw()))
|
||||||
|
return;
|
||||||
|
|
||||||
|
SetWindowLongPtrA(window, GWLP_WNDPROC, proc);
|
||||||
|
hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
|
||||||
|
ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr);
|
||||||
|
hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL);
|
||||||
|
ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr);
|
||||||
|
|
||||||
|
IDirectDraw7_Release(ddraw);
|
||||||
|
}
|
||||||
|
|
||||||
static void test_process_vertices(void)
|
static void test_process_vertices(void)
|
||||||
{
|
{
|
||||||
IDirect3DVertexBuffer7 *src_vb, *dst_vb1, *dst_vb2;
|
IDirect3DVertexBuffer7 *src_vb, *dst_vb1, *dst_vb2;
|
||||||
|
@ -1747,6 +1777,133 @@ static void test_device_qi(void)
|
||||||
DestroyWindow(window);
|
DestroyWindow(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_wndproc(void)
|
||||||
|
{
|
||||||
|
LONG_PTR proc, ddraw_proc;
|
||||||
|
IDirectDraw7 *ddraw;
|
||||||
|
WNDCLASSA wc = {0};
|
||||||
|
HWND window;
|
||||||
|
HRESULT hr;
|
||||||
|
ULONG ref;
|
||||||
|
|
||||||
|
static const UINT messages[] =
|
||||||
|
{
|
||||||
|
WM_WINDOWPOSCHANGING,
|
||||||
|
WM_MOVE,
|
||||||
|
WM_SIZE,
|
||||||
|
WM_WINDOWPOSCHANGING,
|
||||||
|
WM_ACTIVATE,
|
||||||
|
WM_SETFOCUS,
|
||||||
|
0,
|
||||||
|
};
|
||||||
|
|
||||||
|
/* DDSCL_EXCLUSIVE replaces the window's window proc. */
|
||||||
|
if (!(ddraw = create_ddraw()))
|
||||||
|
{
|
||||||
|
skip("Failed to create IDirectDraw7 object, skipping tests.\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
wc.lpfnWndProc = test_proc;
|
||||||
|
wc.lpszClassName = "ddraw_test_wndproc_wc";
|
||||||
|
ok(RegisterClassA(&wc), "Failed to register window class.\n");
|
||||||
|
|
||||||
|
window = CreateWindowA("ddraw_test_wndproc_wc", "ddraw_test",
|
||||||
|
WS_MAXIMIZE | WS_CAPTION , 0, 0, 640, 480, 0, 0, 0, 0);
|
||||||
|
|
||||||
|
proc = GetWindowLongPtrA(window, GWLP_WNDPROC);
|
||||||
|
ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n",
|
||||||
|
(LONG_PTR)test_proc, proc);
|
||||||
|
expect_messages = messages;
|
||||||
|
hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
|
||||||
|
ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr);
|
||||||
|
ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages);
|
||||||
|
expect_messages = NULL;
|
||||||
|
proc = GetWindowLongPtrA(window, GWLP_WNDPROC);
|
||||||
|
ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx, got %#lx.\n",
|
||||||
|
(LONG_PTR)test_proc, proc);
|
||||||
|
ref = IDirectDraw7_Release(ddraw);
|
||||||
|
ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref);
|
||||||
|
proc = GetWindowLongPtrA(window, GWLP_WNDPROC);
|
||||||
|
ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n",
|
||||||
|
(LONG_PTR)test_proc, proc);
|
||||||
|
|
||||||
|
/* DDSCL_NORMAL doesn't. */
|
||||||
|
ddraw = create_ddraw();
|
||||||
|
proc = GetWindowLongPtrA(window, GWLP_WNDPROC);
|
||||||
|
ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n",
|
||||||
|
(LONG_PTR)test_proc, proc);
|
||||||
|
hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL | DDSCL_FULLSCREEN);
|
||||||
|
ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr);
|
||||||
|
proc = GetWindowLongPtrA(window, GWLP_WNDPROC);
|
||||||
|
ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n",
|
||||||
|
(LONG_PTR)test_proc, proc);
|
||||||
|
ref = IDirectDraw7_Release(ddraw);
|
||||||
|
ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref);
|
||||||
|
proc = GetWindowLongPtrA(window, GWLP_WNDPROC);
|
||||||
|
ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n",
|
||||||
|
(LONG_PTR)test_proc, proc);
|
||||||
|
|
||||||
|
/* The original window proc is only restored by ddraw if the current
|
||||||
|
* window proc matches the one ddraw set. This also affects switching
|
||||||
|
* from DDSCL_NORMAL to DDSCL_EXCLUSIVE. */
|
||||||
|
ddraw = create_ddraw();
|
||||||
|
proc = GetWindowLongPtrA(window, GWLP_WNDPROC);
|
||||||
|
ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n",
|
||||||
|
(LONG_PTR)test_proc, proc);
|
||||||
|
hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
|
||||||
|
ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr);
|
||||||
|
proc = GetWindowLongPtrA(window, GWLP_WNDPROC);
|
||||||
|
ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx, got %#lx.\n",
|
||||||
|
(LONG_PTR)test_proc, proc);
|
||||||
|
ddraw_proc = proc;
|
||||||
|
hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL);
|
||||||
|
ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr);
|
||||||
|
proc = GetWindowLongPtrA(window, GWLP_WNDPROC);
|
||||||
|
ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n",
|
||||||
|
(LONG_PTR)test_proc, proc);
|
||||||
|
hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
|
||||||
|
ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr);
|
||||||
|
proc = SetWindowLongPtrA(window, GWLP_WNDPROC, (LONG_PTR)DefWindowProcA);
|
||||||
|
ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx, got %#lx.\n",
|
||||||
|
(LONG_PTR)test_proc, proc);
|
||||||
|
hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL);
|
||||||
|
ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr);
|
||||||
|
proc = GetWindowLongPtrA(window, GWLP_WNDPROC);
|
||||||
|
ok(proc == (LONG_PTR)DefWindowProcA, "Expected wndproc %#lx, got %#lx.\n",
|
||||||
|
(LONG_PTR)DefWindowProcA, proc);
|
||||||
|
hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
|
||||||
|
ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr);
|
||||||
|
proc = SetWindowLongPtrA(window, GWLP_WNDPROC, (LONG_PTR)ddraw_proc);
|
||||||
|
ok(proc == (LONG_PTR)DefWindowProcA, "Expected wndproc %#lx, got %#lx.\n",
|
||||||
|
(LONG_PTR)DefWindowProcA, proc);
|
||||||
|
ref = IDirectDraw7_Release(ddraw);
|
||||||
|
ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref);
|
||||||
|
proc = GetWindowLongPtrA(window, GWLP_WNDPROC);
|
||||||
|
ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n",
|
||||||
|
(LONG_PTR)test_proc, proc);
|
||||||
|
|
||||||
|
ddraw = create_ddraw();
|
||||||
|
proc = GetWindowLongPtrA(window, GWLP_WNDPROC);
|
||||||
|
ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n",
|
||||||
|
(LONG_PTR)test_proc, proc);
|
||||||
|
hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
|
||||||
|
ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr);
|
||||||
|
proc = SetWindowLongPtrA(window, GWLP_WNDPROC, (LONG_PTR)DefWindowProcA);
|
||||||
|
ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx, got %#lx.\n",
|
||||||
|
(LONG_PTR)test_proc, proc);
|
||||||
|
ref = IDirectDraw7_Release(ddraw);
|
||||||
|
ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref);
|
||||||
|
proc = GetWindowLongPtrA(window, GWLP_WNDPROC);
|
||||||
|
ok(proc == (LONG_PTR)DefWindowProcA, "Expected wndproc %#lx, got %#lx.\n",
|
||||||
|
(LONG_PTR)DefWindowProcA, proc);
|
||||||
|
|
||||||
|
fix_wndproc(window, (LONG_PTR)test_proc);
|
||||||
|
expect_messages = NULL;
|
||||||
|
DestroyWindow(window);
|
||||||
|
UnregisterClassA("ddraw_test_wndproc_wc", GetModuleHandleA(NULL));
|
||||||
|
}
|
||||||
|
|
||||||
START_TEST(ddraw7)
|
START_TEST(ddraw7)
|
||||||
{
|
{
|
||||||
HMODULE module = GetModuleHandleA("ddraw.dll");
|
HMODULE module = GetModuleHandleA("ddraw.dll");
|
||||||
|
@ -1770,4 +1927,5 @@ START_TEST(ddraw7)
|
||||||
test_ck_default();
|
test_ck_default();
|
||||||
test_surface_qi();
|
test_surface_qi();
|
||||||
test_device_qi();
|
test_device_qi();
|
||||||
|
test_wndproc();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue