summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/visual/tst_visual.cpp
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2009-04-22 04:47:24 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2009-04-22 04:47:24 (GMT)
commit2366667fc97eb6a56203b2dd7dac776ff4164abd (patch)
treeb2acb6cc6bfe475d7e619e4788973b61fff775e0 /tests/auto/declarative/visual/tst_visual.cpp
parent2c762f3b8b284a7c6dc0c499b7052013bad5b707 (diff)
downloadQt-2366667fc97eb6a56203b2dd7dac776ff4164abd.zip
Qt-2366667fc97eb6a56203b2dd7dac776ff4164abd.tar.gz
Qt-2366667fc97eb6a56203b2dd7dac776ff4164abd.tar.bz2
Initial import of kinetic-dui branch from the old kinetic
Diffstat (limited to 'tests/auto/declarative/visual/tst_visual.cpp')
-rw-r--r--tests/auto/declarative/visual/tst_visual.cpp72
1 files changed, 72 insertions, 0 deletions
diff --git a/tests/auto/declarative/visual/tst_visual.cpp b/tests/auto/declarative/visual/tst_visual.cpp
new file mode 100644
index 0000000..f077994
--- /dev/null
+++ b/tests/auto/declarative/visual/tst_visual.cpp
@@ -0,0 +1,72 @@
+#include <qtest.h>
+#include <QFxView>
+#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());
+
+ QFile configFile(QLatin1String(QT_TEST_SOURCE_DIR) + "/" + testdir + "/test");
+ 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"