ManaPlus
Public Member Functions | Private Attributes
TestLauncher Class Reference

#include <testlauncher.h>

Public Member Functions

 TestLauncher (std::string test)
 
 ~TestLauncher ()
 
int exec ()
 
int calcFps (const timeval &start, const timeval &end, const int calls) const
 
int testBackend () const
 
int testSound () const
 
int testRescale () const
 
int testFps ()
 
int testFps2 ()
 
int testFps3 ()
 
int testInternal ()
 
int testDye ()
 
int testVideoDetection ()
 
int testBatches ()
 
int testTextures ()
 
int testDraw ()
 
int testDyeSSpeed ()
 
int testDyeASpeed ()
 
int testStackSpeed ()
 
int testBlitSpeed ()
 

Private Attributes

std::string mTest
 
std::ofstream file
 

Detailed Description

Definition at line 39 of file testlauncher.h.

Constructor & Destructor Documentation

◆ TestLauncher()

TestLauncher::TestLauncher ( std::string  test)
explicit

Definition at line 90 of file testlauncher.cpp.

90  :
91  mTest(test),
92  file()
93 {
94  file.open(pathJoin(settings.localDataDir, "test.log").c_str(),
95  std::ios::out);
96 }
std::string localDataDir
Definition: settings.h:112
std::string mTest
Definition: testlauncher.h:87
std::ofstream file
Definition: testlauncher.h:89
Settings settings
Definition: settings.cpp:32
std::string pathJoin(std::string str1, const std::string &str2)

References file, Settings::localDataDir, pathJoin(), and settings.

◆ ~TestLauncher()

TestLauncher::~TestLauncher ( )

Definition at line 98 of file testlauncher.cpp.

99 {
100  file.close();
101 }

References file.

Member Function Documentation

◆ calcFps()

int TestLauncher::calcFps ( const timeval &  start,
const timeval &  end,
const int  calls 
) const

Definition at line 821 of file testlauncher.cpp.

824 {
825  long mtime;
826  long seconds;
827  long useconds;
828 
829  seconds = end.tv_sec - start.tv_sec;
830  useconds = end.tv_usec - start.tv_usec;
831 
832  mtime = (seconds * 1000 + useconds / 1000.0) + 0.5;
833  if (mtime == 0)
834  return 100000;
835 
836  return CAST_S32(static_cast<long>(calls) * 10000 / mtime);
837 }
#define CAST_S32
Definition: cast.h:30

References CAST_S32, and anonymous_namespace{stringutils.cpp}::start.

Referenced by PRAGMA45(), testFps2(), and testFps3().

◆ exec()

int TestLauncher::exec ( )

Definition at line 103 of file testlauncher.cpp.

104 {
105  if (mTest == "1" || mTest == "2" || mTest == "3" || mTest == "19")
106  return testBackend();
107  else if (mTest == "4")
108  return testSound();
109  else if (mTest == "5" || mTest == "6" || mTest == "7" || mTest == "18")
110  return testRescale();
111  else if (mTest == "8" || mTest == "9" || mTest == "10" || mTest == "17")
112  return testFps();
113  else if (mTest == "11")
114  return testBatches();
115  else if (mTest == "14" || mTest == "15" || mTest == "16" || mTest == "20")
116  return testTextures();
117  else if (mTest == "99")
118  return testVideoDetection();
119  else if (mTest == "100")
120  return testInternal();
121  else if (mTest == "101")
122  return testDye();
123  else if (mTest == "102")
124  return testDraw();
125  else if (mTest == "103")
126  return testFps2();
127  else if (mTest == "104")
128  return testFps3();
129  else if (mTest == "105")
130  return testDyeSSpeed();
131  else if (mTest == "106")
132  return testStackSpeed();
133  else if (mTest == "107")
134  return testDyeASpeed();
135  else if (mTest == "108")
136  return testBlitSpeed();
137 
138  return -1;
139 }
int testInternal()
int testVideoDetection()
int testRescale() const
int testSound() const
int testStackSpeed()
int testBatches()
int testBackend() const

