Dylan Smith : richedit: Tested EM_CHARFROMPOS with position outside of control.

Alexandre Julliard julliard at winehq.org
Mon Jan 12 10:41:11 CST 2009


Module: wine
Branch: master
Commit: 576ff4b104f4c05a1e6a8b56f02e90dfab8d44e4
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=576ff4b104f4c05a1e6a8b56f02e90dfab8d44e4

Author: Dylan Smith <dylan.ah.smith at gmail.com>
Date:   Sun Jan 11 02:59:01 2009 -0500

richedit: Tested EM_CHARFROMPOS with position outside of control.

---

 dlls/riched20/tests/editor.c |   40 +++++++++++++++++++++++++++++++++++++---
 1 files changed, 37 insertions(+), 3 deletions(-)

diff --git a/dlls/riched20/tests/editor.c b/dlls/riched20/tests/editor.c
index 534d217..8c3281c 100644
--- a/dlls/riched20/tests/editor.c
+++ b/dlls/riched20/tests/editor.c
@@ -5715,17 +5715,51 @@ static void test_EM_CHARFROMPOS(void)
 {
     HWND hwnd;
     int result;
+    RECT rcClient;
     POINTL point;
     point.x = 0;
-    point.y = 50;
+    point.y = 40;
 
     /* multi-line control inserts CR normally */
     hwnd = new_richedit(NULL);
     result = SendMessageA(hwnd, WM_SETTEXT, 0,
-                          (LPARAM)"one two three four five six seven");
+                          (LPARAM)"one two three four five six seven\reight");
 
+    GetClientRect(hwnd, &rcClient);
+
+    result = SendMessage(hwnd, EM_CHARFROMPOS, 0, (LPARAM)&point);
+    ok(result == 34, "expected character index of 34 but got %d\n", result);
+
+    /* Test with points outside the bounds of the richedit control. */
+    point.x = -1;
+    point.y = 40;
+    result = SendMessage(hwnd, EM_CHARFROMPOS, 0, (LPARAM)&point);
+    todo_wine ok(result == 34, "expected character index of 34 but got %d\n", result);
+
+    point.x = 1000;
+    point.y = 0;
+    result = SendMessage(hwnd, EM_CHARFROMPOS, 0, (LPARAM)&point);
+    todo_wine ok(result == 33, "expected character index of 33 but got %d\n", result);
+
+    point.x = 1000;
+    point.y = 40;
+    result = SendMessage(hwnd, EM_CHARFROMPOS, 0, (LPARAM)&point);
+    todo_wine ok(result == 39, "expected character index of 39 but got %d\n", result);
+
+    point.x = 1000;
+    point.y = -1;
+    result = SendMessage(hwnd, EM_CHARFROMPOS, 0, (LPARAM)&point);
+    todo_wine ok(result == 0, "expected character index of 0 but got %d\n", result);
+
+    point.x = 1000;
+    point.y = rcClient.bottom + 1;
+    result = SendMessage(hwnd, EM_CHARFROMPOS, 0, (LPARAM)&point);
+    todo_wine ok(result == 34, "expected character index of 34 but got %d\n", result);
+
+    point.x = 1000;
+    point.y = rcClient.bottom;
     result = SendMessage(hwnd, EM_CHARFROMPOS, 0, (LPARAM)&point);
-    ok(result == 0, "expected character index of 0 but got %d\n", result);
+    todo_wine ok(result == 39, "expected character index of 39 but got %d\n", result);
 
     DestroyWindow(hwnd);
 }




More information about the wine-cvs mailing list