当前位置: 首页>>代码示例>>C++>>正文


C++ SDLTest_AssertPass函数代码示例

本文整理汇总了C++中SDLTest_AssertPass函数的典型用法代码示例。如果您正苦于以下问题:C++ SDLTest_AssertPass函数的具体用法?C++ SDLTest_AssertPass怎么用?C++ SDLTest_AssertPass使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了SDLTest_AssertPass函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: rwops_testMem

/**
 * @brief Tests opening from memory.
 *
 * \sa http://wiki.libsdl.org/moin.cgi/SDL_RWFromMem
 * \sa http://wiki.libsdl.org/moin.cgi/SDL_RWClose
 */
int
rwops_testMem (void)
{
   char mem[sizeof(RWopsHelloWorldTestString)];
   SDL_RWops *rw;
   int result;

   /* Clear buffer */
   SDL_zero(mem);

   /* Open */
   rw = SDL_RWFromMem(mem, sizeof(RWopsHelloWorldTestString)-1);
   SDLTest_AssertPass("Call to SDL_RWFromMem() succeeded");
   SDLTest_AssertCheck(rw != NULL, "Verify opening memory with SDL_RWFromMem does not return NULL");

   /* Bail out if NULL */
   if (rw == NULL) return TEST_ABORTED;

   /* Check type */
   SDLTest_AssertCheck(rw->type == SDL_RWOPS_MEMORY, "Verify RWops type is SDL_RWOPS_MEMORY; expected: %d, got: %d", SDL_RWOPS_MEMORY, rw->type);

   /* Run generic tests */
   _testGenericRWopsValidations(rw, 1);

   /* Close */
   result = SDL_RWclose(rw);
   SDLTest_AssertPass("Call to SDL_RWclose() succeeded");
   SDLTest_AssertCheck(result == 0, "Verify result value is 0; got: %d", result);

   return TEST_COMPLETED;
}
开发者ID:AaronPerl,项目名称:OpenHand,代码行数:37,代码来源:testautomation_rwops.c

示例2: keyboard_getScancodeNameNegative

/**
 * @brief SDL_GetScancodeName negative cases
 * 
 * @sa http://wiki.libsdl.org/moin.cgi/SDL_GetScancodeName
 */
int
keyboard_getScancodeNameNegative(void *arg)
{  
   SDL_Scancode scancode;
   char *result;
   char *expected = "";

   /* Clear error message */
   SDL_ClearError();
   SDLTest_AssertPass("Call to SDL_ClearError()");

   /* Negative scancode */
   scancode = (SDL_Scancode)SDLTest_RandomIntegerInRange(LONG_MIN, -1);
   result = (char *)SDL_GetScancodeName(scancode);
   SDLTest_AssertPass("Call to SDL_GetScancodeName(%d/negative)", scancode);
   SDLTest_AssertCheck(result != NULL, "Verify result from call is not NULL");
   SDLTest_AssertCheck(SDL_strcmp(result, expected) == 0, "Verify result from call is valid, expected: '%s', got: '%s'", expected, result);
   _checkInvalidScancodeError();

   /* Large scancode */
   scancode = (SDL_Scancode)SDLTest_RandomIntegerInRange(SDL_NUM_SCANCODES, LONG_MAX);
   result = (char *)SDL_GetScancodeName(scancode);
   SDLTest_AssertPass("Call to SDL_GetScancodeName(%d/large)", scancode);
   SDLTest_AssertCheck(result != NULL, "Verify result from call is not NULL");
   SDLTest_AssertCheck(SDL_strcmp(result, expected) == 0, "Verify result from call is valid, expected: '%s', got: '%s'", expected, result);
   _checkInvalidScancodeError();

   return TEST_COMPLETED;
}
开发者ID:D-Quick,项目名称:DQuick,代码行数:34,代码来源:testautomation_keyboard.c

示例3: audio_printAudioDrivers

/**
 * \brief Checks available audio driver names.
 *
 * \sa https://wiki.libsdl.org/SDL_GetNumAudioDrivers
 * \sa https://wiki.libsdl.org/SDL_GetAudioDriver
 */
