Dylan Smith : richedit: Added tests reveal a problem with EM_SETCHARFORMAT' s affect on the undo stack.

Alexandre Julliard julliard at winehq.org
Thu Jun 26 14:50:52 CDT 2008


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

Author: Dylan Smith <dylan.ah.smith at gmail.com>
Date:   Wed Jun 25 11:33:32 2008 -0400

richedit: Added tests reveal a problem with EM_SETCHARFORMAT's affect on the undo stack.

---

 dlls/riched20/run.c          |    1 +
 dlls/riched20/tests/editor.c |   15 +++++++++++++++
 2 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/dlls/riched20/run.c b/dlls/riched20/run.c
index 805975c..a64c9f5 100644
--- a/dlls/riched20/run.c
+++ b/dlls/riched20/run.c
@@ -834,6 +834,7 @@ void ME_SetDefaultCharFormat(ME_TextEditor *editor, CHARFORMAT2W *mod)
   ME_Style *style;
   ME_UndoItem *undo;
 
+  /* FIXME: Should this be removed? It breaks a test. */
   assert(mod->cbSize == sizeof(CHARFORMAT2W));
   undo = ME_AddUndoItem(editor, diUndoSetDefaultCharFormat, NULL);
   if (undo) {
diff --git a/dlls/riched20/tests/editor.c b/dlls/riched20/tests/editor.c
index 409c600..318cece 100644
--- a/dlls/riched20/tests/editor.c
+++ b/dlls/riched20/tests/editor.c
@@ -569,6 +569,9 @@ static void test_EM_SETCHARFORMAT(void)
   rc = SendMessage(hwndRichEdit, EM_SETCHARFORMAT, (WPARAM) 0xfffffff0,
              (LPARAM) &cf2);
   ok(rc == 1, "EM_SETCHARFORMAT returned %d instead of 1\n", rc);
+  rc = SendMessage(hwndRichEdit, EM_CANUNDO, 0, 0);
+  ok(rc == FALSE, "Should not be able to undo here.\n");
+  SendMessage(hwndRichEdit, EM_EMPTYUNDOBUFFER, 0, 0);
 
   /* A valid flag, CHARFORMAT2 structure minimally filled */
   memset(&cf2, 0, sizeof(cf2));
@@ -576,6 +579,9 @@ static void test_EM_SETCHARFORMAT(void)
   rc = SendMessage(hwndRichEdit, EM_SETCHARFORMAT, (WPARAM) SCF_DEFAULT,
              (LPARAM) &cf2);
   ok(rc == 1, "EM_SETCHARFORMAT returned %d instead of 1\n", rc);
+  rc = SendMessage(hwndRichEdit, EM_CANUNDO, 0, 0);
+  todo_wine ok(rc == FALSE, "Should not be able to undo here.\n");
+  SendMessage(hwndRichEdit, EM_EMPTYUNDOBUFFER, 0, 0);
 
   /* A valid flag, CHARFORMAT2 structure minimally filled */
   memset(&cf2, 0, sizeof(cf2));
@@ -583,6 +589,9 @@ static void test_EM_SETCHARFORMAT(void)
   rc = SendMessage(hwndRichEdit, EM_SETCHARFORMAT, (WPARAM) SCF_SELECTION,
              (LPARAM) &cf2);
   ok(rc == 1, "EM_SETCHARFORMAT returned %d instead of 1\n", rc);
+  rc = SendMessage(hwndRichEdit, EM_CANUNDO, 0, 0);
+  ok(rc == FALSE, "Should not be able to undo here.\n");
+  SendMessage(hwndRichEdit, EM_EMPTYUNDOBUFFER, 0, 0);
 
   /* A valid flag, CHARFORMAT2 structure minimally filled */
   memset(&cf2, 0, sizeof(cf2));
@@ -590,6 +599,9 @@ static void test_EM_SETCHARFORMAT(void)
   rc = SendMessage(hwndRichEdit, EM_SETCHARFORMAT, (WPARAM) SCF_WORD,
              (LPARAM) &cf2);
   ok(rc == 1, "EM_SETCHARFORMAT returned %d instead of 1\n", rc);
+  rc = SendMessage(hwndRichEdit, EM_CANUNDO, 0, 0);
+  todo_wine ok(rc == TRUE, "Should not be able to undo here.\n");
+  SendMessage(hwndRichEdit, EM_EMPTYUNDOBUFFER, 0, 0);
 
   /* A valid flag, CHARFORMAT2 structure minimally filled */
   memset(&cf2, 0, sizeof(cf2));
@@ -597,6 +609,9 @@ static void test_EM_SETCHARFORMAT(void)
   rc = SendMessage(hwndRichEdit, EM_SETCHARFORMAT, (WPARAM) SCF_ALL,
              (LPARAM) &cf2);
   ok(rc == 1, "EM_SETCHARFORMAT returned %d instead of 1\n", rc);
+  rc = SendMessage(hwndRichEdit, EM_CANUNDO, 0, 0);
+  todo_wine ok(rc == TRUE, "Should not be able to undo here.\n");
+  SendMessage(hwndRichEdit, EM_EMPTYUNDOBUFFER, 0, 0);
 
   cf2.cbSize = sizeof(CHARFORMAT2);
   SendMessage(hwndRichEdit, EM_GETCHARFORMAT, (WPARAM) SCF_DEFAULT,




More information about the wine-cvs mailing list