André Hentschel : user32/tests: Add test for nested default button in dialogs.

Alexandre Julliard julliard at winehq.org
Mon Jul 18 12:46:59 CDT 2011


Module: wine
Branch: master
Commit: b3fbdfa908d122f713078d6929188aa0e91b3f99
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=b3fbdfa908d122f713078d6929188aa0e91b3f99

Author: André Hentschel <nerv at dawncrow.de>
Date:   Wed Jul 13 19:10:30 2011 +0200

user32/tests: Add test for nested default button in dialogs.

---

 dlls/user32/tests/dialog.c |   38 +++++++++++++++++++++++++++++++++++++-
 1 files changed, 37 insertions(+), 1 deletions(-)

diff --git a/dlls/user32/tests/dialog.c b/dlls/user32/tests/dialog.c
index 1dd5884..5964931 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;
 
@@ -539,6 +539,8 @@ static LRESULT CALLBACK testDlgWinProc (HWND hwnd, UINT uiMsg, WPARAM wParam,
         case WM_CREATE:
             return (OnTestDlgCreate (hwnd,
                     (LPCREATESTRUCTA) lParam) ? 0 : (LRESULT) -1);
+        case WM_COMMAND:
+            if(LOWORD(wParam) == 300) g_bReceivedCommand = TRUE;
     }
 
     return DefDlgProcA (hwnd, uiMsg, wParam, lParam);
@@ -576,6 +578,8 @@ static BOOL RegisterWindowClasses (void)
 
 static void test_WM_NEXTDLGCTL(void)
 {
+    HWND child1, child2, child3;
+    MSG msg;
     DWORD dwVal;
 
     g_hwndTestDlg = CreateWindowEx( WS_EX_LEFT | WS_EX_LTRREADING | WS_EX_RIGHTSCROLLBAR
@@ -678,6 +682,38 @@ static void test_WM_NEXTDLGCTL(void)
         dwVal = DefDlgProcA(g_hwndTestDlg, DM_GETDEFID, 0, 0);
         ok ( IDCANCEL == (LOWORD(dwVal)), "WM_NEXTDLGCTL changed default button\n");
     }
+
+    /* test nested default buttons */
+
+    child1 = CreateWindowA("button", "child1", WS_VISIBLE|WS_CHILD, 0, 0, 50, 50,
+                           g_hwndTestDlg, (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_hwndTestDlg, (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_hwndTestDlg, DM_SETDEFID, 200, 0);
+    dwVal = DefDlgProcA( g_hwndTestDlg, DM_GETDEFID, 0, 0);
+    ok(LOWORD(dwVal) == 200, "expected 200, got %x\n", dwVal);
+
+    DefDlgProcA( g_hwndTestDlg, DM_SETDEFID, 300, 0);
+    dwVal = DefDlgProcA( g_hwndTestDlg, DM_GETDEFID, 0, 0);
+    ok(LOWORD(dwVal) == 300, "expected 300, got %x\n", dwVal);
+    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_hwndTestDlg, &msg), "Did not handle the ENTER\n");
+    todo_wine ok(g_bReceivedCommand, "Did not trigger the default Button action\n");
+
+    DestroyWindow(child3);
+    DestroyWindow(child2);
+    DestroyWindow(child1);
     DestroyWindow(g_hwndTestDlg);
 }
 




More information about the wine-cvs mailing list