Module: wine Branch: master Commit: 6aa853ae393ed0155607333e9640183bc736a74c URL: https://source.winehq.org/git/wine.git/?a=commit;h=6aa853ae393ed0155607333e9...
Author: Nikolay Sivov nsivov@codeweavers.com Date: Mon Jan 22 16:54:16 2018 +0300
user32/edit: Fix EM_SETWORDBREAKPROC return value.
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/comctl32/tests/edit.c | 32 ++++++++++++++++++++++++++++++++ dlls/user32/edit.c | 1 + dlls/user32/tests/edit.c | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 65 insertions(+)
diff --git a/dlls/comctl32/tests/edit.c b/dlls/comctl32/tests/edit.c index 7711683..262ea72 100644 --- a/dlls/comctl32/tests/edit.c +++ b/dlls/comctl32/tests/edit.c @@ -2982,6 +2982,37 @@ static void test_EM_GETLINE(void) } }
+static int CALLBACK test_wordbreak_procA(char *text, int current, int length, int code) +{ + return -1; +} + +static void test_wordbreak_proc(void) +{ + EDITWORDBREAKPROCA proc; + LRESULT ret; + HWND hwnd; + + hwnd = create_editcontrol(ES_AUTOHSCROLL | ES_AUTOVSCROLL, 0); + + proc = (void *)SendMessageA(hwnd, EM_GETWORDBREAKPROC, 0, 0); + ok(proc == NULL, "Unexpected wordbreak proc %p.\n", proc); + + ret = SendMessageA(hwnd, EM_SETWORDBREAKPROC, 0, (LPARAM)test_wordbreak_procA); + ok(ret == 1, "Unexpected return value %ld.\n", ret); + + proc = (void *)SendMessageA(hwnd, EM_GETWORDBREAKPROC, 0, 0); + ok(proc == test_wordbreak_procA, "Unexpected wordbreak proc %p.\n", proc); + + ret = SendMessageA(hwnd, EM_SETWORDBREAKPROC, 0, 0); + ok(ret == 1, "Unexpected return value %ld.\n", ret); + + proc = (void *)SendMessageA(hwnd, EM_GETWORDBREAKPROC, 0, 0); + ok(proc == NULL, "Unexpected wordbreak proc %p.\n", proc); + + DestroyWindow(hwnd); +} + START_TEST(edit) { ULONG_PTR ctx_cookie; @@ -3022,6 +3053,7 @@ START_TEST(edit) test_EM_GETHANDLE(); test_paste(); test_EM_GETLINE(); + test_wordbreak_proc();
UnregisterWindowClasses();
diff --git a/dlls/user32/edit.c b/dlls/user32/edit.c index 114d842..5e161c5 100644 --- a/dlls/user32/edit.c +++ b/dlls/user32/edit.c @@ -4839,6 +4839,7 @@ LRESULT EditWndProc_common( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, B
case EM_SETWORDBREAKPROC: EDIT_EM_SetWordBreakProc(es, (void *)lParam); + result = 1; break;
case EM_GETWORDBREAKPROC: diff --git a/dlls/user32/tests/edit.c b/dlls/user32/tests/edit.c index de8a349..01418bf 100644 --- a/dlls/user32/tests/edit.c +++ b/dlls/user32/tests/edit.c @@ -2999,6 +2999,37 @@ static void test_EM_GETLINE(void) } }
+static int CALLBACK test_wordbreak_procA(char *text, int current, int length, int code) +{ + return -1; +} + +static void test_wordbreak_proc(void) +{ + EDITWORDBREAKPROCA proc; + LRESULT ret; + HWND hwnd; + + hwnd = create_editcontrol(ES_AUTOHSCROLL | ES_AUTOVSCROLL, 0); + + proc = (void *)SendMessageA(hwnd, EM_GETWORDBREAKPROC, 0, 0); + ok(proc == NULL, "Unexpected wordbreak proc %p.\n", proc); + + ret = SendMessageA(hwnd, EM_SETWORDBREAKPROC, 0, (LPARAM)test_wordbreak_procA); + ok(ret == 1, "Unexpected return value %ld.\n", ret); + + proc = (void *)SendMessageA(hwnd, EM_GETWORDBREAKPROC, 0, 0); + ok(proc == test_wordbreak_procA, "Unexpected wordbreak proc %p.\n", proc); + + ret = SendMessageA(hwnd, EM_SETWORDBREAKPROC, 0, 0); + ok(ret == 1, "Unexpected return value %ld.\n", ret); + + proc = (void *)SendMessageA(hwnd, EM_GETWORDBREAKPROC, 0, 0); + ok(proc == NULL, "Unexpected wordbreak proc %p.\n", proc); + + DestroyWindow(hwnd); +} + START_TEST(edit) { BOOL b; @@ -3034,6 +3065,7 @@ START_TEST(edit) test_EM_GETHANDLE(); test_paste(); test_EM_GETLINE(); + test_wordbreak_proc();
UnregisterWindowClasses(); }