Dylan Smith : richedit: Test to see if wrapping happens with redraw disabled.

Alexandre Julliard julliard at winehq.org
Sat Oct 18 13:38:52 CDT 2008


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

Author: Dylan Smith <dylan.ah.smith at gmail.com>
Date:   Fri Oct 17 21:29:45 2008 -0400

richedit: Test to see if wrapping happens with redraw disabled.

---

 dlls/riched20/tests/editor.c |   22 +++++++++++++++++++++-
 1 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/dlls/riched20/tests/editor.c b/dlls/riched20/tests/editor.c
index 308c69a..68f2262 100644
--- a/dlls/riched20/tests/editor.c
+++ b/dlls/riched20/tests/editor.c
@@ -5484,7 +5484,7 @@ static void test_word_wrap(void)
     POINTL point = {0, 60}; /* This point must be below the first line */
     const char *text = "Must be long enough to test line wrapping";
     DWORD dwCommonStyle = WS_VISIBLE|WS_POPUP|WS_VSCROLL|ES_MULTILINE;
-    int res, pos;
+    int res, pos, lines;
 
     /* Test the effect of WS_HSCROLL and ES_AUTOHSCROLL styles on wrapping
      * when specified on window creation and set later. */
@@ -5495,6 +5495,8 @@ static void test_word_wrap(void)
     ok(res, "WM_SETTEXT failed.\n");
     pos = SendMessage(hwnd, EM_CHARFROMPOS, 0, (LPARAM) &point);
     ok(pos, "pos=%d indicating no word wrap when it is expected.\n", pos);
+    lines = SendMessage(hwnd, EM_GETLINECOUNT, 0, 0);
+    ok(lines > 1, "Line was expected to wrap (lines=%d).\n", lines);
 
     SetWindowLongW(hwnd, GWL_STYLE, dwCommonStyle|WS_HSCROLL|ES_AUTOHSCROLL);
     pos = SendMessage(hwnd, EM_CHARFROMPOS, 0, (LPARAM) &point);
@@ -5509,6 +5511,8 @@ static void test_word_wrap(void)
     ok(res, "WM_SETTEXT failed.\n");
     pos = SendMessage(hwnd, EM_CHARFROMPOS, 0, (LPARAM) &point);
     ok(!pos, "pos=%d indicating word wrap when none is expected.\n", pos);
+    lines = SendMessage(hwnd, EM_GETLINECOUNT, 0, 0);
+    ok(lines == 1, "Line wasn't expected to wrap (lines=%d).", lines);
 
     SetWindowLongW(hwnd, GWL_STYLE, dwCommonStyle);
     pos = SendMessage(hwnd, EM_CHARFROMPOS, 0, (LPARAM) &point);
@@ -5552,6 +5556,22 @@ static void test_word_wrap(void)
     pos = SendMessage(hwnd, EM_CHARFROMPOS, 0, (LPARAM) &point);
     ok(pos, "pos=%d indicating no word wrap when it is expected.\n", pos);
     DestroyWindow(hwnd);
+
+    /* Test to see if wrapping happens with redraw disabled. */
+    hwnd = CreateWindow(RICHEDIT_CLASS, NULL, dwCommonStyle,
+                        0, 0, 400, 80, NULL, NULL, hmoduleRichEdit, NULL);
+    ok(hwnd != NULL, "error: %d\n", (int) GetLastError());
+    SendMessage(hwnd, WM_SETREDRAW, FALSE, 0);
+    res = SendMessage(hwnd, EM_REPLACESEL, FALSE, (LPARAM) text);
+    ok(res, "EM_REPLACESEL failed.\n");
+    lines = SendMessage(hwnd, EM_GETLINECOUNT, 0, 0);
+    ok(lines == 1, "Line wasn't expected to wrap (lines=%d).\n", lines);
+    MoveWindow(hwnd, 0, 0, 200, 80, FALSE);
+    lines = SendMessage(hwnd, EM_GETLINECOUNT, 0, 0);
+    todo_wine ok(lines > 1, "Line was expected to wrap (lines=%d).\n", lines);
+
+    SendMessage(hwnd, WM_SETREDRAW, TRUE, 0);
+    DestroyWindow(hwnd);
 }
 
 static void test_auto_yscroll(void)




More information about the wine-cvs mailing list