riched32: Fix regression in WM_GETTEXTLENGTH on richedit 1.0 emulation.

This commit is contained in:
Alex Villacís Lasso 2007-12-11 16:02:54 -05:00 committed by Alexandre Julliard
parent 16cc13341f
commit ae7b2c914b
2 changed files with 25 additions and 1 deletions

View File

@ -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);
}

View File

@ -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.