int audio_printAudioDrivers()
{
   int i, n;
   const char *name;

   /* Get number of drivers */
   n = SDL_GetNumAudioDrivers();
   SDLTest_AssertPass("Call to SDL_GetNumAudioDrivers()");
   SDLTest_AssertCheck(n>=0, "Verify number of audio drivers >= 0, got: %i", n);

   /* List drivers. */
   if (n>0)
   {
      for (i=0; i<n; i++) {
         name = SDL_GetAudioDriver(i);
         SDLTest_AssertPass("Call to SDL_GetAudioDriver(%i)", i);
         SDLTest_AssertCheck(name != NULL, "Verify returned name is not NULL");
         if (name != NULL) {
            SDLTest_AssertCheck(name[0] != '\0', "Verify returned name is not empty, got: '%s'", name);
         }
      }
   }

   return TEST_COMPLETED;
}
开发者ID:03050903,项目名称:Torque3D,代码行数:31,代码来源:testautomation_audio.c

示例4: keyboard_setTextInputRectNegative

/**
 * @brief Check call to SDL_SetTextInputRect with invalid data
 * 
 * @sa http://wiki.libsdl.org/moin.cgi/SDL_SetTextInputRect
 */
int
keyboard_setTextInputRectNegative(void *arg)
{      
   /* Some platforms set also an error message; prepare for checking it */
#if SDL_VIDEO_DRIVER_WINDOWS || SDL_VIDEO_DRIVER_ANDROID || SDL_VIDEO_DRIVER_COCOA  
   const char *expectedError = "Parameter 'rect' is invalid";
   const char *error;
   
   SDL_ClearError();
   SDLTest_AssertPass("Call to SDL_ClearError()");
#endif
   
   /* NULL refRect */
   SDL_SetTextInputRect(NULL);
   SDLTest_AssertPass("Call to SDL_SetTextInputRect(NULL)");

   /* Some platforms set also an error message; so check it */
#if SDL_VIDEO_DRIVER_WINDOWS || SDL_VIDEO_DRIVER_ANDROID || SDL_VIDEO_DRIVER_COCOA  
   error = SDL_GetError();
   SDLTest_AssertPass("Call to SDL_GetError()");
   SDLTest_AssertCheck(error != NULL, "Validate that error message was not NULL");
   if (error != NULL) {
      SDLTest_AssertCheck(SDL_strcmp(error, expectedError) == 0, 
          "Validate error message, expected: '%s', got: '%s'", expectedError, error);
   }

   SDL_ClearError();
   SDLTest_AssertPass("Call to SDL_ClearError()");
#endif
      
   return TEST_COMPLETED;
}
开发者ID:D-Quick,项目名称:DQuick,代码行数:37,代码来源:testautomation_keyboard.c

示例5: syswm_getWindowWMInfo

/**
 * @brief Call to SDL_GetWindowWMInfo
 */
int
syswm_getWindowWMInfo(void *arg)
{
  SDL_bool result;
  SDL_Window *window; 
  SDL_SysWMinfo info;
  
  window = SDL_CreateWindow("", 0, 0, 0, 0, SDL_WINDOW_HIDDEN);
  SDLTest_AssertPass("Call to SDL_CreateWindow()");
  SDLTest_AssertCheck(window != NULL, "Check that value returned from SDL_CreateWindow is not NULL");
  if (window == NULL) {
     return TEST_ABORTED;
  }
  
  /* Initialize info structure with SDL version info */
  SDL_VERSION(&info.version); 
  
  /* Make call */
  result = SDL_GetWindowWMInfo(window, &info);
  SDLTest_AssertPass("Call to SDL_GetWindowWMInfo");
  SDLTest_Log((result == SDL_TRUE) ? "Got window information" : "Couldn't get window information");
                                                                                                      		
  SDL_DestroyWindow(window);
  SDLTest_AssertPass("Call to SDL_DestroyWindow()");
  
  return TEST_COMPLETED;
}
开发者ID:CrypticGator,项目名称:hackterm,代码行数:30,代码来源:testautomation_syswm.c

