Roderick Colenbrander : wgl: Add a test case for wglCreateContext.

Alexandre Julliard julliard at winehq.org
Mon Feb 25 14:21:29 CST 2008


Module: wine
Branch: master
Commit: 675988633f698000796940b17b208b6da9ab08a2
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=675988633f698000796940b17b208b6da9ab08a2

Author: Roderick Colenbrander <thunderbird2k at gmx.net>
Date:   Sat Feb 23 18:18:08 2008 +0000

wgl: Add a test case for wglCreateContext.

---

 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 456bf79..3836ba7 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());
 




More information about the wine-cvs mailing list