Commit 86f45494 authored by Lauri Tulmin's avatar Lauri Tulmin Committed by Alexandre Julliard

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

parent 3df678a5
...@@ -4061,7 +4061,7 @@ static LRESULT EDIT_WM_Create(EDITSTATE *es, LPCWSTR name) ...@@ -4061,7 +4061,7 @@ static LRESULT EDIT_WM_Create(EDITSTATE *es, LPCWSTR name)
EDIT_SetRectNP(es, &clientRect); EDIT_SetRectNP(es, &clientRect);
if (name && *name) { 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 /* if we insert text to the editline, the text scrolls out
* of the window, as the caret is placed after the insert * of the window, as the caret is placed after the insert
* pos normally; thus we reset es->selection... to 0 and * pos normally; thus we reset es->selection... to 0 and
......
...@@ -671,6 +671,40 @@ static void test_edit_control_4(void) ...@@ -671,6 +671,40 @@ static void test_edit_control_4(void)
DestroyWindow(hwEdit); 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) static void test_margins(void)
{ {
HWND hwEdit; HWND hwEdit;
...@@ -931,6 +965,7 @@ START_TEST(edit) ...@@ -931,6 +965,7 @@ START_TEST(edit)
test_edit_control_2(); test_edit_control_2();
test_edit_control_3(); test_edit_control_3();
test_edit_control_4(); test_edit_control_4();
test_edit_control_5();
test_margins(); test_margins();
test_text_position(); test_text_position();
......
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