From e5e150a4d60dbb150cc032d70cadb0f8ff04637d Mon Sep 17 00:00:00 2001 From: David Adam Date: Mon, 1 Nov 2010 22:32:52 +0100 Subject: [PATCH] ddraw: Add tests for SetCooperativeLevel with a NULL window. --- dlls/ddraw/tests/ddrawmodes.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/dlls/ddraw/tests/ddrawmodes.c b/dlls/ddraw/tests/ddrawmodes.c index e83541ace8d..3aecb63cd83 100644 --- a/dlls/ddraw/tests/ddrawmodes.c +++ b/dlls/ddraw/tests/ddrawmodes.c @@ -554,6 +554,10 @@ static void testcooperativelevels_normal(void) /* Do some tests with DDSCL_NORMAL mode */ /* Fullscreen mode + normal mode + exclusive mode */ + + rc = IDirectDraw_SetCooperativeLevel(lpDD, NULL, DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE | DDSCL_NORMAL); + ok(rc==DDERR_INVALIDPARAMS, "Expected DDERR_INVALIDPARAMS, received: %x\n", rc); + sfw=FALSE; if(hwnd2) sfw=SetForegroundWindow(hwnd2); @@ -583,6 +587,7 @@ static void testcooperativelevels_normal(void) ok(rc==DDERR_INVALIDPARAMS,"SetCooperativeLevel(DDSCL_EXCLUSIVE | DDSCL_NORMAL) returned: %x\n",rc); /* Fullscreen mode + normal mode */ + sfw=FALSE; if(hwnd2) sfw=SetForegroundWindow(hwnd2); @@ -592,6 +597,9 @@ static void testcooperativelevels_normal(void) if(sfw) ok(GetForegroundWindow()==hwnd2,"Expected the second windows (%p) for foreground, received the main one (%p)\n",hwnd2, hwnd); + rc = IDirectDraw_SetCooperativeLevel(lpDD, NULL, DDSCL_FULLSCREEN | DDSCL_NORMAL); + todo_wine ok(rc==DD_OK, "Expected DD_OK, received %x\n", rc); + /* Try creating a double buffered primary in fullscreen + normal mode */ rc = IDirectDraw_CreateSurface(lpDD, &surfacedesc, &surface, NULL); if (rc == DDERR_UNSUPPORTEDMODE) @@ -605,6 +613,7 @@ static void testcooperativelevels_normal(void) if(surface && surface != (IDirectDrawSurface *)0xdeadbeef) IDirectDrawSurface_Release(surface); /* switching from Fullscreen mode to Normal mode */ + sfw=FALSE; if(hwnd2) sfw=SetForegroundWindow(hwnd2); @@ -615,6 +624,9 @@ static void testcooperativelevels_normal(void) if(sfw) ok(GetForegroundWindow()==hwnd2,"Expected the second windows (%p) for foreground, received the main one (%p)\n",hwnd2, hwnd); + rc = IDirectDraw_SetCooperativeLevel(lpDD, NULL, DDSCL_NORMAL); + ok(rc==DD_OK, "Expected DD_OK, received %x\n", rc); + /* Try creating a double buffered primary in normal mode */ rc = IDirectDraw_CreateSurface(lpDD, &surfacedesc, &surface, NULL); if (rc == DDERR_UNSUPPORTEDMODE) @@ -627,6 +639,7 @@ static void testcooperativelevels_normal(void) if(surface && surface != (IDirectDrawSurface *)0xdeadbeef) IDirectDrawSurface_Release(surface); /* switching from Normal mode to Fullscreen + Normal mode */ + sfw=FALSE; if(hwnd2) sfw=SetForegroundWindow(hwnd2); @@ -637,11 +650,24 @@ static void testcooperativelevels_normal(void) if(sfw) ok(GetForegroundWindow()==hwnd2,"Expected the second windows (%p) for foreground, received the main one (%p)\n",hwnd2, hwnd); + rc = IDirectDraw_SetCooperativeLevel(lpDD, NULL, DDSCL_NORMAL | DDSCL_FULLSCREEN); + todo_wine ok(rc==DD_OK, "Expected DD_OK, received %x\n", rc); + /* Set the focus window */ rc = IDirectDraw_SetCooperativeLevel(lpDD, hwnd, DDSCL_SETFOCUSWINDOW | DDSCL_CREATEDEVICEWINDOW); ok(rc==DDERR_INVALIDPARAMS,"SetCooperativeLevel(DDSCL_SETFOCUSWINDOW | DDSCL_CREATEDEVICEWINDOW) returned: %x\n",rc); + rc = IDirectDraw_SetCooperativeLevel(lpDD, NULL, DDSCL_SETFOCUSWINDOW); + + if (rc == DDERR_INVALIDPARAMS) + { + win_skip("NT4/Win95 do not support cooperative levels DDSCL_SETDEVICEWINDOW and DDSCL_SETFOCUSWINDOW\n"); + return; + } + + ok(rc==DD_OK, "Expected DD_OK, received %x\n", rc); + rc = IDirectDraw_SetCooperativeLevel(lpDD, hwnd, DDSCL_SETFOCUSWINDOW); @@ -733,6 +759,10 @@ static void testcooperativelevels_exclusive(void) ok(rc==DDERR_INVALIDPARAMS,"SetCooperativeLevel(DDSCL_FULLSCREEN) returned: %x\n",rc); /* Full screen mode + exclusive mode */ + + rc = IDirectDraw_SetCooperativeLevel(lpDD, NULL, DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE); + todo_wine ok(rc==DDERR_INVALIDPARAMS, "Expected DDERR_INVALIDPARAMS, received %x\n", rc); + sfw=FALSE; if(hwnd2) sfw=SetForegroundWindow(hwnd2);