Use QTEST_GUILESS_MAIN where applicable

instead of QTEST_MAIN. Reduces the initialization that is done by the Qt
test applications, and can also reduce interference with normal OS
operations like the current window loosing focus.

Change-Id: If88f289281aa1c8703ac7d4dbe0799d067c16588
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
Eike Ziller
2022-06-10 12:21:30 +02:00
parent e2e5d67bc3
commit 737877984d
47 changed files with 47 additions and 50 deletions

View File

@@ -199,6 +199,6 @@ void tst_Aggregate::parentAggregate()
QCOMPARE(Aggregation::Aggregate::parentAggregate(component11), (Aggregation::Aggregate *)0);
}
QTEST_MAIN(tst_Aggregate)
QTEST_GUILESS_MAIN(tst_Aggregate)
#include "tst_aggregate.moc"

View File

@@ -577,6 +577,6 @@ void tst_Algorithm::take()
}
}
QTEST_MAIN(tst_Algorithm)
QTEST_GUILESS_MAIN(tst_Algorithm)
#include "tst_algorithm.moc"

View File

@@ -108,6 +108,6 @@ void tst_AvdManagerOutputParser::parse()
QCOMPARE(avdErrorPaths, errorPaths);
}
QTEST_MAIN(tst_AvdManagerOutputParser)
QTEST_GUILESS_MAIN(tst_AvdManagerOutputParser)
#include "tst_avdmanageroutputparser.moc"

View File

@@ -435,6 +435,6 @@ void tst_ChangeSet::conflicts()
}
}
QTEST_MAIN(tst_ChangeSet)
QTEST_GUILESS_MAIN(tst_ChangeSet)
#include "tst_changeset.moc"

View File

@@ -2221,7 +2221,7 @@ void tst_CodeFormatter::structuredBinding()
checkIndent(data);
}
QTEST_MAIN(tst_CodeFormatter)
QTEST_GUILESS_MAIN(tst_CodeFormatter)
#include "tst_codeformatter.moc"

View File

@@ -1154,5 +1154,5 @@ void tst_CppSelectionChanger::testWholeDocumentSelection()
QVERIFY(!result);
}
QTEST_MAIN(tst_CppSelectionChanger)
QTEST_GUILESS_MAIN(tst_CppSelectionChanger)
#include "tst_cppselectionchangertest.moc"

View File

@@ -98,5 +98,5 @@ void tst_FileIterationOrder::preferWithCommonPrefixToReferenceFilePath()
QCOMPARE(order.toStringList(), expected);
}
QTEST_MAIN(tst_FileIterationOrder)
QTEST_GUILESS_MAIN(tst_FileIterationOrder)
#include "tst_fileiterationorder.moc"

View File

@@ -279,5 +279,5 @@ void tst_Misc::doNotCrashForInvalidRawString()
doc->check();
}
QTEST_MAIN(tst_Misc)
QTEST_GUILESS_MAIN(tst_Misc)
#include "tst_misc.moc"

View File

@@ -1041,5 +1041,5 @@ void tst_Semantic::enum_constantValueNegative()
testEnumaratorDeclarator(e, 3, "1");
}
QTEST_MAIN(tst_Semantic)
QTEST_GUILESS_MAIN(tst_Semantic)
#include "tst_semantic.moc"

View File

@@ -795,8 +795,7 @@ void tst_Differ::cleanupSemanticsLossless()
QCOMPARE(result, expected);
}
QTEST_MAIN(tst_Differ)
QTEST_GUILESS_MAIN(tst_Differ)
#include "tst_differ.moc"

View File

@@ -349,6 +349,6 @@ void tst_Environment::find()
}
QTEST_MAIN(tst_Environment)
QTEST_GUILESS_MAIN(tst_Environment)
#include "tst_environment.moc"

View File

@@ -212,7 +212,7 @@ void tst_PluginManager::correctPlugins1()
QVERIFY(plugin3running);
}
QTEST_MAIN(tst_PluginManager)
QTEST_GUILESS_MAIN(tst_PluginManager)
#include "tst_pluginmanager.moc"

View File

@@ -338,6 +338,6 @@ void tst_PluginSpec::initializeExtensions()
QVERIFY(isExtensionsInitialized);
}
QTEST_MAIN(tst_PluginSpec)
QTEST_GUILESS_MAIN(tst_PluginSpec)
#include "tst_pluginspec.moc"

View File

@@ -146,6 +146,6 @@ void tst_FileSearch::matchCaseReplacement()
QCOMPARE(Utils::matchCaseReplacement("pReFiXTeStPaDSuFfIx", "prefixfoobarsuffix"), QString("pReFiXfoobarSuFfIx")); //mixed case, use replacement as specified
}
QTEST_MAIN(tst_FileSearch)
QTEST_GUILESS_MAIN(tst_FileSearch)
#include "tst_filesearch.moc"

View File

@@ -2527,6 +2527,6 @@ void tst_Json::removeNonLatinKey()
QVERIFY(restoredObject.contains(nonLatinKeyName));
}
QTEST_MAIN(tst_Json)
QTEST_GUILESS_MAIN(tst_Json)
#include "tst_json.moc"

