Fix execution of scenario

There are different ways of having a settingspath for QC. If the
settingspath is not provided for starting QC we may use the global
settings or a temporarily created settings folder.
To correctly run the test scenario from inside a plugin unit test
we need to have the same environment and settings.

Change-Id: I5dcc61e162258a0af8d3c8df2e63255d0e35f464
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
Christian Stenger
2021-06-09 09:22:27 +02:00
parent fed5a44be1
commit 093f3479ce
3 changed files with 10 additions and 2 deletions

View File

@@ -310,7 +310,10 @@ void AutoTestUnitTests::testCodeParserBoostTest_data()
void AutoTestUnitTests::testStringTable()
{
const PluginManager::ProcessData data = PluginManager::creatorProcessData();
QCOMPARE(QProcess::execute(data.m_executable, data.m_args + QStringList({ "-scenario", "TestStringTable" })), 0);
QStringList additionalArgs{ "-scenario", "TestStringTable" };
if (!data.m_args.contains("-settingspath") && !data.m_settingsPath.isEmpty())
additionalArgs << "-settingspath" << data.m_settingsPath;
QCOMPARE(QProcess::execute(data.m_executable, data.m_args + additionalArgs), 0);
}
} // namespace Internal