diff options
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/testlauncher.cpp | 26 | ||||
-rw-r--r-- | src/test/testlauncher.h | 9 | ||||
-rw-r--r-- | src/test/testmain.cpp | 18 | ||||
-rw-r--r-- | src/test/testmain.h | 10 |
4 files changed, 33 insertions, 30 deletions
diff --git a/src/test/testlauncher.cpp b/src/test/testlauncher.cpp index 8538c3e65..c13f52ffb 100644 --- a/src/test/testlauncher.cpp +++ b/src/test/testlauncher.cpp @@ -75,12 +75,13 @@ int TestLauncher::exec() return -1; } -int TestLauncher::testBackend() +int TestLauncher::testBackend() const { - Image *img = Theme::getImageFromTheme("graphics/sprites/arrow_up.gif"); + const Image *const img = Theme::getImageFromTheme( + "graphics/sprites/arrow_up.gif"); if (!img) return 1; - int cnt = 100; + const int cnt = 100; for (int f = 0; f < cnt; f ++) { @@ -92,7 +93,7 @@ int TestLauncher::testBackend() return 0; } -int TestLauncher::testSound() +int TestLauncher::testSound() const { sound.playGuiSfx("system/newmessage.ogg"); sleep(1); @@ -103,11 +104,11 @@ int TestLauncher::testSound() return 0; } -int TestLauncher::testRescale() +int TestLauncher::testRescale() const { Wallpaper::loadWallpapers(); const std::string wallpaperName = Wallpaper::getWallpaper(800, 600); - volatile Image *img = Theme::getImageFromTheme(wallpaperName); + const volatile Image *const img = Theme::getImageFromTheme(wallpaperName); if (!img) return 1; @@ -132,7 +133,7 @@ int TestLauncher::testFps() img[4] = Theme::getImageFromTheme("graphics/images/login_wallpaper.png"); int idx = 0; - int cnt = 20; + const int cnt = 20; gettimeofday(&start, nullptr); for (int k = 0; k < cnt; k ++) @@ -155,7 +156,7 @@ int TestLauncher::testFps() } gettimeofday(&end, nullptr); - int tFps = calcFps(&start, &end, cnt); + const int tFps = calcFps(&start, &end, cnt); file << mTest << std::endl; file << tFps << std::endl; @@ -179,10 +180,10 @@ int TestLauncher::testInternal() 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(); + const int mem = mainGraphics->getMemoryUsage(); // int cnt = 5; - int cnt = 5000; + const int cnt = 5000; gettimeofday(&start, nullptr); for (int k = 0; k < cnt; k ++) @@ -204,7 +205,7 @@ int TestLauncher::testInternal() } gettimeofday(&end, nullptr); - int tFps = calcFps(&start, &end, cnt); + const int tFps = calcFps(&start, &end, cnt); file << mTest << std::endl; file << tFps << std::endl; file << mem << std::endl; @@ -221,7 +222,8 @@ int TestLauncher::testVideoDetection() return 0; } -int TestLauncher::calcFps(timeval *start, timeval *end, int calls) +int TestLauncher::calcFps(const timeval *const start, const timeval *const end, + const int calls) const { long mtime; long seconds; diff --git a/src/test/testlauncher.h b/src/test/testlauncher.h index f42e22644..da8534306 100644 --- a/src/test/testlauncher.h +++ b/src/test/testlauncher.h @@ -34,13 +34,14 @@ class TestLauncher int exec(); - int calcFps(timeval *start, timeval *end, int calls); + int calcFps(const timeval *const start, const timeval *const end, + const int calls) const; - int testBackend(); + int testBackend() const; - int testSound(); + int testSound() const; - int testRescale(); + int testRescale() const; int testFps(); diff --git a/src/test/testmain.cpp b/src/test/testmain.cpp index e5fac5100..c6023a53f 100644 --- a/src/test/testmain.cpp +++ b/src/test/testmain.cpp @@ -66,7 +66,7 @@ void TestMain::initConfig() mConfig.setValue("screenheight", 600); } -int TestMain::exec(bool testAudio) +int TestMain::exec(const bool testAudio) { initConfig(); int softwareTest = invokeSoftwareRenderTest("1"); @@ -197,8 +197,8 @@ int TestMain::exec(bool testAudio) return 0; } -void TestMain::writeConfig(int openGLMode, int rescale, - int sound, std::string info) +void TestMain::writeConfig(const int openGLMode, const int rescale, + const int sound, const std::string &info) { mConfig.init(Client::getConfigDirectory() + "/config.xml"); @@ -222,14 +222,14 @@ void TestMain::writeConfig(int openGLMode, int rescale, mConfig.write(); } -int TestMain::readValue2(int ver) +int TestMain::readValue2(const int ver) { - int def = readValue(ver, 0); + const int def = readValue(ver, 0); log->log("value for %d = %d", ver, def); return def; } -int TestMain::readValue(int ver, int def) +int TestMain::readValue(const int ver, int def) { std::string tmp; int var; @@ -257,14 +257,14 @@ int TestMain::invokeTest(std::string test) mConfig.setValue("opengl", 0); mConfig.write(); - int ret = execFileWait(fileName, fileName, "-t", test); + const int ret = execFileWait(fileName, fileName, "-t", test); return ret; } int TestMain::invokeTest4() { mConfig.setValue("sound", true); - int ret = invokeTest("4"); + const int ret = invokeTest("4"); log->log("4: %d", ret); return ret; @@ -274,7 +274,7 @@ int TestMain::invokeSoftwareRenderTest(std::string test) { mConfig.setValue("opengl", 0); mConfig.write(); - int ret = execFileWait(fileName, fileName, "-t", test, 30); + const int ret = execFileWait(fileName, fileName, "-t", test, 30); log->log("%s: %d", test.c_str(), ret); return ret; } diff --git a/src/test/testmain.h b/src/test/testmain.h index 281cdab3a..ddb10c7c4 100644 --- a/src/test/testmain.h +++ b/src/test/testmain.h @@ -31,9 +31,9 @@ class TestMain public: TestMain(); - int exec(bool testAudio = true); + int exec(const bool testAudio = true); - static int readValue(int ver, int def); + static int readValue(const int ver, int def); Configuration &getConfig() { return mConfig; } @@ -57,10 +57,10 @@ class TestMain void testsMain(); - void writeConfig(int openGLMode, int rescale, - int sound, std::string info); + void writeConfig(const int openGLMode, const int rescale, + const int sound, const std::string &info); - int readValue2(int ver); + int readValue2(const int ver); Logger *log; |