View File

@@ -596,6 +596,6 @@ void tst_LanguageServerProtocol::range()
QCOMPARE(r2.contains(r1), r2Containsr1);
}
QTEST_MAIN(tst_LanguageServerProtocol)
QTEST_GUILESS_MAIN(tst_LanguageServerProtocol)
#include "tst_languageserverprotocol.moc"

View File

@@ -363,6 +363,6 @@ void tst_MapReduce::moveOnlyType()
#endif
QTEST_MAIN(tst_MapReduce)
QTEST_GUILESS_MAIN(tst_MapReduce)
#include "tst_mapreduce.moc"

View File

@@ -319,6 +319,6 @@ void tst_PointerAlgorithm::takeOrDefault()
}
}
QTEST_MAIN(tst_PointerAlgorithm)
QTEST_GUILESS_MAIN(tst_PointerAlgorithm)
#include "tst_pointeralgorithm.moc"

View File

@@ -744,6 +744,5 @@ void tst_ProFileWriter::removeFiles()
QCOMPARE(lines.join(QLatin1Char('\n')), output);
}
QTEST_MAIN(tst_ProFileWriter)
QTEST_GUILESS_MAIN(tst_ProFileWriter)
#include "tst_profilewriter.moc"

View File

@@ -225,6 +225,6 @@ void tst_Check::test()
}
}
QTEST_MAIN(tst_Check);
QTEST_GUILESS_MAIN(tst_Check);
#include "tst_check.moc"

View File

@@ -181,6 +181,6 @@ void tst_Dependencies::test()
QCOMPARE(semanticInfo.staticAnalysisMessages.length(), nExpectedStaticMessages);
}
QTEST_MAIN(tst_Dependencies)
QTEST_GUILESS_MAIN(tst_Dependencies)
#include "tst_dependencies.moc"

View File

@@ -207,6 +207,6 @@ void tst_Ecmascript::test()
QCOMPARE(semanticInfo.staticAnalysisMessages.length(), nExpectedStaticMessages);
}
QTEST_MAIN(tst_Ecmascript)
QTEST_GUILESS_MAIN(tst_Ecmascript)
#include "tst_ecmascript7.moc"

View File

@@ -414,7 +414,7 @@ int main(int argc, char *argv[])
#else
QTEST_MAIN(tst_ImportCheck)
QTEST_GUILESS_MAIN(tst_ImportCheck)
#endif // MANUAL_IMPORT_SCANNER

View File

@@ -363,7 +363,7 @@ int main(int , const char *[])
#else
QTEST_MAIN(tst_TestTrie);
QTEST_GUILESS_MAIN(tst_TestTrie);
//#include "moc_tst_testtrie.cpp"

View File

@@ -1586,7 +1586,7 @@ void tst_QMLCodeFormatter::bug3()
checkIndent(data);
}
QTEST_MAIN(tst_QMLCodeFormatter)
QTEST_GUILESS_MAIN(tst_QMLCodeFormatter)
#include "tst_qmlcodeformatter.moc"

View File

@@ -248,6 +248,6 @@ void tst_SimpleReader::testBug01()
QCOMPARE(rootNode->propertyNames().count(), 1);
}
QTEST_MAIN(tst_SimpleReader);
QTEST_GUILESS_MAIN(tst_SimpleReader);
#include "tst_qmljssimplereader.moc"

View File

@@ -253,5 +253,5 @@ void tst_FileFormat::testMainFile()
delete project;
}
QTEST_MAIN(tst_FileFormat);
QTEST_GUILESS_MAIN(tst_FileFormat);
#include "tst_fileformat.moc"

View File

@@ -116,6 +116,6 @@ void tst_Reformatter::test()
QCOMPARE(sourceLines.size(), newLines.size());
}
QTEST_MAIN(tst_Reformatter);
QTEST_GUILESS_MAIN(tst_Reformatter);
#include "tst_reformatter.moc"

View File

@@ -631,6 +631,6 @@ void tst_RunExtensions::onResultReady()
}
}
QTEST_MAIN(tst_RunExtensions)
QTEST_GUILESS_MAIN(tst_RunExtensions)
#include "tst_runextensions.moc"

View File

@@ -78,6 +78,6 @@ private slots:
void test_RmToolChainOperation() { RmToolChainOperation::unittest(); }
};
QTEST_MAIN(SdktoolTest)
QTEST_GUILESS_MAIN(SdktoolTest)
#include "tst_sdktool.moc"

View File

@@ -132,5 +132,5 @@ void tst_ToolChainCache::insertOneTwoOneThree()
QVERIFY(!cache.check({"other"}));
}
QTEST_MAIN(tst_ToolChainCache)
QTEST_GUILESS_MAIN(tst_ToolChainCache)
#include "tst_toolchaincache.moc"

View File

@@ -152,6 +152,6 @@ void tst_TimelineAbstractRenderer::dirty()
QVERIFY(!renderer.rowHeightsDirty());
}
QTEST_MAIN(tst_TimelineAbstractRenderer)
QTEST_GUILESS_MAIN(tst_TimelineAbstractRenderer)
#include "tst_timelineabstractrenderer.moc"

