summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-05-11 21:55:28 +0300
committerAndrei Karas <akaras@inbox.ru>2012-05-18 01:37:32 +0300
commitf35d6cd35d92ad16a55bf49f61f19153949497c0 (patch)
treeb962c63304767edb38433ae9f1956377c8638f90 /src/test
parenta736a01786b9ad6df5dba9955fcac96300c537a2 (diff)
downloadmv-f35d6cd35d92ad16a55bf49f61f19153949497c0.tar.gz
mv-f35d6cd35d92ad16a55bf49f61f19153949497c0.tar.bz2
mv-f35d6cd35d92ad16a55bf49f61f19153949497c0.tar.xz
mv-f35d6cd35d92ad16a55bf49f61f19153949497c0.zip
Improve auto detection for best graphics mode.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/testlauncher.cpp10
-rw-r--r--src/test/testlauncher.h2
-rw-r--r--src/test/testmain.cpp20
3 files changed, 29 insertions, 3 deletions
diff --git a/src/test/testlauncher.cpp b/src/test/testlauncher.cpp
index 6818c0b3c..b3fa729a0 100644
--- a/src/test/testlauncher.cpp
+++ b/src/test/testlauncher.cpp
@@ -23,6 +23,7 @@
#include "client.h"
#include "configuration.h"
#include "graphics.h"
+#include "graphicsmanager.h"
#include "localconsts.h"
#include "logger.h"
#include "sound.h"
@@ -69,6 +70,8 @@ int TestLauncher::exec()
return testRescale();
else if (mTest == "8" || mTest == "9" || mTest == "10")
return testFps();
+ else if (mTest == "99")
+ return testVideoDetection();
else if (mTest == "100")
return testInternal();
@@ -207,6 +210,13 @@ int TestLauncher::testInternal()
return 0;
}
+int TestLauncher::testVideoDetection()
+{
+ graphicsManager.detectGraphics();
+ file << mTest << std::endl;
+ file << config.getIntValue("opengl") << std::endl;
+}
+
int TestLauncher::calcFps(timeval *start, timeval *end, int calls)
{
long mtime;
diff --git a/src/test/testlauncher.h b/src/test/testlauncher.h
index 1f86dc396..5ca42eae7 100644
--- a/src/test/testlauncher.h
+++ b/src/test/testlauncher.h
@@ -47,6 +47,8 @@ class TestLauncher
int testInternal();
+ int testVideoDetection();
+
private:
std::string mTest;
diff --git a/src/test/testmain.cpp b/src/test/testmain.cpp
index eb24a2c75..8ec48e6e2 100644
--- a/src/test/testmain.cpp
+++ b/src/test/testmain.cpp
@@ -78,9 +78,10 @@ int TestMain::exec()
{
initConfig();
int softwareTest = invokeSoftwareRenderTest("1");
- int fastOpenGLTest = invokeFastOpenGLRenderTest("2");
- int safeOpenGLTest = invokeSafeOpenGLRenderTest("3");
- int soundTest = invokeTest4();
+ int fastOpenGLTest = -1;
+ int safeOpenGLTest = -1;
+ int videoDetectTest = -1;
+ int soundTest = -1;
int rescaleTest[3];
int softFps = 0;
int fastOpenGLFps = 0;
@@ -88,11 +89,20 @@ int TestMain::exec()
int openGLMode = 0;
int maxFps = 0;
+ int detectMode = 0;
rescaleTest[0] = -1;
rescaleTest[1] = -1;
rescaleTest[2] = -1;
std::string info;
+ videoDetectTest = invokeTest("99");
+ if (!videoDetectTest)
+ detectMode = readValue(99);
+
+ fastOpenGLTest = invokeFastOpenGLRenderTest("2");
+ safeOpenGLTest = invokeSafeOpenGLRenderTest("3");
+ soundTest = invokeTest4();
+
info += strprintf("%d.%d,%d,%d.", soundTest, softwareTest,
fastOpenGLTest, safeOpenGLTest);
@@ -184,6 +194,10 @@ int TestMain::exec()
maxFps = safeOpenGLFps;
}
+ // if OpenGL implimentation is not good, disable it.
+ if (!detectMode)
+ openGLMode = 0;
+
writeConfig(openGLMode, rescaleTest[openGLMode], soundTest, info);
return 0;
}