diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c index 96033a2746c..e3bebe76fc9 100644 --- a/dlls/user32/tests/win.c +++ b/dlls/user32/tests/win.c @@ -3295,8 +3295,6 @@ static void test_SetParent(void) BOOL ret; HWND desktop = GetDesktopWindow(); HMENU hMenu; - /* FIXME: This detection is not correct as it also covers (all?) XP+ */ - BOOL is_win9x = GetWindowLongPtrW(desktop, GWLP_WNDPROC) == 0; HWND parent, child1, child2, child3, child4, sibling; parent = CreateWindowExA(0, "static", NULL, WS_OVERLAPPEDWINDOW, @@ -3342,19 +3340,41 @@ static void test_SetParent(void) if (!is_win9x) /* Win9x doesn't survive this test */ { + HWND ret; + ok(!SetParent(parent, child1), "SetParent should fail\n"); ok(!SetParent(child2, child3), "SetParent should fail\n"); ok(SetParent(child1, parent) != 0, "SetParent should not fail\n"); - ok(SetParent(parent, child2) != 0, "SetParent should not fail\n"); - ok(SetParent(parent, child3) != 0, "SetParent should not fail\n"); - ok(!SetParent(child2, parent), "SetParent should fail\n"); - ok(SetParent(parent, child4) != 0, "SetParent should not fail\n"); - - check_parents(parent, child4, child4, 0, 0, child4, parent); - check_parents(child1, parent, parent, parent, 0, child4, parent); - check_parents(child2, desktop, parent, parent, parent, child2, parent); - check_parents(child3, child2, child2, child2, 0, child2, parent); - check_parents(child4, desktop, child2, child2, child2, child4, parent); + ret = SetParent(parent, child2); + todo_wine ok( !ret || broken( ret != 0 ), "SetParent should fail\n"); + if (ret) /* nt4, win2k */ + { + ret = SetParent(parent, child3); + ok(ret != 0, "SetParent should not fail\n"); + ret = SetParent(child2, parent); + ok(!ret, "SetParent should fail\n"); + ret = SetParent(parent, child4); + ok(ret != 0, "SetParent should not fail\n"); + check_parents(parent, child4, child4, 0, 0, child4, parent); + check_parents(child1, parent, parent, parent, 0, child4, parent); + check_parents(child2, desktop, parent, parent, parent, child2, parent); + check_parents(child3, child2, child2, child2, 0, child2, parent); + check_parents(child4, desktop, child2, child2, child2, child4, parent); + } + else + { + ret = SetParent(parent, child3); + ok(ret != 0, "SetParent should not fail\n"); + ret = SetParent(child2, parent); + ok(!ret, "SetParent should fail\n"); + ret = SetParent(parent, child4); + ok(!ret, "SetParent should fail\n"); + check_parents(parent, child3, child3, 0, 0, child2, parent); + check_parents(child1, parent, parent, parent, 0, child2, parent); + check_parents(child2, desktop, parent, parent, parent, child2, parent); + check_parents(child3, child2, child2, child2, 0, child2, parent); + check_parents(child4, desktop, child2, child2, child2, child4, parent); + } } else skip("Win9x/WinMe crash\n");