[PATCH] Fix test failures on Win9x, WinMe and Wine in win9x mode

Paul Vriens Paul.Vriens.Wine at gmail.com
Tue Dec 16 04:29:54 CST 2008


---
 dlls/riched20/tests/editor.c |   45 ++++++++++++++++++++++++++++--------------
 1 files changed, 30 insertions(+), 15 deletions(-)

diff --git a/dlls/riched20/tests/editor.c b/dlls/riched20/tests/editor.c
index 39d519b..b758f89 100644
--- a/dlls/riched20/tests/editor.c
+++ b/dlls/riched20/tests/editor.c
@@ -43,6 +43,8 @@ static CHAR string1[MAX_PATH], string2[MAX_PATH], string3[MAX_PATH];
        format, string1, string2, string3);
 
 static HMODULE hmoduleRichEdit;
+ 
+static int is_win9x = 0;
 
 static HWND new_window(LPCTSTR lpClassName, DWORD dwStyle, HWND parent) {
   HWND hwnd;
@@ -4911,9 +4913,7 @@ static void test_unicode_conversions(void)
     char bufA[64];
     WCHAR bufW[64];
     HWND hwnd;
-    int is_win9x, em_settextex_supported, ret;
-
-    is_win9x = GetVersion() & 0x80000000;
+    int em_settextex_supported, ret;
 
 #define set_textA(hwnd, wm_set_text, txt) \
     do { \
@@ -5146,8 +5146,12 @@ static void test_EM_GETTEXTLENGTHEX(void)
     char buffer[64] = {0};
 
     /* single line */
-    hwnd = CreateWindowExA(0, "RichEdit20W", NULL, WS_POPUP,
-                           0, 0, 200, 60, 0, 0, 0, 0);
+    if (!is_win9x)
+        hwnd = CreateWindowExA(0, "RichEdit20W", NULL, WS_POPUP,
+                               0, 0, 200, 60, 0, 0, 0, 0);
+    else
+        hwnd = CreateWindowExA(0, "RichEdit20A", NULL, WS_POPUP,
+                               0, 0, 200, 60, 0, 0, 0, 0);
     ok(hwnd != 0, "CreateWindowExA error %u\n", GetLastError());
 
     gtl.flags = GTL_NUMCHARS | GTL_PRECISE | GTL_USECRLF;
@@ -5191,8 +5195,12 @@ static void test_EM_GETTEXTLENGTHEX(void)
     DestroyWindow(hwnd);
 
     /* multi line */
-    hwnd = CreateWindowExA(0, "RichEdit20W", NULL, WS_POPUP | ES_MULTILINE,
-                           0, 0, 200, 60, 0, 0, 0, 0);
+    if (!is_win9x)
+        hwnd = CreateWindowExA(0, "RichEdit20W", NULL, WS_POPUP | ES_MULTILINE,
+                               0, 0, 200, 60, 0, 0, 0, 0);
+    else
+        hwnd = CreateWindowExA(0, "RichEdit20A", NULL, WS_POPUP | ES_MULTILINE,
+                               0, 0, 200, 60, 0, 0, 0, 0);
     ok(hwnd != 0, "CreateWindowExA error %u\n", GetLastError());
 
     gtl.flags = GTL_NUMCHARS | GTL_PRECISE | GTL_USECRLF;
@@ -5431,8 +5439,12 @@ static void test_undo_coalescing(void)
     char buffer[64] = {0};
 
     /* multi-line control inserts CR normally */
-    hwnd = CreateWindowExA(0, "RichEdit20W", NULL, WS_POPUP|ES_MULTILINE,
-                           0, 0, 200, 60, 0, 0, 0, 0);
+    if (!is_win9x)
+        hwnd = CreateWindowExA(0, "RichEdit20W", NULL, WS_POPUP|ES_MULTILINE,
+                               0, 0, 200, 60, 0, 0, 0, 0);
+    else
+        hwnd = CreateWindowExA(0, "RichEdit20A", NULL, WS_POPUP|ES_MULTILINE,
+                               0, 0, 200, 60, 0, 0, 0, 0);
     ok(hwnd != 0, "CreateWindowExA error %u\n", GetLastError());
 
     result = SendMessage(hwnd, EM_CANUNDO, 0, 0);
@@ -5652,16 +5664,16 @@ static void test_word_movement(void)
 
     /* Make sure the behaviour is the same with a unicode richedit window,
      * and using unicode functions. */
-    SetLastError(0xdeadbeef);
-    hwnd = CreateWindowW(RICHEDIT_CLASS20W, NULL,
-                        ES_MULTILINE|WS_POPUP|WS_HSCROLL|WS_VSCROLL|WS_VISIBLE,
-                        0, 0, 200, 60, NULL, NULL, hmoduleRichEdit, NULL);
-    if (!hwnd && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
+    if (is_win9x)
     {
-        win_skip("Needed unicode functions are not implemented\n");
+        skip("Cannot test with unicode richedit window\n");
         return;
     }
 
+    hwnd = CreateWindowW(RICHEDIT_CLASS20W, NULL,
+                        ES_MULTILINE|WS_POPUP|WS_HSCROLL|WS_VSCROLL|WS_VISIBLE,
+                        0, 0, 200, 60, NULL, NULL, hmoduleRichEdit, NULL);
+
     /* Test with a custom word break procedure that uses X as the delimiter. */
     result = SendMessageW(hwnd, WM_SETTEXT, 0, (LPARAM)textW);
     ok (result == TRUE, "Failed to clear the text.\n");
@@ -5829,6 +5841,9 @@ START_TEST( editor )
    * RICHED20.DLL, so the linker doesn't actually link to it. */
   hmoduleRichEdit = LoadLibrary("RICHED20.DLL");
   ok(hmoduleRichEdit != NULL, "error: %d\n", (int) GetLastError());
+
+  is_win9x = GetVersion() & 0x80000000;
+
   test_WM_CHAR();
   test_EM_FINDTEXT();
   test_EM_GETLINE();
-- 
1.6.0.4


--------------060605090707080902000707--



More information about the wine-patches mailing list