diff options
author | hjk <hjk@qt.io> | 2023-01-12 15:30:01 +0100 |
---|---|---|
committer | hjk <hjk@qt.io> | 2023-01-13 10:46:13 +0000 |
commit | 33cdb052ba865287c26108d9b126ab43f57a8631 (patch) | |
tree | 0c9babb1344f4a55d90e5f2a9efb9d07636097a8 /src/plugins/autotest | |
parent | 2ce413112b00fb29c979f1ebfaf55c690330ebda (diff) | |
download | qt-creator-33cdb052ba865287c26108d9b126ab43f57a8631.tar.gz |
FilePathify some testing code
Change-Id: I3739a6eb3c2172078e9519e8186daf94ec74d99a
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Diffstat (limited to 'src/plugins/autotest')
-rw-r--r-- | src/plugins/autotest/autotestunittests.cpp | 39 | ||||
-rw-r--r-- | src/plugins/autotest/loadprojectscenario.cpp | 2 |
2 files changed, 22 insertions, 19 deletions
diff --git a/src/plugins/autotest/autotestunittests.cpp b/src/plugins/autotest/autotestunittests.cpp index 973194255f..6a0c8f1834 100644 --- a/src/plugins/autotest/autotestunittests.cpp +++ b/src/plugins/autotest/autotestunittests.cpp @@ -81,7 +81,7 @@ void AutoTestUnitTests::cleanupTestCase() void AutoTestUnitTests::testCodeParser() { - QFETCH(QString, projectFilePath); + QFETCH(FilePath, projectFilePath); QFETCH(int, expectedAutoTestsCount); QFETCH(int, expectedNamedQuickTestsCount); QFETCH(int, expectedUnnamedQuickTestsCount); @@ -106,30 +106,30 @@ void AutoTestUnitTests::testCodeParser() void AutoTestUnitTests::testCodeParser_data() { - QTest::addColumn<QString>("projectFilePath"); + QTest::addColumn<FilePath>("projectFilePath"); QTest::addColumn<int>("expectedAutoTestsCount"); QTest::addColumn<int>("expectedNamedQuickTestsCount"); QTest::addColumn<int>("expectedUnnamedQuickTestsCount"); QTest::addColumn<int>("expectedDataTagsCount"); - + const FilePath base = m_tmpDir->filePath(); QTest::newRow("plainAutoTest") - << QString(m_tmpDir->path() + "/plain/plain.pro") + << base / "plain/plain.pro" << 1 << 0 << 0 << 0; QTest::newRow("mixedAutoTestAndQuickTests") - << QString(m_tmpDir->path() + "/mixed_atp/mixed_atp.pro") + << base / "mixed_atp/mixed_atp.pro" << 4 << 10 << 5 << 10; QTest::newRow("plainAutoTestQbs") - << QString(m_tmpDir->path() + "/plain/plain.qbs") + << base / "plain/plain.qbs" << 1 << 0 << 0 << 0; QTest::newRow("mixedAutoTestAndQuickTestsQbs") - << QString(m_tmpDir->path() + "/mixed_atp/mixed_atp.qbs") + << base / "mixed_atp/mixed_atp.qbs" << 4 << 10 << 5 << 10; } void AutoTestUnitTests::testCodeParserSwitchStartup() { - QFETCH(QStringList, projectFilePaths); + QFETCH(FilePaths, projectFilePaths); QFETCH(QList<int>, expectedAutoTestsCount); QFETCH(QList<int>, expectedNamedQuickTestsCount); QFETCH(QList<int>, expectedUnnamedQuickTestsCount); @@ -157,16 +157,19 @@ void AutoTestUnitTests::testCodeParserSwitchStartup() void AutoTestUnitTests::testCodeParserSwitchStartup_data() { - QTest::addColumn<QStringList>("projectFilePaths"); + QTest::addColumn<FilePaths>("projectFilePaths"); QTest::addColumn<QList<int> >("expectedAutoTestsCount"); QTest::addColumn<QList<int> >("expectedNamedQuickTestsCount"); QTest::addColumn<QList<int> >("expectedUnnamedQuickTestsCount"); QTest::addColumn<QList<int> >("expectedDataTagsCount"); - QStringList projects = QStringList({m_tmpDir->path() + "/plain/plain.pro", - m_tmpDir->path() + "/mixed_atp/mixed_atp.pro", - m_tmpDir->path() + "/plain/plain.qbs", - m_tmpDir->path() + "/mixed_atp/mixed_atp.qbs"}); + const FilePath base = m_tmpDir->filePath(); + FilePaths projects { + base / "plain/plain.pro", + base / "mixed_atp/mixed_atp.pro", + base / "plain/plain.qbs", + base / "mixed_atp/mixed_atp.qbs" + }; QList<int> expectedAutoTests = QList<int>() << 1 << 4 << 1 << 4; QList<int> expectedNamedQuickTests = QList<int>() << 0 << 10 << 0 << 10; @@ -183,7 +186,7 @@ void AutoTestUnitTests::testCodeParserGTest() if (qtcEnvironmentVariableIsEmpty("GOOGLETEST_DIR")) QSKIP("This test needs googletest - set GOOGLETEST_DIR (point to googletest repository)"); - QFETCH(QString, projectFilePath); + QFETCH(FilePath, projectFilePath); CppEditor::Tests::ProjectOpenerAndCloser projectManager; QVERIFY(projectManager.open(projectFilePath, true, m_kit)); @@ -219,11 +222,11 @@ void AutoTestUnitTests::testCodeParserGTest() void AutoTestUnitTests::testCodeParserGTest_data() { - QTest::addColumn<QString>("projectFilePath"); + QTest::addColumn<FilePath>("projectFilePath"); QTest::newRow("simpleGoogletest") - << QString(m_tmpDir->path() + "/simple_gt/simple_gt.pro"); + << m_tmpDir->filePath() / "simple_gt/simple_gt.pro"; QTest::newRow("simpleGoogletestQbs") - << QString(m_tmpDir->path() + "/simple_gt/simple_gt.qbs"); + << m_tmpDir->filePath() / "simple_gt/simple_gt.qbs"; } void AutoTestUnitTests::testCodeParserBoostTest() @@ -231,7 +234,7 @@ void AutoTestUnitTests::testCodeParserBoostTest() if (!m_checkBoost) QSKIP("This test needs boost - set BOOST_INCLUDE_DIR (or have it installed)"); - QFETCH(QString, projectFilePath); + QFETCH(FilePath, projectFilePath); QFETCH(QString, extension); CppEditor::Tests::ProjectOpenerAndCloser projectManager; const CppEditor::ProjectInfo::ConstPtr projectInfo diff --git a/src/plugins/autotest/loadprojectscenario.cpp b/src/plugins/autotest/loadprojectscenario.cpp index af738255e3..fa0530cbc9 100644 --- a/src/plugins/autotest/loadprojectscenario.cpp +++ b/src/plugins/autotest/loadprojectscenario.cpp @@ -68,7 +68,7 @@ bool LoadProjectScenario::init() bool LoadProjectScenario::loadProject() { - const QString projectFilePath = m_tmpDir->path() + "/plain/plain.pro"; + const FilePath projectFilePath = m_tmpDir->filePath() / "/plain/plain.pro"; CppEditor::Tests::ProjectOpenerAndCloser projectManager; // This code must trigger a call to PluginManager::finishScenario() at some later point. |