Commit ae725df5 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

ddraw: Add a small tests for SetCooperativeLevel() calls with different windows.

In particular, test that the windows aren't destroyed by accident.
parent b43f8976
......@@ -2629,6 +2629,36 @@ static void test_coop_level_surf_create(void)
IDirectDraw_Release(ddraw);
}
static void test_coop_level_multi_window(void)
{
HWND window1, window2;
IDirectDraw *ddraw;
HRESULT hr;
window1 = CreateWindowA("static", "ddraw_test1", WS_OVERLAPPEDWINDOW,
0, 0, 640, 480, 0, 0, 0, 0);
window2 = CreateWindowA("static", "ddraw_test2", WS_OVERLAPPEDWINDOW,
0, 0, 640, 480, 0, 0, 0, 0);
if (!(ddraw = create_ddraw()))
{
skip("Failed to create a ddraw object, skipping test.\n");
DestroyWindow(window2);
DestroyWindow(window1);
return;
}
hr = IDirectDraw_SetCooperativeLevel(ddraw, window1, DDSCL_NORMAL);
ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr);
hr = IDirectDraw_SetCooperativeLevel(ddraw, window2, DDSCL_NORMAL);
ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr);
todo_wine ok(IsWindow(window1), "Window 1 was destroyed.\n");
ok(IsWindow(window2), "Window 2 was destroyed.\n");
IDirectDraw_Release(ddraw);
DestroyWindow(window2);
DestroyWindow(window1);
}
START_TEST(ddraw1)
{
test_coop_level_create_device_window();
......@@ -2649,4 +2679,5 @@ START_TEST(ddraw1)
test_coop_level_mode_set_multi();
test_initialize();
test_coop_level_surf_create();
test_coop_level_multi_window();
}
......@@ -2748,6 +2748,36 @@ static void test_coop_level_surf_create(void)
IDirectDraw2_Release(ddraw);
}
static void test_coop_level_multi_window(void)
{
HWND window1, window2;
IDirectDraw2 *ddraw;
HRESULT hr;
window1 = CreateWindowA("static", "ddraw_test1", WS_OVERLAPPEDWINDOW,
0, 0, 640, 480, 0, 0, 0, 0);
window2 = CreateWindowA("static", "ddraw_test2", WS_OVERLAPPEDWINDOW,
0, 0, 640, 480, 0, 0, 0, 0);
if (!(ddraw = create_ddraw()))
{
skip("Failed to create a ddraw object, skipping test.\n");
DestroyWindow(window2);
DestroyWindow(window1);
return;
}
hr = IDirectDraw2_SetCooperativeLevel(ddraw, window1, DDSCL_NORMAL);
ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr);
hr = IDirectDraw2_SetCooperativeLevel(ddraw, window2, DDSCL_NORMAL);
ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr);
todo_wine ok(IsWindow(window1), "Window 1 was destroyed.\n");
ok(IsWindow(window2), "Window 2 was destroyed.\n");
IDirectDraw2_Release(ddraw);
DestroyWindow(window2);
DestroyWindow(window1);
}
START_TEST(ddraw2)
{
test_coop_level_create_device_window();
......@@ -2770,4 +2800,5 @@ START_TEST(ddraw2)
test_coop_level_mode_set_multi();
test_initialize();
test_coop_level_surf_create();
test_coop_level_multi_window();
}
......@@ -2935,6 +2935,36 @@ static void test_vb_discard(void)
DestroyWindow(window);
}
static void test_coop_level_multi_window(void)
{
HWND window1, window2;
IDirectDraw4 *ddraw;
HRESULT hr;
window1 = CreateWindowA("static", "ddraw_test1", WS_OVERLAPPEDWINDOW,
0, 0, 640, 480, 0, 0, 0, 0);
window2 = CreateWindowA("static", "ddraw_test2", WS_OVERLAPPEDWINDOW,
0, 0, 640, 480, 0, 0, 0, 0);
if (!(ddraw = create_ddraw()))
{
skip("Failed to create a ddraw object, skipping test.\n");
DestroyWindow(window2);
DestroyWindow(window1);
return;
}
hr = IDirectDraw4_SetCooperativeLevel(ddraw, window1, DDSCL_NORMAL);
ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr);
hr = IDirectDraw4_SetCooperativeLevel(ddraw, window2, DDSCL_NORMAL);
ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr);
todo_wine ok(IsWindow(window1), "Window 1 was destroyed.\n");
ok(IsWindow(window2), "Window 2 was destroyed.\n");
IDirectDraw4_Release(ddraw);
DestroyWindow(window2);
DestroyWindow(window1);
}
START_TEST(ddraw4)
{
test_process_vertices();
......@@ -2959,4 +2989,5 @@ START_TEST(ddraw4)
test_initialize();
test_coop_level_surf_create();
test_vb_discard();
test_coop_level_multi_window();
}
......@@ -2744,6 +2744,36 @@ static void test_vb_discard(void)
DestroyWindow(window);
}
static void test_coop_level_multi_window(void)
{
HWND window1, window2;
IDirectDraw7 *ddraw;
HRESULT hr;
window1 = CreateWindowA("static", "ddraw_test1", WS_OVERLAPPEDWINDOW,
0, 0, 640, 480, 0, 0, 0, 0);
window2 = CreateWindowA("static", "ddraw_test2", WS_OVERLAPPEDWINDOW,
0, 0, 640, 480, 0, 0, 0, 0);
if (!(ddraw = create_ddraw()))
{
skip("Failed to create a ddraw object, skipping test.\n");
DestroyWindow(window2);
DestroyWindow(window1);
return;
}
hr = IDirectDraw7_SetCooperativeLevel(ddraw, window1, DDSCL_NORMAL);
ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr);
hr = IDirectDraw7_SetCooperativeLevel(ddraw, window2, DDSCL_NORMAL);
ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr);
todo_wine ok(IsWindow(window1), "Window 1 was destroyed.\n");
ok(IsWindow(window2), "Window 2 was destroyed.\n");
IDirectDraw7_Release(ddraw);
DestroyWindow(window2);
DestroyWindow(window1);
}
START_TEST(ddraw7)
{
HMODULE module = GetModuleHandleA("ddraw.dll");
......@@ -2775,4 +2805,5 @@ START_TEST(ddraw7)
test_initialize();
test_coop_level_surf_create();
test_vb_discard();
test_coop_level_multi_window();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment