Alex Villacís Lasso : richedit: On failure to parse incoming text as RTF, EM_STREAMIN must set dwError to -16.

Alexandre Julliard julliard at winehq.org
Wed Apr 30 06:57:05 CDT 2008


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

Author: Alex Villacís Lasso <a_villacis at palosanto.com>
Date:   Mon Apr 28 22:43:49 2008 -0500

richedit: On failure to parse incoming text as RTF, EM_STREAMIN must set dwError to -16.

---

 dlls/riched20/editor.c       |    1 +
 dlls/riched20/tests/editor.c |   10 +++++++++-
 dlls/riched32/tests/editor.c |    8 ++++++++
 3 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c
index 392a60a..c867df9 100644
--- a/dlls/riched20/editor.c
+++ b/dlls/riched20/editor.c
@@ -1073,6 +1073,7 @@ static LRESULT ME_StreamIn(ME_TextEditor *editor, DWORD format, EDITSTREAM *stre
 	|| (editor->bEmulateVersion10 && *inStream.buffer != '{'))
       {
         invalidRTF = TRUE;
+        inStream.editstream->dwError = -16;
       }
     }
   }
diff --git a/dlls/riched20/tests/editor.c b/dlls/riched20/tests/editor.c
index 891c713..fff8119 100644
--- a/dlls/riched20/tests/editor.c
+++ b/dlls/riched20/tests/editor.c
@@ -2575,6 +2575,7 @@ static void test_EM_STREAMIN(void)
   result = strcmp (buffer,"TestSomeText");
   ok (result  == 0,
       "EM_STREAMIN: Test 0 set wrong text: Result: %s\n",buffer);
+  ok(es.dwError == 0, "EM_STREAMIN: Test 0 set error %d, expected %d\n", es.dwError, 0);
 
   /* Native richedit 2.0 ignores last \par */
   es.dwCookie = (DWORD_PTR)&streamText0a;
@@ -2589,6 +2590,7 @@ static void test_EM_STREAMIN(void)
   result = strcmp (buffer,"TestSomeText");
   ok (result  == 0,
       "EM_STREAMIN: Test 0-a set wrong text: Result: %s\n",buffer);
+  ok(es.dwError == 0, "EM_STREAMIN: Test 0-a set error %d, expected %d\n", es.dwError, 0);
 
   /* Native richedit 2.0 ignores last \par, next-to-last \par appears */
   es.dwCookie = (DWORD_PTR)&streamText0b;
@@ -2603,6 +2605,7 @@ static void test_EM_STREAMIN(void)
   result = strcmp (buffer,"TestSomeText\r\n");
   ok (result  == 0,
       "EM_STREAMIN: Test 0-b set wrong text: Result: %s\n",buffer);
+  ok(es.dwError == 0, "EM_STREAMIN: Test 0-b set error %d, expected %d\n", es.dwError, 0);
 
   es.dwCookie = (DWORD_PTR)&streamText1;
   es.dwError = 0;
@@ -2616,8 +2619,10 @@ static void test_EM_STREAMIN(void)
   result = strcmp (buffer,"TestSomeText");
   ok (result  == 0,
       "EM_STREAMIN: Test 1 set wrong text: Result: %s\n",buffer);
+  ok(es.dwError == 0, "EM_STREAMIN: Test 1 set error %d, expected %d\n", es.dwError, 0);
 
   es.dwCookie = (DWORD_PTR)&streamText2;
+  es.dwError = 0;
   SendMessage(hwndRichEdit, EM_STREAMIN,
               (WPARAM)(SF_RTF), (LPARAM)&es);
 
@@ -2626,16 +2631,19 @@ static void test_EM_STREAMIN(void)
       "EM_STREAMIN: Test 2 returned %ld, expected 0\n", result);
   ok (strlen(buffer)  == 0,
       "EM_STREAMIN: Test 2 set wrong text: Result: %s\n",buffer);
+  ok(es.dwError == -16, "EM_STREAMIN: Test 2 set error %d, expected %d\n", es.dwError, -16);
 
   es.dwCookie = (DWORD_PTR)&streamText3;
