Francois Gouget : twain_32/tests: Generate an error and skip instead of assert()-ing when the setup fails.

Alexandre Julliard julliard at winehq.org
Wed Jul 3 15:02:19 CDT 2013


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

Author: Francois Gouget <fgouget at free.fr>
Date:   Wed Jul  3 12:11:01 2013 +0200

twain_32/tests: Generate an error and skip instead of assert()-ing when the setup fails.

---

 dlls/twain_32/tests/dsm.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/dlls/twain_32/tests/dsm.c b/dlls/twain_32/tests/dsm.c
index f3b6f95..96381e6 100644
--- a/dlls/twain_32/tests/dsm.c
+++ b/dlls/twain_32/tests/dsm.c
@@ -18,7 +18,7 @@
  *
  */
 #include <stdarg.h>
-#include <assert.h>
+
 #include "windef.h"
 #include "winbase.h"
 #include "wingdi.h"
@@ -33,6 +33,7 @@ static DSMENTRYPROC pDSM_Entry;
 static BOOL dsm_RegisterWindowClasses(void)
 {
     WNDCLASSA cls;
+    BOOL rc;
 
     cls.style = 0;
     cls.lpfnWndProc = DefWindowProc;
@@ -44,9 +45,10 @@ static BOOL dsm_RegisterWindowClasses(void)
     cls.hbrBackground = GetStockObject(WHITE_BRUSH);
     cls.lpszMenuName = NULL;
     cls.lpszClassName = "TWAIN_dsm_class";
-    if (!RegisterClassA(&cls)) return FALSE;
 
-    return TRUE;
+    rc = RegisterClassA(&cls);
+    ok(rc, "RegisterClassA failed: le=%u\n", GetLastError());
+    return rc;
 }
 
 
@@ -832,7 +834,11 @@ START_TEST(dsm)
     HANDLE hwnd;
     HMODULE htwain;
 
-    if (!dsm_RegisterWindowClasses()) assert(0);
+    if (!dsm_RegisterWindowClasses())
+    {
+        skip("Could not register the test class, skipping tests\n");
+        return;
+    }
 
     htwain = LoadLibraryA("twain_32.dll");
     if (! htwain)




More information about the wine-cvs mailing list