user: Don't drop owned windows in WIN_EnumChildWindows. [Try 2]

Vitaliy Margolen wine-patch at kievinfo.com
Wed Dec 14 00:06:20 CST 2005


This time added few more tests with desktop as an owner.

ChangeLog:
user: Don't drop owned windows in WIN_EnumChildWindows.
Add few tests to test this.

 dlls/user/tests/win.c |   28 +++++++++++++++++++++++++++-
 dlls/user/win.c       |    2 --
 2 files changed, 27 insertions(+), 3 deletions(-)
-------------- next part --------------
764a4968af7e81f72a36e0b9c549fd72f4d3c7b8
diff --git a/dlls/user/tests/win.c b/dlls/user/tests/win.c
index e1f787b..cc0a140 100644
--- a/dlls/user/tests/win.c
+++ b/dlls/user/tests/win.c
@@ -451,7 +451,9 @@ static void test_parent_owner(void)
 
 
     owner = create_tool_window( WS_OVERLAPPED, 0 );
-    test = create_tool_window( WS_POPUP, NULL );
+    test = create_tool_window( WS_POPUP, desktop );
+
+    ok( !GetWindow( test, GW_OWNER ), "Wrong owner window\n" );
     numChildren = 0;
     ok( !EnumChildWindows( owner, EnumChildProc, (LPARAM)&numChildren ),
         "EnumChildWindows should have returned FALSE\n" );
@@ -471,6 +473,30 @@ static void test_parent_owner(void)
     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 );
+
+    child = create_tool_window( WS_VISIBLE | WS_OVERLAPPEDWINDOW, owner );
+    ok( GetWindow( child, GW_OWNER ) == owner, "Wrong owner window\n" );
+    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 );
+
+    ret = SetParent( child, owner );
+    ok( GetWindow( child, GW_OWNER ) == owner, "Wrong owner window\n" );
+    ok( ret == desktop, "SetParent return value %p expected %p\n", ret, desktop );
+    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 );
+
+    ret = SetParent( child, NULL );
+    ok( GetWindow( child, GW_OWNER ) == owner, "Wrong owner window\n" );
+    ok( ret == owner, "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 );
 
     DestroyWindow( child );
     DestroyWindow( test );
diff --git a/dlls/user/win.c b/dlls/user/win.c
index dbdb7e5..1e3b418 100644
--- a/dlls/user/win.c
+++ b/dlls/user/win.c
@@ -2812,8 +2812,6 @@ static BOOL WIN_EnumChildWindows( HWND *
     {
         /* Make sure that the window still exists */
         if (!IsWindow( *list )) continue;
-        /* skip owned windows */
-        if (GetWindow( *list, GW_OWNER )) continue;
         /* Build children list first */
         childList = WIN_ListChildren( *list );
 


More information about the wine-patches mailing list