示例6: mouse_setCursor

/**
 * @brief Check call to SDL_SetCursor
 *
 * @sa http://wiki.libsdl.org/moin.cgi/SDL_SetCursor
 */
int
mouse_setCursor(void *arg)
{
    SDL_Cursor *cursor;

    /* Create a cursor */
    cursor = _initArrowCursor(_mouseArrowData);
        SDLTest_AssertPass("Call to SDL_CreateCursor()");
        SDLTest_AssertCheck(cursor != NULL, "Validate result from SDL_CreateCursor() is not NULL");
    if (cursor == NULL) {
        return TEST_ABORTED;
    }

    /* Set the arrow cursor */
    SDL_SetCursor(cursor);
    SDLTest_AssertPass("Call to SDL_SetCursor(cursor)");

    /* Force redraw */
    SDL_SetCursor(NULL);
    SDLTest_AssertPass("Call to SDL_SetCursor(NULL)");

    /* Free cursor again */
    SDL_FreeCursor(cursor);
    SDLTest_AssertPass("Call to SDL_FreeCursor()");

    return TEST_COMPLETED;
}
开发者ID:03050903,项目名称:Torque3D,代码行数:32,代码来源:testautomation_mouse.c

示例7: mouse_createFreeColorCursor

/**
 * @brief Check call to SDL_CreateColorCursor and SDL_FreeCursor
 *
 * @sa http://wiki.libsdl.org/moin.cgi/SDL_CreateColorCursor
 * @sa http://wiki.libsdl.org/moin.cgi/SDL_FreeCursor
 */
int
mouse_createFreeColorCursor(void *arg)
{
    SDL_Surface *face;
    SDL_Cursor *cursor;

    /* Get sample surface */
    face = SDLTest_ImageFace();
    SDLTest_AssertCheck(face != NULL, "Validate sample input image is not NULL");
    if (face == NULL) return TEST_ABORTED;

    /* Create a color cursor from surface */
    cursor = SDL_CreateColorCursor(face, 0, 0);
        SDLTest_AssertPass("Call to SDL_CreateColorCursor()");
        SDLTest_AssertCheck(cursor != NULL, "Validate result from SDL_CreateColorCursor() is not NULL");
    if (cursor == NULL) {
        SDL_FreeSurface(face);
        return TEST_ABORTED;
    }

    /* Free cursor again */
    SDL_FreeCursor(cursor);
    SDLTest_AssertPass("Call to SDL_FreeCursor()");

    /* Clean up */
    SDL_FreeSurface(face);

    return TEST_COMPLETED;
}
开发者ID:03050903,项目名称:Torque3D,代码行数:35,代码来源:testautomation_mouse.c

示例8: keyboard_getKeyNameNegative

/**
 * @brief SDL_GetKeyName negative cases
 * 
 * @sa http://wiki.libsdl.org/moin.cgi/SDL_GetKeyName
 */
int
keyboard_getKeyNameNegative(void *arg)
{  
   SDL_Keycode keycode;
   char *result;
   char *expected = "";

   /* Unknown keycode */
   keycode = SDLK_UNKNOWN;
   result = (char *)SDL_GetKeyName(keycode);
   SDLTest_AssertPass("Call to SDL_GetKeyName(%d/unknown)", keycode);
   SDLTest_AssertCheck(result != NULL, "Verify result from call is not NULL");
   SDLTest_AssertCheck(SDL_strcmp(result, expected) == 0, "Verify result from call is valid, expected: '%s', got: '%s'", expected, result);

   /* Clear error message */
   SDL_ClearError();
   SDLTest_AssertPass("Call to SDL_ClearError()");

   /* Negative keycode */
   keycode = (SDL_Keycode)SDLTest_RandomIntegerInRange(-255, -1);
   result = (char *)SDL_GetKeyName(keycode);
   SDLTest_AssertPass("Call to SDL_GetKeyName(%d/negative)", keycode);
   SDLTest_AssertCheck(result != NULL, "Verify result from call is not NULL");
   SDLTest_AssertCheck(SDL_strcmp(result, expected) == 0, "Verify result from call is valid, expected: '%s', got: '%s'", expected, result);
   _checkInvalidScancodeError();

   SDL_ClearError();
   SDLTest_AssertPass("Call to SDL_ClearError()");

   return TEST_COMPLETED;
}
开发者ID:D-Quick,项目名称:DQuick,代码行数:36,代码来源:testautomation_keyboard.c

