diff options
Diffstat (limited to 'src/test/testlauncher.cpp')
-rw-r--r-- | src/test/testlauncher.cpp | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/test/testlauncher.cpp b/src/test/testlauncher.cpp index d3caa8938..55273ab41 100644 --- a/src/test/testlauncher.cpp +++ b/src/test/testlauncher.cpp @@ -69,6 +69,8 @@ int TestLauncher::exec() return testRescale(); else if (mTest == "8" || mTest == "9" || mTest == "10") return testFps(); + else if (mTest == "100") + return testInternal(); return -1; } @@ -155,6 +157,54 @@ int TestLauncher::testFps() return 0; } +int TestLauncher::testInternal() +{ + timeval start; + timeval end; + + Wallpaper::loadWallpapers(); + Wallpaper::getWallpaper(800, 600); + Image *img[4]; + + img[0] = Theme::getImageFromTheme("graphics/sprites/manaplus_emotions.png"); + img[1] = Theme::getImageFromTheme("graphics/sprites/manaplus_emotions.png"); + img[2] = Theme::getImageFromTheme("graphics/sprites/arrow_left.gif"); + img[3] = Theme::getImageFromTheme("graphics/sprites/arrow_right.gif"); + int idx = 0; + int mem = mainGraphics->getMemoryUsage(); + +// int cnt = 5; + int cnt = 5000; + + gettimeofday(&start, nullptr); + for (int k = 0; k < cnt; k ++) + { + for (int x = 0; x < 800; x += 20) + { + for (int y = 0; y < 600; y += 25) + { + mainGraphics->drawImage(img[idx], x, y); + mainGraphics->drawImage(img[idx], x + 1, y); + mainGraphics->drawImage(img[idx], x, y + 5); + + idx ++; + if (idx > 3) + idx = 0; + } + } + mainGraphics->updateScreen(); + } + + gettimeofday(&end, nullptr); + int tFps = calcFps(&start, &end, cnt); + file << mTest << std::endl; + file << tFps << std::endl; + file << mem << std::endl; + + sleep(1); + return 0; +} + int TestLauncher::calcFps(timeval *start, timeval *end, int calls) { long mtime; |