QtQuick test: Do not complain about Qt specific arguments
Commit 1ca5e82ccc
caused a regression for Qt arguments like
-qmlsjsdebugger=xxx . These are automatically removed from argv by
QCoreApplication, but since we copied argv before instantiating
QCoreApplication this didn't have any effect.
Fix this by moving Q[Core]Application instantiation again before
the parsing and copying of testlib-specific arguments.
Task-number: QTBUG-37793
Change-Id: Ief41640b6cf3251f700a5d24d2e1141233a3888f
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Liang Qi <liang.qi@digia.com>
This commit is contained in:
parent
8d172f1f38
commit
cf06b028f7
|
@ -198,6 +198,29 @@ bool qWaitForSignal(QObject *obj, const char* signal, int timeout = 5000)
|
|||
|
||||
int quick_test_main(int argc, char **argv, const char *name, const char *sourceDir)
|
||||
{
|
||||
// Peek at arguments to check for '-widgets' argument
|
||||
#ifdef QT_QMLTEST_WITH_WIDGETS
|
||||
bool withWidgets = false;
|
||||
for (int index = 1; index < argc; ++index) {
|
||||
if (strcmp(argv[index], "-widgets") == 0) {
|
||||
withWidgets = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
QCoreApplication *app = 0;
|
||||
if (!QCoreApplication::instance()) {
|
||||
#ifdef QT_QMLTEST_WITH_WIDGETS
|
||||
if (withWidgets)
|
||||
app = new QApplication(argc, argv);
|
||||
else
|
||||
#endif
|
||||
{
|
||||
app = new QGuiApplication(argc, argv);
|
||||
}
|
||||
}
|
||||
|
||||
// Look for QML-specific command-line options.
|
||||
// -import dir Specify an import directory.
|
||||
// -input dir Specify the input directory for test cases.
|
||||
|
@ -205,9 +228,6 @@ int quick_test_main(int argc, char **argv, const char *name, const char *sourceD
|
|||
QStringList imports;
|
||||
QString testPath;
|
||||
QString translationFile;
|
||||
#ifdef QT_QMLTEST_WITH_WIDGETS
|
||||
bool withWidgets = false;
|
||||
#endif
|
||||
int index = 1;
|
||||
QScopedArrayPointer<char *> testArgV(new char *[argc + 1]);
|
||||
testArgV[0] = argv[0];
|
||||
|
@ -235,20 +255,6 @@ int quick_test_main(int argc, char **argv, const char *name, const char *sourceD
|
|||
}
|
||||
testArgV[testArgC] = 0;
|
||||
|
||||
QCoreApplication* app = 0;
|
||||
if (!QCoreApplication::instance()) {
|
||||
#ifdef QT_QMLTEST_WITH_WIDGETS
|
||||
if (withWidgets)
|
||||
app = new QApplication(argc, argv);
|
||||
else
|
||||
#endif
|
||||
{
|
||||
app = new QGuiApplication(argc, argv);
|
||||
}
|
||||
}
|
||||
|
||||
// Parse the command-line arguments.
|
||||
|
||||
// Setting currentAppname and currentTestObjectName (via setProgramName) are needed
|
||||
// for the code coverage analysis. Must be done before parseArgs is called.
|
||||
QuickTestResult::setCurrentAppname(argv[0]);
|
||||
|
|
Loading…
Reference in New Issue