Fix the user32/wsprintf test

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



With this patch, this test should complete successfully on Win95, Win98
and NT4.

Changelog:

 * dlls/user/tests/wsprintf.c

   wsprintfW is not supported on Win9x platforms
   wsprintf{A,W}Test dshould be void
   Improve error reporting
   Remove unnecessary #includes


Index: dlls/user/tests/wsprintf.c
===================================================================
RCS file: /home/wine/wine/dlls/user/tests/wsprintf.c,v
retrieving revision 1.2
diff -u -r1.2 wsprintf.c
--- dlls/user/tests/wsprintf.c	23 May 2002 02:40:07 -0000	1.2
+++ dlls/user/tests/wsprintf.c	18 Dec 2002 04:09:06 -0000
@@ -17,41 +17,38 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */

-#include <assert.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-
 #include "wine/test.h"
 #include "winbase.h"
 #include "winuser.h"

-static BOOL wsprintfATest (void)
+static void wsprintfATest(void)
 {
-    char buf[25];
-
-    ok ((wsprintfA (buf, "%010ld", -1) == 10), "wsPrintfA length failure");
-	ok ((strcmp (buf, "-000000001") == 0),
-	    "wsprintfA zero padded negative value failure\n");
-
-    return TRUE;
+    char buf[25];
+    int rc;
+
+    rc=wsprintfA(buf, "%010ld", -1);
+    ok(rc == 10, "wsPrintfA length failure: rc=%d error=%ld",rc,GetLastError());
+    ok((lstrcmpA(buf, "-000000001") == 0),
+       "wsprintfA zero padded negative value failure: buf=[%s]",buf);
 }

-static BOOL wsprintfWTest (void)
+static void wsprintfWTest(void)
 {
-    WCHAR buf[25];
-	static const WCHAR fmt[] = {'%','0','1','0','l','d','\0'};
-	static const WCHAR target[] = {'-','0','0','0','0','0','0','0','0','1', '\0'};
-
-    ok ((wsprintfW (buf, fmt, -1) == 10), "wsPrintfW length failure");
-	ok ((lstrcmpW (buf, target) == 0),
-	    "wsprintfW zero padded negative value failure\n");
-
-    return TRUE;
+    static const WCHAR fmt[] = {'%','0','1','0','l','d','\0'};
+    static const WCHAR target[] = {'-','0','0','0','0','0','0','0','0','1', '\0'};
+    WCHAR buf[25];
+    int rc;
+
+    rc=wsprintfW(buf, fmt, -1);
+    if (rc==0 && GetLastError()==ERROR_CALL_NOT_IMPLEMENTED)
+        return;
+    ok(rc == 10, "wsPrintfW length failure: rc=%d error=%ld",rc,GetLastError());
+    ok((lstrcmpW(buf, target) == 0),
+       "wsprintfW zero padded negative value failure");
 }

 START_TEST(wsprintf)
 {
-    wsprintfATest ();
-    wsprintfWTest ();
+    wsprintfATest();
+    wsprintfWTest();
 }



-- 
Francois Gouget         fgouget@free.fr        http://fgouget.free.fr/
                     Avoid the Gates of Hell - use Linux.



[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux