Dylan Smith : richedit: Added tests for initial options.

Alexandre Julliard julliard at winehq.org
Fri Jan 16 07:41:52 CST 2009


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

Author: Dylan Smith <dylan.ah.smith at gmail.com>
Date:   Thu Jan 15 14:46:18 2009 -0500

richedit: Added tests for initial options.

Using the WS_VSCROLL style causes the ES_AUTOVSCROLL option to be set,
and using the WS_HSCROLL style causes the ES_AUTOHSCROLL flag to be
set (except with richedit v1.0).

---

 dlls/riched20/tests/editor.c |   23 ++++++++++++++++++++++-
 dlls/riched32/tests/editor.c |   22 ++++++++++++++++++++++
 2 files changed, 44 insertions(+), 1 deletions(-)

diff --git a/dlls/riched20/tests/editor.c b/dlls/riched20/tests/editor.c
index 5bbb613..11efb7b 100644
--- a/dlls/riched20/tests/editor.c
+++ b/dlls/riched20/tests/editor.c
@@ -1452,7 +1452,7 @@ static void test_EM_GETSELTEXT(void)
 /* FIXME: need to test unimplemented options and robustly test wparam */
 static void test_EM_SETOPTIONS(void)
 {
-    HWND hwndRichEdit = new_richedit(NULL);
+    HWND hwndRichEdit;
     static const char text[] = "Hello. My name is RichEdit!";
     char buffer[1024] = {0};
     DWORD dwStyle, options, oldOptions;
@@ -1460,6 +1460,27 @@ static void test_EM_SETOPTIONS(void)
                          ES_READONLY|ES_WANTRETURN|ES_SAVESEL|
                          ES_SELECTIONBAR|ES_VERTICAL;
 
+    /* Test initial options. */
+    hwndRichEdit = CreateWindow(RICHEDIT_CLASS, NULL, WS_POPUP,
+                                0, 0, 200, 60, NULL, NULL,
+                                hmoduleRichEdit, NULL);
+    ok(hwndRichEdit != NULL, "class: %s, error: %d\n",
+       RICHEDIT_CLASS, (int) GetLastError());
+    options = SendMessage(hwndRichEdit, EM_GETOPTIONS, 0, 0);
+    ok(options == 0, "Incorrect initial options %x\n", options);
+    DestroyWindow(hwndRichEdit);
+
+    hwndRichEdit = CreateWindow(RICHEDIT_CLASS, NULL,
+                                WS_POPUP|WS_HSCROLL|WS_VSCROLL,
+                                0, 0, 200, 60, NULL, NULL,
+                                hmoduleRichEdit, NULL);
+    ok(hwndRichEdit != NULL, "class: %s, error: %d\n",
+       RICHEDIT_CLASS, (int) GetLastError());
+    options = SendMessage(hwndRichEdit, EM_GETOPTIONS, 0, 0);
+    /* WS_[VH]SCROLL cause the ECO_AUTO[VH]SCROLL options to be set */
+    todo_wine ok(options == (ECO_AUTOVSCROLL|ECO_AUTOHSCROLL),
+       "Incorrect initial options %x\n", options);
+
     /* NEGATIVE TESTING - NO OPTIONS SET */
     SendMessage(hwndRichEdit, WM_SETTEXT, 0, (LPARAM) text);
     SendMessage(hwndRichEdit, EM_SETOPTIONS, ECOOP_SET, 0);
diff --git a/dlls/riched32/tests/editor.c b/dlls/riched32/tests/editor.c
index 5a3530d..ccac356 100644
--- a/dlls/riched32/tests/editor.c
+++ b/dlls/riched32/tests/editor.c
@@ -889,6 +889,27 @@ static void test_word_wrap(void)
     DestroyWindow(hwnd);
 }
 
+static void test_EM_GETOPTIONS(void)
+{
+    HWND hwnd;
+    DWORD options;
+
+    hwnd = CreateWindow(RICHEDIT_CLASS10A, NULL,
+                        WS_POPUP,
+                        0, 0, 200, 60, NULL, NULL, hmoduleRichEdit, NULL);
+    options = SendMessage(hwnd, EM_GETOPTIONS, 0, 0);
+    ok(options == 0, "Incorrect options %x\n", options);
+    DestroyWindow(hwnd);
+
+    hwnd = CreateWindow(RICHEDIT_CLASS10A, NULL,
+                        WS_POPUP|WS_VSCROLL|WS_HSCROLL,
+                        0, 0, 200, 60, NULL, NULL, hmoduleRichEdit, NULL);
+    options = SendMessage(hwnd, EM_GETOPTIONS, 0, 0);
+    todo_wine ok(options == ECO_AUTOVSCROLL,
+       "Incorrect initial options %x\n", options);
+    DestroyWindow(hwnd);
+}
+
 static void test_autoscroll(void)
 {
     HWND hwnd;
@@ -942,6 +963,7 @@ START_TEST( editor )
   test_EM_FINDTEXT();
   test_EM_POSFROMCHAR();
   test_word_wrap();
+  test_EM_GETOPTIONS();
   test_autoscroll();
 
   /* Set the environment variable WINETEST_RICHED32 to keep windows




More information about the wine-cvs mailing list