From 54d5f891beee211f2b97538e7195044f457a8e2c Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Mon, 7 Apr 2008 14:11:58 -0700 Subject: [PATCH 5/7] user32: fix WM_CHAR return value for edit controls. --- dlls/user32/edit.c | 9 +++++---- dlls/user32/tests/edit.c | 25 ++++++++++++++++--------- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/dlls/user32/edit.c b/dlls/user32/edit.c index e6d2530..8afc87a 100644 --- a/dlls/user32/edit.c +++ b/dlls/user32/edit.c @@ -257,7 +257,7 @@ static BOOL EDIT_EM_Undo(EDITSTATE *es); /* * WM_XXX message handlers */ -static void EDIT_WM_Char(EDITSTATE *es, WCHAR c); +static LRESULT EDIT_WM_Char(EDITSTATE *es, WCHAR c); static void EDIT_WM_Command(EDITSTATE *es, INT code, INT id, HWND conrtol); static void EDIT_WM_ContextMenu(EDITSTATE *es, INT x, INT y); static void EDIT_WM_Copy(EDITSTATE *es); @@ -834,7 +834,7 @@ static LRESULT WINAPI EditWndProc_common( HWND hwnd, UINT msg, strng[1] = wParam & 0xff; if (strng[0]) MultiByteToWideChar(CP_ACP, 0, strng, 2, &charW, 1); else MultiByteToWideChar(CP_ACP, 0, &strng[1], 1, &charW, 1); - EDIT_WM_Char(es, charW); + result = EDIT_WM_Char(es, charW); break; } /* fall through */ @@ -866,7 +866,7 @@ static LRESULT WINAPI EditWndProc_common( HWND hwnd, UINT msg, if (charW == VK_TAB || charW == VK_RETURN) break; } - EDIT_WM_Char(es, charW); + result = EDIT_WM_Char(es, charW); break; } @@ -3994,7 +3994,7 @@ static BOOL EDIT_EM_Undo(EDITSTATE *es) * WM_CHAR * */ -static void EDIT_WM_Char(EDITSTATE *es, WCHAR c) +static LRESULT EDIT_WM_Char(EDITSTATE *es, WCHAR c) { BOOL control; @@ -4065,6 +4065,7 @@ static void EDIT_WM_Char(EDITSTATE *es, WCHAR c) } break; } + return 1; } diff --git a/dlls/user32/tests/edit.c b/dlls/user32/tests/edit.c index 0eafc80..396f74d 100644 --- a/dlls/user32/tests/edit.c +++ b/dlls/user32/tests/edit.c @@ -731,6 +731,7 @@ static void test_edit_control_2(void) { HWND hwndMain; char szLocalString[MAXLEN]; + LONG r; /* Create main and edit windows. */ hwndMain = CreateWindow(szEditTest2Class, "ET2", WS_OVERLAPPEDWINDOW, @@ -749,9 +750,12 @@ static void test_edit_control_2(void) trace("EDIT: SETTEXT atomicity\n"); /* Send messages to "type" in the word 'foo'. */ - SendMessage(hwndET2, WM_CHAR, 'f', 1); - SendMessage(hwndET2, WM_CHAR, 'o', 1); - SendMessage(hwndET2, WM_CHAR, 'o', 1); + r = SendMessage(hwndET2, WM_CHAR, 'f', 1); + ok(1 == r, "Expected: %d, got: %d\n", 1, r); + r = SendMessage(hwndET2, WM_CHAR, 'o', 1); + ok(1 == r, "Expected: %d, got: %d\n", 1, r); + r = SendMessage(hwndET2, WM_CHAR, 'o', 1); + ok(1 == r, "Expected: %d, got: %d\n", 1, r); /* 'foo' should have been changed to 'bar' by the UPDATE handler. */ GetWindowText(hwndET2, szLocalString, MAXLEN); ok(lstrcmp(szLocalString, "bar")==0, @@ -1553,7 +1557,8 @@ static void test_espassword(void) /* select all, cut (ctrl-x) */ SendMessage(hwEdit, EM_SETSEL, 0, -1); - SendMessage(hwEdit, WM_CHAR, 24, 0); + r = SendMessage(hwEdit, WM_CHAR, 24, 0); + ok(1 == r, "Expected: %d, got: %d\n", 1, r); /* get text */ r = SendMessage(hwEdit, WM_GETTEXT, 1024, (LPARAM) buffer); @@ -1569,8 +1574,10 @@ static void test_espassword(void) /* select all, copy (ctrl-c) and paste (ctrl-v) */ SendMessage(hwEdit, EM_SETSEL, 0, -1); - SendMessage(hwEdit, WM_CHAR, 3, 0); - SendMessage(hwEdit, WM_CHAR, 22, 0); + r = SendMessage(hwEdit, WM_CHAR, 3, 0); + ok(1 == r, "Expected: %d, got: %d\n", 1, r); + r = SendMessage(hwEdit, WM_CHAR, 22, 0); + ok(1 == r, "Expected: %d, got: %d\n", 1, r); /* get text */ buffer[0] = 0; @@ -1607,7 +1614,7 @@ static void test_undo(void) /* cut (ctrl-x) */ r = SendMessage(hwEdit, WM_CHAR, 24, 0); - todo_wine { ok(1 == r, "Expected: %d, got: %d\n", 1, r); } + ok(1 == r, "Expected: %d, got: %d\n", 1, r); /* get text */ buffer[0] = 0; @@ -1617,7 +1624,7 @@ static void test_undo(void) /* undo (ctrl-z) */ r = SendMessage(hwEdit, WM_CHAR, 26, 0); - todo_wine { ok(1 == r, "Expected: %d, got: %d\n", 1, r); } + ok(1 == r, "Expected: %d, got: %d\n", 1, r); /* get text */ buffer[0] = 0; @@ -1627,7 +1634,7 @@ static void test_undo(void) /* undo again (ctrl-z) */ r = SendMessage(hwEdit, WM_CHAR, 26, 0); - todo_wine { ok(1 == r, "Expected: %d, got: %d\n", 1, r); } + ok(1 == r, "Expected: %d, got: %d\n", 1, r); /* get text */ buffer[0] = 0; -- 1.5.3.6