[PATCH] Add a testcase for when wglCreateContext is without a pixel format. This already passes in winex11.drv but it can't hurt for a future quartz driver.

Roderick Colenbrander thunderbird2k at gmx.net
Sat Feb 23 12:18:08 CST 2008


---
 dlls/opengl32/tests/opengl.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/dlls/opengl32/tests/opengl.c b/dlls/opengl32/tests/opengl.c
index 103a18f..b7e5a49 100644
--- a/dlls/opengl32/tests/opengl.c
+++ b/dlls/opengl32/tests/opengl.c
@@ -395,6 +395,7 @@ START_TEST(opengl)
         HDC hdc;
         int iPixelFormat, res;
         HGLRC hglrc;
+        DWORD error;
         ShowWindow(hwnd, SW_SHOW);
 
         hdc = GetDC(hwnd);
@@ -402,6 +403,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());
 
-- 
1.5.3.8


--========GMX285291203787420840894--



More information about the wine-patches mailing list