user32/tests: Test that GetDlgItem does not recurse

André Hentschel nerv at dawncrow.de
Thu Jul 1 15:07:40 CDT 2010


This test shows that GetDlgItem does not recurse.
ok, i guessed wrong.
AJ, i see you grin...:)

I send this so that the work doesnt get lost.
---
 dlls/user32/tests/dialog.c |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/dlls/user32/tests/dialog.c b/dlls/user32/tests/dialog.c
index d18ba0e..af66a41 100644
--- a/dlls/user32/tests/dialog.c
+++ b/dlls/user32/tests/dialog.c
@@ -929,6 +929,31 @@ static void test_GetDlgItem(void)
     DestroyWindow(child1);
     DestroyWindow(child2);
     DestroyWindow(hwnd);
+
+    /* Now test how GetDlgItem searches */
+    hwnd = CreateWindowA("button", "parent", WS_VISIBLE, 0, 0, 100, 100, NULL, 0, g_hinst, NULL);
+    ok(hwnd != NULL, "failed to created window\n");
+
+    child1 = CreateWindowA("button", "child1", WS_VISIBLE|WS_CHILD, 0, 0, 10, 10, hwnd, 0, g_hinst, NULL);
+    ok(child1 != NULL, "failed to create first child\n");
+    child2 = CreateWindowA("button", "child2", WS_VISIBLE|WS_CHILD, 0, 0, 10, 10, child1, 0, g_hinst, NULL);
+    ok(child2 != NULL, "failed to create second child\n");
+
+    /* give child2 an ID */
+    SetWindowLong(child2, GWLP_ID, 100);
+
+    hwnd2 = GetDlgItem(hwnd, 100);
+    ok(!hwnd2, "expected child to not be found, got %p\n", hwnd2);
+
+    /* make the ID of child2 public with a WS_EX_CONTROLPARENT parent */
+    SetWindowLong(child1, GWL_EXSTYLE, WS_EX_CONTROLPARENT);
+
+    hwnd2 = GetDlgItem(hwnd, 100);
+    ok(!hwnd2, "expected child to not be found, got %p\n", hwnd2);
+
+    DestroyWindow(child1);
+    DestroyWindow(child2);
+    DestroyWindow(hwnd);
 }
 
 static INT_PTR CALLBACK DestroyDlgWinProc (HWND hDlg, UINT uiMsg,
-- 

Best Regards, André Hentschel



More information about the wine-patches mailing list