Module: wine Branch: master Commit: 0af447ce9f0685b8cc222fb3b1c8b4d6aad44325 URL: http://source.winehq.org/git/wine.git/?a=commit;h=0af447ce9f0685b8cc222fb3b1...
Author: Nikolay Sivov nsivov@codeweavers.com Date: Fri Apr 23 20:52:13 2010 +0400
user32/tests: Add some GetDlgItem() tests regarding children windows Z-order.
---
dlls/user32/tests/dialog.c | 51 +++++++++++++++++++++++++++++++++++++------- 1 files changed, 43 insertions(+), 8 deletions(-)
diff --git a/dlls/user32/tests/dialog.c b/dlls/user32/tests/dialog.c index 1b36c53..d18ba0e 100644 --- a/dlls/user32/tests/dialog.c +++ b/dlls/user32/tests/dialog.c @@ -338,7 +338,7 @@ static int id (HWND h) * (tab test) */
-static void GetNextDlgItemTest (void) +static void test_GetNextDlgItem(void) { static test_record test [] = { @@ -574,7 +574,7 @@ static BOOL RegisterWindowClasses (void) return TRUE; }
-static void WM_NEXTDLGCTLTest(void) +static void test_WM_NEXTDLGCTL(void) { DWORD dwVal;
@@ -681,7 +681,7 @@ static void WM_NEXTDLGCTLTest(void) DestroyWindow(g_hwndTestDlg); }
-static void IsDialogMessageWTest (void) +static void test_IsDialogMessage(void) { MSG msg;
@@ -795,7 +795,7 @@ static const char * GetHwndString(HWND hw) return "unknown handle"; }
-static void InitialFocusTest (void) +static void test_initial_focus(void) { /* Test 1: * This test intentionally returns FALSE in response to WM_INITDIALOG @@ -897,6 +897,40 @@ static void test_GetDlgItemText(void) "string retrieved using GetDlgItemText should have been NULL terminated\n"); }
+static void test_GetDlgItem(void) +{ + HWND hwnd, child1, child2, hwnd2; + BOOL ret; + + hwnd = CreateWindowA("button", "parent", WS_VISIBLE, 0, 0, 100, 100, NULL, 0, g_hinst, NULL); + ok(hwnd != NULL, "failed to created window\n"); + + /* created with the same ID */ + 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, hwnd, 0, g_hinst, NULL); + ok(child2 != NULL, "failed to create second child\n"); + + hwnd2 = GetDlgItem(hwnd, 0); + ok(hwnd2 == child1, "expected first child, got %p\n", hwnd2); + + hwnd2 = GetTopWindow(hwnd); + ok(hwnd2 == child1, "expected first child to be top, got %p\n", hwnd2); + + ret = SetWindowPos(child1, child2, 0, 0, 0, 0, SWP_NOMOVE); + ok(ret, "got %d\n", ret); + hwnd2 = GetTopWindow(hwnd); + ok(hwnd2 == child2, "expected second child to be top, got %p\n", hwnd2); + + /* top window from child list is picked */ + hwnd2 = GetDlgItem(hwnd, 0); + ok(hwnd2 == child2, "expected second child, got %p\n", hwnd2); + + DestroyWindow(child1); + DestroyWindow(child2); + DestroyWindow(hwnd); +} + static INT_PTR CALLBACK DestroyDlgWinProc (HWND hDlg, UINT uiMsg, WPARAM wParam, LPARAM lParam) { @@ -1212,10 +1246,11 @@ START_TEST(dialog)
if (!RegisterWindowClasses()) assert(0);
- GetNextDlgItemTest(); - IsDialogMessageWTest(); - WM_NEXTDLGCTLTest(); - InitialFocusTest(); + test_GetNextDlgItem(); + test_IsDialogMessage(); + test_WM_NEXTDLGCTL(); + test_initial_focus(); + test_GetDlgItem(); test_GetDlgItemText(); test_DialogBoxParamA(); test_DisabledDialogTest();