winetest: Refuse to run if we cannot create a window.
authorAlexandre Julliard <julliard@winehq.org>
Fri, 5 Mar 2010 12:10:16 +0000 (13:10 +0100)
committerAlexandre Julliard <julliard@winehq.org>
Fri, 5 Mar 2010 12:10:16 +0000 (13:10 +0100)
programs/winetest/gui.c
programs/winetest/main.c

index 7a7b1e0aac38db27b6b50c2a290e51b690cc11ce..f13cc1872c87f0cdf1b8e8d82e05fd41595b68b5 100644 (file)
@@ -473,7 +473,7 @@ DlgThreadProc (LPVOID param)
                      NULL, DlgProc);
     switch (ret) {
     case 0:
-        report (R_WARNING, "Invalid parent handle");
+        report (R_FATAL, "Cannot display dialog");
         break;
     case 1:
         report (R_WARNING, "DialogBox failed: %d",
index e0b9ced38d6f7f72ec78ea551e7410f3ca5920a4..3eabf5f675c45d6b078b986fc7e85d574891863f 100644 (file)
@@ -145,6 +145,18 @@ static int check_mount_mgr(void)
     return TRUE;
 }
 
+static int check_display_driver(void)
+{
+    if (running_under_wine())
+    {
+        HWND hwnd = CreateWindowA( "STATIC", "", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, 0, CW_USEDEFAULT, 0,
+                                   0, 0, GetModuleHandleA(0), 0 );
+        if (!hwnd) return FALSE;
+        DestroyWindow( hwnd );
+    }
+    return TRUE;
+}
+
 static int running_on_visible_desktop (void)
 {
     HWND desktop;
@@ -1052,7 +1064,10 @@ int main( int argc, char *argv[] )
             report (R_FATAL, "Tests must be run on a visible desktop");
 
         if (!check_mount_mgr())
-            report (R_FATAL, "Mount manager not running, most likely your WINEPREFIX wasn't created correctly");
+            report (R_FATAL, "Mount manager not running, most likely your WINEPREFIX wasn't created correctly.");
+
+        if (!check_display_driver())
+            report (R_FATAL, "Unable to create a window, the display driver is not working.");
 
         SetConsoleCtrlHandler(ctrl_handler, TRUE);