+  es.dwError = 0;
   SendMessage(hwndRichEdit, EM_STREAMIN,
               (WPARAM)(SF_RTF), (LPARAM)&es);
 
   result = SendMessage(hwndRichEdit, WM_GETTEXT, 1024, (LPARAM) buffer);
   ok (result  == 0,
-      "EM_STREAMIN: Test 3 returned %ld, expected 9\n", result);
+      "EM_STREAMIN: Test 3 returned %ld, expected 0\n", result);
   ok (strlen(buffer)  == 0,
       "EM_STREAMIN: Test 3 set wrong text: Result: %s\n",buffer);
+  ok(es.dwError == -16, "EM_STREAMIN: Test 3 set error %d, expected %d\n", es.dwError, -16);
 
   DestroyWindow(hwndRichEdit);
 }
diff --git a/dlls/riched32/tests/editor.c b/dlls/riched32/tests/editor.c
index abecaee..b4082c4 100644
--- a/dlls/riched32/tests/editor.c
+++ b/dlls/riched32/tests/editor.c
@@ -213,6 +213,7 @@ static void test_EM_STREAMIN(void)
   result = strcmp (buffer,"TestSomeText");
   ok (result  == 0,
       "EM_STREAMIN: Test 0 set wrong text: Result: %s\n",buffer);
+  ok(es.dwError == 0, "EM_STREAMIN: Test 0 set error %d, expected %d\n", es.dwError, 0);
 
   /* Native richedit 2.0 ignores last \par */
   es.dwCookie = (DWORD_PTR)&streamText0a;
@@ -227,6 +228,7 @@ static void test_EM_STREAMIN(void)
   result = strcmp (buffer,"TestSomeText");
   ok (result  == 0,
       "EM_STREAMIN: Test 0-a set wrong text: Result: %s\n",buffer);
+  ok(es.dwError == 0, "EM_STREAMIN: Test 0 set error %d, expected %d\n", es.dwError, 0);
 
   /* Native richedit 2.0 ignores last \par, next-to-last \par appears */
   es.dwCookie = (DWORD_PTR)&streamText0b;
@@ -241,6 +243,7 @@ static void test_EM_STREAMIN(void)
   result = strcmp (buffer,"TestSomeText\r\n");
   ok (result  == 0,
       "EM_STREAMIN: Test 0-b set wrong text: Result: %s\n",buffer);
+  ok(es.dwError == 0, "EM_STREAMIN: Test 0 set error %d, expected %d\n", es.dwError, 0);
 
   es.dwCookie = (DWORD_PTR)&streamText1;
   es.dwError = 0;
@@ -254,9 +257,11 @@ static void test_EM_STREAMIN(void)
   result = strcmp (buffer,"TestSomeText");
   ok (result  == 0,
       "EM_STREAMIN: Test 1 set wrong text: Result: %s\n",buffer);
+  ok(es.dwError == 0, "EM_STREAMIN: Test 0 set error %d, expected %d\n", es.dwError, 0);
 
 
   es.dwCookie = (DWORD_PTR)&streamText2;
+  es.dwError = 0;
   SendMessage(hwndRichEdit, EM_STREAMIN,
               (WPARAM)(SF_RTF), (LPARAM)&es);
 
@@ -270,8 +275,10 @@ static void test_EM_STREAMIN(void)
   ok (result  == 0,
       "EM_STREAMIN: Test 2 set wrong text: Result: %s\n",buffer);
   }
+  ok(es.dwError == 0, "EM_STREAMIN: Test 0 set error %d, expected %d\n", es.dwError, 0);
 
   es.dwCookie = (DWORD_PTR)&streamText3;
+  es.dwError = 0;
   SendMessage(hwndRichEdit, EM_STREAMIN,
               (WPARAM)(SF_RTF), (LPARAM)&es);
 
@@ -280,6 +287,7 @@ static void test_EM_STREAMIN(void)
       "EM_STREAMIN: Test 3 returned %ld, expected 0\n", result);
   ok (strlen(buffer)  == 0,
       "EM_STREAMIN: Test 3 set wrong text: Result: %s\n",buffer);
+  ok(es.dwError == -16, "EM_STREAMIN: Test 0 set error %d, expected %d\n", es.dwError, -16);
 
   DestroyWindow(hwndRichEdit);
 }




More information about the wine-cvs mailing list