test/testmessage.c
changeset 7456 193c9a1723ad
parent 7088 664d8532219b
child 7458 648067e9073a
     1.1 --- a/test/testmessage.c	Sun Jul 14 11:57:01 2013 -0700
     1.2 +++ b/test/testmessage.c	Sun Jul 14 11:57:45 2013 -0700
     1.3 @@ -94,6 +94,7 @@
     1.4          return (1);
     1.5      }
     1.6  
     1.7 +#if 0
     1.8      success = SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR,
     1.9                  "Simple MessageBox",
    1.10                  "This is a simple error MessageBox",
    1.11 @@ -134,9 +135,7 @@
    1.12  
    1.13      button_messagebox(NULL);
    1.14  
    1.15 -    /* Technically this isn't a supported operation for the API, but it doesn't
    1.16 -     * hurt for it to work.
    1.17 -     */
    1.18 +    /* Test showing a message box from a background thread */
    1.19      {
    1.20          int status = 0;
    1.21          SDL_Event event;
    1.22 @@ -154,6 +153,29 @@
    1.23  
    1.24          printf("Message box thread return %i\n", status);
    1.25      }
    1.26 +#endif
    1.27 +
    1.28 +    /* Test showing a message box with a parent window */
    1.29 +    {
    1.30 +        SDL_Event event;
    1.31 +        SDL_Window *window = SDL_CreateWindow("Test", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 640, 480, SDL_WINDOW_SHOWN);
    1.32 +
    1.33 +        success = SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR,
    1.34 +                    "Simple MessageBox",
    1.35 +                    "This is a simple error MessageBox with a parent window",
    1.36 +                    window);
    1.37 +        if (success == -1) {
    1.38 +            printf("Error Presenting MessageBox: %s\n", SDL_GetError());
    1.39 +            quit(1);
    1.40 +        }
    1.41 +
    1.42 +        while (SDL_WaitEvent(&event))
    1.43 +        {
    1.44 +            if (event.type == SDL_QUIT || event.type == SDL_KEYUP) {
    1.45 +                break;
    1.46 +            }
    1.47 +        }
    1.48 +    }
    1.49  
    1.50      SDL_Quit();
    1.51      return (0);