References mTest, testBackend(), testBatches(), testBlitSpeed(), testDraw(), testDye(), testDyeASpeed(), testDyeSSpeed(), testFps(), testFps2(), testFps3(), testInternal(), testRescale(), testSound(), testStackSpeed(), testTextures(), and testVideoDetection().

◆ testBackend()

int TestLauncher::testBackend ( ) const

Definition at line 141 of file testlauncher.cpp.

142 {
143  const Image *const img = Theme::getImageFromTheme(
144  "graphics/sprites/arrow_up.png");
145  if (img == nullptr)
146  return 1;
147  const int cnt = 100;
148 
149  for (int f = 0; f < cnt; f ++)
150  {
151  mainGraphics->drawImage(img, cnt * 7, cnt * 5);
153  }
154 
155  sleep(1);
156  return 0;
157 }
virtual void updateScreen()=0
virtual void drawImage(const Image *const image, int dstX, int dstY)=0
static Image * getImageFromTheme(const std::string &path)
Definition: theme.cpp:655
Graphics * mainGraphics
Definition: graphics.cpp:109

References Graphics::drawImage(), Theme::getImageFromTheme(), mainGraphics, and Graphics::updateScreen().

Referenced by exec().

◆ testBatches()

int TestLauncher::testBatches ( )

Referenced by exec().

◆ testBlitSpeed()

int TestLauncher::testBlitSpeed ( )

Definition at line 588 of file testlauncher.cpp.

589 {
590 #if defined __linux__ || defined __linux
591 #if SDL_BYTEORDER == SDL_LIL_ENDIAN
592 #ifndef USE_SDL2
593 
594  timespec time1;
595  timespec time2;
596  const int cnt1 = 10000;
597  const int cnt2 = 10;
598 
599  SDL_Surface *const srcSurface = imageHelper->create32BitSurface(
600  64, 64);
601  SDL_Surface *const dstSurface = imageHelper->create32BitSurface(
602  512, 512);
603  for (int f = 0; f < 64 * 64; f ++)
604  static_cast<uint32_t*>(srcSurface->pixels)[f] = 0x11223344;
605  clock_gettime(CLOCK_MONOTONIC, &time1);
606  for (int d = 0; d < cnt2; d ++)
607  {
608  for (int f = 0; f < 512 * 512; f ++)
609  static_cast<uint32_t*>(dstSurface->pixels)[f] = 0x55667788;
610  for (int f = 0; f < cnt1; f ++)
611  {
612  SDLgfxBlitRGBA(srcSurface,
613  nullptr,
614  dstSurface,
615  nullptr);
616  }
617  }
618  calcTime("blit test",
619  "custom time",
620  time1,
621  time2,
622  static_cast<uint32_t*>(dstSurface->pixels));
623 
624  clock_gettime(CLOCK_MONOTONIC, &time1);
625  for (int d = 0; d < cnt2; d ++)
626  {
627  for (int f = 0; f < 512 * 512; f ++)
628  static_cast<uint32_t*>(dstSurface->pixels)[f] = 0x55667788;
629  for (int f = 0; f < cnt1; f ++)
630  {
631  SDL_gfxBlitRGBA(srcSurface,
632  nullptr,
633  dstSurface,
634  nullptr);
635  }
636  }
637  calcTime("blit test",
638  "SDL_gfx time",
639  time1,
640  time2,
641  static_cast<uint32_t*>(dstSurface->pixels));
642 
643 #endif // USE_SDL2
644 #endif // SDL_BYTEORDER == SDL_LIL_ENDIAN
645 #endif // defined __linux__ || defined __linux
646  return 0;
647 }
virtual SDL_Surface * create32BitSurface(int width, int height) const
ImageHelper * imageHelper
Definition: imagehelper.cpp:44
int SDLgfxBlitRGBA(const SDL_Surface *const src, const SDL_Rect *const srcrect, SDL_Surface *const dst, const SDL_Rect *const dstrect)

References ImageHelper::create32BitSurface(), imageHelper, and SDLgfxBlitRGBA().

Referenced by exec().

◆ testDraw()

