Lauri Tulmin : user32: Don't truncate text when creating edit control.
Alexandre Julliard
julliard at wine.codeweavers.com
Mon Dec 19 03:22:39 CST 2005
Module: wine
Branch: refs/heads/master
Commit: 86f45494b6fb92cf1151317921cad23fe8e81667
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=86f45494b6fb92cf1151317921cad23fe8e81667
Author: Lauri Tulmin <tulmin at gmail.com>
Date: Mon Dec 19 09:53:19 2005 +0100
user32: Don't truncate text when creating edit control.
---
dlls/user/edit.c | 2 +-
dlls/user/tests/edit.c | 35 +++++++++++++++++++++++++++++++++++
2 files changed, 36 insertions(+), 1 deletions(-)
diff --git a/dlls/user/edit.c b/dlls/user/edit.c
index 47f317d..bc67e43 100644
--- a/dlls/user/edit.c
+++ b/dlls/user/edit.c
@@ -4061,7 +4061,7 @@ static LRESULT EDIT_WM_Create(EDITSTATE
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
diff --git a/dlls/user/tests/edit.c b/dlls/user/tests/edit.c
index 846ed2d..0bd521b 100644
--- a/dlls/user/tests/edit.c
+++ b/dlls/user/tests/edit.c
@@ -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();
More information about the wine-cvs
mailing list