wine/dlls/user tests/win.c win.c

Alexandre Julliard julliard at wine.codeweavers.com
Tue Nov 29 05:04:33 CST 2005


ChangeSet ID:	21516
CVSROOT:	/opt/cvs-commit
Module name:	wine
Changes by:	julliard at winehq.org	2005/11/29 05:04:33

Modified files:
	dlls/user/tests: win.c 
	dlls/user      : win.c 

Log message:
	Vitaliy Margolen <wine-patch at kievinfo.com>
	EnumChildWindows should return result from the callback.

Patch: http://cvs.winehq.org/patch.py?id=21516

Old revision  New revision  Changes     Path
 1.73          1.74          +35 -0      wine/dlls/user/tests/win.c
 1.22          1.23          +3 -2       wine/dlls/user/win.c

Index: wine/dlls/user/tests/win.c
diff -u -p wine/dlls/user/tests/win.c:1.73 wine/dlls/user/tests/win.c:1.74
--- wine/dlls/user/tests/win.c:1.73	29 Nov 2005 11: 4:33 -0000
+++ wine/dlls/user/tests/win.c	29 Nov 2005 11: 4:33 -0000
@@ -86,6 +86,13 @@ static void check_parents( HWND hwnd, HW
     }
 }
 
+BOOL CALLBACK EnumChildProc( HWND hwndChild, LPARAM lParam) 
+{
+    (*(LPINT)lParam)++;
+    trace("EnumChildProc on %p\n", hwndChild);
+    if (*(LPINT)lParam > 1) return FALSE;
+    return TRUE;
+}
 
 static HWND create_tool_window( LONG style, HWND parent )
 {
@@ -102,6 +109,7 @@ static void test_parent_owner(void)
     HWND test, owner, ret;
     HWND desktop = GetDesktopWindow();
     HWND child = create_tool_window( WS_CHILD, hwndMain );
+    INT  numChildren;
 
     trace( "main window %p main2 %p desktop %p child %p\n", hwndMain, hwndMain2, desktop, child );
 
@@ -440,6 +448,33 @@ static void test_parent_owner(void)
 
     /* final cleanup */
     DestroyWindow(child);
+
+
+    owner = create_tool_window( WS_OVERLAPPED, 0 );
+    test = create_tool_window( WS_POPUP, NULL );
+    numChildren = 0;
+    ok( !EnumChildWindows( owner, EnumChildProc, (LPARAM)&numChildren ),
+        "EnumChildWindows should have returned FALSE\n" );
+    ok( numChildren == 0, "numChildren should be 0 got %d\n", numChildren );
+
+    SetWindowLongA( test, GWL_STYLE, (GetWindowLongA( test, GWL_STYLE ) & ~WS_POPUP) | WS_CHILD );
+    ret = SetParent( test, owner );
+    ok( ret == desktop, "SetParent return value %p expected %p\n", ret, desktop );
+
+    numChildren = 0;
+    ok( EnumChildWindows( owner, EnumChildProc, (LPARAM)&numChildren ),
+        "EnumChildWindows should have returned TRUE\n" );
+    ok( numChildren == 1, "numChildren should be 1 got %d\n", numChildren );
+
+    child = create_tool_window( WS_CHILD, owner );
+    numChildren = 0;
+    ok( !EnumChildWindows( owner, EnumChildProc, (LPARAM)&numChildren ),
+        "EnumChildWindows should have returned FALSE\n" );
+    ok( numChildren == 2, "numChildren should be 2 got %d\n", numChildren );
+
+    DestroyWindow( child );
+    DestroyWindow( test );
+    DestroyWindow( owner );
 }
 
 
Index: wine/dlls/user/win.c
diff -u -p wine/dlls/user/win.c:1.22 wine/dlls/user/win.c:1.23
--- wine/dlls/user/win.c:1.22	29 Nov 2005 11: 4:33 -0000
+++ wine/dlls/user/win.c	29 Nov 2005 11: 4:33 -0000
@@ -2836,13 +2836,14 @@ static BOOL WIN_EnumChildWindows( HWND *
 BOOL WINAPI EnumChildWindows( HWND parent, WNDENUMPROC func, LPARAM lParam )
 {
     HWND *list;
+    BOOL ret;
 
     USER_CheckNotLock();
 
     if (!(list = WIN_ListChildren( parent ))) return FALSE;
-    WIN_EnumChildWindows( list, func, lParam );
+    ret = WIN_EnumChildWindows( list, func, lParam );
     HeapFree( GetProcessHeap(), 0, list );
-    return TRUE;
+    return ret;
 }
 
 



More information about the wine-cvs mailing list