int TestLauncher::testDraw ( )

Definition at line 732 of file testlauncher.cpp.

733 {
734  Image *img[3];
735  img[0] = Theme::getImageFromTheme("graphics/sprites/arrow_left.png");
736  img[1] = Theme::getImageFromTheme("graphics/sprites/arrow_right.png");
737  img[2] = Theme::getImageFromTheme("graphics/sprites/arrow_up.png");
738  Skin *skin = theme->load("button.xml",
739  "button.xml",
740  true,
742  if (skin == nullptr)
743  return 0;
744 
745  ImageCollection *const col = new ImageCollection;
746  ImageCollection *const col2 = new ImageCollection;
747  ImageVertexes *const vert = new ImageVertexes;
748  vert->image = img[2];
749 
750  mainGraphics->pushClipArea(Rect(10, 20, 790, 580));
751  mainGraphics->setColor(Color(0xFFU, 0xFFU, 0x00U, 0xFFU));
752  mainGraphics->drawRectangle(Rect(0, 0, 400, 200));
753 
754  mainGraphics->setColor(Color(0xFFU, 0x00U, 0x00U, 0xB0U));
755  img[0]->setAlpha(0.5F);
756  mainGraphics->drawImage(img[0], 190, 383);
757  img[0]->setAlpha(1.0F);
758 
759  mainGraphics->calcWindow(col2,
760  5, 40,
761  500, 40,
762  skin->getBorder());
763  mainGraphics->finalize(col2);
764 
765  mainGraphics->calcTileVertexes(vert, img[2], 10, 10);
766  mainGraphics->calcTileVertexes(vert, img[2], 40, 10);
767  mainGraphics->finalize(vert);
768 
769  mainGraphics->setColor(Color(0x80U, 0x00U, 0xA0U, 0x90U));
770  mainGraphics->fillRectangle(Rect(200, 100, 300, 300));
772 
773  Color color(0xFFU, 0x00U, 0x00U, 0xB0U);
774  Color color2(0x00U, 0xFFU, 0x00U, 0xB0U);
776  color, color2,
777  "test test test test test test test test ", 300, 100);
778 
780 
781  mainGraphics->drawPattern(img[0], 10, 400, 300, 180);
782 
783  mainGraphics->calcPattern(col, img[1], 500, 400, 150, 100);
784  mainGraphics->finalize(col);
785 
787 
788  mainGraphics->drawRescaledImage(img[0], 250, 350, 35, 90);
789 
790  mainGraphics->setColor(Color(0x00U, 0xFFU, 0x00U, 0x90U));
791  mainGraphics->drawNet(450, 10, 600, 300, 32, 20);
792 
794 
795  img[0]->setAlpha(0.3F);
796  mainGraphics->drawRescaledPattern(img[0], 250, 150, 250, 300, 30, 100);
797 
798  for (int f = 0; f < 255; f ++)
799  {
800  mainGraphics->setColor(Color(0x20U, 0x60U, f, 0x90U));
801  mainGraphics->drawLine(300 + f, 490, 300 + f, 480);
802  for (int d = 0; d < 10; d ++)
803  mainGraphics->drawPoint(300 + f, 500 + d);
804  }
806  sleep(10);
807 
808  delete col;
809  delete col2;
810  delete vert;
811  return 0;
812 }
Definition: color.h:76
void drawString(Graphics *const graphics, Color col, const Color &col2, const std::string &text, const int x, const int y)
Definition: font.cpp:254
virtual void popClipArea()
Definition: graphics.cpp:739
virtual void drawRescaledPattern(const Image *const image, const int x, const int y, const int w, const int h, const int scaledWidth, const int scaledHeight)=0
virtual void drawTileCollection(const ImageCollection *const vertCol)=0
virtual void fillRectangle(const Rect &rectangle)=0
virtual void calcPattern(ImageVertexes *const vert, const Image *const image, const int x, const int y, const int w, const int h) const =0
virtual void setColor(const Color &color)
Definition: graphics.h:320
virtual void finalize(ImageCollection *const col)
Definition: graphics.h:465
virtual void drawRectangle(const Rect &rectangle)=0
virtual void calcWindow(ImageCollection *const vertCol, const int x, const int y, const int w, const int h, const ImageRect &imgRect)=0
virtual void drawLine(int x1, int y1, int x2, int y2)=0
virtual void calcTileVertexes(ImageVertexes *const vert, const Image *const image, int x, int y) const =0
virtual void drawPattern(const Image *const image, const int x, const int y, const int w, const int h)=0
virtual void drawPoint(int x, int y)=0
virtual void pushClipArea(const Rect &area)
Definition: graphics.cpp:677
virtual void drawTileVertexes(const ImageVertexes *const vert)=0
virtual void drawNet(const int x1, const int y1, const int x2, const int y2, const int width, const int height)
Definition: graphics.cpp:653
virtual void drawRescaledImage(const Image *const image, int dstX, int dstY, const int desiredWidth, const int desiredHeight)=0
const Image * image
Definition: imagevertexes.h:48
Definition: rect.h:74
Definition: skin.h:37
const ImageRect & getBorder() const
Definition: skin.h:68
static std::string getThemePath()
Definition: theme.h:67
Skin * load(const std::string &filename, const std::string &filename2, const bool full, const std::string &defaultPath)
Definition: theme.cpp:179
Font * boldFont
Definition: gui.cpp:112
Theme * theme
Definition: theme.cpp:62

