test/testmessage.c
changeset 7639 9406b7dd2f2d
parent 7517 965d57022c01
child 7663 53fe1b64eb2d
     1.1 --- a/test/testmessage.c	Mon Aug 12 22:00:21 2013 -0700
     1.2 +++ b/test/testmessage.c	Wed Aug 14 23:30:10 2013 -0700
     1.3 @@ -62,7 +62,7 @@
     1.4  
     1.5      success = SDL_ShowMessageBox(&data, &button);
     1.6      if (success == -1) {
     1.7 -        printf("Error Presenting MessageBox: %s\n", SDL_GetError());
     1.8 +        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Error Presenting MessageBox: %s\n", SDL_GetError());
     1.9          if (eventNumber) {
    1.10              SDL_UserEvent event;
    1.11              event.type = (intptr_t)eventNumber;
    1.12 @@ -72,7 +72,7 @@
    1.13              quit(2);
    1.14          }
    1.15      }
    1.16 -    printf("Pressed button: %d, %s\n", button, button == 1 ? "Cancel" : "OK");
    1.17 +    SDL_Log("Pressed button: %d, %s\n", button, button == 1 ? "Cancel" : "OK");
    1.18  
    1.19      if (eventNumber) {
    1.20          SDL_UserEvent event;
    1.21 @@ -88,12 +88,15 @@
    1.22  {
    1.23      int success;
    1.24  
    1.25 +	/* Enable standard application logging */
    1.26 +    SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
    1.27 +
    1.28      success = SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR,
    1.29                  "Simple MessageBox",
    1.30                  "This is a simple error MessageBox",
    1.31                  NULL);
    1.32      if (success == -1) {
    1.33 -        printf("Error Presenting MessageBox: %s\n", SDL_GetError());
    1.34 +        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Error Presenting MessageBox: %s\n", SDL_GetError());
    1.35          quit(1);
    1.36      }
    1.37  
    1.38 @@ -102,7 +105,7 @@
    1.39                  "This is a simple MessageBox with a newline:\r\nHello world!",
    1.40                  NULL);
    1.41      if (success == -1) {
    1.42 -        printf("Error Presenting MessageBox: %s\n", SDL_GetError());
    1.43 +        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Error Presenting MessageBox: %s\n", SDL_GetError());
    1.44          quit(1);
    1.45      }
    1.46  
    1.47 @@ -112,7 +115,7 @@
    1.48                  "Unicode text: '牛肉西蘭花' ...",
    1.49                  NULL);
    1.50      if (success == -1) {
    1.51 -        printf("Error Presenting MessageBox: %s\n", SDL_GetError());
    1.52 +        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Error Presenting MessageBox: %s\n", SDL_GetError());
    1.53          quit(1);
    1.54      }
    1.55  
    1.56 @@ -122,7 +125,7 @@
    1.57                  "Unicode text and newline:\r\n'牛肉西蘭花'\n'牛肉西蘭花'",
    1.58                  NULL);
    1.59      if (success == -1) {
    1.60 -        printf("Error Presenting MessageBox: %s\n", SDL_GetError());
    1.61 +        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Error Presenting MessageBox: %s\n", SDL_GetError());
    1.62          quit(1);
    1.63      }
    1.64  
    1.65 @@ -135,7 +138,7 @@
    1.66         subsystem on the main thread.
    1.67       */
    1.68      if (SDL_Init(SDL_INIT_VIDEO) < 0) {
    1.69 -        fprintf(stderr, "Couldn't initialize SDL video subsystem: %s\n", SDL_GetError());
    1.70 +        SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL video subsystem: %s\n", SDL_GetError());
    1.71          return (1);
    1.72      }
    1.73      {
    1.74 @@ -153,7 +156,7 @@
    1.75  
    1.76          SDL_WaitThread(thread, &status);
    1.77  
    1.78 -        printf("Message box thread return %i\n", status);
    1.79 +        SDL_Log("Message box thread return %i\n", status);
    1.80      }
    1.81  
    1.82      /* Test showing a message box with a parent window */
    1.83 @@ -166,7 +169,7 @@
    1.84                      "This is a simple error MessageBox with a parent window",
    1.85                      window);
    1.86          if (success == -1) {
    1.87 -            printf("Error Presenting MessageBox: %s\n", SDL_GetError());
    1.88 +            SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Error Presenting MessageBox: %s\n", SDL_GetError());
    1.89              quit(1);
    1.90          }
    1.91