[PATCH 1/2] riched20/tests: Test for Windows Rich Edit EM_UNDO/EM_REDO status bug.

Jinoh Kang wine at gitlab.winehq.org
Mon Jun 27 10:45:49 CDT 2022


From: Jinoh Kang <jinoh.kang.kr at gmail.com>

Signed-off-by: Jinoh Kang <jinoh.kang.kr at gmail.com>
---
 dlls/riched20/tests/editor.c | 50 ++++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)

diff --git a/dlls/riched20/tests/editor.c b/dlls/riched20/tests/editor.c
index 03c07829ee4..79ee7007873 100644
--- a/dlls/riched20/tests/editor.c
+++ b/dlls/riched20/tests/editor.c
@@ -7079,6 +7079,55 @@ static void test_undo_coalescing(void)
     DestroyWindow(hwnd);
 }
 
+static void test_undo_status_bug(void)
+{
+    HWND hwnd;
+    LRESULT lresult;
+
+    hwnd = new_richedit(NULL);
+
+    lresult = SendMessageA(hwnd, EM_CANUNDO, 0, 0);
+    ok(lresult == FALSE, "EM_CANUNDO returned %Id\n", lresult);
+    lresult = SendMessageA(hwnd, EM_UNDO, 0, 0);
+    ok(lresult == FALSE, "EM_UNDO returned %Id\n", lresult);
+    lresult = SendMessageA(hwnd, EM_CANREDO, 0, 0);
+    ok(lresult == FALSE, "EM_CANREDO returned %Id\n", lresult);
+    lresult = SendMessageA(hwnd, EM_REDO, 0, 0);
+    ok(lresult == FALSE, "EM_REDO returned %Id\n", lresult);
+
+    SendMessageA(hwnd, EM_SETSEL, 0, -1);
+    SendMessageA(hwnd, EM_REPLACESEL, TRUE, (LPARAM)"lorem");
+
+    lresult = SendMessageA(hwnd, EM_CANREDO, 0, 0);
+    ok(lresult == FALSE, "EM_CANREDO returned %Id\n", lresult);
+    lresult = SendMessageA(hwnd, EM_REDO, 0, 0);
+    ok(lresult == FALSE, "EM_REDO returned %Id\n", lresult);
+
+    lresult = SendMessageA(hwnd, EM_CANUNDO, 0, 0);
+    ok(lresult == TRUE, "EM_CANUNDO returned %Id\n", lresult);
+    lresult = SendMessageA(hwnd, EM_UNDO, 0, 0);
+    ok(lresult == TRUE, "EM_UNDO returned %Id\n", lresult);
+
+    lresult = SendMessageA(hwnd, EM_CANUNDO, 0, 0);
+    ok(lresult == FALSE, "EM_CANUNDO returned %Id\n", lresult);
+    lresult = SendMessageA(hwnd, EM_UNDO, 0, 0);
+    todo_wine
+    ok(lresult == TRUE, "EM_UNDO returned %Id\n", lresult);
+
+    lresult = SendMessageA(hwnd, EM_CANREDO, 0, 0);
+    ok(lresult == TRUE, "EM_CANREDO returned %Id\n", lresult);
+    lresult = SendMessageA(hwnd, EM_REDO, 0, 0);
+    ok(lresult == TRUE, "EM_REDO returned %Id\n", lresult);
+
+    lresult = SendMessageA(hwnd, EM_CANREDO, 0, 0);
+    ok(lresult == FALSE, "EM_CANREDO returned %Id\n", lresult);
+    lresult = SendMessageA(hwnd, EM_REDO, 0, 0);
+    todo_wine
+    ok(lresult == TRUE, "EM_REDO returned %Id\n", lresult);
+
+    DestroyWindow(hwnd);
+}
+
 static LONG CALLBACK customWordBreakProc(WCHAR *text, int pos, int bytes, int code)
 {
     int length;
@@ -9080,6 +9129,7 @@ START_TEST( editor )
   test_EM_AUTOURLDETECT();
   test_eventMask();
   test_undo_coalescing();
+  test_undo_status_bug();
   test_word_movement();
   test_EM_CHARFROMPOS();
   test_SETPARAFORMAT();
-- 
GitLab


https://gitlab.winehq.org/wine/wine/-/merge_requests/326



More information about the wine-devel mailing list