Commit 0dcebea4 authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

riched20: Add some test for EM_GETTEXTLENGTHEX and fix the single line edit cases.

parent ce26e78c
...@@ -57,8 +57,8 @@ int ME_GetTextLengthEx(ME_TextEditor *editor, const GETTEXTLENGTHEX *how) ...@@ -57,8 +57,8 @@ int ME_GetTextLengthEx(ME_TextEditor *editor, const GETTEXTLENGTHEX *how)
return E_INVALIDARG; return E_INVALIDARG;
length = ME_GetTextLength(editor); length = ME_GetTextLength(editor);
if (how->flags & GTL_USECRLF) if ((GetWindowLongW(editor->hWnd, GWL_STYLE) & ES_MULTILINE) && (how->flags & GTL_USECRLF))
length += editor->nParagraphs; length += editor->nParagraphs;
if (how->flags & GTL_NUMBYTES) if (how->flags & GTL_NUMBYTES)
......
...@@ -1823,6 +1823,72 @@ static void test_unicode_conversions(void) ...@@ -1823,6 +1823,72 @@ static void test_unicode_conversions(void)
DestroyWindow(hwnd); DestroyWindow(hwnd);
} }
static void test_EM_GETTEXTLENGTHEX(void)
{
HWND hwnd;
GETTEXTLENGTHEX gtl;
int ret;
/* single line */
hwnd = CreateWindowExA(0, "RichEdit20W", NULL, WS_POPUP,
0, 0, 200, 60, 0, 0, 0, 0);
ok(hwnd != 0, "CreateWindowExA error %u\n", GetLastError());
gtl.flags = GTL_NUMCHARS | GTL_PRECISE | GTL_USECRLF;
gtl.codepage = CP_ACP;
ret = SendMessageA(hwnd, EM_GETTEXTLENGTHEX, (WPARAM)&gtl, 0);
ok(ret == 0, "ret %d\n",ret);
gtl.flags = GTL_NUMCHARS | GTL_PRECISE;
gtl.codepage = CP_ACP;
ret = SendMessageA(hwnd, EM_GETTEXTLENGTHEX, (WPARAM)&gtl, 0);
ok(ret == 0, "ret %d\n",ret);
SendMessage(hwnd, WM_SETTEXT, 0, (LPARAM) "a\nb\n\n\r\n");
gtl.flags = GTL_NUMCHARS | GTL_PRECISE | GTL_USECRLF;
gtl.codepage = CP_ACP;
ret = SendMessageA(hwnd, EM_GETTEXTLENGTHEX, (WPARAM)&gtl, 0);
todo_wine ok(ret == 1, "ret %d\n",ret);
gtl.flags = GTL_NUMCHARS | GTL_PRECISE;
gtl.codepage = CP_ACP;
ret = SendMessageA(hwnd, EM_GETTEXTLENGTHEX, (WPARAM)&gtl, 0);
todo_wine ok(ret == 1, "ret %d\n",ret);
DestroyWindow(hwnd);
/* multi line */
hwnd = CreateWindowExA(0, "RichEdit20W", NULL, WS_POPUP | ES_MULTILINE,
0, 0, 200, 60, 0, 0, 0, 0);
ok(hwnd != 0, "CreateWindowExA error %u\n", GetLastError());
gtl.flags = GTL_NUMCHARS | GTL_PRECISE | GTL_USECRLF;
gtl.codepage = CP_ACP;
ret = SendMessageA(hwnd, EM_GETTEXTLENGTHEX, (WPARAM)&gtl, 0);
todo_wine ok(ret == 0, "ret %d\n",ret);
gtl.flags = GTL_NUMCHARS | GTL_PRECISE;
gtl.codepage = CP_ACP;
ret = SendMessageA(hwnd, EM_GETTEXTLENGTHEX, (WPARAM)&gtl, 0);
ok(ret == 0, "ret %d\n",ret);
SendMessage(hwnd, WM_SETTEXT, 0, (LPARAM) "a\nb\n\n\r\n");
gtl.flags = GTL_NUMCHARS | GTL_PRECISE | GTL_USECRLF;
gtl.codepage = CP_ACP;
ret = SendMessageA(hwnd, EM_GETTEXTLENGTHEX, (WPARAM)&gtl, 0);
todo_wine ok(ret == 10, "ret %d\n",ret);
gtl.flags = GTL_NUMCHARS | GTL_PRECISE;
gtl.codepage = CP_ACP;
ret = SendMessageA(hwnd, EM_GETTEXTLENGTHEX, (WPARAM)&gtl, 0);
ok(ret == 6, "ret %d\n",ret);
DestroyWindow(hwnd);
}
START_TEST( editor ) START_TEST( editor )
{ {
MSG msg; MSG msg;
...@@ -1855,6 +1921,7 @@ START_TEST( editor ) ...@@ -1855,6 +1921,7 @@ START_TEST( editor )
test_EM_StreamIn_Undo(); test_EM_StreamIn_Undo();
test_EM_FORMATRANGE(); test_EM_FORMATRANGE();
test_unicode_conversions(); test_unicode_conversions();
test_EM_GETTEXTLENGTHEX();
/* Set the environment variable WINETEST_RICHED20 to keep windows /* Set the environment variable WINETEST_RICHED20 to keep windows
* responsive and open for 30 seconds. This is useful for debugging. * responsive and open for 30 seconds. This is useful for debugging.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment