From 751b55f4e959c155253452fac558bb2224a48194 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Wed, 28 May 2008 17:52:26 +0200 Subject: [PATCH] opengl32/tests: Add a couple of test cases for pixel format handle on window DCs. --- dlls/opengl32/tests/opengl.c | 37 ++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/dlls/opengl32/tests/opengl.c b/dlls/opengl32/tests/opengl.c index ad058221277..46ded06c4c3 100644 --- a/dlls/opengl32/tests/opengl.c +++ b/dlls/opengl32/tests/opengl.c @@ -182,6 +182,7 @@ static void test_setpixelformat(HDC winhdc) int nCfgs; int pf; int i; + HWND hwnd; PIXELFORMATDESCRIPTOR pfd = { sizeof(PIXELFORMATDESCRIPTOR), 1, /* version */ @@ -226,6 +227,42 @@ static void test_setpixelformat(HDC winhdc) if(i == pf) ok(res, "Failed to set the same pixel format\n"); else ok(!res, "Unexpectedly set an alternate pixel format\n"); } + + hwnd = CreateWindow("static", "Title", WS_OVERLAPPEDWINDOW, + 10, 10, 200, 200, NULL, NULL, NULL, NULL); + ok(hwnd != NULL, "err: %d\n", GetLastError()); + if (hwnd) + { + HDC hdc = GetDC( hwnd ); + pf = ChoosePixelFormat( hdc, &pfd ); + ok( pf != 0, "ChoosePixelFormat failed\n" ); + res = SetPixelFormat( hdc, pf, &pfd ); + ok( res != 0, "SetPixelFormat failed\n" ); + i = GetPixelFormat( hdc ); + ok( i == pf, "GetPixelFormat returned wrong format %d/%d\n", i, pf ); + ReleaseDC( hwnd, hdc ); + hdc = GetWindowDC( hwnd ); + i = GetPixelFormat( hdc ); + ok( i == pf, "GetPixelFormat returned wrong format %d/%d\n", i, pf ); + ReleaseDC( hwnd, hdc ); + DestroyWindow( hwnd ); + } + + hwnd = CreateWindow("static", "Title", WS_OVERLAPPEDWINDOW, + 10, 10, 200, 200, NULL, NULL, NULL, NULL); + ok(hwnd != NULL, "err: %d\n", GetLastError()); + if (hwnd) + { + HDC hdc = GetWindowDC( hwnd ); + pf = ChoosePixelFormat( hdc, &pfd ); + ok( pf != 0, "ChoosePixelFormat failed\n" ); + res = SetPixelFormat( hdc, pf, &pfd ); + ok( res != 0, "SetPixelFormat failed\n" ); + i = GetPixelFormat( hdc ); + ok( i == pf, "GetPixelFormat returned wrong format %d/%d\n", i, pf ); + ReleaseDC( hwnd, hdc ); + DestroyWindow( hwnd ); + } } static void test_colorbits(HDC hdc)