References boldFont, Graphics::calcPattern(), Graphics::calcTileVertexes(), Graphics::calcWindow(), Graphics::drawImage(), Graphics::drawLine(), Graphics::drawNet(), Graphics::drawPattern(), Graphics::drawPoint(), Graphics::drawRectangle(), Graphics::drawRescaledImage(), Graphics::drawRescaledPattern(), Font::drawString(), Graphics::drawTileCollection(), Graphics::drawTileVertexes(), Graphics::fillRectangle(), Graphics::finalize(), Skin::getBorder(), Theme::getImageFromTheme(), Theme::getThemePath(), ImageVertexes::image, Theme::load(), mainGraphics, Graphics::popClipArea(), Graphics::pushClipArea(), Graphics::setColor(), theme, and Graphics::updateScreen().

Referenced by exec().

◆ testDye()

int TestLauncher::testDye ( )

Referenced by exec().

◆ testDyeASpeed()

int TestLauncher::testDyeASpeed ( )

Definition at line 569 of file testlauncher.cpp.

570 {
571 #if defined __linux__ || defined __linux
572 #ifdef SIMD_SUPPORTED
573  const int sz = 100000;
574  uint32_t buf[sz];
575  timespec time1;
576  timespec time2;
577 
578  DyePalette pal("#0000ffff,00000000,000020ff,70605040", 8);
579 
580  runDyeTest("dye a salt", "default time", replaceAColorDefault);
581  runDyeTest("dye a salt", "sse2 time ", replaceAColorSse2);
582  runDyeTest("dye a salt", "avx2 time ", replaceAColorAvx2);
583 #endif // SIMD_SUPPORTED
584 #endif // defined __linux__ || defined __linux
585  return 0;
586 }

Referenced by exec().

◆ testDyeSSpeed()

int TestLauncher::testDyeSSpeed ( )

Definition at line 550 of file testlauncher.cpp.

551 {
552 #if defined __linux__ || defined __linux
553 #ifdef SIMD_SUPPORTED
554  const int sz = 100000;
555  uint32_t buf[sz];
556  timespec time1;
557  timespec time2;
558 
559  DyePalette pal("#0000ff,000000,000020,706050", 6);
560 
561  runDyeTest("dye s salt", "default time", replaceSColorDefault);
562  runDyeTest("dye s salt", "sse2 time ", replaceSColorSse2);
563  runDyeTest("dye s salt", "avx2 time ", replaceSColorAvx2);
564 #endif // SIMD_SUPPORTED
565 #endif // defined __linux__ || defined __linux
566  return 0;
567 }

Referenced by exec().

◆ testFps()

int TestLauncher::testFps ( )

Referenced by exec().

◆ testFps2()

