wgl: Add a test case for wglCreateContext.

This commit is contained in:
Roderick Colenbrander 2008-02-23 18:18:08 +00:00 committed by Alexandre Julliard
parent 575b1bfcc7
commit 675988633f
1 changed files with 7 additions and 0 deletions

View File

@ -374,6 +374,7 @@ START_TEST(opengl)
HDC hdc;
int iPixelFormat, res;
HGLRC hglrc;
DWORD error;
ShowWindow(hwnd, SW_SHOW);
hdc = GetDC(hwnd);
@ -381,6 +382,12 @@ START_TEST(opengl)
iPixelFormat = ChoosePixelFormat(hdc, &pfd);
ok(iPixelFormat > 0, "No pixelformat found!\n"); /* This should never happen as ChoosePixelFormat always returns a closest match */
/* We shouldn't be able to create a context from a hdc which doesn't have a pixel format set */
hglrc = wglCreateContext(hdc);
ok(hglrc == NULL, "wglCreateContext should fail when no pixel format has been set, but it passed");
error = GetLastError();
ok(error == ERROR_INVALID_PIXEL_FORMAT, "expected ERROR_INVALID_PIXEL_FORMAT for wglCreateContext without a pixelformat set, but recevied %#x", error);
res = SetPixelFormat(hdc, iPixelFormat, &pfd);
ok(res, "SetPixelformat failed: %x\n", GetLastError());