2018-07-07 16:55:24 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2018-07-25 19:39:04 +00:00
|
|
|
#include <QApplication>
|
|
|
|
#include <QQmlContext>
|
2018-07-07 16:55:24 +00:00
|
|
|
#include <QQmlEngine>
|
|
|
|
#include <QtQuickTest>
|
|
|
|
#include <QtTest>
|
|
|
|
|
2018-07-12 16:24:38 +00:00
|
|
|
#include "core/qt-gui.h"
|
2018-07-25 19:39:04 +00:00
|
|
|
#include "core/settings/qPref.h"
|
2018-07-07 16:55:24 +00:00
|
|
|
|
|
|
|
// 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
|
|
|
|
|
2018-07-05 20:34:04 +00:00
|
|
|
// check that qPref classes exists
|
|
|
|
qPref::instance();
|
|
|
|
qPrefDisplay::instance();
|
|
|
|
|
|
|
|
// prepare Qt application
|
|
|
|
new QApplication(argc, argv);
|
2018-07-07 16:55:24 +00:00
|
|
|
|
|
|
|
// 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++)
|
2018-07-25 19:39:04 +00:00
|
|
|
argv[i] = argv[i + 1];
|
2018-07-07 16:55:24 +00:00
|
|
|
argc--;
|
|
|
|
|
|
|
|
// Register types
|
2018-09-04 09:18:43 +00:00
|
|
|
qPref::instance()->registerQML(NULL);
|
2018-07-07 16:55:24 +00:00
|
|
|
|
2018-07-12 16:24:38 +00:00
|
|
|
// Run all tst_*.qml files
|
2018-07-07 16:55:24 +00:00
|
|
|
return quick_test_main(argc, argv, "TestQML", tst_dir);
|
|
|
|
#else
|
|
|
|
return 0;
|
|
|
|
#endif
|
|
|
|
}
|