user32: Don't truncate text when creating edit control.

This commit is contained in:
Lauri Tulmin 2005-12-19 09:53:19 +01:00 committed by Alexandre Julliard
parent 3df678a5af
commit 86f45494b6
2 changed files with 36 additions and 1 deletions

View File

@ -4061,7 +4061,7 @@ static LRESULT EDIT_WM_Create(EDITSTATE *es, LPCWSTR name)
EDIT_SetRectNP(es, &clientRect);
if (name && *name) {
EDIT_EM_ReplaceSel(es, FALSE, name, FALSE, TRUE);
EDIT_EM_ReplaceSel(es, FALSE, name, FALSE, FALSE);
/* if we insert text to the editline, the text scrolls out
* of the window, as the caret is placed after the insert
* pos normally; thus we reset es->selection... to 0 and

View File

@ -671,6 +671,40 @@ static void test_edit_control_4(void)
DestroyWindow(hwEdit);
}
/* Test if creating edit control without ES_AUTOHSCROLL and ES_AUTOVSCROLL
* truncates text that doesn't fit.
*/
static void test_edit_control_5(void)
{
static const char *str = "test\r\ntest";
HWND hWnd;
int len;
hWnd = CreateWindowEx(0,
"EDIT",
str,
0,
10, 10, 1, 1,
NULL, NULL, NULL, NULL);
assert(hWnd);
len = SendMessageA(hWnd, WM_GETTEXTLENGTH, 0, 0);
ok(lstrlenA(str) == len, "text shouldn't have been truncated\n");
DestroyWindow(hWnd);
hWnd = CreateWindowEx(0,
"EDIT",
str,
ES_MULTILINE,
10, 10, 1, 1,
NULL, NULL, NULL, NULL);
assert(hWnd);
len = SendMessageA(hWnd, WM_GETTEXTLENGTH, 0, 0);
ok(lstrlenA(str) == len, "text shouldn't have been truncated\n");
DestroyWindow(hWnd);
}
static void test_margins(void)
{
HWND hwEdit;
@ -931,6 +965,7 @@ START_TEST(edit)
test_edit_control_2();
test_edit_control_3();
test_edit_control_4();
test_edit_control_5();
test_margins();
test_text_position();