richedit: GTL_PRECISE to GETTEXTLENGTHEX implies GTL_NUMBYTES.
If GTL_PRECISE is passed without specifying either GTL_NUMCHARS or GTL_NUMBYTES, behave as if GTL_NUMBYTES was passed.
This commit is contained in:
parent
7ed13120ab
commit
534398a57e
|
@ -92,7 +92,9 @@ int ME_GetTextLengthEx(ME_TextEditor *editor, const GETTEXTLENGTHEX *how)
|
|||
&& !editor->bEmulateVersion10) /* Ignore GTL_USECRLF flag in 1.0 emulation */
|
||||
length += editor->nParagraphs - 1;
|
||||
|
||||
if (how->flags & GTL_NUMBYTES)
|
||||
if (how->flags & GTL_NUMBYTES ||
|
||||
(how->flags & GTL_PRECISE && /* GTL_PRECISE seems to imply GTL_NUMBYTES */
|
||||
!(how->flags & GTL_NUMCHARS))) /* unless GTL_NUMCHARS is given */
|
||||
{
|
||||
CPINFO cpinfo;
|
||||
|
||||
|
|
|
@ -5540,6 +5540,45 @@ static void test_EM_GETTEXTLENGTHEX(void)
|
|||
ret = SendMessageA(hwnd, EM_GETTEXTLENGTHEX, (WPARAM)>l, 0);
|
||||
ok(ret == 6, "ret %d\n",ret);
|
||||
|
||||
/* Unicode/NUMCHARS/NUMBYTES */
|
||||
SendMessage(hwnd, WM_SETTEXT, 0, (LPARAM) test_string_2);
|
||||
|
||||
gtl.flags = GTL_DEFAULT;
|
||||
gtl.codepage = 1200;
|
||||
ret = SendMessage(hwnd, EM_GETTEXTLENGTHEX, (WPARAM) >l, 0);
|
||||
ok(ret == lstrlen(test_string_2),
|
||||
"GTL_DEFAULT gave %i, expected %i\n", ret, lstrlen(test_string_2));
|
||||
|
||||
gtl.flags = GTL_NUMCHARS;
|
||||
gtl.codepage = 1200;
|
||||
ret = SendMessage(hwnd, EM_GETTEXTLENGTHEX, (WPARAM) >l, 0);
|
||||
ok(ret == lstrlen(test_string_2),
|
||||
"GTL_NUMCHARS gave %i, expected %i\n", ret, lstrlen(test_string_2));
|
||||
|
||||
gtl.flags = GTL_NUMBYTES;
|
||||
gtl.codepage = 1200;
|
||||
ret = SendMessage(hwnd, EM_GETTEXTLENGTHEX, (WPARAM) >l, 0);
|
||||
ok(ret == lstrlen(test_string_2)*2,
|
||||
"GTL_NUMBYTES gave %i, expected %i\n", ret, lstrlen(test_string_2)*2);
|
||||
|
||||
gtl.flags = GTL_PRECISE;
|
||||
gtl.codepage = 1200;
|
||||
ret = SendMessage(hwnd, EM_GETTEXTLENGTHEX, (WPARAM) >l, 0);
|
||||
ok(ret == lstrlen(test_string_2)*2,
|
||||
"GTL_PRECISE gave %i, expected %i\n", ret, lstrlen(test_string_2)*2);
|
||||
|
||||
gtl.flags = GTL_NUMCHARS | GTL_PRECISE;
|
||||
gtl.codepage = 1200;
|
||||
ret = SendMessage(hwnd, EM_GETTEXTLENGTHEX, (WPARAM) >l, 0);
|
||||
ok(ret == lstrlen(test_string_2),
|
||||
"GTL_NUMCHAR | GTL_PRECISE gave %i, expected %i\n", ret, lstrlen(test_string_2));
|
||||
|
||||
gtl.flags = GTL_NUMCHARS | GTL_NUMBYTES;
|
||||
gtl.codepage = 1200;
|
||||
ret = SendMessage(hwnd, EM_GETTEXTLENGTHEX, (WPARAM) >l, 0);
|
||||
ok(ret == E_INVALIDARG,
|
||||
"GTL_NUMCHARS | GTL_NUMBYTES gave %i, expected %i\n", ret, E_INVALIDARG);
|
||||
|
||||
DestroyWindow(hwnd);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue