ddraw/tests: Remove unnecessary skips and conditionals from test_pixel_format().

We do not expect normal CreateWindow() and GetDC() calls to ever fail.
This commit is contained in:
Zebediah Figura 2023-01-20 17:37:21 -06:00 committed by Alexandre Julliard
parent b3aea08c31
commit 02b482f47b
4 changed files with 152 additions and 280 deletions

View file

@ -5878,29 +5878,19 @@ static void test_pixel_format(void)
IDirectDrawClipper *clipper = NULL;
DDSURFACEDESC ddsd;
IDirectDrawSurface *primary = NULL, *offscreen;
ULONG refcount;
DDBLTFX fx;
HRESULT hr;
window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
100, 100, 160, 160, NULL, NULL, NULL, NULL);
if (!window)
{
skip("Failed to create window\n");
return;
}
window2 = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
100, 100, 160, 160, NULL, NULL, NULL, NULL);
window = create_window();
ok(!!window, "Failed to create window.\n");
window2 = create_window();
ok(!!window2, "Failed to create window.\n");
hdc = GetDC(window);
if (!hdc)
{
skip("Failed to get DC\n");
goto cleanup;
}
if (window2)
hdc2 = GetDC(window2);
ok(!!hdc, "Failed to get DC.\n");
hdc2 = GetDC(window2);
ok(!!hdc2, "Failed to get DC.\n");
gl = LoadLibraryA("opengl32.dll");
ok(!!gl, "failed to load opengl32.dll; SetPixelFormat()/GetPixelFormat() may not work right\n");
@ -5927,14 +5917,10 @@ static void test_pixel_format(void)
goto cleanup;
}
if (!hdc2 || !SetPixelFormat(hdc2, format, &pfd) || GetPixelFormat(hdc2) != format)
if (!SetPixelFormat(hdc2, format, &pfd) || GetPixelFormat(hdc2) != format)
{
skip("failed to set pixel format on second window\n");
if (hdc2)
{
ReleaseDC(window2, hdc2);
hdc2 = NULL;
}
goto cleanup;
}
ddraw = create_ddraw();
@ -5944,28 +5930,20 @@ static void test_pixel_format(void)
ok(test_format == format, "window has pixel format %d, expected %d\n", test_format, format);
hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL);
if (FAILED(hr))
{
skip("Failed to set cooperative level, hr %#lx.\n", hr);
goto cleanup;
}
ok(hr == S_OK, "Got hr %#lx.\n", hr);
test_format = GetPixelFormat(hdc);
ok(test_format == format, "window has pixel format %d, expected %d\n", test_format, format);
if (hdc2)
{
hr = IDirectDraw_CreateClipper(ddraw, 0, &clipper, NULL);
ok(SUCCEEDED(hr), "Failed to create clipper, hr %#lx.\n", hr);
hr = IDirectDrawClipper_SetHWnd(clipper, 0, window2);
ok(SUCCEEDED(hr), "Failed to set clipper window, hr %#lx.\n", hr);
hr = IDirectDraw_CreateClipper(ddraw, 0, &clipper, NULL);
ok(SUCCEEDED(hr), "Failed to create clipper, hr %#lx.\n", hr);
hr = IDirectDrawClipper_SetHWnd(clipper, 0, window2);
ok(SUCCEEDED(hr), "Failed to set clipper window, hr %#lx.\n", hr);
test_format = GetPixelFormat(hdc);
ok(test_format == format, "window has pixel format %d, expected %d\n", test_format, format);
test_format = GetPixelFormat(hdc2);
ok(test_format == format, "second window has pixel format %d, expected %d\n", test_format, format);
}
test_format = GetPixelFormat(hdc);
ok(test_format == format, "window has pixel format %d, expected %d\n", test_format, format);
test_format = GetPixelFormat(hdc2);
ok(test_format == format, "second window has pixel format %d, expected %d\n", test_format, format);
memset(&ddsd, 0, sizeof(ddsd));
ddsd.dwSize = sizeof(ddsd);
@ -5977,24 +5955,16 @@ static void test_pixel_format(void)
test_format = GetPixelFormat(hdc);
ok(test_format == format, "window has pixel format %d, expected %d\n", test_format, format);
test_format = GetPixelFormat(hdc2);
ok(test_format == format, "second window has pixel format %d, expected %d\n", test_format, format);
if (hdc2)
{
test_format = GetPixelFormat(hdc2);
ok(test_format == format, "second window has pixel format %d, expected %d\n", test_format, format);
}
hr = IDirectDrawSurface_SetClipper(primary, clipper);
ok(SUCCEEDED(hr), "Failed to set clipper, hr %#lx.\n", hr);
if (clipper)
{
hr = IDirectDrawSurface_SetClipper(primary, clipper);
ok(SUCCEEDED(hr), "Failed to set clipper, hr %#lx.\n", hr);
test_format = GetPixelFormat(hdc);
ok(test_format == format, "window has pixel format %d, expected %d\n", test_format, format);
test_format = GetPixelFormat(hdc2);
ok(test_format == format, "second window has pixel format %d, expected %d\n", test_format, format);
}
test_format = GetPixelFormat(hdc);
ok(test_format == format, "window has pixel format %d, expected %d\n", test_format, format);
test_format = GetPixelFormat(hdc2);
ok(test_format == format, "second window has pixel format %d, expected %d\n", test_format, format);
memset(&ddsd, 0, sizeof(ddsd));
ddsd.dwSize = sizeof(ddsd);
@ -6017,24 +5987,22 @@ static void test_pixel_format(void)
test_format = GetPixelFormat(hdc);
ok(test_format == format, "window has pixel format %d, expected %d\n", test_format, format);
if (hdc2)
{
test_format = GetPixelFormat(hdc2);
ok(test_format == format, "second window has pixel format %d, expected %d\n", test_format, format);
}
test_format = GetPixelFormat(hdc2);
ok(test_format == format, "second window has pixel format %d, expected %d\n", test_format, format);
IDirectDrawSurface_Release(offscreen);
IDirectDrawSurface_Release(primary);
refcount = IDirectDrawClipper_Release(clipper);
ok(!refcount, "Got unexpected refcount %lu.\n", refcount);
refcount = IDirectDraw_Release(ddraw);
ok(!refcount, "Got unexpected refcount %lu.\n", refcount);
cleanup:
if (primary) IDirectDrawSurface_Release(primary);
if (clipper) IDirectDrawClipper_Release(clipper);
if (ddraw) IDirectDraw_Release(ddraw);
if (gl) FreeLibrary(gl);
if (hdc) ReleaseDC(window, hdc);
if (hdc2) ReleaseDC(window2, hdc2);
FreeLibrary(gl);
ReleaseDC(window2, hdc2);
ReleaseDC(window, hdc);
DestroyWindow(window2);
DestroyWindow(window);
if (window2) DestroyWindow(window2);
}
static void test_create_surface_pitch(void)

