David Hedberg : user32: Fix return value of EDIT_EM_Scroll.
Alexandre Julliard
julliard at winehq.org
Wed Mar 3 11:15:46 CST 2010
Module: wine
Branch: master
Commit: 598052b4ad2254af22e9bfc65c567a8d5b07e4fc
URL: http://source.winehq.org/git/wine.git/?a=commit;h=598052b4ad2254af22e9bfc65c567a8d5b07e4fc
Author: David Hedberg <david.hedberg at gmail.com>
Date: Wed Mar 3 13:19:46 2010 +0100
user32: Fix return value of EDIT_EM_Scroll.
---
dlls/user32/edit.c | 7 +++++--
dlls/user32/tests/edit.c | 35 +++++++++++++++++++++++++++++++++++
2 files changed, 40 insertions(+), 2 deletions(-)
diff --git a/dlls/user32/edit.c b/dlls/user32/edit.c
index 0c9287c..35f8285 100644
--- a/dlls/user32/edit.c
+++ b/dlls/user32/edit.c
@@ -1635,10 +1635,13 @@ static LRESULT EDIT_EM_Scroll(EDITSTATE *es, INT action)
dy = es->line_count - vlc - es->y_offset;
/* Notification is done in EDIT_EM_LineScroll */
- if(dy)
+ if(dy) {
EDIT_EM_LineScroll(es, 0, dy);
+ return MAKELONG(dy, TRUE);
+ }
+
}
- return MAKELONG(dy, TRUE);
+ return (LRESULT)FALSE;
}
diff --git a/dlls/user32/tests/edit.c b/dlls/user32/tests/edit.c
index 7ecee13..6d3afb8 100644
--- a/dlls/user32/tests/edit.c
+++ b/dlls/user32/tests/edit.c
@@ -1316,6 +1316,40 @@ static void test_edit_control_limittext(void)
DestroyWindow(hwEdit);
}
+/* Test EM_SCROLL */
+static void test_edit_control_scroll(void)
+{
+ static const char *single_line_str = "a";
+ HWND hwEdit;
+ LONG ret;
+
+ /* Check the return value when EM_SCROLL doesn't scroll
+ * anything. Should not return true unless any lines were actually
+ * scrolled. */
+ hwEdit = CreateWindow(
+ "EDIT",
+ single_line_str,
+ WS_VSCROLL | ES_MULTILINE,
+ 1, 1, 100, 100,
+ NULL, NULL, hinst, NULL);
+
+ assert(hwEdit);
+
+ ret = SendMessage(hwEdit, EM_SCROLL, SB_PAGEDOWN, 0);
+ ok(!ret, "Returned %x, expected 0.\n", ret);
+
+ ret = SendMessage(hwEdit, EM_SCROLL, SB_PAGEUP, 0);
+ ok(!ret, "Returned %x, expected 0.\n", ret);
+
+ ret = SendMessage(hwEdit, EM_SCROLL, SB_LINEUP, 0);
+ ok(!ret, "Returned %x, expected 0.\n", ret);
+
+ ret = SendMessage(hwEdit, EM_SCROLL, SB_LINEDOWN, 0);
+ ok(!ret, "Returned %x, expected 0.\n", ret);
+
+ DestroyWindow (hwEdit);
+}
+
static void test_margins(void)
{
HWND hwEdit;
@@ -2319,6 +2353,7 @@ START_TEST(edit)
test_edit_control_5();
test_edit_control_6();
test_edit_control_limittext();
+ test_edit_control_scroll();
test_margins();
test_margins_font_change();
test_text_position();
More information about the wine-cvs
mailing list