int TestLauncher::testFps2 ( )

Definition at line 235 of file testlauncher.cpp.

236 {
237  timeval start;
238  timeval end;
239 
241  Wallpaper::getWallpaper(800, 600);
242  Image *img[1];
243 
244  img[0] = Theme::getImageFromTheme("graphics/images/login_wallpaper.png");
245  mainGraphics->drawImage(img[0], 0, 0);
246 
247  const int cnt = 500;
248 
249  gettimeofday(&start, nullptr);
250  for (int k = 0; k < cnt; k ++)
251  {
252  for (int f = 0; f < 300; f ++)
255  }
256 
257  gettimeofday(&end, nullptr);
258  const int tFps = calcFps(start, end, cnt);
259  file << mTest << std::endl;
260  file << tFps << std::endl;
261 
262  printf("fps: %d\n", tFps / 10);
263  sleep(1);
264  return 0;
265 }
virtual void testDraw()
Definition: graphics.h:473
int calcFps(const timeval &start, const timeval &end, const int calls) const
static void loadWallpapers()
Definition: wallpaper.cpp:88
static std::string getWallpaper(const int width, const int height)
Definition: wallpaper.cpp:137

References calcFps(), Graphics::drawImage(), file, Theme::getImageFromTheme(), Wallpaper::getWallpaper(), Wallpaper::loadWallpapers(), mainGraphics, mTest, anonymous_namespace{stringutils.cpp}::start, Graphics::testDraw(), and Graphics::updateScreen().

Referenced by exec().

◆ testFps3()

int TestLauncher::testFps3 ( )

Definition at line 267 of file testlauncher.cpp.

268 {
269  timeval start;
270  timeval end;
271 
273  Wallpaper::getWallpaper(800, 600);
274  Image *img[2];
275 
276  img[0] = Theme::getImageFromTheme("graphics/sprites/arrow_up.png");
277  img[1] = Theme::getImageFromTheme("graphics/sprites/arrow_left.png");
278  ImageVertexes *const vert1 = new ImageVertexes;
279  vert1->image = img[0];
280  ImageVertexes *const vert2 = new ImageVertexes;
281  vert2->image = img[1];
282 
283  for (int f = 0; f < 50; f ++)
284  {
285  for (int d = 0; d < 50; d ++)
286  {
287  mainGraphics->calcTileVertexes(vert1, img[0], f * 16, d * 12);
288  mainGraphics->calcTileVertexes(vert1, img[1], f * 16 + 5, d * 12);
289  }
290  }
291  mainGraphics->finalize(vert1);
292  mainGraphics->finalize(vert2);
293 
294  const int cnt = 2000;
295 
296  gettimeofday(&start, nullptr);
297  for (int k = 0; k < cnt; k ++)
298  {
302  }
303 
304  gettimeofday(&end, nullptr);
305  const int tFps = calcFps(start, end, cnt);
306  file << mTest << std::endl;
307  file << tFps << std::endl;
308 
309  printf("fps: %d\n", tFps / 10);
310  sleep(1);
311  return 0;
312 }

References calcFps(), Graphics::calcTileVertexes(), Graphics::drawTileVertexes(), file, Graphics::finalize(), Theme::getImageFromTheme(), Wallpaper::getWallpaper(), ImageVertexes::image, Wallpaper::loadWallpapers(), mainGraphics, mTest, anonymous_namespace{stringutils.cpp}::start, and Graphics::updateScreen().

Referenced by exec().

◆ testInternal()

int TestLauncher::testInternal ( )

Referenced by exec().

◆ testRescale()

int TestLauncher::testRescale ( ) const

Definition at line 170 of file testlauncher.cpp.

171 {
173  const std::string wallpaperName = Wallpaper::getWallpaper(800, 600);
174  const volatile Image *const img = Theme::getImageFromTheme(wallpaperName);
175  if (img == nullptr)
176  return 1;
177 
178  sleep(1);
179  return 0;
180 }

References Theme::getImageFromTheme(), Wallpaper::getWallpaper(), and Wallpaper::loadWallpapers().