View file

@ -6975,29 +6975,19 @@ static void test_pixel_format(void)
IDirectDrawClipper *clipper = NULL;
DDSURFACEDESC ddsd;
IDirectDrawSurface *primary = NULL, *offscreen;
ULONG refcount;
DDBLTFX fx;
HRESULT hr;
window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
100, 100, 160, 160, NULL, NULL, NULL, NULL);
if (!window)
{
skip("Failed to create window\n");
return;
}
window2 = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
100, 100, 160, 160, NULL, NULL, NULL, NULL);
window = create_window();
ok(!!window, "Failed to create window.\n");
window2 = create_window();
ok(!!window2, "Failed to create window.\n");
hdc = GetDC(window);
if (!hdc)
{
skip("Failed to get DC\n");
goto cleanup;
}
if (window2)
hdc2 = GetDC(window2);
ok(!!hdc, "Failed to get DC.\n");
hdc2 = GetDC(window2);
ok(!!hdc2, "Failed to get DC.\n");
gl = LoadLibraryA("opengl32.dll");
ok(!!gl, "failed to load opengl32.dll; SetPixelFormat()/GetPixelFormat() may not work right\n");
@ -7024,14 +7014,10 @@ static void test_pixel_format(void)
goto cleanup;
}
if (!hdc2 || !SetPixelFormat(hdc2, format, &pfd) || GetPixelFormat(hdc2) != format)
if (!SetPixelFormat(hdc2, format, &pfd) || GetPixelFormat(hdc2) != format)
{
skip("failed to set pixel format on second window\n");
if (hdc2)
{
ReleaseDC(window2, hdc2);
hdc2 = NULL;
}
goto cleanup;
}
ddraw = create_ddraw();
@ -7041,28 +7027,20 @@ static void test_pixel_format(void)
ok(test_format == format, "window has pixel format %d, expected %d\n", test_format, format);
hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL);
if (FAILED(hr))
{
skip("Failed to set cooperative level, hr %#lx.\n", hr);
goto cleanup;
}
ok(hr == S_OK, "Got hr %#lx.\n", hr);
test_format = GetPixelFormat(hdc);
ok(test_format == format, "window has pixel format %d, expected %d\n", test_format, format);
if (hdc2)
{
hr = IDirectDraw2_CreateClipper(ddraw, 0, &clipper, NULL);
ok(SUCCEEDED(hr), "Failed to create clipper, hr %#lx.\n", hr);
hr = IDirectDrawClipper_SetHWnd(clipper, 0, window2);
ok(SUCCEEDED(hr), "Failed to set clipper window, hr %#lx.\n", hr);
hr = IDirectDraw2_CreateClipper(ddraw, 0, &clipper, NULL);
ok(SUCCEEDED(hr), "Failed to create clipper, hr %#lx.\n", hr);
hr = IDirectDrawClipper_SetHWnd(clipper, 0, window2);
ok(SUCCEEDED(hr), "Failed to set clipper window, hr %#lx.\n", hr);
test_format = GetPixelFormat(hdc);
ok(test_format == format, "window has pixel format %d, expected %d\n", test_format, format);
test_format = GetPixelFormat(hdc2);
ok(test_format == format, "second window has pixel format %d, expected %d\n", test_format, format);
}
test_format = GetPixelFormat(hdc);
ok(test_format == format, "window has pixel format %d, expected %d\n", test_format, format);
test_format = GetPixelFormat(hdc2);
ok(test_format == format, "second window has pixel format %d, expected %d\n", test_format, format);
memset(&ddsd, 0, sizeof(ddsd));
ddsd.dwSize = sizeof(ddsd);
@ -7074,24 +7052,16 @@ static void test_pixel_format(void)
test_format = GetPixelFormat(hdc);
ok(test_format == format, "window has pixel format %d, expected %d\n", test_format, format);
test_format = GetPixelFormat(hdc2);
ok(test_format == format, "second window has pixel format %d, expected %d\n", test_format, format);
if (hdc2)
{
test_format = GetPixelFormat(hdc2);
ok(test_format == format, "second window has pixel format %d, expected %d\n", test_format, format);
}
hr = IDirectDrawSurface_SetClipper(primary, clipper);
ok(SUCCEEDED(hr), "Failed to set clipper, hr %#lx.\n", hr);
if (clipper)
{
hr = IDirectDrawSurface_SetClipper(primary, clipper);
ok(SUCCEEDED(hr), "Failed to set clipper, hr %#lx.\n", hr);
test_format = GetPixelFormat(hdc);
ok(test_format == format, "window has pixel format %d, expected %d\n", test_format, format);
test_format = GetPixelFormat(hdc2);
ok(test_format == format, "second window has pixel format %d, expected %d\n", test_format, format);
}
test_format = GetPixelFormat(hdc);
ok(test_format == format, "window has pixel format %d, expected %d\n", test_format, format);
test_format = GetPixelFormat(hdc2);
ok(test_format == format, "second window has pixel format %d, expected %d\n", test_format, format);
memset(&ddsd, 0, sizeof(ddsd));
ddsd.dwSize = sizeof(ddsd);
@ -7114,24 +7084,22 @@ static void test_pixel_format(void)
test_format = GetPixelFormat(hdc);
ok(test_format == format, "window has pixel format %d, expected %d\n", test_format, format);
if (hdc2)
{
test_format = GetPixelFormat(hdc2);
ok(test_format == format, "second window has pixel format %d, expected %d\n", test_format, format);
}
test_format = GetPixelFormat(hdc2);
ok(test_format == format, "second window has pixel format %d, expected %d\n", test_format, format);
IDirectDrawSurface_Release(offscreen);
IDirectDrawSurface_Release(primary);
refcount = IDirectDrawClipper_Release(clipper);
ok(!refcount, "Got unexpected refcount %lu.\n", refcount);
refcount = IDirectDraw2_Release(ddraw);
ok(!refcount, "Got unexpected refcount %lu.\n", refcount);
cleanup:
if (primary) IDirectDrawSurface_Release(primary);
if (clipper) IDirectDrawClipper_Release(clipper);
if (ddraw) IDirectDraw2_Release(ddraw);
if (gl) FreeLibrary(gl);
if (hdc) ReleaseDC(window, hdc);
if (hdc2) ReleaseDC(window2, hdc2);
FreeLibrary(gl);
ReleaseDC(window2, hdc2);
ReleaseDC(window, hdc);
DestroyWindow(window2);
DestroyWindow(window);
if (window2) DestroyWindow(window2);
}
static void test_create_surface_pitch(void)

