Commit 7937596f authored by Zhiyi Zhang's avatar Zhiyi Zhang Committed by Alexandre Julliard

opengl32/tests: Make context current before calling wglCopyContext().

Otherwise, wglCopyContext() crashes on Windows with a NVIDIA GPU and fails on Windows with a AMD GPU. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51311 Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54103
parent 2fbe1f35
......@@ -1899,11 +1899,16 @@ static void test_wglChoosePixelFormatARB(HDC hdc)
static void test_copy_context(HDC hdc)
{
HGLRC ctx, ctx2;
HGLRC ctx, ctx2, old_ctx;
BOOL ret;
old_ctx = wglGetCurrentContext();
ok(!!old_ctx, "wglGetCurrentContext failed, last error %#lx.\n", GetLastError());
ctx = wglCreateContext(hdc);
ok(!!ctx, "Failed to create GL context, last error %#lx.\n", GetLastError());
ret = wglMakeCurrent(hdc, ctx);
ok(ret, "wglMakeCurrent failed, last error %#lx.\n", GetLastError());
ctx2 = wglCreateContext(hdc);
ok(!!ctx2, "Failed to create GL context, last error %#lx.\n", GetLastError());
......@@ -1911,10 +1916,15 @@ static void test_copy_context(HDC hdc)
todo_wine
ok(ret, "Failed to copy GL context, last error %#lx.\n", GetLastError());
ret = wglMakeCurrent(NULL, NULL);
ok(ret, "wglMakeCurrent failed, last error %#lx.\n", GetLastError());
ret = wglDeleteContext(ctx2);
ok(ret, "Failed to delete GL context, last error %#lx.\n", GetLastError());
ret = wglDeleteContext(ctx);
ok(ret, "Failed to delete GL context, last error %#lx.\n", GetLastError());
ret = wglMakeCurrent(hdc, old_ctx);
ok(ret, "wglMakeCurrent failed, last error %#lx.\n", GetLastError());
}
START_TEST(opengl)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment