Commit dbcf2e39 authored by Matt Finnicum's avatar Matt Finnicum Committed by Alexandre Julliard

riched20: Implement EM_LIMITTEXT and some simple tests.

parent dc98ac1a
......@@ -77,7 +77,7 @@
- EM_GETWORDWRAPMODE 1.0asian
+ EM_GETZOOM 3.0
+ EM_HIDESELECTION
- EM_LIMITTEXT
+ EM_LIMITTEXT (Also called EM_SETLIMITTEXT)
+ EM_LINEFROMCHAR
+ EM_LINEINDEX
+ EM_LINELENGTH
......@@ -1429,7 +1429,6 @@ LRESULT WINAPI RichEditANSIWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP
UNSUPPORTED_MSG(EM_GETTYPOGRAPHYOPTIONS)
UNSUPPORTED_MSG(EM_GETUNDONAME)
UNSUPPORTED_MSG(EM_GETWORDBREAKPROCEX)
UNSUPPORTED_MSG(EM_LIMITTEXT) /* also known as EM_SETLIMITTEXT */
UNSUPPORTED_MSG(EM_PASTESPECIAL)
UNSUPPORTED_MSG(EM_SELECTIONTYPE)
UNSUPPORTED_MSG(EM_SETBIDIOPTIONS)
......@@ -2185,6 +2184,14 @@ LRESULT WINAPI RichEditANSIWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP
editor->nTextLimit = (int) lParam;
return 0;
}
case EM_LIMITTEXT:
{
if (wParam == 0)
editor->nTextLimit = 65536;
else
editor->nTextLimit = (int) wParam;
return 0;
}
case EM_GETLIMITTEXT:
{
return editor->nTextLimit;
......
......@@ -2,6 +2,7 @@
* Unit test suite for rich edit control
*
* Copyright 2006 Google (Thomas Kho)
* Copyright 2007 Matt Finnicum
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -975,6 +976,45 @@ static void test_EM_SETTEXTEX(void)
DestroyWindow(hwndRichEdit);
}
static void test_EM_LIMITTEXT(void)
{
int ret;
HWND hwndRichEdit = new_richedit(NULL);
/* The main purpose of this test is to demonstrate that the nonsense in MSDN
* about setting the length to -1 for multiline edit controls doesn't happen.
*/
/* Don't check default gettextlimit case. That's done in other tests */
/* Set textlimit to 100 */
SendMessage (hwndRichEdit, EM_LIMITTEXT, 100, 0);
ret = SendMessage (hwndRichEdit, EM_GETLIMITTEXT, 0, 0);
ok (ret == 100,
"EM_LIMITTEXT: set to 100, returned: %d, expected: 100\n", ret);
/* Set textlimit to 0 */
SendMessage (hwndRichEdit, EM_LIMITTEXT, 0, 0);
ret = SendMessage (hwndRichEdit, EM_GETLIMITTEXT, 0, 0);
ok (ret == 65536,
"EM_LIMITTEXT: set to 0, returned: %d, expected: 65536\n", ret);
/* Set textlimit to -1 */
SendMessage (hwndRichEdit, EM_LIMITTEXT, -1, 0);
ret = SendMessage (hwndRichEdit, EM_GETLIMITTEXT, 0, 0);
ok (ret == -1,
"EM_LIMITTEXT: set to -1, returned: %d, expected: -1\n", ret);
/* Set textlimit to -2 */
SendMessage (hwndRichEdit, EM_LIMITTEXT, -2, 0);
ret = SendMessage (hwndRichEdit, EM_GETLIMITTEXT, 0, 0);
ok (ret == -2,
"EM_LIMITTEXT: set to -2, returned: %d, expected: -2\n", ret);
DestroyWindow (hwndRichEdit);
}
static void test_EM_EXLIMITTEXT(void)
{
......@@ -1443,6 +1483,7 @@ START_TEST( editor )
test_EM_SETUNDOLIMIT();
test_ES_PASSWORD();
test_EM_SETTEXTEX();
test_EM_LIMITTEXT();
test_EM_EXLIMITTEXT();
test_EM_GETLIMITTEXT();
test_WM_SETFONT();
......
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