Dylan Smith : richedit: Added test for detecting ascii rtf with Unicode codepage.

Alexandre Julliard julliard at winehq.org
Mon Jan 19 08:58:25 CST 2009


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

Author: Dylan Smith <dylan.ah.smith at gmail.com>
Date:   Fri Jan 16 20:38:17 2009 -0500

richedit: Added test for detecting ascii rtf with Unicode codepage.

---

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

diff --git a/dlls/riched20/tests/editor.c b/dlls/riched20/tests/editor.c
index ff5d598..2cf9a10 100644
--- a/dlls/riched20/tests/editor.c
+++ b/dlls/riched20/tests/editor.c
@@ -3562,6 +3562,23 @@ static void test_EM_SETTEXTEX(void)
   ok(lstrcmpW(buf, TestItem1) == 0,
       "EM_GETTEXTEX results not what was set by EM_SETTEXTEX\n");
 
+  /* The following test demonstrates that EM_SETTEXTEX treats text as ASCII if it
+   * starts with ASCII characters "{\rtf" even when the codepage is unicode. */
+  setText.codepage = 1200; /* Lie about code page (actual ASCII) */
+  getText.codepage = CP_ACP;
+  getText.cb = MAX_BUF_LEN;
+  getText.flags = GT_DEFAULT;
+  getText.lpDefaultChar = NULL;
+  getText.lpUsedDefChar = NULL;
+
+  setText.flags = ST_SELECTION;
+  SendMessage(hwndRichEdit, EM_SETSEL, 0, -1);
+  result = SendMessage(hwndRichEdit, EM_SETTEXTEX, (WPARAM)&setText, (LPARAM) "{\\rtf not unicode}");
+  todo_wine ok(result == 11, "EM_SETTEXTEX incorrectly returned %d\n", result);
+  SendMessage(hwndRichEdit, EM_GETTEXTEX, (WPARAM)&getText, (LPARAM) bufACP);
+  todo_wine ok(lstrcmpA(bufACP, "not unicode") == 0,
+      "'%s' != 'not unicode'\n", bufACP);
+
   /* The following test demonstrates that EM_SETTEXTEX supports RTF strings with a selection */
   SendMessage(hwndRichEdit, WM_SETTEXT, 0, (LPARAM) "TestSomeText"); /* TestItem1 */
   p = (char *)buf;




More information about the wine-cvs mailing list