mirror of
https://github.com/reactos/wine.git
synced 2024-11-25 20:59:54 +00:00
wgl: SetPixelFormat should fail on the root window.
This commit is contained in:
parent
219269c0f1
commit
323d9e428c
@ -151,6 +151,43 @@ static void test_pbuffers(HDC hdc)
|
||||
else skip("Pbuffer test for offscreen pixelformat skipped as no offscreen-only format with pbuffer capabilities has been found\n");
|
||||
}
|
||||
|
||||
static void test_setpixelformat(void)
|
||||
{
|
||||
int res = 0;
|
||||
int pf;
|
||||
PIXELFORMATDESCRIPTOR pfd = {
|
||||
sizeof(PIXELFORMATDESCRIPTOR),
|
||||
1, /* version */
|
||||
PFD_DRAW_TO_WINDOW |
|
||||
PFD_SUPPORT_OPENGL |
|
||||
PFD_DOUBLEBUFFER,
|
||||
PFD_TYPE_RGBA,
|
||||
24, /* 24-bit color depth */
|
||||
0, 0, 0, 0, 0, 0, /* color bits */
|
||||
0, /* alpha buffer */
|
||||
0, /* shift bit */
|
||||
0, /* accumulation buffer */
|
||||
0, 0, 0, 0, /* accum bits */
|
||||
32, /* z-buffer */
|
||||
0, /* stencil buffer */
|
||||
0, /* auxiliary buffer */
|
||||
PFD_MAIN_PLANE, /* main layer */
|
||||
0, /* reserved */
|
||||
0, 0, 0 /* layer masks */
|
||||
};
|
||||
|
||||
HDC hdc = GetDC(0);
|
||||
ok(hdc != 0, "GetDC(0) failed!\n");
|
||||
|
||||
/* This should pass even on the main device context */
|
||||
pf = ChoosePixelFormat(hdc, &pfd);
|
||||
ok(pf != 0, "ChoosePixelFormat failed on main device context");
|
||||
|
||||
/* SetPixelFormat on the main device context 'X root window' should fail */
|
||||
res = SetPixelFormat(hdc, pf, &pfd);
|
||||
ok(res == 0, "SetPixelFormat on main device context should fail\n");
|
||||
}
|
||||
|
||||
START_TEST(opengl)
|
||||
{
|
||||
HWND hwnd;
|
||||
@ -198,6 +235,8 @@ START_TEST(opengl)
|
||||
ok(res, "wglMakeCurrent failed!\n");
|
||||
init_functions();
|
||||
|
||||
test_setpixelformat();
|
||||
|
||||
wgl_extensions = pwglGetExtensionsStringARB(hdc);
|
||||
if(wgl_extensions == NULL) skip("Skipping opengl32 tests because this OpenGL implementation doesn't support WGL extensions!\n");
|
||||
|
||||
|
@ -1298,6 +1298,13 @@ BOOL X11DRV_SetPixelFormat(X11DRV_PDEVICE *physDev,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* SetPixelFormat is not allowed on the X root_window e.g. GetDC(0) */
|
||||
if(get_glxdrawable(physDev) == root_window)
|
||||
{
|
||||
ERR("Invalid operation on root_window\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Check if iPixelFormat is in our list of supported formats to see if it is supported. */
|
||||
fmt = ConvertPixelFormatWGLtoGLX(gdi_display, iPixelFormat, FALSE /* Offscreen */, &value);
|
||||
if(!fmt) {
|
||||
|
Loading…
Reference in New Issue
Block a user