View file

@ -8858,29 +8858,19 @@ static void test_pixel_format(void)
IDirectDrawClipper *clipper = NULL;
DDSURFACEDESC2 ddsd;
IDirectDrawSurface4 *primary = NULL, *offscreen;
ULONG refcount;
DDBLTFX fx;
HRESULT hr;
window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
100, 100, 160, 160, NULL, NULL, NULL, NULL);
if (!window)
{
skip("Failed to create window\n");
return;
}
window2 = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
100, 100, 160, 160, NULL, NULL, NULL, NULL);
window = create_window();
ok(!!window, "Failed to create window.\n");
window2 = create_window();
ok(!!window2, "Failed to create window.\n");
hdc = GetDC(window);
if (!hdc)
{
skip("Failed to get DC\n");
goto cleanup;
}
if (window2)
hdc2 = GetDC(window2);
ok(!!hdc, "Failed to get DC.\n");
hdc2 = GetDC(window2);
ok(!!hdc2, "Failed to get DC.\n");
gl = LoadLibraryA("opengl32.dll");
ok(!!gl, "failed to load opengl32.dll; SetPixelFormat()/GetPixelFormat() may not work right\n");
@ -8907,14 +8897,10 @@ static void test_pixel_format(void)
goto cleanup;
}
if (!hdc2 || !SetPixelFormat(hdc2, format, &pfd) || GetPixelFormat(hdc2) != format)
if (!SetPixelFormat(hdc2, format, &pfd) || GetPixelFormat(hdc2) != format)
{
skip("failed to set pixel format on second window\n");
if (hdc2)
{
ReleaseDC(window2, hdc2);
hdc2 = NULL;
}
goto cleanup;
}
ddraw = create_ddraw();
@ -8924,28 +8910,20 @@ static void test_pixel_format(void)
ok(test_format == format, "window has pixel format %d, expected %d\n", test_format, format);
hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL);
if (FAILED(hr))
{
skip("Failed to set cooperative level, hr %#lx.\n", hr);
goto cleanup;
}
ok(hr == S_OK, "Got hr %#lx.\n", hr);
test_format = GetPixelFormat(hdc);
ok(test_format == format, "window has pixel format %d, expected %d\n", test_format, format);
if (hdc2)
{
hr = IDirectDraw4_CreateClipper(ddraw, 0, &clipper, NULL);
ok(SUCCEEDED(hr), "Failed to create clipper, hr %#lx.\n", hr);
hr = IDirectDrawClipper_SetHWnd(clipper, 0, window2);
ok(SUCCEEDED(hr), "Failed to set clipper window, hr %#lx.\n", hr);
hr = IDirectDraw4_CreateClipper(ddraw, 0, &clipper, NULL);
ok(SUCCEEDED(hr), "Failed to create clipper, hr %#lx.\n", hr);
hr = IDirectDrawClipper_SetHWnd(clipper, 0, window2);
ok(SUCCEEDED(hr), "Failed to set clipper window, hr %#lx.\n", hr);
test_format = GetPixelFormat(hdc);
ok(test_format == format, "window has pixel format %d, expected %d\n", test_format, format);
test_format = GetPixelFormat(hdc2);
ok(test_format == format, "second window has pixel format %d, expected %d\n", test_format, format);
}
test_format = GetPixelFormat(hdc);
ok(test_format == format, "window has pixel format %d, expected %d\n", test_format, format);
test_format = GetPixelFormat(hdc2);
ok(test_format == format, "second window has pixel format %d, expected %d\n", test_format, format);
memset(&ddsd, 0, sizeof(ddsd));
ddsd.dwSize = sizeof(ddsd);
@ -8957,24 +8935,16 @@ static void test_pixel_format(void)
test_format = GetPixelFormat(hdc);
ok(test_format == format, "window has pixel format %d, expected %d\n", test_format, format);
test_format = GetPixelFormat(hdc2);
ok(test_format == format, "second window has pixel format %d, expected %d\n", test_format, format);
if (hdc2)
{
test_format = GetPixelFormat(hdc2);
ok(test_format == format, "second window has pixel format %d, expected %d\n", test_format, format);
}
hr = IDirectDrawSurface4_SetClipper(primary, clipper);
ok(SUCCEEDED(hr), "Failed to set clipper, hr %#lx.\n", hr);
if (clipper)
{
hr = IDirectDrawSurface4_SetClipper(primary, clipper);
ok(SUCCEEDED(hr), "Failed to set clipper, hr %#lx.\n", hr);
test_format = GetPixelFormat(hdc);
ok(test_format == format, "window has pixel format %d, expected %d\n", test_format, format);
test_format = GetPixelFormat(hdc2);
ok(test_format == format, "second window has pixel format %d, expected %d\n", test_format, format);
}
test_format = GetPixelFormat(hdc);
ok(test_format == format, "window has pixel format %d, expected %d\n", test_format, format);
test_format = GetPixelFormat(hdc2);
ok(test_format == format, "second window has pixel format %d, expected %d\n", test_format, format);
memset(&ddsd, 0, sizeof(ddsd));
ddsd.dwSize = sizeof(ddsd);
@ -8997,24 +8967,22 @@ static void test_pixel_format(void)
test_format = GetPixelFormat(hdc);
ok(test_format == format, "window has pixel format %d, expected %d\n", test_format, format);
if (hdc2)
{
test_format = GetPixelFormat(hdc2);
ok(test_format == format, "second window has pixel format %d, expected %d\n", test_format, format);
}
test_format = GetPixelFormat(hdc2);
ok(test_format == format, "second window has pixel format %d, expected %d\n", test_format, format);
IDirectDrawSurface4_Release(offscreen);
IDirectDrawSurface4_Release(primary);
refcount = IDirectDrawClipper_Release(clipper);
ok(!refcount, "Got unexpected refcount %lu.\n", refcount);
refcount = IDirectDraw4_Release(ddraw);
ok(!refcount, "Got unexpected refcount %lu.\n", refcount);
cleanup:
if (primary) IDirectDrawSurface4_Release(primary);
if (clipper) IDirectDrawClipper_Release(clipper);
if (ddraw) IDirectDraw4_Release(ddraw);
if (gl) FreeLibrary(gl);
if (hdc) ReleaseDC(window, hdc);
if (hdc2) ReleaseDC(window2, hdc2);
FreeLibrary(gl);
ReleaseDC(window2, hdc2);
ReleaseDC(window, hdc);
DestroyWindow(window2);
DestroyWindow(window);
if (window2) DestroyWindow(window2);
}
static void test_create_surface_pitch(void)

