Commit 0af447ce authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

user32/tests: Add some GetDlgItem() tests regarding children windows Z-order.

parent 57b55f36
...@@ -338,7 +338,7 @@ static int id (HWND h) ...@@ -338,7 +338,7 @@ static int id (HWND h)
* (tab test) * (tab test)
*/ */
static void GetNextDlgItemTest (void) static void test_GetNextDlgItem(void)
{ {
static test_record test [] = static test_record test [] =
{ {
...@@ -574,7 +574,7 @@ static BOOL RegisterWindowClasses (void) ...@@ -574,7 +574,7 @@ static BOOL RegisterWindowClasses (void)
return TRUE; return TRUE;
} }
static void WM_NEXTDLGCTLTest(void) static void test_WM_NEXTDLGCTL(void)
{ {
DWORD dwVal; DWORD dwVal;
...@@ -681,7 +681,7 @@ static void WM_NEXTDLGCTLTest(void) ...@@ -681,7 +681,7 @@ static void WM_NEXTDLGCTLTest(void)
DestroyWindow(g_hwndTestDlg); DestroyWindow(g_hwndTestDlg);
} }
static void IsDialogMessageWTest (void) static void test_IsDialogMessage(void)
{ {
MSG msg; MSG msg;
...@@ -795,7 +795,7 @@ static const char * GetHwndString(HWND hw) ...@@ -795,7 +795,7 @@ static const char * GetHwndString(HWND hw)
return "unknown handle"; return "unknown handle";
} }
static void InitialFocusTest (void) static void test_initial_focus(void)
{ {
/* Test 1: /* Test 1:
* This test intentionally returns FALSE in response to WM_INITDIALOG * This test intentionally returns FALSE in response to WM_INITDIALOG
...@@ -897,6 +897,40 @@ static void test_GetDlgItemText(void) ...@@ -897,6 +897,40 @@ static void test_GetDlgItemText(void)
"string retrieved using GetDlgItemText should have been NULL terminated\n"); "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, static INT_PTR CALLBACK DestroyDlgWinProc (HWND hDlg, UINT uiMsg,
WPARAM wParam, LPARAM lParam) WPARAM wParam, LPARAM lParam)
{ {
...@@ -1212,10 +1246,11 @@ START_TEST(dialog) ...@@ -1212,10 +1246,11 @@ START_TEST(dialog)
if (!RegisterWindowClasses()) assert(0); if (!RegisterWindowClasses()) assert(0);
GetNextDlgItemTest(); test_GetNextDlgItem();
IsDialogMessageWTest(); test_IsDialogMessage();
WM_NEXTDLGCTLTest(); test_WM_NEXTDLGCTL();
InitialFocusTest(); test_initial_focus();
test_GetDlgItem();
test_GetDlgItemText(); test_GetDlgItemText();
test_DialogBoxParamA(); test_DialogBoxParamA();
test_DisabledDialogTest(); test_DisabledDialogTest();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment