main.cpp 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. // SexyKanjiTestSuite.cpp : Defines the entry point for the console application.
  2. //
  3. #include "MiniCppUnit.hxx"
  4. #ifdef WIN32
  5. #include <direct.h>
  6. #else
  7. #include <unistd.h>
  8. #endif // WIN32
  9. #include <ctime>
  10. #include "KString.h"
  11. #include <stdio.h>
  12. #include "spine/extension.h"
  13. #include "spine/spine.h"
  14. #include "KMemory.h" // last include
  15. void RegisterMemoryLeakDetector() {
  16. // Register our malloc and free functions to track memory leaks
  17. #ifdef KANJI_MEMTRACE
  18. _spSetDebugMalloc(_kanjimalloc);
  19. #endif
  20. _spSetMalloc(_kanjimalloc);
  21. _spSetRealloc(_kanjirealloc);
  22. _spSetFree(_kanjifree);
  23. }
  24. int main(int argc, char *argv[]) {
  25. RegisterMemoryLeakDetector();
  26. // Start Timing
  27. time_t start_time, end_time;
  28. time(&start_time);
  29. /* Set working directory to current location for opening test data */
  30. #ifdef WIN32
  31. _chdir( GetFileDir(argv[0], false).c_str() );
  32. #else
  33. chdir(GetFileDir(argv[0], false).c_str());
  34. #endif
  35. // Run Test Suite
  36. if (JetBrains::underTeamcity()) gTeamCityListener.startSuite("Spine-C Test Suite");
  37. int ret_val = TestFixtureFactory::theInstance().runTests() ? 0 : -1;
  38. if (JetBrains::underTeamcity()) gTeamCityListener.endSuite("Spine-C Test Suite");
  39. // End Timing
  40. time(&end_time);
  41. double secs = difftime(end_time, start_time);
  42. printf("\n\n%i minutes and %i seconds of your life taken from you by these tests.\n", ((int) secs) / 60,
  43. ((int) secs) % 60);
  44. spAnimationState_disposeStatics(); // Fix for #775
  45. return ret_val;
  46. }
  47. extern "C" { // probably unnecessary
  48. void _spAtlasPage_createTexture(spAtlasPage *self, const char *path) {
  49. self->rendererObject = 0;
  50. self->width = 2048;
  51. self->height = 2048;
  52. }
  53. void _spAtlasPage_disposeTexture(spAtlasPage *self) {
  54. }
  55. char *_spUtil_readFile(const char *path, int *length) {
  56. return _spReadFile(path, length);
  57. }
  58. }