Module: wine Branch: master Commit: 9bd2ce97f58a31f385f30eec9f0b6e2b867cbeb2 URL: http://source.winehq.org/git/wine.git/?a=commit;h=9bd2ce97f58a31f385f30eec9f...
Author: Rico Schüller kgbricola@web.de Date: Sat Sep 19 15:52:47 2009 +0200
opengl32/tests: Improve test for wglMakeCurrent.
---
dlls/opengl32/tests/opengl.c | 36 ++++++++++++++++++++++++++++++++++++ 1 files changed, 36 insertions(+), 0 deletions(-)
diff --git a/dlls/opengl32/tests/opengl.c b/dlls/opengl32/tests/opengl.c index 2ced97d..96df784 100644 --- a/dlls/opengl32/tests/opengl.c +++ b/dlls/opengl32/tests/opengl.c @@ -346,6 +346,7 @@ static void test_makecurrent(HDC winhdc) { BOOL ret; HGLRC hglrc; + DWORD error;
hglrc = wglCreateContext(winhdc); ok( hglrc != 0, "wglCreateContext failed\n" ); @@ -354,6 +355,41 @@ static void test_makecurrent(HDC winhdc) ok( ret, "wglMakeCurrent failed\n" );
ok( wglGetCurrentContext() == hglrc, "wrong context\n" ); + + /* set the same context again */ + ret = wglMakeCurrent( winhdc, hglrc ); + ok( ret, "wglMakeCurrent failed\n" ); + + /* check wglMakeCurrent(x, y) after another call to wglMakeCurrent(x, y) */ + ret = wglMakeCurrent( winhdc, NULL ); + ok( ret, "wglMakeCurrent failed\n" ); + + ret = wglMakeCurrent( winhdc, NULL ); + ok( ret, "wglMakeCurrent failed\n" ); + + SetLastError( 0xdeadbeef ); + ret = wglMakeCurrent( NULL, NULL ); + ok( !ret, "wglMakeCurrent succeeded\n" ); + error = GetLastError(); + ok( error == ERROR_INVALID_HANDLE, "Expected ERROR_INVALID_HANDLE, got error=%x\n", error); + + ret = wglMakeCurrent( winhdc, NULL ); + ok( ret, "wglMakeCurrent failed\n" ); + + ret = wglMakeCurrent( winhdc, hglrc ); + ok( ret, "wglMakeCurrent failed\n" ); + + ret = wglMakeCurrent( NULL, NULL ); + ok( ret, "wglMakeCurrent failed\n" ); + + SetLastError( 0xdeadbeef ); + ret = wglMakeCurrent( NULL, NULL ); + ok( !ret, "wglMakeCurrent succeeded\n" ); + error = GetLastError(); + ok( error == ERROR_INVALID_HANDLE, "Expected ERROR_INVALID_HANDLE, got error=%x\n", error); + + ret = wglMakeCurrent( winhdc, hglrc ); + ok( ret, "wglMakeCurrent failed\n" ); }
static void test_colorbits(HDC hdc)