blob: 10823e82d30d8c313d261e16baf0711591d9d988 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
#include <qtest.h>
#include <QmlView>
#include <QApplication>
#include <QFxTestView>
#include <QFile>
static QString testdir;
class tst_visual : public QObject
{
Q_OBJECT
public:
tst_visual() {}
private slots:
void visual();
};
#ifdef QT_OPENGL_ES
#define RASTER_TESTDIR "/data/opengl"
#else
#define RASTER_TESTDIR "/data/raster"
#endif
void tst_visual::visual()
{
QVERIFY(!testdir.isEmpty());
QString filename = QLatin1String(QT_TEST_SOURCE_DIR) + "/" + testdir + "/test";
qWarning() << "Using config:" << filename;
QFile configFile(filename);
QVERIFY(configFile.open(QIODevice::ReadOnly));
QString testfile = configFile.readLine().trimmed();
QVERIFY(!testfile.isEmpty());
if(testfile.startsWith("QTDIR/")) {
testfile.remove(0, 6);
testfile.prepend(QLatin1String(QT_TEST_SOURCE_DIR) + "/../../../../");
} else {
testfile.prepend(QLatin1String(QT_TEST_SOURCE_DIR) + "/" + testdir + "/");
}
QFxTestView *view = new QFxTestView(testfile, QLatin1String(QT_TEST_SOURCE_DIR) + "/" + testdir + RASTER_TESTDIR);
QVERIFY(view->runTest());
}
#include <QtTest/qtest_gui.h>
int main(int argc, char *argv[])
{
int newArgc = 1;
char **newArgv = new char*[argc];
newArgv[0] = argv[0];
QApplication app(newArgc, newArgv);
for(int ii = 1; ii < argc; ii++) {
if(QLatin1String(argv[ii]) == "-testdir" && (ii + 1) < argc) {
testdir = QLatin1String(argv[ii + 1]);
ii++;
} else {
newArgv[newArgc++] = argv[ii];
}
}
tst_visual tc;
int rv = QTest::qExec(&tc, newArgc, newArgv);
delete [] newArgv;
return rv;
}
#include "tst_visual.moc"
|