test/testautomation_events.c
changeset 7677 871d43c6968a
parent 7191 75360622e65f
child 10517 563edd87e287
equal deleted inserted replaced
7676:013483acb374 7677:871d43c6968a
    56    event1.type = SDL_USEREVENT;
    56    event1.type = SDL_USEREVENT;
    57    event1.user.code = SDLTest_RandomSint32();
    57    event1.user.code = SDLTest_RandomSint32();
    58    event1.user.data1 = (void *)&_userdataValue1;
    58    event1.user.data1 = (void *)&_userdataValue1;
    59    event1.user.data2 = (void *)&_userdataValue2;
    59    event1.user.data2 = (void *)&_userdataValue2;
    60 
    60 
    61    /* Push a user event onto the queue and force queue update*/
    61    /* Push a user event onto the queue and force queue update */
    62    SDL_PushEvent(&event1);
    62    SDL_PushEvent(&event1);
    63    SDLTest_AssertPass("Call to SDL_PushEvent()");
    63    SDLTest_AssertPass("Call to SDL_PushEvent()");
    64    SDL_PumpEvents();
    64    SDL_PumpEvents();
    65    SDLTest_AssertPass("Call to SDL_PumpEvents()");
    65    SDLTest_AssertPass("Call to SDL_PumpEvents()");
    66 
    66 
    99 
    99 
   100    /* Add watch */
   100    /* Add watch */
   101    SDL_AddEventWatch(_events_sampleNullEventFilter, NULL);
   101    SDL_AddEventWatch(_events_sampleNullEventFilter, NULL);
   102    SDLTest_AssertPass("Call to SDL_AddEventWatch()");
   102    SDLTest_AssertPass("Call to SDL_AddEventWatch()");
   103 
   103 
   104    /* Push a user event onto the queue and force queue update*/
   104    /* Push a user event onto the queue and force queue update */
   105    SDL_PushEvent(&event);
   105    SDL_PushEvent(&event);
   106    SDLTest_AssertPass("Call to SDL_PushEvent()");
   106    SDLTest_AssertPass("Call to SDL_PushEvent()");
   107    SDL_PumpEvents();
   107    SDL_PumpEvents();
   108    SDLTest_AssertPass("Call to SDL_PumpEvents()");
   108    SDLTest_AssertPass("Call to SDL_PumpEvents()");
   109    SDLTest_AssertCheck(_eventFilterCalled == 1, "Check that event filter was called");
   109    SDLTest_AssertCheck(_eventFilterCalled == 1, "Check that event filter was called");
   110 
   110 
   111    /* Delete watch */
   111    /* Delete watch */
   112    SDL_DelEventWatch(_events_sampleNullEventFilter, NULL);
   112    SDL_DelEventWatch(_events_sampleNullEventFilter, NULL);
   113    SDLTest_AssertPass("Call to SDL_DelEventWatch()");
   113    SDLTest_AssertPass("Call to SDL_DelEventWatch()");
   114 
   114 
   115    /* Push a user event onto the queue and force queue update*/
   115    /* Push a user event onto the queue and force queue update */
   116    _eventFilterCalled = 0;
   116    _eventFilterCalled = 0;
   117    SDL_PushEvent(&event);
   117    SDL_PushEvent(&event);
   118    SDLTest_AssertPass("Call to SDL_PushEvent()");
   118    SDLTest_AssertPass("Call to SDL_PushEvent()");
   119    SDL_PumpEvents();
   119    SDL_PumpEvents();
   120    SDLTest_AssertPass("Call to SDL_PumpEvents()");
   120    SDLTest_AssertPass("Call to SDL_PumpEvents()");
   150 
   150 
   151    /* Add watch */
   151    /* Add watch */
   152    SDL_AddEventWatch(_events_sampleNullEventFilter, (void *)&_userdataValue);
   152    SDL_AddEventWatch(_events_sampleNullEventFilter, (void *)&_userdataValue);
   153    SDLTest_AssertPass("Call to SDL_AddEventWatch()");
   153    SDLTest_AssertPass("Call to SDL_AddEventWatch()");
   154 
   154 
   155    /* Push a user event onto the queue and force queue update*/
   155    /* Push a user event onto the queue and force queue update */
   156    SDL_PushEvent(&event);
   156    SDL_PushEvent(&event);
   157    SDLTest_AssertPass("Call to SDL_PushEvent()");
   157    SDLTest_AssertPass("Call to SDL_PushEvent()");
   158    SDL_PumpEvents();
   158    SDL_PumpEvents();
   159    SDLTest_AssertPass("Call to SDL_PumpEvents()");
   159    SDLTest_AssertPass("Call to SDL_PumpEvents()");
   160    SDLTest_AssertCheck(_eventFilterCalled == 1, "Check that event filter was called");
   160    SDLTest_AssertCheck(_eventFilterCalled == 1, "Check that event filter was called");
   161 
   161 
   162    /* Delete watch */
   162    /* Delete watch */
   163    SDL_DelEventWatch(_events_sampleNullEventFilter, (void *)&_userdataValue);
   163    SDL_DelEventWatch(_events_sampleNullEventFilter, (void *)&_userdataValue);
   164    SDLTest_AssertPass("Call to SDL_DelEventWatch()");
   164    SDLTest_AssertPass("Call to SDL_DelEventWatch()");
   165 
   165 
   166    /* Push a user event onto the queue and force queue update*/
   166    /* Push a user event onto the queue and force queue update */
   167    _eventFilterCalled = 0;
   167    _eventFilterCalled = 0;
   168    SDL_PushEvent(&event);
   168    SDL_PushEvent(&event);
   169    SDLTest_AssertPass("Call to SDL_PushEvent()");
   169    SDLTest_AssertPass("Call to SDL_PushEvent()");
   170    SDL_PumpEvents();
   170    SDL_PumpEvents();
   171    SDLTest_AssertPass("Call to SDL_PumpEvents()");
   171    SDLTest_AssertPass("Call to SDL_PumpEvents()");