From 455eca6d228a4850214345be2cccc665bece5a0e Mon Sep 17 00:00:00 2001 From: Jactry Zeng Date: Fri, 4 Jul 2014 22:51:35 +0800 Subject: [PATCH] riched20: Return nonzero value instead of zero when EM_SETREADONLY succeeds. --- dlls/riched20/editor.c | 2 +- dlls/riched20/tests/editor.c | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c index f0d6590003b..43d74ecf026 100644 --- a/dlls/riched20/editor.c +++ b/dlls/riched20/editor.c @@ -3479,7 +3479,7 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam, editor->styleFlags |= ES_READONLY; else editor->styleFlags &= ~ES_READONLY; - return 0; + return 1; } case EM_SETEVENTMASK: { diff --git a/dlls/riched20/tests/editor.c b/dlls/riched20/tests/editor.c index 5421614d9a1..3bd3ec0e2cc 100644 --- a/dlls/riched20/tests/editor.c +++ b/dlls/riched20/tests/editor.c @@ -7576,6 +7576,25 @@ static void test_reset_default_para_fmt( void ) DestroyWindow( richedit ); } +static void test_EM_SETREADONLY(void) +{ + HWND richedit = new_richeditW(NULL); + DWORD dwStyle; + LRESULT res; + + res = SendMessageA(richedit, EM_SETREADONLY, TRUE, 0); + ok(res == 1, "EM_SETREADONLY\n"); + dwStyle = GetWindowLongA(richedit, GWL_STYLE); + ok(dwStyle & ES_READONLY, "got wrong value: 0x%x\n", dwStyle & ES_READONLY); + + res = SendMessageA(richedit, EM_SETREADONLY, FALSE, 0); + ok(res == 1, "EM_SETREADONLY\n"); + dwStyle = GetWindowLongA(richedit, GWL_STYLE); + ok(!(dwStyle & ES_READONLY), "got wrong value: 0x%x\n", dwStyle & ES_READONLY); + + DestroyWindow(richedit); +} + START_TEST( editor ) { BOOL ret; @@ -7639,6 +7658,7 @@ START_TEST( editor ) test_enter(); test_WM_CREATE(); test_reset_default_para_fmt(); + test_EM_SETREADONLY(); /* Set the environment variable WINETEST_RICHED20 to keep windows * responsive and open for 30 seconds. This is useful for debugging. -- 2.11.4.GIT