示例9: rwops_testConstMem

/**
 * @brief Tests opening from memory.
 *
 * \sa
 * http://wiki.libsdl.org/moin.cgi/SDL_RWFromConstMem
 * http://wiki.libsdl.org/moin.cgi/SDL_RWClose
 */
int
rwops_testConstMem (void)
{
   SDL_RWops *rw;
   int result;

   /* Open handle */
   rw = SDL_RWFromConstMem( RWopsHelloWorldCompString, sizeof(RWopsHelloWorldCompString)-1 );
   SDLTest_AssertPass("Call to SDL_RWFromConstMem() succeeded");
   SDLTest_AssertCheck(rw != NULL, "Verify opening memory with SDL_RWFromConstMem does not return NULL");

   /* Bail out if NULL */
   if (rw == NULL) return TEST_ABORTED;

   /* Check type */
   SDLTest_AssertCheck(rw->type == SDL_RWOPS_MEMORY_RO, "Verify RWops type is SDL_RWOPS_MEMORY_RO; expected: %d, got: %d", SDL_RWOPS_MEMORY_RO, rw->type);

   /* Run generic tests */
   _testGenericRWopsValidations( rw, 0 );

   /* Close handle */
   result = SDL_RWclose(rw);
   SDLTest_AssertPass("Call to SDL_RWclose() succeeded");
   SDLTest_AssertCheck(result == 0, "Verify result value is 0; got: %d", result);

  return TEST_COMPLETED;
}
开发者ID:AaronPerl,项目名称:OpenHand,代码行数:34,代码来源:testautomation_rwops.c

示例10: rwops_testParamNegative

/*!
 * Negative test for SDL_RWFromFile parameters
 *
 * \sa http://wiki.libsdl.org/moin.cgi/SDL_RWFromFile
 *
 */
int
rwops_testParamNegative (void)
{
   SDL_RWops *rwops;

   /* These should all fail. */
   rwops = SDL_RWFromFile(NULL, NULL);
   SDLTest_AssertPass("Call to SDL_RWFromFile(NULL, NULL) succeeded");
   SDLTest_AssertCheck(rwops == NULL, "Verify SDL_RWFromFile(NULL, NULL) returns NULL");

   rwops = SDL_RWFromFile(NULL, "ab+");
   SDLTest_AssertPass("Call to SDL_RWFromFile(NULL, \"ab+\") succeeded");
   SDLTest_AssertCheck(rwops == NULL, "Verify SDL_RWFromFile(NULL, \"ab+\") returns NULL");

   rwops = SDL_RWFromFile(NULL, "sldfkjsldkfj");
   SDLTest_AssertPass("Call to SDL_RWFromFile(NULL, \"sldfkjsldkfj\") succeeded");
   SDLTest_AssertCheck(rwops == NULL, "Verify SDL_RWFromFile(NULL, \"sldfkjsldkfj\") returns NULL");

   rwops = SDL_RWFromFile("something", "");
   SDLTest_AssertPass("Call to SDL_RWFromFile(\"something\", \"\") succeeded");
   SDLTest_AssertCheck(rwops == NULL, "Verify SDL_RWFromFile(\"something\", \"\") returns NULL");

   rwops = SDL_RWFromFile("something", NULL);
   SDLTest_AssertPass("Call to SDL_RWFromFile(\"something\", NULL) succeeded");
   SDLTest_AssertCheck(rwops == NULL, "Verify SDL_RWFromFile(\"something\", NULL) returns NULL");

   return TEST_COMPLETED;
}
开发者ID:CrypticGator,项目名称:hackterm,代码行数:34,代码来源:testautomation_rwops.c

