riched20: WM_GETTEXTLENGTH should include CRLF conversions in returned count.

This commit is contained in:
Alex Villacís Lasso 2007-12-06 13:50:22 -05:00 committed by Alexandre Julliard
parent 3b636b58ba
commit f945f16de2
2 changed files with 19 additions and 1 deletions

View File

@ -1996,7 +1996,13 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam,
return 0;
}
case WM_GETTEXTLENGTH:
return ME_GetTextLength(editor);
{
GETTEXTLENGTHEX how;
how.flags = GTL_CLOSE | GTL_USECRLF | GTL_NUMCHARS;
how.codepage = unicode ? 1200 : CP_ACP;
return ME_GetTextLengthEx(editor, &how);
}
case EM_GETTEXTLENGTHEX:
return ME_GetTextLengthEx(editor, (GETTEXTLENGTHEX *)wParam);
case WM_GETTEXT:

View File

@ -671,6 +671,12 @@ static void test_WM_GETTEXT(void)
ok(result == 0,
"WM_GETTEXT: settext and gettext differ. strcmp: %d\n", result);
/* Test for returned value of WM_GETTEXTLENGTH */
result = SendMessage(hwndRichEdit, WM_GETTEXTLENGTH, 0, 0);
ok(result == strlen(text),
"WM_GETTEXTLENGTH reports incorrect length %d, expected %d\n",
result, strlen(text));
/* Test for behavior in overflow case */
memset(buffer, 0, 1024);
result = SendMessage(hwndRichEdit, WM_GETTEXT, strlen(text), (LPARAM)buffer);
@ -689,6 +695,12 @@ static void test_WM_GETTEXT(void)
ok(result == 0,
"WM_GETTEXT: settext and gettext differ. strcmp: %d\n", result);
/* Test for returned value of WM_GETTEXTLENGTH */
result = SendMessage(hwndRichEdit, WM_GETTEXTLENGTH, 0, 0);
ok(result == strlen(text2_after),
"WM_GETTEXTLENGTH reports incorrect length %d, expected %d\n",
result, strlen(text2_after));
/* Test for behavior of CRLF conversion in case of overflow */
memset(buffer, 0, 1024);
result = SendMessage(hwndRichEdit, WM_GETTEXT, strlen(text2), (LPARAM)buffer);