View File

@@ -483,6 +483,6 @@ void tst_TimelineModel::parentingOfEqualStarts()
QCOMPARE(dummy.lastIndex(2), 1);
}
QTEST_MAIN(tst_TimelineModel)
QTEST_GUILESS_MAIN(tst_TimelineModel)
#include "tst_timelinemodel.moc"

View File

@@ -162,6 +162,6 @@ void tst_TimelineModelAggregator::prevNext()
}
}
QTEST_MAIN(tst_TimelineModelAggregator)
QTEST_GUILESS_MAIN(tst_TimelineModelAggregator)
#include "tst_timelinemodelaggregator.moc"

View File

@@ -193,6 +193,6 @@ void tst_TimelineNotesModel::modify()
}
QTEST_MAIN(tst_TimelineNotesModel)
QTEST_GUILESS_MAIN(tst_TimelineNotesModel)
#include "tst_timelinenotesmodel.moc"

View File

@@ -75,6 +75,6 @@ void tst_TimelineOverviewRenderer::updatePaintNode()
delete node;
}
QTEST_MAIN(tst_TimelineOverviewRenderer)
QTEST_GUILESS_MAIN(tst_TimelineOverviewRenderer)
#include "tst_timelineoverviewrenderer.moc"

View File

@@ -86,7 +86,7 @@ void tst_TimelineRenderPass::emptyState()
QVERIFY(state.expandedRows().isEmpty());
}
QTEST_MAIN(tst_TimelineRenderPass)
QTEST_GUILESS_MAIN(tst_TimelineRenderPass)
#include "tst_timelinerenderpass.moc"

View File

@@ -171,7 +171,7 @@ void tst_TimelineRenderState::assembleNodeTree()
delete node;
}
QTEST_MAIN(tst_TimelineRenderState)
QTEST_GUILESS_MAIN(tst_TimelineRenderState)
#include "tst_timelinerenderstate.moc"

View File

@@ -217,6 +217,6 @@ void tst_TimelineZoomControl::selection()
QCOMPARE(spy.count(), 2);
}
QTEST_MAIN(tst_TimelineZoomControl)
QTEST_GUILESS_MAIN(tst_TimelineZoomControl)
#include "tst_timelinezoomcontrol.moc"

View File

@@ -527,5 +527,5 @@ void tst_fileutils::asyncLocalCopy()
QVERIFY(spy.count() == 1 || spy.wait(3000));
}
QTEST_MAIN(tst_fileutils)
QTEST_GUILESS_MAIN(tst_fileutils)
#include "tst_fileutils.moc"

View File

@@ -204,6 +204,6 @@ void tst_IndexedContainerProxyConstIterator::testIteration()
QCOMPARE(boolsCopy, bools);
}
QTEST_MAIN(tst_IndexedContainerProxyConstIterator)
QTEST_GUILESS_MAIN(tst_IndexedContainerProxyConstIterator)
#include "tst_indexedcontainerproxyconstiterator.moc"

View File

@@ -101,6 +101,6 @@ void PersistentSettingsTest::tst_readwrite()
tmpDir.setAutoRemove(!QTest::currentTestFailed());
}
QTEST_MAIN(PersistentSettingsTest)
QTEST_GUILESS_MAIN(PersistentSettingsTest)
#include "tst_persistentsettings.moc"

View File

@@ -1352,6 +1352,6 @@ void tst_QtcProcess::quitBlockingProcess()
}
}
QTEST_MAIN(tst_QtcProcess)
QTEST_GUILESS_MAIN(tst_QtcProcess)
#include "tst_qtcprocess.moc"

View File

@@ -752,6 +752,6 @@ void tst_SettingsAccessor::loadSettings_pickBest()
QCOMPARE(read.size(), data.size() + 2);
}
QTEST_MAIN(tst_SettingsAccessor)
QTEST_GUILESS_MAIN(tst_SettingsAccessor)
#include "tst_settings.moc"

View File

@@ -267,6 +267,6 @@ void tst_StringUtils::testParseUsedPortFromNetstatOutput_data()
QTest::newRow("QnxA") << "tcp6 0 0 *.22 *.* LISTEN " << 22;
}
QTEST_MAIN(tst_StringUtils)
QTEST_GUILESS_MAIN(tst_StringUtils)
#include "tst_stringutils.moc"

View File

@@ -99,7 +99,6 @@ void tst_TemplateEngine::testTemplateEngine()
QCOMPARE(errorMessage, expectedErrorMessage);
}
QTEST_MAIN(tst_TemplateEngine)
QTEST_GUILESS_MAIN(tst_TemplateEngine)
#include "tst_templateengine.moc"

View File

@@ -130,6 +130,6 @@ void tst_TreeModel::testTypes()
static_assert(std::is_same<Internal::SelectType<3, A, B, C>::Type, TreeItem>::value, "");
}
QTEST_MAIN(tst_TreeModel)
QTEST_GUILESS_MAIN(tst_TreeModel)
#include "tst_treemodel.moc"