Re: ddraw: Add tests for the foreground window set by SetCooperativeLevel

2010-10-26 Thread David Adam
Timeout does not seem related to my patch (Anyway, I dont see how this patch
could cause a timeout)
Second failure is harmless

A+

David

2010/10/25 Stefan Leichter stefan.leich...@camline.com

 Am Monday 25 October 2010 20:11:35 schrieb David Adam:
  Any problems with patch?
 
  A+
 
  David
 
  -- Forwarded message --
  From: David Adam david.adam.c...@gmail.com
  Date: 2010/10/24
  Subject: ddraw: Add tests for the foreground window set by
  SetCooperativeLevel
  To: wine-patches wine-patc...@winehq.org

 http://source.winehq.org/patches/ shows test failures on windows for your
 patch. Not sure if the failures were caused by your patch.

 Bye
 Stefan




Re: ddraw: Add tests for the foreground window set by SetCooperativeLevel

2010-10-26 Thread Alexandre Julliard
David Adam david.adam.c...@gmail.com writes:

 @@ -33,8 +33,9 @@ static LPDIRECTDRAW lpDD = NULL;
  static LPDIRECTDRAWSURFACE lpDDSPrimary = NULL;
  static LPDIRECTDRAWSURFACE lpDDSBack = NULL;
  static WNDCLASS wc;
 -static HWND hwnd;
 +static HWND hwnd, hwnd2;
  static int modes_cnt;
 +static BOOL success;

That boolean make much sense, especially with this name. If you want to
check that you have a valid window you should test the window
handle. Same with your createwindow function, it should simply return
the handle.

-- 
Alexandre Julliard
julli...@winehq.org




ddraw: Add tests for the foreground window set by SetCooperativeLevel

2010-10-25 Thread David Adam
Any problems with patch?

A+

David

-- Forwarded message --
From: David Adam david.adam.c...@gmail.com
Date: 2010/10/24
Subject: ddraw: Add tests for the foreground window set by
SetCooperativeLevel
To: wine-patches wine-patc...@winehq.org
From e929b17027bebd7eb466d7e8b71efd270889e713 Mon Sep 17 00:00:00 2001
From: David Adam david.adam.c...@gmail.com
Date: Sun, 24 Oct 2010 08:44:51 +0200
Subject: Add tests for the foreground window set by SetCooperativeLevel

---
 dlls/ddraw/tests/ddrawmodes.c |  178 +++--
 1 files changed, 154 insertions(+), 24 deletions(-)

diff --git a/dlls/ddraw/tests/ddrawmodes.c b/dlls/ddraw/tests/ddrawmodes.c
index b6491f3..c41302a 100644
--- a/dlls/ddraw/tests/ddrawmodes.c
+++ b/dlls/ddraw/tests/ddrawmodes.c
@@ -33,8 +33,9 @@ static LPDIRECTDRAW lpDD = NULL;
 static LPDIRECTDRAWSURFACE lpDDSPrimary = NULL;
 static LPDIRECTDRAWSURFACE lpDDSBack = NULL;
 static WNDCLASS wc;
-static HWND hwnd;
+static HWND hwnd, hwnd2;
 static int modes_cnt;
+static BOOL success;
 static int modes_size;
 static LPDDSURFACEDESC modes;
 static RECT rect_before_create;
@@ -54,31 +55,19 @@ static void init_function_pointers(void)
 pDirectDrawEnumerateExW = (void*)GetProcAddress(hmod, DirectDrawEnumerateExW);
 }
 
