Module: wine Branch: master Commit: 751b55f4e959c155253452fac558bb2224a48194 URL: http://source.winehq.org/git/wine.git/?a=commit;h=751b55f4e959c155253452fac5...
Author: Alexandre Julliard julliard@winehq.org Date: Wed May 28 17:52:26 2008 +0200
opengl32/tests: Add a couple of test cases for pixel format handle on window DCs.
---
dlls/opengl32/tests/opengl.c | 37 +++++++++++++++++++++++++++++++++++++ 1 files changed, 37 insertions(+), 0 deletions(-)
diff --git a/dlls/opengl32/tests/opengl.c b/dlls/opengl32/tests/opengl.c index ad05822..46ded06 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)