test/testautomation_syswm.c
author Sam Lantinga <slouken@libsdl.org>
Thu, 25 Apr 2013 00:26:17 -0700
changeset 7110 2a98852fd58d
parent 6800 26c6795ec1a4
child 7191 75360622e65f
permissions -rw-r--r--
Fixed bug 1582 - Allow disabling SDL_VIDEO_DRIVER_WINDOWS

Marcus von Appen

Trying to build SDL 2.x (HG) on Win32 platforms with either VS.NET or MinGW requires one to have the video subsystem and SDL_VIDEO_DRIVER_WINDOWS flag enabled due to the helper window creation routines.

The attached patch changes the helper window creation behaviour, so that one can build SDL2 without the video subsystem or Windows video drivers on Win32 platforms.
     1 /**
     2  * SysWM test suite
     3  */
     4 
     5 #include <stdio.h>
     6 
     7 #include "SDL.h"
     8 #include "SDL_syswm.h"
     9 #include "SDL_test.h"
    10 
    11 /* Test case functions */
    12 
    13 /**
    14  * @brief Call to SDL_GetWindowWMInfo
    15  */
    16 int
    17 syswm_getWindowWMInfo(void *arg)
    18 {
    19   SDL_bool result;
    20   SDL_Window *window; 
    21   SDL_SysWMinfo info;
    22   
    23   window = SDL_CreateWindow("", 0, 0, 0, 0, SDL_WINDOW_HIDDEN);
    24   SDLTest_AssertPass("Call to SDL_CreateWindow()");
    25   SDLTest_AssertCheck(window != NULL, "Check that value returned from SDL_CreateWindow is not NULL");
    26   if (window == NULL) {
    27      return TEST_ABORTED;
    28   }
    29   
    30   /* Initialize info structure with SDL version info */
    31   SDL_VERSION(&info.version); 
    32   
    33   /* Make call */
    34   result = SDL_GetWindowWMInfo(window, &info);
    35   SDLTest_AssertPass("Call to SDL_GetWindowWMInfo");
    36   SDLTest_Log((result == SDL_TRUE) ? "Got window information" : "Couldn't get window information");
    37                                                                                                       		
    38   SDL_DestroyWindow(window);
    39   SDLTest_AssertPass("Call to SDL_DestroyWindow()");
    40   
    41   return TEST_COMPLETED;
    42 }
    43 
    44 /* ================= Test References ================== */
    45 
    46 /* SysWM test cases */
    47 static const SDLTest_TestCaseReference syswmTest1 =
    48 		{ (SDLTest_TestCaseFp)syswm_getWindowWMInfo, "syswm_getWindowWMInfo", "Call to SDL_GetWindowWMInfo", TEST_ENABLED };
    49 
    50 /* Sequence of SysWM test cases */
    51 static const SDLTest_TestCaseReference *syswmTests[] =  {
    52 	&syswmTest1, NULL
    53 };
    54 
    55 /* SysWM test suite (global) */
    56 SDLTest_TestSuiteReference syswmTestSuite = {
    57 	"SysWM",
    58 	NULL,
    59 	syswmTests,
    60 	NULL
    61 };