Commit 751b55f4 authored by Alexandre Julliard's avatar Alexandre Julliard

opengl32/tests: Add a couple of test cases for pixel format handle on window DCs.

parent 2d9b3813
...@@ -182,6 +182,7 @@ static void test_setpixelformat(HDC winhdc) ...@@ -182,6 +182,7 @@ static void test_setpixelformat(HDC winhdc)
int nCfgs; int nCfgs;
int pf; int pf;
int i; int i;
HWND hwnd;
PIXELFORMATDESCRIPTOR pfd = { PIXELFORMATDESCRIPTOR pfd = {
sizeof(PIXELFORMATDESCRIPTOR), sizeof(PIXELFORMATDESCRIPTOR),
1, /* version */ 1, /* version */
...@@ -226,6 +227,42 @@ static void test_setpixelformat(HDC winhdc) ...@@ -226,6 +227,42 @@ static void test_setpixelformat(HDC winhdc)
if(i == pf) ok(res, "Failed to set the same pixel format\n"); if(i == pf) ok(res, "Failed to set the same pixel format\n");
else ok(!res, "Unexpectedly set an alternate 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) static void test_colorbits(HDC hdc)
......
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