View file

@ -8698,29 +8698,19 @@ static void test_pixel_format(void)
IDirectDrawClipper *clipper = NULL;
DDSURFACEDESC2 ddsd;
IDirectDrawSurface7 *primary = NULL, *offscreen;
ULONG refcount;
DDBLTFX fx;
HRESULT hr;
window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
100, 100, 160, 160, NULL, NULL, NULL, NULL);
if (!window)
{
skip("Failed to create window\n");
return;
}
window2 = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
100, 100, 160, 160, NULL, NULL, NULL, NULL);
window = create_window();
ok(!!window, "Failed to create window.\n");
window2 = create_window();
ok(!!window2, "Failed to create window.\n");
hdc = GetDC(window);
if (!hdc)
{
skip("Failed to get DC\n");
goto cleanup;
}
if (window2)
hdc2 = GetDC(window2);
ok(!!hdc, "Failed to get DC.\n");
hdc2 = GetDC(window2);
ok(!!hdc2, "Failed to get DC.\n");
gl = LoadLibraryA("opengl32.dll");
ok(!!gl, "failed to load opengl32.dll; SetPixelFormat()/GetPixelFormat() may not work right\n");
@ -8747,14 +8737,10 @@ static void test_pixel_format(void)
goto cleanup;
}
if (!hdc2 || !SetPixelFormat(hdc2, format, &pfd) || GetPixelFormat(hdc2) != format)
if (!SetPixelFormat(hdc2, format, &pfd) || GetPixelFormat(hdc2) != format)
{
skip("failed to set pixel format on second window\n");
if (hdc2)
{
ReleaseDC(window2, hdc2);
hdc2 = NULL;
}
goto cleanup;
}
ddraw = create_ddraw();
@ -8764,28 +8750,20 @@ static void test_pixel_format(void)
ok(test_format == format, "window has pixel format %d, expected %d\n", test_format, format);
hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL);
if (FAILED(hr))
{
skip("Failed to set cooperative level, hr %#lx.\n", hr);
goto cleanup;
}
ok(hr == S_OK, "Got hr %#lx.\n", hr);
test_format = GetPixelFormat(hdc);
ok(test_format == format, "window has pixel format %d, expected %d\n", test_format, format);
if (hdc2)
{
hr = IDirectDraw7_CreateClipper(ddraw, 0, &clipper, NULL);
ok(SUCCEEDED(hr), "Failed to create clipper, hr %#lx.\n", hr);
hr = IDirectDrawClipper_SetHWnd(clipper, 0, window2);
ok(SUCCEEDED(hr), "Failed to set clipper window, hr %#lx.\n", hr);
hr = IDirectDraw7_CreateClipper(ddraw, 0, &clipper, NULL);
ok(SUCCEEDED(hr), "Failed to create clipper, hr %#lx.\n", hr);
hr = IDirectDrawClipper_SetHWnd(clipper, 0, window2);
ok(SUCCEEDED(hr), "Failed to set clipper window, hr %#lx.\n", hr);
test_format = GetPixelFormat(hdc);
ok(test_format == format, "window has pixel format %d, expected %d\n", test_format, format);
test_format = GetPixelFormat(hdc2);
ok(test_format == format, "second window has pixel format %d, expected %d\n", test_format, format);
}
test_format = GetPixelFormat(hdc);
ok(test_format == format, "window has pixel format %d, expected %d\n", test_format, format);
test_format = GetPixelFormat(hdc2);
ok(test_format == format, "second window has pixel format %d, expected %d\n", test_format, format);
memset(&ddsd, 0, sizeof(ddsd));
ddsd.dwSize = sizeof(ddsd);
@ -8797,24 +8775,16 @@ static void test_pixel_format(void)
test_format = GetPixelFormat(hdc);
ok(test_format == format, "window has pixel format %d, expected %d\n", test_format, format);
test_format = GetPixelFormat(hdc2);
ok(test_format == format, "second window has pixel format %d, expected %d\n", test_format, format);
if (hdc2)
{
test_format = GetPixelFormat(hdc2);
ok(test_format == format, "second window has pixel format %d, expected %d\n", test_format, format);
}
hr = IDirectDrawSurface7_SetClipper(primary, clipper);
ok(SUCCEEDED(hr), "Failed to set clipper, hr %#lx.\n", hr);
if (clipper)
{
hr = IDirectDrawSurface7_SetClipper(primary, clipper);
ok(SUCCEEDED(hr), "Failed to set clipper, hr %#lx.\n", hr);
test_format = GetPixelFormat(hdc);
ok(test_format == format, "window has pixel format %d, expected %d\n", test_format, format);
test_format = GetPixelFormat(hdc2);
ok(test_format == format, "second window has pixel format %d, expected %d\n", test_format, format);
}
test_format = GetPixelFormat(hdc);
ok(test_format == format, "window has pixel format %d, expected %d\n", test_format, format);
test_format = GetPixelFormat(hdc2);
ok(test_format == format, "second window has pixel format %d, expected %d\n", test_format, format);
memset(&ddsd, 0, sizeof(ddsd));
ddsd.dwSize = sizeof(ddsd);
@ -8837,24 +8807,22 @@ static void test_pixel_format(void)
test_format = GetPixelFormat(hdc);
ok(test_format == format, "window has pixel format %d, expected %d\n", test_format, format);
if (hdc2)
{
test_format = GetPixelFormat(hdc2);
ok(test_format == format, "second window has pixel format %d, expected %d\n", test_format, format);
}
test_format = GetPixelFormat(hdc2);
ok(test_format == format, "second window has pixel format %d, expected %d\n", test_format, format);
IDirectDrawSurface7_Release(offscreen);
IDirectDrawSurface7_Release(primary);
refcount = IDirectDrawClipper_Release(clipper);
ok(!refcount, "Got unexpected refcount %lu.\n", refcount);
refcount = IDirectDraw7_Release(ddraw);
ok(!refcount, "Got unexpected refcount %lu.\n", refcount);
cleanup:
if (primary) IDirectDrawSurface7_Release(primary);
if (clipper) IDirectDrawClipper_Release(clipper);
if (ddraw) IDirectDraw7_Release(ddraw);
if (gl) FreeLibrary(gl);
if (hdc) ReleaseDC(window, hdc);
if (hdc2) ReleaseDC(window2, hdc2);
FreeLibrary(gl);
ReleaseDC(window2, hdc2);
ReleaseDC(window, hdc);
DestroyWindow(window2);
DestroyWindow(window);
if (window2) DestroyWindow(window2);
}
static void test_create_surface_pitch(void)