[PATCH] user32/edit: Fix EM_SETWORDBREAKPROC return value

Nikolay Sivov nsivov at codeweavers.com
Mon Jan 22 07:54:16 CST 2018


Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
 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 77116837df..262ea72c30 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 114d842759..5e161c5dbf 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 de8a349e13..01418bf551 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();
 }
-- 
2.15.1




More information about the wine-devel mailing list