summaryrefslogtreecommitdiff
path: root/src/test/testlauncher.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-04-26 21:56:58 +0300
committerAndrei Karas <akaras@inbox.ru>2012-04-26 21:56:58 +0300
commit129b19f69fbbdcd896150aa8faa7f20254169c0c (patch)
treedd15d89fa3d6422139a0ba41a22f6f4db3f8b5ee /src/test/testlauncher.cpp
parent5f5ea46910feefc212a98ea715b0d4b0d9d4bc23 (diff)
downloadplus-129b19f69fbbdcd896150aa8faa7f20254169c0c.tar.gz
plus-129b19f69fbbdcd896150aa8faa7f20254169c0c.tar.bz2
plus-129b19f69fbbdcd896150aa8faa7f20254169c0c.tar.xz
plus-129b19f69fbbdcd896150aa8faa7f20254169c0c.zip
Add to log draw backend name.
Add ability to get free video memory (fast openg with NVIDIA). Add test with id 100 for long perfomance testing.
Diffstat (limited to 'src/test/testlauncher.cpp')
-rw-r--r--src/test/testlauncher.cpp50
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;