示例11: rwops_testMem

/**
 * @brief Tests opening from memory.
 *
 * \sa http://wiki.libsdl.org/moin.cgi/SDL_RWFromMem
 * http://wiki.libsdl.org/moin.cgi/SDL_RWClose
 */
int
rwops_testMem (void)
{
   char mem[sizeof(RWopsHelloWorldTestString)];
   SDL_RWops *rw;

   /* Clear buffer */
   SDL_zero(mem);

   /* Open */
   rw = SDL_RWFromMem(mem, sizeof(RWopsHelloWorldTestString)-1);
   SDLTest_AssertPass("Call to SDL_RWFromMem() succeeded");
   SDLTest_AssertCheck(rw != NULL, "Verify opening memory with SDL_RWFromMem does not return NULL");

   /* Bail out if NULL */
   if (rw == NULL) return TEST_ABORTED;

   /* Run generic tests */
   _testGenericRWopsValidations(rw, 1);

   /* Close */
   SDL_RWclose(rw);
   SDLTest_AssertPass("Call to SDL_RWclose() succeeded");

   return TEST_COMPLETED;
}
开发者ID:CrypticGator,项目名称:hackterm,代码行数:32,代码来源:testautomation_rwops.c

示例12: events_pushPumpAndPollUserevent

/**
 * @brief Test pumping and peeking events.
 *
 * @sa http://wiki.libsdl.org/moin.cgi/SDL_PumpEvents
 * @sa http://wiki.libsdl.org/moin.cgi/SDL_PollEvent
 */
int
events_pushPumpAndPollUserevent(void *arg)
{
   SDL_Event event1;
   SDL_Event event2;
   int result;

   /* Create user event */
   event1.type = SDL_USEREVENT;
   event1.user.code = SDLTest_RandomSint32();
   event1.user.data1 = (void *)&_userdataValue1;
   event1.user.data2 = (void *)&_userdataValue2;

   /* Push a user event onto the queue and force queue update */
   SDL_PushEvent(&event1);
   SDLTest_AssertPass("Call to SDL_PushEvent()");
   SDL_PumpEvents();
   SDLTest_AssertPass("Call to SDL_PumpEvents()");

   /* Poll for user event */
   result = SDL_PollEvent(&event2);
   SDLTest_AssertPass("Call to SDL_PollEvent()");
   SDLTest_AssertCheck(result == 1, "Check result from SDL_PollEvent, expected: 1, got: %d", result);

   return TEST_COMPLETED;
}
开发者ID:Antokolos,项目名称:instead-android-ng,代码行数:32,代码来源:testautomation_events.c

示例13: stdlib_sscanf

int
stdlib_sscanf(void *arg)
{
  int output;
  int result;
  int expected_output;
  int expected_result;

  expected_output = output = 123;
  expected_result = -1;
  result = SDL_sscanf("", "%i", &output);
  SDLTest_AssertPass("Call to SDL_sscanf(\"\", \"%%i\", &output)");
  SDLTest_AssertCheck(expected_output == output, "Check output, expected: %i, got: %i", expected_output, output);
  SDLTest_AssertCheck(expected_result == result, "Check return value, expected: %i, got: %i", expected_result, result);

  expected_output = output = 123;
  expected_result = 0;
  result = SDL_sscanf("a", "%i", &output);
  SDLTest_AssertPass("Call to SDL_sscanf(\"a\", \"%%i\", &output)");
  SDLTest_AssertCheck(expected_output == output, "Check output, expected: %i, got: %i", expected_output, output);
  SDLTest_AssertCheck(expected_result == result, "Check return value, expected: %i, got: %i", expected_result, result);

  output = 123;
  expected_output = 2;
  expected_result = 1;
  result = SDL_sscanf("2", "%i", &output);
  SDLTest_AssertPass("Call to SDL_sscanf(\"2\", \"%%i\", &output)");
  SDLTest_AssertCheck(expected_output == output, "Check output, expected: %i, got: %i", expected_output, output);
  SDLTest_AssertCheck(expected_result == result, "Check return value, expected: %i, got: %i", expected_result, result);

  return TEST_COMPLETED;
}
开发者ID:Evengard,项目名称:UniMod,代码行数:32,代码来源:testautomation_stdlib.c

