test/testwm2.c
changeset 7639 9406b7dd2f2d
parent 7517 965d57022c01
child 7663 53fe1b64eb2d
equal deleted inserted replaced
7638:783d1cff9b20 7639:9406b7dd2f2d
    46     int i, done;
    46     int i, done;
    47     SDL_Event event;
    47     SDL_Event event;
    48     int system_cursor = -1;
    48     int system_cursor = -1;
    49     SDL_Cursor *cursor = NULL;
    49     SDL_Cursor *cursor = NULL;
    50 
    50 
       
    51 	/* Enable standard application logging */
       
    52     SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
       
    53 
    51     SDL_assert(SDL_arraysize(cursorNames) == SDL_NUM_SYSTEM_CURSORS);
    54     SDL_assert(SDL_arraysize(cursorNames) == SDL_NUM_SYSTEM_CURSORS);
    52 
    55 
    53     /* Initialize test framework */
    56     /* Initialize test framework */
    54     state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
    57     state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
    55     if (!state) {
    58     if (!state) {
    62         consumed = SDLTest_CommonArg(state, i);
    65         consumed = SDLTest_CommonArg(state, i);
    63         if (consumed == 0) {
    66         if (consumed == 0) {
    64             consumed = -1;
    67             consumed = -1;
    65         }
    68         }
    66         if (consumed < 0) {
    69         if (consumed < 0) {
    67             fprintf(stderr, "Usage: %s %s\n", argv[0], SDLTest_CommonUsage(state));
    70             SDL_Log("Usage: %s %s\n", argv[0], SDLTest_CommonUsage(state));
    68             quit(1);
    71             quit(1);
    69         }
    72         }
    70         i += consumed;
    73         i += consumed;
    71     }
    74     }
    72     if (!SDLTest_CommonInit(state)) {
    75     if (!SDLTest_CommonInit(state)) {
    82 
    85 
    83             if (event.type == SDL_WINDOWEVENT) {
    86             if (event.type == SDL_WINDOWEVENT) {
    84                 if (event.window.event == SDL_WINDOWEVENT_RESIZED) {
    87                 if (event.window.event == SDL_WINDOWEVENT_RESIZED) {
    85                     SDL_Window *window = SDL_GetWindowFromID(event.window.windowID);
    88                     SDL_Window *window = SDL_GetWindowFromID(event.window.windowID);
    86                     if (window) {
    89                     if (window) {
    87                         printf("Window %d resized to %dx%d\n",
    90                         SDL_Log("Window %d resized to %dx%d\n",
    88                             event.window.windowID,
    91                             event.window.windowID,
    89                             event.window.data1,
    92                             event.window.data1,
    90                             event.window.data2);
    93                             event.window.data2);
    91                     }
    94                     }
    92                 }
    95                 }
    93                 if (event.window.event == SDL_WINDOWEVENT_MOVED) {
    96                 if (event.window.event == SDL_WINDOWEVENT_MOVED) {
    94                     SDL_Window *window = SDL_GetWindowFromID(event.window.windowID);
    97                     SDL_Window *window = SDL_GetWindowFromID(event.window.windowID);
    95                     if (window) {
    98                     if (window) {
    96                         printf("Window %d moved to %d,%d (display %s)\n",
    99                         SDL_Log("Window %d moved to %d,%d (display %s)\n",
    97                             event.window.windowID,
   100                             event.window.windowID,
    98                             event.window.data1,
   101                             event.window.data1,
    99                             event.window.data2,
   102                             event.window.data2,
   100                             SDL_GetDisplayName(SDL_GetWindowDisplayIndex(window)));
   103                             SDL_GetDisplayName(SDL_GetWindowDisplayIndex(window)));
   101                     }
   104                     }