summaryrefslogtreecommitdiffstats
path: root/tests/testqml.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2018-07-14 08:10:35 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-07-14 08:12:27 -0700
commitcf329ca13100f3b8947c33c8e0a7f4a9cedd5e2b (patch)
treeac321aa1687b73d769abc15b097a191fa15c110e /tests/testqml.cpp
parent52cc51f9061f578932ede736ed591b36e69b8695 (diff)
parentd7fed0bcb76cc1742f73577b70df048032f70a61 (diff)
downloadsubsurface-cf329ca13100f3b8947c33c8e0a7f4a9cedd5e2b.tar.gz
Merge branch 'qml_test' of https://github.com/janiversen/subsurface
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'tests/testqml.cpp')
-rw-r--r--tests/testqml.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/testqml.cpp b/tests/testqml.cpp
new file mode 100644
index 000000000..8ba04da90
--- /dev/null
+++ b/tests/testqml.cpp
@@ -0,0 +1,43 @@
+// SPDX-License-Identifier: GPL-2.0
+#include <QQmlEngine>
+#include <QtQuickTest>
+#include <QtTest>
+#include <QQmlEngine>
+#include <QQmlContext>
+
+#include "core/settings/qPref.h"
+#include "core/qt-gui.h"
+
+// this is the content of QUICK_TEST_MAIN amended with
+// registration of ssrf classes
+int main(int argc, char **argv)
+{
+ // QML testing is not supported in the oldest Qt versions we support
+ // if running with Qt version less than 5.10 then skip test
+#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
+ QTEST_ADD_GPU_BLACKLIST_SUPPORT
+ QTEST_SET_MAIN_SOURCE_PATH
+
+ // check that qPref exists
+ new qPref;
+
+ // check that we have a directory
+ if (argc < 2) {
+ qDebug() << "ERROR: missing tst_* directory";
+ return -1;
+ }
+ // save tst_dir and pass rest to Qt
+ const char *tst_dir = argv[1];
+ for (int i = 1; i < argc; i++)
+ argv[i] = argv[i+1];
+ argc--;
+
+ // Register types
+ register_qml_types();
+
+ // Run all tst_*.qml files
+ return quick_test_main(argc, argv, "TestQML", tst_dir);
+#else
+ return 0;
+#endif
+}