-static void createwindow(void)
+static BOOL createwindow(HWND *hwnd)
 {
-wc.style = CS_HREDRAW | CS_VREDRAW;
-wc.lpfnWndProc = DefWindowProcA;
-wc.cbClsExtra = 0;
-wc.cbWndExtra = 0;
-wc.hInstance = GetModuleHandleA(0);
-wc.hIcon = LoadIconA(wc.hInstance, IDI_APPLICATION);
-wc.hCursor = LoadCursorA(NULL, IDC_ARROW);
-wc.hbrBackground = GetStockObject(BLACK_BRUSH);
-wc.lpszMenuName = NULL;
-wc.lpszClassName = TestWindowClass;
-if(!RegisterClassA(wc))
-assert(0);
-
-hwnd = CreateWindowExA(0, TestWindowClass, TestWindowClass,
+*hwnd = CreateWindowExA(0, TestWindowClass, TestWindowClass,
 WS_POPUP, 0, 0,
 GetSystemMetrics(SM_CXSCREEN),
 GetSystemMetrics(SM_CYSCREEN),
 NULL, NULL, GetModuleHandleA(0), NULL);
-assert(hwnd != NULL);
 
-ShowWindow(hwnd, SW_HIDE);
-UpdateWindow(hwnd);
-SetFocus(hwnd);
+ShowWindow(*hwnd, SW_HIDE);
+UpdateWindow(*hwnd);
+SetFocus(*hwnd);
+
+return (*hwnd != NULL);
 }
 
 static BOOL createdirectdraw(void)
@@ -546,6 +535,7 @@ static void testdisplaymodes(void)
 
 static void testcooperativelevels_normal(void)
 {
+BOOL sfw;
 HRESULT rc;
 DDSURFACEDESC surfacedesc;
 IDirectDrawSurface *surface = (IDirectDrawSurface *) 0xdeadbeef;
@@ -561,11 +551,34 @@ static void testcooperativelevels_normal(void)
 ok(rc==DDERR_INVALIDPARAMS,SetCooperativeLevel(DDSCL_SETFOCUSWINDOW | DDSCL_CREATEDEVICEWINDOW) returned: %x\n,rc);
 
 /* Do some tests with DDSCL_NORMAL mode */
+
 /* Fullscreen mode + normal mode + exclusive mode */
+sfw=FALSE;
+
+if(success)
+{
+sfw=SetForegroundWindow(hwnd2);
+}
+else
+{
+skip(Failed to create the second window\n);
+}
+
 rc = IDirectDraw_SetCooperativeLevel(lpDD, hwnd, DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE | DDSCL_NORMAL);
 todo_wine ok(rc==DD_OK,SetCooperativeLevel(DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE | DDSCL_NORMAL) returned: %x\n,rc);
+
+if(sfw)
+{
+todo_wine ok(GetForegroundWindow()==hwnd,Expected the main windows (%p) for foreground, received the second one (%p)\n,hwnd, hwnd2);
+}
+else
+{
+skip(Failed to set the second window for foreground\n);
+}
+
 /* Try creating a double buffered primary in fullscreen + exclusive + normal mode */
 rc = IDirectDraw_CreateSurface(lpDD, surfacedesc, surface, NULL);
+
 if (rc == DDERR_UNSUPPORTEDMODE)
 skip(Unsupported mode\n);
 else
@@ -574,12 +587,35 @@ static void testcooperativelevels_normal(void)
 todo_wine ok(surface!=NULL, Returned NULL surface pointer \n);
 }
 if(surface  surface != (IDirectDrawSurface *)0xdeadbeef) IDirectDrawSurface_Release(surface);
+
 /* Exclusive mode + normal mode */
 rc = IDirectDraw_SetCooperativeLevel(lpDD, hwnd, DDSCL_EXCLUSIVE | DDSCL_NORMAL);
 ok(rc==DDERR_INVALIDPARAMS,SetCooperativeLevel(DDSCL_EXCLUSIVE | DDSCL_NORMAL) returned: %x\n,rc);
+
 /* Fullscreen mode + normal mode */
+sfw=FALSE;
+
+if(success)
+{
+sfw=SetForegroundWindow(hwnd2);
+}
+else
+{
+skip(Failed to create the second window\n);
+}
+
 rc = IDirectDraw_SetCooperativeLevel(lpDD, hwnd, DDSCL_FULLSCREEN | DDSCL_NORMAL);
 todo_wine ok(rc==DD_OK,SetCooperativeLevel(DDSCL_FULLSCREEN | DDSCL_NORMAL) returned: %x\n,rc);
+
+if(sfw)
+{
+ok(GetForegroundWindow()==hwnd2,Expected the second windows (%p) for foreground, received the main one (%p)\n,hwnd2, hwnd);
+}
+else
+{
+skip(Failed to set the second window for foreground\n);
+}
+
 /* Try creating a double buffered primary in fullscreen

Re: ddraw: Add tests for the foreground window set by SetCooperativeLevel

2010-10-25 Thread Stefan Leichter
Am Monday 25 October 2010 20:11:35 schrieb David Adam:
 Any problems with patch?

 A+

 David

 -- Forwarded message --
 From: David Adam david.adam.c...@gmail.com
 Date: 2010/10/24
 Subject: ddraw: Add tests for the foreground window set by
 SetCooperativeLevel
 To: wine-patches wine-patc...@winehq.org

http://source.winehq.org/patches/ shows test failures on windows for your 
patch. Not sure if the failures were caused by your patch.

Bye
Stefan




Re: ddraw: Add tests for the foreground window set by SetCooperativeLevel

2010-10-24 Thread testbot
Hi,

While running your changed tests on Windows, I think I found new failures.
Being a bot and all I'm not very good at pattern recognition, so I might be
wrong, but could you please double-check?
Full results can be found at
http://testbot.winehq.org/JobDetails.pl?Key=6448

Your paranoid android.


=== W98SE (32 bit ddrawmodes) ===
No test summary line found

=== W7PROX64 (64 bit ddrawmodes) ===
Timeout