From 675988633f698000796940b17b208b6da9ab08a2 Mon Sep 17 00:00:00 2001 From: Roderick Colenbrander Date: Sat, 23 Feb 2008 18:18:08 +0000 Subject: [PATCH] wgl: Add a test case for wglCreateContext. --- dlls/opengl32/tests/opengl.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dlls/opengl32/tests/opengl.c b/dlls/opengl32/tests/opengl.c index 456bf79aaf9..3836ba761bb 100644 --- a/dlls/opengl32/tests/opengl.c +++ b/dlls/opengl32/tests/opengl.c @@ -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());