richedit: Added tests to show that options are stored internally.

Dylan Smith dylan.ah.smith at gmail.com
Sun Jan 11 01:58:47 CST 2009


Wine is currently getting the window styles and using them directly, but
the tests I added show that an internal copy is being stored by native
richedit controls.
---
 dlls/riched20/tests/editor.c |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)
-------------- next part --------------
diff --git a/dlls/riched20/tests/editor.c b/dlls/riched20/tests/editor.c
index 11930ad..f775e04 100644
--- a/dlls/riched20/tests/editor.c
+++ b/dlls/riched20/tests/editor.c
@@ -1458,6 +1458,10 @@ static void test_EM_SETOPTIONS(void)
     HWND hwndRichEdit = new_richedit(NULL);
     static const char text[] = "Hello. My name is RichEdit!";
     char buffer[1024] = {0};
+    DWORD dwStyle, options, oldOptions;
+    DWORD optionStyles = ES_AUTOVSCROLL|ES_AUTOHSCROLL|ES_NOHIDESEL|
+                         ES_READONLY|ES_WANTRETURN|ES_SAVESEL|
+                         ES_SELECTIONBAR|ES_VERTICAL;
 
     /* NEGATIVE TESTING - NO OPTIONS SET */
     SendMessage(hwndRichEdit, WM_SETTEXT, 0, (LPARAM) text);
@@ -1480,6 +1484,25 @@ static void test_EM_SETOPTIONS(void)
     ok(buffer[0]==text[0], 
        "EM_SETOPTIONS: Text changed! s1:%s s2:%s\n", text, buffer); 
 
+    /* EM_SETOPTIONS changes the window style, but changing the
+     * window style does not change the options. */
+    dwStyle = GetWindowLongW(hwndRichEdit, GWL_STYLE);
+    ok(dwStyle & ES_READONLY, "Readonly style not set by EM_SETOPTIONS\n");
+    SetWindowLongW(hwndRichEdit, GWL_STYLE, dwStyle & ~ES_READONLY);
+    options = SendMessage(hwndRichEdit, EM_GETOPTIONS, 0, 0);
+    todo_wine ok(options & ES_READONLY, "Readonly option set by SetWindowLong\n");
+    /* Confirm that the text is still read only. */
+    SendMessage(hwndRichEdit, WM_CHAR, 'a', ('a' << 16) | 0x0001);
+    SendMessage(hwndRichEdit, WM_GETTEXT, 1024, (LPARAM) buffer);
+    todo_wine ok(buffer[0]==text[0],
+       "EM_SETOPTIONS: Text changed! s1:%s s2:%s\n", text, buffer);
+
+    oldOptions = options;
+    SetWindowLongW(hwndRichEdit, GWL_STYLE, dwStyle|optionStyles);
+    options = SendMessage(hwndRichEdit, EM_GETOPTIONS, 0, 0);
+    todo_wine ok(options == oldOptions,
+       "Options set by SetWindowLong (%x -> %x)\n", oldOptions, options);
+
     DestroyWindow(hwndRichEdit);
 }
 


More information about the wine-patches mailing list