aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmltest
diff options
context:
space:
mode:
Diffstat (limited to 'src/qmltest')
-rw-r--r--src/qmltest/quicktest.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/qmltest/quicktest.cpp b/src/qmltest/quicktest.cpp
index 3cd1694dd0..463833a100 100644
--- a/src/qmltest/quicktest.cpp
+++ b/src/qmltest/quicktest.cpp
@@ -62,6 +62,7 @@
#include <QtGui/QGuiApplication>
#include <QtCore/QTranslator>
#include <QtTest/QSignalSpy>
+#include <QtQml/QQmlFileSelector>
#include <private/qqmlcomponent_p.h>
@@ -354,10 +355,12 @@ int quick_test_main(int argc, char **argv, const char *name, const char *sourceD
// -plugins dir Specify a directory where to search for plugins.
// -input dir Specify the input directory for test cases.
// -translation file Specify the translation file.
+ // -file-selector Specify a file selector
QStringList imports;
QStringList pluginPaths;
QString testPath;
QString translationFile;
+ QStringList fileSelectors;
int index = 1;
QScopedArrayPointer<char *> testArgV(new char *[argc + 1]);
testArgV[0] = argv[0];
@@ -382,6 +385,9 @@ int quick_test_main(int argc, char **argv, const char *name, const char *sourceD
} else if (strcmp(argv[index], "-translation") == 0 && (index + 1) < argc) {
translationFile = stripQuotes(QString::fromLocal8Bit(argv[index + 1]));
index += 2;
+ } else if (strcmp(argv[index], "-file-selector") == 0 && (index + 1) < argc) {
+ fileSelectors += stripQuotes(QString::fromLocal8Bit(argv[index + 1]));
+ index += 2;
} else {
testArgV[testArgC++] = argv[index++];
}
@@ -474,6 +480,11 @@ int quick_test_main(int argc, char **argv, const char *name, const char *sourceD
for (const QString &path : qAsConst(pluginPaths))
engine.addPluginPath(path);
+ if (!fileSelectors.isEmpty()) {
+ QQmlFileSelector* const qmlFileSelector = new QQmlFileSelector(&engine, &engine);
+ qmlFileSelector->setExtraSelectors(fileSelectors);
+ }
+
TestCaseCollector testCaseCollector(fi, &engine);
if (!testCaseCollector.errors().isEmpty()) {
for (const QQmlError &error : testCaseCollector.errors())