[1/2] user32/tests: Add test for nested default Button in Dialogs (try 3)
André Hentschel
nerv at dawncrow.de
Mon Jul 11 17:28:18 CDT 2011
---
dlls/user32/tests/dialog.c | 42 +++++++++++++++++++++++++++++++++++++++---
1 files changed, 39 insertions(+), 3 deletions(-)
diff --git a/dlls/user32/tests/dialog.c b/dlls/user32/tests/dialog.c
index 1dd5884..5d40b7f 100644
--- a/dlls/user32/tests/dialog.c
+++ b/dlls/user32/tests/dialog.c
@@ -50,7 +50,7 @@ static HWND g_hwndTestDlg, g_hwndTestDlgBut1, g_hwndTestDlgBut2, g_hwndTestDlgEd
static HWND g_hwndInitialFocusT1, g_hwndInitialFocusT2, g_hwndInitialFocusGroupBox;
static LONG g_styleInitialFocusT1, g_styleInitialFocusT2;
-static BOOL g_bInitialFocusInitDlgResult;
+static BOOL g_bInitialFocusInitDlgResult, g_bReceivedCommand;
static int g_terminated;
@@ -481,10 +481,11 @@ static LRESULT CALLBACK main_window_procA (HWND hwnd, UINT uiMsg, WPARAM wParam,
g_terminated = TRUE;
return 0;
}
+ if(LOWORD(wParam) == 300) g_bReceivedCommand = TRUE;
break;
}
- return DefWindowProcA (hwnd, uiMsg, wParam, lParam);
+ return DefDlgProcA (hwnd, uiMsg, wParam, lParam);
}
static LRESULT CALLBACK disabled_test_proc (HWND hwnd, UINT uiMsg,
@@ -561,12 +562,12 @@ static BOOL RegisterWindowClasses (void)
if (!RegisterClassA (&cls)) return FALSE;
+ GetClassInfoA(0, "#32770", &cls);
cls.lpfnWndProc = main_window_procA;
cls.lpszClassName = "IsDialogMessageWindowClass";
if (!RegisterClassA (&cls)) return FALSE;
- GetClassInfoA(0, "#32770", &cls);
cls.lpfnWndProc = testDlgWinProc;
cls.lpszClassName = "WM_NEXTDLGCTLWndClass";
if (!RegisterClassA (&cls)) return FALSE;
@@ -683,6 +684,8 @@ static void test_WM_NEXTDLGCTL(void)
static void test_IsDialogMessage(void)
{
+ HWND child1, child2, child3;
+ DWORD dw;
MSG msg;
g_hwndMain = CreateWindow ("IsDialogMessageWindowClass", "IsDialogMessageWindowClass",
@@ -708,6 +711,39 @@ static void test_IsDialogMessage(void)
FormEnterMsg (&msg, g_hwndButtonCancel);
ok (IsDialogMessage (g_hwndMain, &msg), "Did not handle the ENTER\n");
ok (g_terminated, "ENTER did not terminate\n");
+
+ /* test nested default buttons */
+
+ child1 = CreateWindowA("button", "child1", WS_VISIBLE|WS_CHILD, 0, 0, 50, 50,
+ g_hwndMain, (HMENU)100, g_hinst, NULL);
+ ok(child1 != NULL, "failed to create first child\n");
+ child2 = CreateWindowA("button", "child2", WS_VISIBLE|WS_CHILD, 60, 60, 30, 30,
+ g_hwndMain, (HMENU)200, g_hinst, NULL);
+ ok(child2 != NULL, "failed to create second child\n");
+ /* create nested child */
+ child3 = CreateWindowA("button", "child3", WS_VISIBLE|WS_CHILD, 10, 10, 10, 10,
+ child1, (HMENU)300, g_hinst, NULL);
+ ok(child3 != NULL, "failed to create subchild\n");
+
+ DefDlgProcA( g_hwndMain, DM_SETDEFID, 200, 0);
+ dw = DefDlgProcA( g_hwndMain, DM_GETDEFID, 0, 0);
+ ok(LOWORD(dw) == 200, "expected 200, got %x\n", dw);
+
+ DefDlgProcA( g_hwndMain, DM_SETDEFID, 300, 0);
+ dw = DefDlgProcA( g_hwndMain, DM_GETDEFID, 0, 0);
+ ok(LOWORD(dw) == 300, "expected 300, got %x\n", dw);
+ ok(SendMessageW( child3, WM_GETDLGCODE, 0, 0) != DLGC_DEFPUSHBUTTON,
+ "expected child3 not to be marked as DLGC_DEFPUSHBUTTON\n");
+
+ g_bReceivedCommand = FALSE;
+ FormEnterMsg (&msg, child3);
+ ok(IsDialogMessage (g_hwndMain, &msg), "Did not handle the ENTER\n");
+ todo_wine ok(g_bReceivedCommand, "Did not triggered the default Button action\n");
+
+ DestroyWindow(child3);
+ DestroyWindow(child2);
+ DestroyWindow(child1);
+ DestroyWindow(g_hwndMain);
}
--
Best Regards, André Hentschel
More information about the wine-patches
mailing list