Referenced by exec().

◆ testSound()

int TestLauncher::testSound ( ) const

Definition at line 159 of file testlauncher.cpp.

160 {
161  soundManager.playGuiSfx("system/newmessage.ogg");
162  sleep(1);
163  soundManager.playSfx("system/newmessage.ogg", 0, 0);
164  soundManager.playMusic("sfx/system/newmessage.ogg", SkipError_false);
165  sleep(3);
167  return 0;
168 }
void playGuiSfx(const std::string &path)
void playSfx(const std::string &path, const int x, const int y) const
void playMusic(const std::string &fileName, const SkipError skipError)
const bool SkipError_false
Definition: skiperror.h:30
SoundManager soundManager

References SoundManager::playGuiSfx(), SoundManager::playMusic(), SoundManager::playSfx(), SkipError_false, soundManager, and SoundManager::stopMusic().

Referenced by exec().

◆ testStackSpeed()

int TestLauncher::testStackSpeed ( )

Definition at line 649 of file testlauncher.cpp.

650 {
651 /*
652  const int sz = 100000;
653  const int k = 100;
654  const int sz2 = sz * k;
655 
656  std::stack<ClipRect> stack1;
657  MStack<ClipRect> stack2(sz2);
658  timespec time1;
659  timespec time2;
660 
661 #if defined __linux__ || defined __linux
662  for (int d = 0; d < 100; d ++)
663  {
664  for (int f = 0; f < sz; f ++)
665  {
666  ClipRect rect;
667  rect.xOffset = f;
668  rect.yOffset = f;
669  stack1.push(rect);
670  }
671  }
672  while (!stack1.empty())
673  stack1.pop();
674 
675  clock_gettime(CLOCK_MONOTONIC, &time1);
676 
677  for (int d = 0; d < 100; d ++)
678  {
679  for (int f = 0; f < sz; f ++)
680  {
681  ClipRect rect;
682  rect.xOffset = f;
683  rect.yOffset = f;
684  stack1.push(rect);
685  }
686  }
687 
688  clock_gettime(CLOCK_MONOTONIC, &time2);
689  long diff = ((static_cast<long int>(time2.tv_sec) * 1000000000L
690  + static_cast<long int>(time2.tv_nsec)) / 1) -
691  ((static_cast<long int>(time1.tv_sec) * 1000000000L
692  + static_cast<long int>(time1.tv_nsec)) / 1);
693  printf("debug: %d\n", stack1.top().xOffset);
694  printf("stl time: %ld\n", diff);
695 
696  for (int d = 0; d < 100; d ++)
697  {
698  for (int f = 0; f < sz; f ++)
699  {
700  ClipRect &rect = stack2.push();
701  rect.xOffset = f;
702  rect.yOffset = f;
703  }
704  }
705  stack2.clear();
706 
707  clock_gettime(CLOCK_MONOTONIC, &time1);
708 
709  for (int d = 0; d < 100; d ++)
710  {
711  for (int f = 0; f < sz; f ++)
712  {
713  ClipRect &rect = stack2.push();
714  rect.xOffset = f;
715  rect.yOffset = f;
716  }
717  }
718 
719  clock_gettime(CLOCK_MONOTONIC, &time2);
720  diff = ((static_cast<long int>(time2.tv_sec) * 1000000000L
721  + static_cast<long int>(time2.tv_nsec)) / 1) -
722  ((static_cast<long int>(time1.tv_sec) * 1000000000L
723  + static_cast<long int>(time1.tv_nsec)) / 1);
724  printf("debug: %d\n", stack2.top().xOffset);
725  printf("my time: %ld\n", diff);
726 
727 #endif
728 */
729  return 0;
730 }

Referenced by exec().

◆ testTextures()

int TestLauncher::testTextures ( )

Definition at line 324 of file testlauncher.cpp.

