From c65ec218668d2262f5d1f42ebafdce0dcd317a38 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Thu, 27 Mar 2008 11:48:44 -0700 Subject: [PATCH 1/3] user32: make an edit test more readable. --- dlls/user32/tests/edit.c | 23 +++++++++++++---------- dlls/user32/tests/resource.rc | 4 ++-- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/dlls/user32/tests/edit.c b/dlls/user32/tests/edit.c index 05e6741..c8ae56c 100644 --- a/dlls/user32/tests/edit.c +++ b/dlls/user32/tests/edit.c @@ -37,23 +37,24 @@ struct edit_notify { static struct edit_notify notifications; -static INT_PTR CALLBACK bug_11841_proc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam) +static INT_PTR CALLBACK edit_dialog_proc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam) { switch (msg) { case WM_INITDIALOG: { - SetFocus(GetDlgItem(hdlg, 1000)); + HWND hedit = GetDlgItem(hdlg, 1000); + SetFocus(hedit); switch (lparam) { case 0: - PostMessage(GetDlgItem(hdlg, 1000), WM_KEYDOWN, 0x1b, 0x10001); + PostMessage(hedit, WM_KEYDOWN, VK_ESCAPE, 0x10001); break; case 1: - PostMessage(GetDlgItem(hdlg, 1000), WM_KEYDOWN, 0xd, 0x1c0001); + PostMessage(hedit, WM_KEYDOWN, VK_RETURN, 0x1c0001); break; case 2: - PostMessage(GetDlgItem(hdlg, 1000), WM_KEYDOWN, 0x9, 0xf0001); + PostMessage(hedit, WM_KEYDOWN, VK_TAB, 0xf0001); PostMessage(hdlg, WM_USER, 0xdeadbeef, 0xdeadbeef); break; default: @@ -1198,14 +1199,16 @@ static void test_undo(void) DestroyWindow (hwEdit); } -static void test_bug_11841(void) +static void test_edit_dialog(void) { int r; - r = DialogBoxParam(hinst, "BUG_11841_DIALOG", NULL, (DLGPROC)bug_11841_proc, 0); + + /* from bug 11841 */ + r = DialogBoxParam(hinst, "EDIT_READONLY_DIALOG", NULL, (DLGPROC)edit_dialog_proc, 0); ok(333 == r, "Expected %d, got %d\n", 333, r); - r = DialogBoxParam(hinst, "BUG_11841_DIALOG", NULL, (DLGPROC)bug_11841_proc, 1); + r = DialogBoxParam(hinst, "EDIT_READONLY_DIALOG", NULL, (DLGPROC)edit_dialog_proc, 1); ok(111 == r, "Expected %d, got %d\n", 111, r); - r = DialogBoxParam(hinst, "BUG_11841_DIALOG", NULL, (DLGPROC)bug_11841_proc, 2); + r = DialogBoxParam(hinst, "EDIT_READONLY_DIALOG", NULL, (DLGPROC)edit_dialog_proc, 2); ok(444 == r, "Expected %d, got %d\n", 444, r); } @@ -1277,7 +1280,7 @@ START_TEST(edit) test_text_position(); test_espassword(); test_undo(); - test_bug_11841(); + test_edit_dialog(); UnregisterWindowClasses(); } diff --git a/dlls/user32/tests/resource.rc b/dlls/user32/tests/resource.rc index a68857f..2945466 100644 --- a/dlls/user32/tests/resource.rc +++ b/dlls/user32/tests/resource.rc @@ -98,9 +98,9 @@ BEGIN PUSHBUTTON "Cancel",IDCANCEL,129,24,50,14 END -BUG_11841_DIALOG DIALOG DISCARDABLE 0, 0, 160, 80 +EDIT_READONLY_DIALOG DIALOG DISCARDABLE 0, 0, 160, 80 STYLE WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | DS_CENTER -CAPTION "Bug 11841 Test" +CAPTION "Edit Readonly Test" FONT 8, "MS Shell Dlg" { PUSHBUTTON "Ok", IDOK, 20, 60, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP -- 1.5.2.5