示例14: keyboard_getKeyFromScancode

/**
 * @brief Check call to SDL_GetKeyFromScancode
 * 
 * @sa http://wiki.libsdl.org/moin.cgi/SDL_GetKeyFromScancode
 */
int
keyboard_getKeyFromScancode(void *arg)
{
   SDL_Keycode result;

   /* Case where input is valid */
   result = SDL_GetKeyFromScancode(SDL_SCANCODE_A);
   SDLTest_AssertPass("Call to SDL_GetKeyFromScancode(valid)");
   SDLTest_AssertCheck(result == SDLK_a, "Verify result from call, expected: %i, got: %i", SDLK_a, result);

   /* Case where input is zero */
   result = SDL_GetKeyFromScancode(0);
   SDLTest_AssertPass("Call to SDL_GetKeyFromScancode(0)");
   SDLTest_AssertCheck(result == SDLK_UNKNOWN, "Verify result from call is UNKNOWN, expected: %i, got: %i", SDLK_UNKNOWN, result);

   /* Clear error message */
   SDL_ClearError();
   SDLTest_AssertPass("Call to SDL_ClearError()");

   /* Case where input is invalid (too small) */
   result = SDL_GetKeyFromScancode(-999);
   SDLTest_AssertPass("Call to SDL_GetKeyFromScancode(-999)");
   SDLTest_AssertCheck(result == SDLK_UNKNOWN, "Verify result from call is UNKNOWN, expected: %i, got: %i", SDLK_UNKNOWN, result);
   _checkInvalidScancodeError();

   /* Case where input is invalid (too big) */
   result = SDL_GetKeyFromScancode(999);
   SDLTest_AssertPass("Call to SDL_GetKeyFromScancode(999)");
   SDLTest_AssertCheck(result == SDLK_UNKNOWN, "Verify result from call is UNKNOWN, expected: %i, got: %i", SDLK_UNKNOWN, result);
   _checkInvalidScancodeError();

   return TEST_COMPLETED;
}
开发者ID:D-Quick,项目名称:DQuick,代码行数:38,代码来源:testautomation_keyboard.c

示例15: video_getWindowFlags

/**
 * @brief Tests the functionality of the SDL_GetWindowFlags function
 */
int
video_getWindowFlags(void *arg)
{
  SDL_Window* window;
  const char* title = "video_getWindowFlags Test Window";
  int x, y, w, h;
  SDL_WindowFlags flags;
  Uint32 actualFlags;
  
  /* Standard window */
  x = SDLTest_RandomIntegerInRange(1, 100);
  y = SDLTest_RandomIntegerInRange(1, 100);
  w = SDLTest_RandomIntegerInRange(320, 1024);
  h = SDLTest_RandomIntegerInRange(320, 768);
  
  /* Reliable flag */
  flags = SDL_WINDOW_SHOWN;
  
  window = SDL_CreateWindow(title, x, y, w, h, flags);
  SDLTest_AssertPass("Call to SDL_CreateWindow('Title',%d,%d,%d,%d,%d)", x, y, w, h, flags);
  SDLTest_AssertCheck(window != NULL, "Validate that returned window struct is not NULL");
  if (window != NULL) {
      actualFlags = SDL_GetWindowFlags(window);
      SDLTest_AssertPass("Call to SDL_GetWindowFlags");
      SDLTest_AssertCheck((flags & actualFlags) == flags, "Verify returned value has flags %d set, got: %d", flags, actualFlags);
      SDL_DestroyWindow(window);
      SDLTest_AssertPass("Call to SDL_DestroyWindow");  
  }

  return TEST_COMPLETED;
}
开发者ID:Plombo,项目名称:SDL,代码行数:34,代码来源:testautomation_video.c


注:本文中的SDLTest_AssertPass函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。