325 {
326  int maxSize = 512;
327  int nextSize = 512;
328  int sz = OpenGLImageHelper::getTextureSize() + 1;
329  if (sz > 16500)
330  sz = 16500;
331 
332  const uint32_t bytes1[] =
333  {
334  0xFFFF0000U, 0xFFFFFF00U, 0xFF00FFFFU, 0xFF0000FFU,
335  0xFF000000U, 0xFFFF00FFU
336  };
337 
338  const uint32_t bytes2[] =
339  {
340  0xFF0000FFU, 0xFF00FFFFU, 0xFFFFFF00U, 0xFFFF0000U,
341  0xFF000000U, 0xFFFF00FFU
342  };
343 
344  for (nextSize = 512; nextSize < sz; nextSize *= 2)
345  {
347  SDL_Surface *const surface = imageHelper->create32BitSurface(
348  nextSize, nextSize);
349  if (surface == nullptr)
350  break;
351  uint32_t *pixels = static_cast<uint32_t*>(surface->pixels);
352  for (int f = 0; f < 6; f ++)
353  pixels[f] = bytes1[f];
356  Image *const image = imageHelper->loadSurface(surface);
357  SDL_FreeSurface(surface);
358  if (image == nullptr)
359  break;
360 
361  if (graphicsManager.getLastErrorCached() != GL_NO_ERROR)
362  {
363  delete image;
364  break;
365  }
366  Image *const subImage = image->getSubImage(0, 0, 10, 10);
367  if (subImage == nullptr)
368  {
369  delete image;
370  break;
371  }
372  mainGraphics->drawImage(subImage, 0, 0);
374  mainGraphics->drawImage(subImage, 0, 0);
375  delete subImage;
376  SDL_Surface *const screen1 = screenshortHelper->getScreenshot();
377  SDL_Surface *const screen2 = ImageHelper::convertTo32Bit(screen1);
378  SDL_FreeSurface(screen1);
379  if (screen2 == nullptr)
380  break;
381  pixels = static_cast<uint32_t*>(screen2->pixels);
382  bool fail(false);
383  for (int f = 0; f < 6; f ++)
384  {
385  if (pixels[f] != bytes2[f])
386  {
387  fail = true;
388  break;
389  }
390  }
391 
392  SDL_FreeSurface(screen2);
393  if (fail)
394  break;
395 
396  maxSize = nextSize;
397  }
398 
399  file << mTest << std::endl;
400  file << maxSize << std::endl;
401  printf("OpenGL max size: %d\n", sz);
402  printf("actual max size: %d\n", maxSize);
403  return 0;
404 }
static GLenum getLastError()
static void resetCachedError()
static GLenum getLastErrorCached()
virtual void clearScreen() const
Definition: graphics.h:456
static SDL_Surface * convertTo32Bit(SDL_Surface *const tmpImage)
virtual Image * loadSurface(SDL_Surface *const)
Definition: imagehelper.h:73
static int getTextureSize()
virtual SDL_Surface * getScreenshot()=0
GraphicsManager graphicsManager
ScreenshotHelper * screenshortHelper

References Graphics::clearScreen(), ImageHelper::convertTo32Bit(), ImageHelper::create32BitSurface(), Graphics::drawImage(), file, GraphicsManager::getLastError(), GraphicsManager::getLastErrorCached(), ScreenshotHelper::getScreenshot(), OpenGLImageHelper::getTextureSize(), graphicsManager, imageHelper, ImageHelper::loadSurface(), mainGraphics, mTest, GraphicsManager::resetCachedError(), screenshortHelper, and Graphics::updateScreen().

Referenced by exec().

◆ testVideoDetection()

int TestLauncher::testVideoDetection ( )

Definition at line 814 of file testlauncher.cpp.

815 {
816  file << mTest << std::endl;
817  file << graphicsManager.detectGraphics() << std::endl;
818  return 0;
819 }

References GraphicsManager::detectGraphics(), file, graphicsManager, and mTest.

Referenced by exec().

Field Documentation

◆ file

std::ofstream TestLauncher::file
private

◆ mTest

std::string TestLauncher::mTest
private

Definition at line 87 of file testlauncher.h.

Referenced by exec(), PRAGMA45(), testFps2(), testFps3(), testTextures(), and testVideoDetection().


The documentation for this class was generated from the following files: