Alex Villacís Lasso : riched32: Fix regression in WM_GETTEXTLENGTH on richedit 1.0 emulation.
Alexandre Julliard
julliard at winehq.org
Wed Dec 12 09:29:17 CST 2007
Module: wine
Branch: master
Commit: ae7b2c914b813ad818c6a90b65dc6ce81cda3832
URL: http://source.winehq.org/git/wine.git/?a=commit;h=ae7b2c914b813ad818c6a90b65dc6ce81cda3832
Author: Alex Villacís Lasso <a_villacis at palosanto.com>
Date: Tue Dec 11 16:02:54 2007 -0500
riched32: Fix regression in WM_GETTEXTLENGTH on richedit 1.0 emulation.
---
dlls/riched20/editor.c | 2 +-
dlls/riched32/tests/editor.c | 24 ++++++++++++++++++++++++
2 files changed, 25 insertions(+), 1 deletions(-)
diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c
index 10aaaa9..394ffe5 100644
--- a/dlls/riched20/editor.c
+++ b/dlls/riched20/editor.c
@@ -1999,7 +1999,7 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam,
{
GETTEXTLENGTHEX how;
- how.flags = GTL_CLOSE | GTL_USECRLF | GTL_NUMCHARS;
+ how.flags = GTL_CLOSE | (editor->bEmulateVersion10 ? 0 : GTL_USECRLF) | GTL_NUMCHARS;
how.codepage = unicode ? 1200 : CP_ACP;
return ME_GetTextLengthEx(editor, &how);
}
diff --git a/dlls/riched32/tests/editor.c b/dlls/riched32/tests/editor.c
index 77c86e7..4b86e23 100644
--- a/dlls/riched32/tests/editor.c
+++ b/dlls/riched32/tests/editor.c
@@ -108,6 +108,29 @@ static void test_WM_SETTEXT()
DestroyWindow(hwndRichEdit);
}
+static void test_WM_GETTEXTLENGTH(void)
+{
+ HWND hwndRichEdit = new_richedit(NULL);
+ static const char text3[] = "aaa\r\nbbb\r\nccc\r\nddd\r\neee";
+ static const char text4[] = "aaa\r\nbbb\r\nccc\r\nddd\r\neee\r\n";
+ int result;
+
+ /* Test for WM_GETTEXTLENGTH */
+ SendMessage(hwndRichEdit, WM_SETTEXT, 0, (LPARAM) text3);
+ result = SendMessage(hwndRichEdit, WM_GETTEXTLENGTH, 0, 0);
+ ok(result == strlen(text3),
+ "WM_GETTEXTLENGTH reports incorrect length %d, expected %d\n",
+ result, strlen(text3));
+
+ SendMessage(hwndRichEdit, WM_SETTEXT, 0, (LPARAM) text4);
+ result = SendMessage(hwndRichEdit, WM_GETTEXTLENGTH, 0, 0);
+ ok(result == strlen(text4),
+ "WM_GETTEXTLENGTH reports incorrect length %d, expected %d\n",
+ result, strlen(text4));
+
+ DestroyWindow(hwndRichEdit);
+}
+
START_TEST( editor )
{
MSG msg;
@@ -119,6 +142,7 @@ START_TEST( editor )
ok(hmoduleRichEdit != NULL, "error: %d\n", (int) GetLastError());
test_WM_SETTEXT();
+ test_WM_GETTEXTLENGTH();
/* Set the environment variable WINETEST_RICHED32 to keep windows
* responsive and open for 30 seconds. This is useful for debugging.
More information about the wine-cvs
mailing list