diff options
author | Denis Shienkov <denis.shienkov@gmail.com> | 2019-02-19 22:16:04 +0300 |
---|---|---|
committer | Denis Shienkov <denis.shienkov@gmail.com> | 2019-02-25 15:58:40 +0000 |
commit | 0876dc4d6abb147ccdcc190adfad01c704a73e61 (patch) | |
tree | e8a1d558827e2a9e4092600cbe1a2029895d9f99 /tests | |
parent | e160b26d8c7476c63f6220ac69d1d6405e8ce3aa (diff) |
Use QStringLiteral more where it is possible
Change-Id: I7419cc3fbc1e8776de3943852dcedab4c95d1c32
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/api/tst_api.cpp | 10 | ||||
-rw-r--r-- | tests/auto/blackbox/testdata-qt/plugin-meta-data/app.cpp | 6 | ||||
-rw-r--r-- | tests/auto/blackbox/tst_blackbox.cpp | 98 | ||||
-rw-r--r-- | tests/auto/blackbox/tst_blackboxandroid.cpp | 4 | ||||
-rw-r--r-- | tests/auto/blackbox/tst_blackboxbase.cpp | 4 | ||||
-rw-r--r-- | tests/auto/language/tst_language.cpp | 44 | ||||
-rw-r--r-- | tests/auto/tools/tst_tools.cpp | 40 | ||||
-rw-r--r-- | tests/benchmarker/benchmarker.cpp | 2 | ||||
-rw-r--r-- | tests/benchmarker/commandlineparser.cpp | 6 | ||||
-rw-r--r-- | tests/benchmarker/runsupport.cpp | 8 | ||||
-rw-r--r-- | tests/benchmarker/valgrindrunner.cpp | 18 | ||||
-rw-r--r-- | tests/fuzzy-test/commandlineparser.cpp | 14 | ||||
-rw-r--r-- | tests/fuzzy-test/fuzzytester.cpp | 24 |
13 files changed, 139 insertions, 139 deletions
diff --git a/tests/auto/api/tst_api.cpp b/tests/auto/api/tst_api.cpp index 228b0e078..58150150a 100644 --- a/tests/auto/api/tst_api.cpp +++ b/tests/auto/api/tst_api.cpp @@ -1372,7 +1372,7 @@ void TestApi::generatedFilesList() const QStringList directParents = project.generatedFiles(product, uiFilePath, false); QCOMPARE(directParents.size(), 1); const QFileInfo uiHeaderFileInfo(directParents.front()); - QCOMPARE(uiHeaderFileInfo.fileName(), QLatin1String("ui_mainwindow.h")); + QCOMPARE(uiHeaderFileInfo.fileName(), QStringLiteral("ui_mainwindow.h")); QVERIFY(!uiHeaderFileInfo.exists()); const QStringList allParents = project.generatedFiles(product, uiFilePath, true); QCOMPARE(allParents.size(), 3); @@ -1448,7 +1448,7 @@ void TestApi::installableFiles() { qbs::SetupProjectParameters setupParams = defaultSetupParameters("installed-artifact"); QVariantMap overriddenValues; - overriddenValues.insert(QLatin1String("qbs.installRoot"), QLatin1String("/tmp")); + overriddenValues.insert(QStringLiteral("qbs.installRoot"), QStringLiteral("/tmp")); setupParams.setOverriddenValues(overriddenValues); std::unique_ptr<qbs::SetupProjectJob> job(qbs::Project().setupProject(setupParams, m_logSink, 0)); @@ -1471,7 +1471,7 @@ void TestApi::installableFiles() if (!QFileInfo(f.filePath()).fileName().startsWith("main")) { QVERIFY(f.isExecutable()); QString expectedTargetFilePath = qbs::Internal::HostOsInfo - ::appendExecutableSuffix(QLatin1String("/tmp/usr/bin/installedApp")); + ::appendExecutableSuffix(QStringLiteral("/tmp/usr/bin/installedApp")); QCOMPARE(f.installData().localInstallFilePath(), expectedTargetFilePath); QCOMPARE(product.targetExecutable(), expectedTargetFilePath); break; @@ -1872,7 +1872,7 @@ void TestApi::multiArch() // Error check: Try to build for the same profile twice, this time attaching // the properties via the product name. - overriddenValues.remove(QLatin1String("project.targetProfile")); + overriddenValues.remove(QStringLiteral("project.targetProfile")); overriddenValues.insert("products.p1.myProfiles", targetProfile.name() + ',' + targetProfile.name()); setupParams.setOverriddenValues(overriddenValues); @@ -2185,7 +2185,7 @@ void TestApi::nonexistingProjectPropertyFromCommandLine() = defaultSetupParameters("nonexistingprojectproperties"); removeBuildDir(setupParams); QVariantMap projectProperties; - projectProperties.insert(QLatin1String("project.blubb"), QLatin1String("true")); + projectProperties.insert(QStringLiteral("project.blubb"), QStringLiteral("true")); setupParams.setOverriddenValues(projectProperties); std::unique_ptr<qbs::SetupProjectJob> job(qbs::Project().setupProject(setupParams, m_logSink, 0)); diff --git a/tests/auto/blackbox/testdata-qt/plugin-meta-data/app.cpp b/tests/auto/blackbox/testdata-qt/plugin-meta-data/app.cpp index 8f2aec87d..c57504e9e 100644 --- a/tests/auto/blackbox/testdata-qt/plugin-meta-data/app.cpp +++ b/tests/auto/blackbox/testdata-qt/plugin-meta-data/app.cpp @@ -62,7 +62,7 @@ int main(int argc, char *argv[]) #endif if (metaData.isEmpty()) metaData = QPluginLoader("thePlugin").metaData(); - const QJsonValue v = metaData.value(QLatin1String("theKey")); + const QJsonValue v = metaData.value(QStringLiteral("theKey")); if (!v.isArray()) { qDebug() << "value is" << v; return 1; @@ -72,8 +72,8 @@ int main(int argc, char *argv[]) qDebug() << "value is" << v; return 1; } - const QJsonValue v2 = metaData.value(QLatin1String("MetaData")).toObject() - .value(QLatin1String("theOtherKey")); + const QJsonValue v2 = metaData.value(QStringLiteral("MetaData")).toObject() + .value(QStringLiteral("theOtherKey")); if (v2.toString() != QLatin1String("theOtherValue")) { qDebug() << "metadata:" << metaData; return 1; diff --git a/tests/auto/blackbox/tst_blackbox.cpp b/tests/auto/blackbox/tst_blackbox.cpp index e1f5026bd..d8c2d2c82 100644 --- a/tests/auto/blackbox/tst_blackbox.cpp +++ b/tests/auto/blackbox/tst_blackbox.cpp @@ -819,7 +819,7 @@ static QJsonObject findByName(const QJsonArray &objects, const QString &name) if (!v.isObject()) continue; QJsonObject obj = v.toObject(); - const QString objName = obj.value(QLatin1String("name")).toString(); + const QString objName = obj.value(QStringLiteral("name")).toString(); if (objName == name) return obj; } @@ -850,14 +850,14 @@ void TestBlackbox::dependenciesProperty() QJsonArray dependencies = jsondoc.array(); QCOMPARE(dependencies.size(), 2); QJsonObject product2 = findByName(dependencies, QStringLiteral("product2")); - QJsonArray product2_type = product2.value(QLatin1String("type")).toArray(); + QJsonArray product2_type = product2.value(QStringLiteral("type")).toArray(); QCOMPARE(product2_type.size(), 1); QCOMPARE(product2_type.first().toString(), QLatin1String("application")); QCOMPARE(product2.value(QLatin1String("narf")).toString(), QLatin1String("zort")); QJsonArray product2_cppArtifacts = product2.value("artifacts").toObject().value("cpp").toArray(); QCOMPARE(product2_cppArtifacts.size(), 1); - QJsonArray product2_deps = product2.value(QLatin1String("dependencies")).toArray(); + QJsonArray product2_deps = product2.value(QStringLiteral("dependencies")).toArray(); QVERIFY(!product2_deps.empty()); QJsonObject product2_qbs = findByName(product2_deps, QStringLiteral("qbs")); QVERIFY(!product2_qbs.empty()); @@ -918,9 +918,9 @@ void TestBlackbox::dependenciesProperty() dependencies = jsondoc.array(); QCOMPARE(dependencies.size(), 3); product2 = findByName(dependencies, QStringLiteral("product2")); - product2_deps = product2.value(QLatin1String("dependencies")).toArray(); + product2_deps = product2.value(QStringLiteral("dependencies")).toArray(); product2_cpp = findByName(product2_deps, QStringLiteral("cpp")); - product2_cpp_defines = product2_cpp.value(QLatin1String("defines")).toArray(); + product2_cpp_defines = product2_cpp.value(QStringLiteral("defines")).toArray(); QCOMPARE(product2_cpp_defines.size(), 1); QCOMPARE(product2_cpp_defines.first().toString(), QLatin1String("DIGEDAG")); } @@ -1532,7 +1532,7 @@ void TestBlackbox::clean() QCOMPARE(runQbs(), 0); QVERIFY(regularFileExists(appObjectFilePath)); QVERIFY(regularFileExists(appExeFilePath)); - QCOMPARE(runQbs(QbsRunParameters(QLatin1String("clean"))), 0); + QCOMPARE(runQbs(QbsRunParameters(QStringLiteral("clean"))), 0); QVERIFY(!QFile(appObjectFilePath).exists()); QVERIFY(!QFile(appExeFilePath).exists()); QVERIFY(!QFile(depObjectFilePath).exists()); @@ -1563,7 +1563,7 @@ void TestBlackbox::clean() QCOMPARE(runQbs(), 0); QVERIFY(regularFileExists(appObjectFilePath)); QVERIFY(regularFileExists(appExeFilePath)); - QCOMPARE(runQbs(QbsRunParameters(QLatin1String("clean"), QStringList("-n"))), 0); + QCOMPARE(runQbs(QbsRunParameters(QStringLiteral("clean"), QStringList("-n"))), 0); QVERIFY(regularFileExists(appObjectFilePath)); QVERIFY(regularFileExists(appExeFilePath)); QVERIFY(regularFileExists(depObjectFilePath)); @@ -1577,7 +1577,7 @@ void TestBlackbox::clean() QVERIFY(regularFileExists(appExeFilePath)); QVERIFY(regularFileExists(depObjectFilePath)); QVERIFY(regularFileExists(depLibFilePath)); - QCOMPARE(runQbs(QbsRunParameters(QLatin1String("clean"), QStringList("-p") << "dep")), 0); + QCOMPARE(runQbs(QbsRunParameters(QStringLiteral("clean"), QStringList("-p") << "dep")), 0); QVERIFY(regularFileExists(appObjectFilePath)); QVERIFY(regularFileExists(appExeFilePath)); QVERIFY(!QFile(depObjectFilePath).exists()); @@ -1591,7 +1591,7 @@ void TestBlackbox::clean() QVERIFY(regularFileExists(appExeFilePath)); QVERIFY(regularFileExists(depObjectFilePath)); QVERIFY(regularFileExists(depLibFilePath)); - QCOMPARE(runQbs(QbsRunParameters(QLatin1String("clean"), QStringList("-p") << "app")), 0); + QCOMPARE(runQbs(QbsRunParameters(QStringLiteral("clean"), QStringList("-p") << "app")), 0); QVERIFY(!QFile(appObjectFilePath).exists()); QVERIFY(!QFile(appExeFilePath).exists()); QVERIFY(regularFileExists(depObjectFilePath)); @@ -2042,7 +2042,7 @@ void TestBlackbox::trackRemoveFile() QFile::copy("../before/main.cpp", "main.cpp"); QVERIFY(QFile::remove("zort.h")); QVERIFY(QFile::remove("zort.cpp")); - QCOMPARE(runQbs(QbsRunParameters(QLatin1String("resolve"))), 0); + QCOMPARE(runQbs(QbsRunParameters(QStringLiteral("resolve"))), 0); touch("main.cpp"); touch("trackAddFile.qbs"); @@ -2184,7 +2184,7 @@ void TestBlackbox::wildcardRenaming() QVERIFY(QFileInfo(defaultInstallRoot + "/pioniere.txt").exists()); WAIT_FOR_NEW_TIMESTAMP(); QFile::rename(QDir::currentPath() + "/pioniere.txt", QDir::currentPath() + "/fdj.txt"); - QCOMPARE(runQbs(QbsRunParameters(QLatin1String("install"), + QCOMPARE(runQbs(QbsRunParameters(QStringLiteral("install"), QStringList("--clean-install-root"))), 0); QVERIFY(!QFileInfo(defaultInstallRoot + "/pioniere.txt").exists()); QVERIFY(QFileInfo(defaultInstallRoot + "/fdj.txt").exists()); @@ -2198,7 +2198,7 @@ void TestBlackbox::recursiveRenaming() QVERIFY(QFileInfo(defaultInstallRoot + "/dir/subdir/blubb.txt").exists()); WAIT_FOR_NEW_TIMESTAMP(); QVERIFY(QFile::rename(QDir::currentPath() + "/dir/wasser.txt", QDir::currentPath() + "/dir/wein.txt")); - QCOMPARE(runQbs(QbsRunParameters(QLatin1String("install"), + QCOMPARE(runQbs(QbsRunParameters(QStringLiteral("install"), QStringList("--clean-install-root"))), 0); QVERIFY(!QFileInfo(defaultInstallRoot + "/dir/wasser.txt").exists()); QVERIFY(QFileInfo(defaultInstallRoot + "/dir/wein.txt").exists()); @@ -2679,25 +2679,25 @@ void TestBlackbox::overrideProjectProperties() { QDir::setCurrent(testDataDir + "/overrideProjectProperties"); QCOMPARE(runQbs(QbsRunParameters(QStringList() - << QLatin1String("-f") - << QLatin1String("overrideProjectProperties.qbs") - << QLatin1String("project.nameSuffix:ForYou") - << QLatin1String("project.someBool:false") - << QLatin1String("project.someInt:156") - << QLatin1String("project.someStringList:one") - << QLatin1String("products.MyAppForYou.mainFile:main.cpp"))), + << QStringLiteral("-f") + << QStringLiteral("overrideProjectProperties.qbs") + << QStringLiteral("project.nameSuffix:ForYou") + << QStringLiteral("project.someBool:false") + << QStringLiteral("project.someInt:156") + << QStringLiteral("project.someStringList:one") + << QStringLiteral("products.MyAppForYou.mainFile:main.cpp"))), 0); QVERIFY(regularFileExists(relativeExecutableFilePath("MyAppForYou"))); QVERIFY(QFile::remove(relativeBuildGraphFilePath())); QbsRunParameters params; - params.arguments << QLatin1String("-f") << QLatin1String("project_using_helper_lib.qbs"); + params.arguments << QStringLiteral("-f") << QStringLiteral("project_using_helper_lib.qbs"); params.expectFailure = true; QVERIFY(runQbs(params) != 0); rmDirR(relativeBuildDir()); - params.arguments = QStringList() << QLatin1String("-f") - << QLatin1String("project_using_helper_lib.qbs") - << QLatin1String("project.linkSuccessfully:true"); + params.arguments = QStringList() << QStringLiteral("-f") + << QStringLiteral("project_using_helper_lib.qbs") + << QStringLiteral("project.linkSuccessfully:true"); params.expectFailure = false; QCOMPARE(runQbs(params), 0); } @@ -2968,8 +2968,8 @@ void TestBlackbox::probesAndShadowProducts() void TestBlackbox::probeInExportedModule() { QDir::setCurrent(testDataDir + "/probe-in-exported-module"); - QCOMPARE(runQbs(QbsRunParameters(QStringList() << QLatin1String("-f") - << QLatin1String("probe-in-exported-module.qbs"))), 0); + QCOMPARE(runQbs(QbsRunParameters(QStringList() << QStringLiteral("-f") + << QStringLiteral("probe-in-exported-module.qbs"))), 0); QVERIFY2(m_qbsStdout.contains("found: true"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("prop: yes"), m_qbsStdout.constData()); QVERIFY2(m_qbsStdout.contains("listProp: my,myother"), m_qbsStdout.constData()); @@ -2989,8 +2989,8 @@ void TestBlackbox::probesAndArrayProperties() void TestBlackbox::productProperties() { QDir::setCurrent(testDataDir + "/productproperties"); - QCOMPARE(runQbs(QbsRunParameters(QStringList() << QLatin1String("-f") - << QLatin1String("productproperties.qbs"))), 0); + QCOMPARE(runQbs(QbsRunParameters(QStringList() << QStringLiteral("-f") + << QStringLiteral("productproperties.qbs"))), 0); QVERIFY(regularFileExists(relativeExecutableFilePath("blubb_user"))); } @@ -5069,7 +5069,7 @@ void TestBlackbox::properQuoting() { QDir::setCurrent(testDataDir + "/proper quoting"); QCOMPARE(runQbs(), 0); - QbsRunParameters params(QLatin1String("run"), QStringList() << "-q" << "-p" << "Hello World"); + QbsRunParameters params(QStringLiteral("run"), QStringList() << "-q" << "-p" << "Hello World"); params.expectFailure = true; // Because the exit code is non-zero. QCOMPARE(runQbs(params), 156); const char * const expectedOutput = "whitespaceless\ncontains space\ncontains\ttab\n" @@ -5318,7 +5318,7 @@ void TestBlackbox::installedApp() QCOMPARE(runQbs(), 0); QVERIFY(regularFileExists(defaultInstallRoot - + HostOsInfo::appendExecutableSuffix(QLatin1String("/usr/bin/installedApp")))); + + HostOsInfo::appendExecutableSuffix(QStringLiteral("/usr/bin/installedApp")))); QCOMPARE(runQbs(QbsRunParameters("resolve", QStringList("qbs.installRoot:" + testDataDir + "/installed-app"))), 0); @@ -5333,7 +5333,7 @@ void TestBlackbox::installedApp() QCOMPARE(runQbs(QbsRunParameters("resolve")), 0); QCOMPARE(runQbs(QbsRunParameters(QStringList() << "--clean-install-root")), 0); QVERIFY(regularFileExists(defaultInstallRoot - + HostOsInfo::appendExecutableSuffix(QLatin1String("/usr/bin/installedApp")))); + + HostOsInfo::appendExecutableSuffix(QStringLiteral("/usr/bin/installedApp")))); QVERIFY(regularFileExists(defaultInstallRoot + QLatin1String("/usr/src/main.cpp"))); QVERIFY(!addedFile.exists()); @@ -5343,7 +5343,7 @@ void TestBlackbox::installedApp() "qbs.installPrefix: '/usr/local'"); QCOMPARE(runQbs(), 0); QVERIFY(regularFileExists(defaultInstallRoot - + HostOsInfo::appendExecutableSuffix(QLatin1String("/usr/local/bin/installedApp")))); + + HostOsInfo::appendExecutableSuffix(QStringLiteral("/usr/local/bin/installedApp")))); QVERIFY(regularFileExists(defaultInstallRoot + QLatin1String("/usr/local/src/main.cpp"))); // Check whether changing install parameters on the artifact causes re-installation. @@ -5352,7 +5352,7 @@ void TestBlackbox::installedApp() "qbs.installDir: 'custom'"); QCOMPARE(runQbs(), 0); QVERIFY(regularFileExists(defaultInstallRoot - + HostOsInfo::appendExecutableSuffix(QLatin1String("/usr/local/custom/installedApp")))); + + HostOsInfo::appendExecutableSuffix(QStringLiteral("/usr/local/custom/installedApp")))); // Check whether changing install parameters on a source file causes re-installation. WAIT_FOR_NEW_TIMESTAMP(); @@ -5410,7 +5410,7 @@ void TestBlackbox::installedSourceFiles() void TestBlackbox::toolLookup() { - QbsRunParameters params(QLatin1String("setup-toolchains"), QStringList("--help")); + QbsRunParameters params(QStringLiteral("setup-toolchains"), QStringList("--help")); params.profile.clear(); QCOMPARE(runQbs(params), 0); } @@ -5514,13 +5514,13 @@ public: TemporaryDefaultProfileRemover(qbs::Settings *settings) : m_settings(settings), m_defaultProfile(settings->defaultProfile()) { - m_settings->remove(QLatin1String("defaultProfile")); + m_settings->remove(QStringLiteral("defaultProfile")); } ~TemporaryDefaultProfileRemover() { if (!m_defaultProfile.isEmpty()) - m_settings->setValue(QLatin1String("defaultProfile"), m_defaultProfile); + m_settings->setValue(QStringLiteral("defaultProfile"), m_defaultProfile); } private: @@ -5680,15 +5680,15 @@ void TestBlackbox::explicitlyDependsOn_data() static bool haveMakeNsis() { QStringList regKeys; - regKeys << QLatin1String("HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\NSIS") - << QLatin1String("HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS"); + regKeys << QStringLiteral("HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\NSIS") + << QStringLiteral("HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS"); QStringList paths = QProcessEnvironment::systemEnvironment().value("PATH") .split(HostOsInfo::pathListSeparator(), QString::SkipEmptyParts); for (const QString &key : qAsConst(regKeys)) { QSettings settings(key, QSettings::NativeFormat); - QString str = settings.value(QLatin1String(".")).toString(); + QString str = settings.value(QStringLiteral(".")).toString(); if (!str.isEmpty()) paths.prepend(str); } @@ -5696,7 +5696,7 @@ static bool haveMakeNsis() bool haveMakeNsis = false; for (const QString &path : qAsConst(paths)) { if (regularFileExists(QDir::fromNativeSeparators(path) + - HostOsInfo::appendExecutableSuffix(QLatin1String("/makensis")))) { + HostOsInfo::appendExecutableSuffix(QStringLiteral("/makensis")))) { haveMakeNsis = true; break; } @@ -5904,8 +5904,8 @@ static bool haveWiX(const Profile &profile) } QStringList regKeys; - regKeys << QLatin1String("HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows Installer XML\\") - << QLatin1String("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Installer XML\\"); + regKeys << QStringLiteral("HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows Installer XML\\") + << QStringLiteral("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Installer XML\\"); QStringList paths = QProcessEnvironment::systemEnvironment().value("PATH") .split(HostOsInfo::pathListSeparator(), QString::SkipEmptyParts); @@ -5914,7 +5914,7 @@ static bool haveWiX(const Profile &profile) const QStringList versions = QSettings(key, QSettings::NativeFormat).childGroups(); for (const QString &version : versions) { QSettings settings(key + version, QSettings::NativeFormat); - QString str = settings.value(QLatin1String("InstallRoot")).toString(); + QString str = settings.value(QStringLiteral("InstallRoot")).toString(); if (!str.isEmpty()) paths.prepend(str); } @@ -5922,9 +5922,9 @@ static bool haveWiX(const Profile &profile) for (const QString &path : qAsConst(paths)) { if (regularFileExists(QDir::fromNativeSeparators(path) + - HostOsInfo::appendExecutableSuffix(QLatin1String("/candle"))) && + HostOsInfo::appendExecutableSuffix(QStringLiteral("/candle"))) && regularFileExists(QDir::fromNativeSeparators(path) + - HostOsInfo::appendExecutableSuffix(QLatin1String("/light")))) { + HostOsInfo::appendExecutableSuffix(QStringLiteral("/light")))) { return true; } } @@ -6043,7 +6043,7 @@ void TestBlackbox::typescript() QCOMPARE(status, 0); params.expectFailure = false; - params.command = QLatin1String("run"); + params.command = QStringLiteral("run"); params.arguments = QStringList() << "-p" << "animals"; QCOMPARE(runQbs(params), 0); @@ -6093,22 +6093,22 @@ static bool haveInnoSetup(const Profile &profile) return true; QStringList regKeys; - regKeys << QLatin1String("HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Inno Setup 5_is1") - << QLatin1String("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Inno Setup 5_is1"); + regKeys << QStringLiteral("HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Inno Setup 5_is1") + << QStringLiteral("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Inno Setup 5_is1"); QStringList paths = QProcessEnvironment::systemEnvironment().value("PATH") .split(HostOsInfo::pathListSeparator(), QString::SkipEmptyParts); for (const QString &key : regKeys) { QSettings settings(key, QSettings::NativeFormat); - QString str = settings.value(QLatin1String("InstallLocation")).toString(); + QString str = settings.value(QStringLiteral("InstallLocation")).toString(); if (!str.isEmpty()) paths.prepend(str); } for (const QString &path : paths) { if (regularFileExists(QDir::fromNativeSeparators(path) + - HostOsInfo::appendExecutableSuffix(QLatin1String("/ISCC")))) + HostOsInfo::appendExecutableSuffix(QStringLiteral("/ISCC")))) return true; } diff --git a/tests/auto/blackbox/tst_blackboxandroid.cpp b/tests/auto/blackbox/tst_blackboxandroid.cpp index bf47c241c..e02f70213 100644 --- a/tests/auto/blackbox/tst_blackboxandroid.cpp +++ b/tests/auto/blackbox/tst_blackboxandroid.cpp @@ -192,7 +192,7 @@ void TestBlackboxAndroid::android_data() const SettingsPtr s = settings(); const Profile p(profileName(), s.get()); const Profile pQt(theProfileName(true), s.get()); - QStringList archsStringList = p.value(QLatin1String("qbs.architectures")).toStringList(); + QStringList archsStringList = p.value(QStringLiteral("qbs.architectures")).toStringList(); if (archsStringList.empty()) archsStringList << QStringLiteral("armv7a"); // must match default in common.qbs QByteArrayList archs; @@ -203,7 +203,7 @@ void TestBlackboxAndroid::android_data() .replace("arm64", "arm64-v8a"); }); const auto cxxLibPath = [&p, &pQt](const QByteArray &oldcxxLib, bool forQt) { - const bool usesClang = (forQt ? pQt : p).value(QLatin1String("qbs.toolchainType")) + const bool usesClang = (forQt ? pQt : p).value(QStringLiteral("qbs.toolchainType")) .toString() == "clang"; return QByteArray("lib/${ARCH}/") + (usesClang ? "libc++_shared.so" : oldcxxLib); }; diff --git a/tests/auto/blackbox/tst_blackboxbase.cpp b/tests/auto/blackbox/tst_blackboxbase.cpp index e1844b69c..85bc26ba4 100644 --- a/tests/auto/blackbox/tst_blackboxbase.cpp +++ b/tests/auto/blackbox/tst_blackboxbase.cpp @@ -79,9 +79,9 @@ int TestBlackboxBase::runQbs(const QbsRunParameters ¶ms) if (!params.settingsDir.isEmpty() && supportsSettingsDirOption(params.command)) args << "--settings-dir" << params.settingsDir; if (supportsBuildDirectoryOption(params.command)) { - args.push_back(QLatin1String("-d")); + args.push_back(QStringLiteral("-d")); args.push_back(params.buildDirectory.isEmpty() - ? QLatin1String(".") + ? QStringLiteral(".") : params.buildDirectory); } args << params.arguments; diff --git a/tests/auto/language/tst_language.cpp b/tests/auto/language/tst_language.cpp index 9a7071f3b..31aebfa3a 100644 --- a/tests/auto/language/tst_language.cpp +++ b/tests/auto/language/tst_language.cpp @@ -79,8 +79,8 @@ using namespace qbs; using namespace qbs::Internal; static QString testDataDir() { - return FileInfo::resolvePath(QLatin1String(SRCDIR), - QLatin1String("../../../tests/auto/language/testdata")); + return FileInfo::resolvePath(QStringLiteral(SRCDIR), + QStringLiteral("../../../tests/auto/language/testdata")); } static QString testProject(const char *fileName) { return testDataDir() + QLatin1Char('/') + QLatin1String(fileName); @@ -180,7 +180,7 @@ void TestLanguage::initTestCase() m_engine = ScriptEngine::create(m_logger, EvalContext::PropertyEvaluation, this); loader = new Loader(m_engine, m_logger); loader->setSearchPaths(QStringList() - << QLatin1String(SRCDIR "/../../../share/qbs")); + << QStringLiteral(SRCDIR "/../../../share/qbs")); defaultParameters.setTopLevelProfile(profileName()); defaultParameters.setConfigurationName("default"); defaultParameters.expandBuildConfiguration(); @@ -343,7 +343,7 @@ void TestLanguage::canonicalArchitecture() project = loader->loadProject(defaultParameters); QVERIFY(!!project); QHash<QString, ResolvedProductPtr> products = productsFromProject(project); - ResolvedProductPtr product = products.value(QLatin1String("x86")); + ResolvedProductPtr product = products.value(QStringLiteral("x86")); QVERIFY(!!product); } catch (const ErrorInfo &e) { exceptionCaught = true; @@ -360,7 +360,7 @@ void TestLanguage::rfc1034Identifier() project = loader->loadProject(defaultParameters); QVERIFY(!!project); QHash<QString, ResolvedProductPtr> products = productsFromProject(project); - ResolvedProductPtr product = products.value(QLatin1String("this-has-special-characters-" + ResolvedProductPtr product = products.value(QStringLiteral("this-has-special-characters-" "uh-oh-Undersc0r3s-Are.Bad")); QVERIFY(!!product); } catch (const ErrorInfo &e) { @@ -753,7 +753,7 @@ void TestLanguage::environmentVariable() bool exceptionCaught = false; try { // Create new environment: - const QString varName = QLatin1String("PRODUCT_NAME"); + const QString varName = QStringLiteral("PRODUCT_NAME"); const QString productName = QLatin1String("MyApp") + QString::number(qrand()); QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); env.insert(varName, productName); @@ -1161,11 +1161,11 @@ void TestLanguage::getNativeSetting() QString expectedTargetName; if (HostOsInfo::isMacosHost()) - expectedTargetName = QLatin1String("Mac OS X"); + expectedTargetName = QStringLiteral("Mac OS X"); else if (HostOsInfo::isWindowsHost()) - expectedTargetName = QLatin1String("Windows"); + expectedTargetName = QStringLiteral("Windows"); else - expectedTargetName = QLatin1String("Unix"); + expectedTargetName = QStringLiteral("Unix"); QVERIFY(!!project); QHash<QString, ResolvedProductPtr> products; @@ -1173,7 +1173,7 @@ void TestLanguage::getNativeSetting() products.insert(product->targetName, product); ResolvedProductPtr product = products.value(expectedTargetName); QVERIFY(!!product); - ResolvedProductPtr product2 = products.value(QLatin1String("fallback")); + ResolvedProductPtr product2 = products.value(QStringLiteral("fallback")); QVERIFY(!!product2); } catch (const ErrorInfo &e) { exceptionCaught = true; @@ -1288,11 +1288,11 @@ void TestLanguage::homeDirectory() dir.filePath("a")); QCOMPARE(product->productProperties.value("bogus1").toString(), - FileInfo::resolvePath(product->sourceDirectory, QLatin1String("a~b"))); + FileInfo::resolvePath(product->sourceDirectory, QStringLiteral("a~b"))); QCOMPARE(product->productProperties.value("bogus2").toString(), - FileInfo::resolvePath(product->sourceDirectory, QLatin1String("a/~/bb"))); + FileInfo::resolvePath(product->sourceDirectory, QStringLiteral("a/~/bb"))); QCOMPARE(product->productProperties.value("user").toString(), - FileInfo::resolvePath(product->sourceDirectory, QLatin1String("~foo/bar"))); + FileInfo::resolvePath(product->sourceDirectory, QStringLiteral("~foo/bar"))); } catch (const ErrorInfo &e) { qDebug() << e.toString(); @@ -1650,7 +1650,7 @@ void TestLanguage::jsImportUsedInMultipleScopes() try { SetupProjectParameters params = defaultParameters; params.setProjectFilePath(testProject("jsimportsinmultiplescopes.qbs")); - params.setOverriddenValues({std::make_pair(QLatin1String("qbs.buildVariant"), + params.setOverriddenValues({std::make_pair(QStringLiteral("qbs.buildVariant"), buildVariant)}); params.expandBuildConfiguration(); TopLevelProjectPtr project = loader->loadProject(params); @@ -1703,7 +1703,7 @@ void TestLanguage::modulePrioritizationBySearchPath() try { SetupProjectParameters params = defaultParameters; params.setProjectFilePath(testProject("module-prioritization-by-search-path/project.qbs")); - params.setOverriddenValues({std::make_pair(QLatin1String("project.qbsSearchPaths"), + params.setOverriddenValues({std::make_pair(QStringLiteral("project.qbsSearchPaths"), searchPaths)}); params.expandBuildConfiguration(); TopLevelProjectPtr project = loader->loadProject(params); @@ -2398,9 +2398,9 @@ void TestLanguage::pathProperties() QStringList() << "dummy" << "includePaths").toStringList(); QCOMPARE(includePaths, QStringList() << projectFileDir); QCOMPARE(productProps.value("base_fileInProductDir").toString(), - FileInfo::resolvePath(projectFileDir, QLatin1String("foo"))); + FileInfo::resolvePath(projectFileDir, QStringLiteral("foo"))); QCOMPARE(productProps.value("base_fileInBaseProductDir").toString(), - FileInfo::resolvePath(projectFileDir, QLatin1String("subdir/bar"))); + FileInfo::resolvePath(projectFileDir, QStringLiteral("subdir/bar"))); } catch (const ErrorInfo &e) { exceptionCaught = true; qDebug() << e.toString(); @@ -2412,7 +2412,7 @@ void TestLanguage::profileValuesAndOverriddenValues() { bool exceptionCaught = false; try { - TemporaryProfile tp(QLatin1String("tst_lang_profile"), m_settings); + TemporaryProfile tp(QStringLiteral("tst_lang_profile"), m_settings); Profile profile = tp.p; profile.setValue("dummy.defines", "IN_PROFILE"); profile.setValue("dummy.cFlags", "IN_PROFILE"); @@ -2435,7 +2435,7 @@ void TestLanguage::profileValuesAndOverriddenValues() QCOMPARE(values.length(), 1); QCOMPARE(values.front().toString(), QString("IN_PROFILE")); values = product->moduleProperties->moduleProperty("dummy", "defines").toList(); - QCOMPARE(values, QVariantList() << QLatin1String("IN_FILE") << QLatin1String("IN_PROFILE")); + QCOMPARE(values, QVariantList() << QStringLiteral("IN_FILE") << QStringLiteral("IN_PROFILE")); values = product->moduleProperties->moduleProperty("dummy", "cFlags").toList(); QCOMPARE(values.length(), 1); QCOMPARE(values.front().toString(), QString("OVERRIDDEN")); @@ -2536,9 +2536,9 @@ void TestLanguage::productDirectories() product = products.value("MyApp"); QVERIFY(!!product); const QVariantMap config = product->productProperties; - QCOMPARE(config.value(QLatin1String("buildDirectory")).toString(), + QCOMPARE(config.value(QStringLiteral("buildDirectory")).toString(), product->buildDirectory()); - QCOMPARE(config.value(QLatin1String("sourceDirectory")).toString(), testDataDir()); + QCOMPARE(config.value(QStringLiteral("sourceDirectory")).toString(), testDataDir()); } catch (const ErrorInfo &e) { exceptionCaught = true; @@ -2911,7 +2911,7 @@ void TestLanguage::throwingProbe() SetupProjectParameters params = defaultParameters; params.setProjectFilePath(testProject("throwing-probe.qbs")); QVariantMap properties; - properties.insert(QLatin1String("products.theProduct.enableProbe"), enableProbe); + properties.insert(QStringLiteral("products.theProduct.enableProbe"), enableProbe); params.setOverriddenValues(properties); const TopLevelProjectPtr project = loader->loadProject(params); QVERIFY(!!project); diff --git a/tests/auto/tools/tst_tools.cpp b/tests/auto/tools/tst_tools.cpp index 33cb95a78..da40a2dc6 100644 --- a/tests/auto/tools/tst_tools.cpp +++ b/tests/auto/tools/tst_tools.cpp @@ -387,37 +387,37 @@ void TestTools::testBuildConfigMerging() { TemporaryProfile tp(QLatin1String("tst_tools_profile"), m_settings); Profile profile = tp.p; - profile.setValue(QLatin1String("topLevelKey"), QLatin1String("topLevelValue")); - profile.setValue(QLatin1String("qbs.toolchain"), QLatin1String("gcc")); - profile.setValue(QLatin1String("qbs.architecture"), - QLatin1String("Jean-Claude Pillemann")); - profile.setValue(QLatin1String("cpp.treatWarningsAsErrors"), true); + profile.setValue(QStringLiteral("topLevelKey"), QStringLiteral("topLevelValue")); + profile.setValue(QStringLiteral("qbs.toolchain"), QStringLiteral("gcc")); + profile.setValue(QStringLiteral("qbs.architecture"), + QStringLiteral("Jean-Claude Pillemann")); + profile.setValue(QStringLiteral("cpp.treatWarningsAsErrors"), true); QVariantMap overrideMap; - overrideMap.insert(QLatin1String("qbs.toolchain"), QLatin1String("clang")); - overrideMap.insert(QLatin1String("qbs.installRoot"), QLatin1String("/blubb")); + overrideMap.insert(QStringLiteral("qbs.toolchain"), QStringLiteral("clang")); + overrideMap.insert(QStringLiteral("qbs.installRoot"), QStringLiteral("/blubb")); SetupProjectParameters params; params.setSettingsDirectory(m_settings->baseDirectory()); params.setTopLevelProfile(profile.name()); - params.setConfigurationName(QLatin1String("debug")); + params.setConfigurationName(QStringLiteral("debug")); params.setOverriddenValues(overrideMap); const ErrorInfo error = params.expandBuildConfiguration(); QVERIFY2(!error.hasError(), qPrintable(error.toString())); const QVariantMap finalMap = params.finalBuildConfigurationTree(); QCOMPARE(finalMap.size(), 3); - QCOMPARE(finalMap.value(QLatin1String("topLevelKey")).toString(), - QString::fromLatin1("topLevelValue")); - const QVariantMap finalQbsMap = finalMap.value(QLatin1String("qbs")).toMap(); + QCOMPARE(finalMap.value(QStringLiteral("topLevelKey")).toString(), + QStringLiteral("topLevelValue")); + const QVariantMap finalQbsMap = finalMap.value(QStringLiteral("qbs")).toMap(); QCOMPARE(finalQbsMap.size(), 4); - QCOMPARE(finalQbsMap.value(QLatin1String("toolchain")).toString(), - QString::fromLatin1("clang")); - QCOMPARE(finalQbsMap.value(QLatin1String("configurationName")).toString(), - QString::fromLatin1("debug")); - QCOMPARE(finalQbsMap.value(QLatin1String("architecture")).toString(), - QString::fromLatin1("Jean-Claude Pillemann")); - QCOMPARE(finalQbsMap.value(QLatin1String("installRoot")).toString(), QLatin1String("/blubb")); - const QVariantMap finalCppMap = finalMap.value(QLatin1String("cpp")).toMap(); + QCOMPARE(finalQbsMap.value(QStringLiteral("toolchain")).toString(), + QStringLiteral("clang")); + QCOMPARE(finalQbsMap.value(QStringLiteral("configurationName")).toString(), + QStringLiteral("debug")); + QCOMPARE(finalQbsMap.value(QStringLiteral("architecture")).toString(), + QStringLiteral("Jean-Claude Pillemann")); + QCOMPARE(finalQbsMap.value(QStringLiteral("installRoot")).toString(), QLatin1String("/blubb")); + const QVariantMap finalCppMap = finalMap.value(QStringLiteral("cpp")).toMap(); QCOMPARE(finalCppMap.size(), 1); - QCOMPARE(finalCppMap.value(QLatin1String("treatWarningsAsErrors")).toBool(), true); + QCOMPARE(finalCppMap.value(QStringLiteral("treatWarningsAsErrors")).toBool(), true); } void TestTools::testProcessNameByPid() diff --git a/tests/benchmarker/benchmarker.cpp b/tests/benchmarker/benchmarker.cpp index 050eb97a7..5ecdbf08b 100644 --- a/tests/benchmarker/benchmarker.cpp +++ b/tests/benchmarker/benchmarker.cpp @@ -116,7 +116,7 @@ void Benchmarker::rememberCurrentRepoState() void Benchmarker::buildQbs(const QString &buildDir) const { if (!QDir::root().mkpath(buildDir)) - throw Exception(QString::fromLatin1("Failed to create directory '%1'.").arg(buildDir)); + throw Exception(QStringLiteral("Failed to create directory '%1'.").arg(buildDir)); runProcess(QStringList() << "qmake" << "CONFIG+=force_debug_info" << (m_qbsRepo + "/qbs.pro"), buildDir); runProcess(QStringList() << "make" << "-s", buildDir); diff --git a/tests/benchmarker/commandlineparser.cpp b/tests/benchmarker/commandlineparser.cpp index 7c7e1a9c7..4e5052453 100644 --- a/tests/benchmarker/commandlineparser.cpp +++ b/tests/benchmarker/commandlineparser.cpp @@ -64,7 +64,7 @@ void CommandLineParser::parse() "repo path"); parser.addOption(qbsRepoOption); QCommandLineOption activitiesOption(QStringList{"activities", "a"}, - QString::fromLatin1("The activities to benchmark. Possible values (CSV): %1,%2,%3,%4") + QStringLiteral("The activities to benchmark. Possible values (CSV): %1,%2,%3,%4") .arg(resolveActivity(), ruleExecutionActivity(), nullBuildActivity(), allActivities()), "activities", allActivities()); parser.addOption(activitiesOption); @@ -119,14 +119,14 @@ void CommandLineParser::parse() void CommandLineParser::throwException(const QString &optionName, const QString &illegalValue, const QString &helpText) { - const QString errorText(QString::fromLatin1("Error parsing command line: Illegal value '%1' " + const QString errorText(QStringLiteral("Error parsing command line: Illegal value '%1' " "for option '--%2'.\n%3").arg(illegalValue, optionName, helpText)); throw Exception(errorText); } void CommandLineParser::throwException(const QString &missingOption, const QString &helpText) { - const QString errorText(QString::fromLatin1("Error parsing command line: Missing mandatory " + const QString errorText(QStringLiteral("Error parsing command line: Missing mandatory " "option '--%1'.\n%3").arg(missingOption, helpText)); throw Exception(errorText); } diff --git a/tests/benchmarker/runsupport.cpp b/tests/benchmarker/runsupport.cpp index e01200067..3f8f46470 100644 --- a/tests/benchmarker/runsupport.cpp +++ b/tests/benchmarker/runsupport.cpp @@ -46,20 +46,20 @@ void runProcess(const QStringList &commandLine, const QString &workingDir, QByte p.setWorkingDirectory(workingDir); p.start(command, args); if (!p.waitForStarted()) - throw Exception(QString::fromLatin1("Process '%1' failed to start.").arg(command)); + throw Exception(QStringLiteral("Process '%1' failed to start.").arg(command)); p.waitForFinished(-1); if (p.exitStatus() != QProcess::NormalExit) { - throw Exception(QString::fromLatin1("Error running '%1': %2") + throw Exception(QStringLiteral("Error running '%1': %2") .arg(command, p.errorString())); } if (exitCode) *exitCode = p.exitCode(); if (p.exitCode() != 0) { - QString errorString = QString::fromLatin1("Command '%1' finished with exit code %2.") + QString errorString = QStringLiteral("Command '%1' finished with exit code %2.") .arg(command).arg(p.exitCode()); const QByteArray stdErr = p.readAllStandardError(); if (!stdErr.isEmpty()) { - errorString += QString::fromLatin1("\nStandard error output was: '%1'") + errorString += QStringLiteral("\nStandard error output was: '%1'") .arg(QString::fromLocal8Bit(stdErr)); } throw Exception(errorString); diff --git a/tests/benchmarker/valgrindrunner.cpp b/tests/benchmarker/valgrindrunner.cpp index 399216226..0441e1b10 100644 --- a/tests/benchmarker/valgrindrunner.cpp +++ b/tests/benchmarker/valgrindrunner.cpp @@ -51,7 +51,7 @@ ValgrindRunner::ValgrindRunner(Activities activities, const QString &testProject , m_baseOutputDir(baseOutputDir) { if (!QDir::root().mkpath(m_baseOutputDir)) - throw Exception(QString::fromLatin1("Failed to create directory '%1'.").arg(baseOutputDir)); + throw Exception(QStringLiteral("Failed to create directory '%1'.").arg(baseOutputDir)); } void ValgrindRunner::run() @@ -163,7 +163,7 @@ qint64 ValgrindRunner::runCallgrind(const QString &qbsCommand, const QString &bu runProcess(valgrindCommandLine(qbsCommand, buildDir, dryRun, "callgrind", outFile)); QFile f(outFile); if (!f.open(QIODevice::ReadOnly)) { - throw Exception(QString::fromLatin1("Failed to open file '%1': %2") + throw Exception(QStringLiteral("Failed to open file '%1': %2") .arg(outFile, f.errorString())); } while (!f.atEnd()) { @@ -175,14 +175,14 @@ qint64 ValgrindRunner::runCallgrind(const QString &qbsCommand, const QString &bu bool ok; const qint64 iCount = icString.toLongLong(&ok); if (!ok) { - throw Exception(QString::fromLatin1("Unexpected line in callgrind output file " + throw Exception(QStringLiteral("Unexpected line in callgrind output file " "'%1': '%2'.") .arg(outFile, QString::fromLocal8Bit(line))); } return iCount; } - throw Exception(QString::fromLatin1("Failed to find summary line in callgrind " + throw Exception(QStringLiteral("Failed to find summary line in callgrind " "output file '%1'.").arg(outFile)); } @@ -195,7 +195,7 @@ qint64 ValgrindRunner::runMassif(const QString &qbsCommand, const QString &build QBuffer buffer(&ms_printOutput); buffer.open(QIODevice::ReadOnly); QByteArray peakSnapshot; - const QString exceptionStringPattern = QString::fromLatin1("Failed to extract peak memory " + const QString exceptionStringPattern = QStringLiteral("Failed to extract peak memory " "usage from file '%1': %2").arg(outFile); while (!buffer.atEnd()) { const QByteArray line = buffer.readLine(); @@ -207,7 +207,7 @@ qint64 ValgrindRunner::runMassif(const QString &qbsCommand, const QString &build if (delimiterOffset == -1) delimiterOffset = line.lastIndexOf('[', magicStringOffset); if (delimiterOffset == -1) { - const QString details = QString::fromLatin1("Failed to extract peak snapshot from " + const QString details = QStringLiteral("Failed to extract peak snapshot from " "line '%1'.").arg(QString::fromLocal8Bit(line)); throw Exception(exceptionStringPattern.arg(details)); } @@ -222,7 +222,7 @@ qint64 ValgrindRunner::runMassif(const QString &qbsCommand, const QString &build continue; const QList<QByteArray> entries = line.split(' '); if (entries.size() != 6) { - const QString details = QString::fromLatin1("Expected 6 entries in line '%1', but " + const QString details = QStringLiteral("Expected 6 entries in line '%1', but " "there are %2.").arg(QString::fromLocal8Bit(line)).arg(entries.size()); throw Exception(exceptionStringPattern.arg(details)); } @@ -231,14 +231,14 @@ qint64 ValgrindRunner::runMassif(const QString &qbsCommand, const QString &build bool ok; qint64 peakMemoryUsage = peakMemoryString.toLongLong(&ok); if (!ok) { - const QString details = QString::fromLatin1("Failed to parse peak memory value '%1' " + const QString details = QStringLiteral("Failed to parse peak memory value '%1' " "as a number.").arg(QString::fromLocal8Bit(peakMemoryString)); throw Exception(exceptionStringPattern.arg(details)); } return peakMemoryUsage; } - const QString details = QString::fromLatin1("Failed to find snapshot '%1'.") + const QString details = QStringLiteral("Failed to find snapshot '%1'.") .arg(QString::fromLocal8Bit(peakSnapshot)); throw Exception(exceptionStringPattern.arg(details)); } diff --git a/tests/fuzzy-test/commandlineparser.cpp b/tests/fuzzy-test/commandlineparser.cpp index 86f498dec..18515604b 100644 --- a/tests/fuzzy-test/commandlineparser.cpp +++ b/tests/fuzzy-test/commandlineparser.cpp @@ -64,7 +64,7 @@ void CommandLineParser::parse(const QStringList &commandLine) else if (arg == logOption()) m_log = true; else - throw ParseException(QString::fromLatin1("Unknown parameter '%1'").arg(arg)); + throw ParseException(QStringLiteral("Unknown parameter '%1'").arg(arg)); } if (m_profile.isEmpty()) throw ParseException("No profile given."); @@ -74,7 +74,7 @@ void CommandLineParser::parse(const QStringList &commandLine) QString CommandLineParser::usageString() const { - return QString::fromLatin1("%1 %2 <profile> %3 <start commit> [%4 <duration>] " + return QStringLiteral("%1 %2 <profile> %3 <start commit> [%4 <duration>] " "[%5 <job count>] [%6]") .arg(QFileInfo(m_command).fileName(), profileOption(), startCommitOption(), maxDurationoption(), jobCountOption(), logOption()); @@ -83,10 +83,10 @@ QString CommandLineParser::usageString() const void CommandLineParser::assignOptionArgument(const QString &option, QString &argument) { if (m_commandLine.empty()) - throw ParseException(QString::fromLatin1("Option '%1' needs an argument.").arg(option)); + throw ParseException(QStringLiteral("Option '%1' needs an argument.").arg(option)); argument = m_commandLine.takeFirst(); if (argument.isEmpty()) { - throw ParseException(QString::fromLatin1("Argument for option '%1' must not be empty.") + throw ParseException(QStringLiteral("Argument for option '%1' must not be empty.") .arg(option)); } } @@ -98,7 +98,7 @@ void CommandLineParser::assignOptionArgument(const QString &option, int &argumen bool ok; argument = numberString.toInt(&ok); if (!ok || argument <= 0) { - throw ParseException(QString::fromLatin1("Invalid argument '%1' for option '%2'.") + throw ParseException(QStringLiteral("Invalid argument '%1' for option '%2'.") .arg(numberString, option)); } } @@ -116,7 +116,7 @@ void CommandLineParser::parseDuration() bool ok; m_maxDuration = choppedDurationString.toInt(&ok); if (!ok || m_maxDuration <= 0) { - throw ParseException(QString::fromLatin1("Invalid duration argument '%1'.") + throw ParseException(QStringLiteral("Invalid duration argument '%1'.") .arg(durationString)); } if (hasSuffix) { @@ -125,7 +125,7 @@ void CommandLineParser::parseDuration() case 'd': m_maxDuration *= 24; // Fall-through. case 'h': m_maxDuration *= 60; break; default: - throw ParseException(QString::fromLatin1("Invalid duration suffix '%1'.") + throw ParseException(QStringLiteral("Invalid duration suffix '%1'.") .arg(suffix)); } } diff --git a/tests/fuzzy-test/fuzzytester.cpp b/tests/fuzzy-test/fuzzytester.cpp index 37a6c56fe..b836ee623 100644 --- a/tests/fuzzy-test/fuzzytester.cpp +++ b/tests/fuzzy-test/fuzzytester.cpp @@ -100,10 +100,10 @@ void FuzzyTester::runTest(const QString &profile, const QString &startCommit, // for errors, as information from change tracking has to be serialized correctly. QString qbsError; m_currentActivity = resolveIncrementalActivity(); - bool success = runQbs(defaultBuildDir(), QLatin1String("resolve"), &qbsError); + bool success = runQbs(defaultBuildDir(), QStringLiteral("resolve"), &qbsError); if (success) { m_currentActivity = buildIncrementalActivity(); - success = runQbs(defaultBuildDir(), QLatin1String("build"), &qbsError); + success = runQbs(defaultBuildDir(), QStringLiteral("build"), &qbsError); } m_currentActivity = buildFromScratchActivity(); if (success) { @@ -111,7 +111,7 @@ void FuzzyTester::runTest(const QString &profile, const QString &startCommit, QString message = "An incremental build succeeded " "with a commit for which a clean build failed."; if (!m_log) { - message += QString::fromLatin1("\nThe qbs error message " + message += QStringLiteral("\nThe qbs error message " "for the clean build was: '%1'").arg(qbsError); } throwIncrementalBuildError(message, buildSequence); @@ -122,7 +122,7 @@ void FuzzyTester::runTest(const QString &profile, const QString &startCommit, QString message = "An incremental build failed " "with a commit for which a clean build succeeded."; if (!m_log) { - message += QString::fromLatin1("\nThe qbs error message for " + message += QStringLiteral("\nThe qbs error message for " "the incremental build was: '%1'").arg(qbsError); } throwIncrementalBuildError(message, buildSequence); @@ -166,14 +166,14 @@ QString FuzzyTester::findWorkingStartCommit(const QString &startCommit) } checkoutCommit(m_currentCommit); removeDir(defaultBuildDir()); - if (runQbs(defaultBuildDir(), QLatin1String("build"), &qbsError)) { + if (runQbs(defaultBuildDir(), QStringLiteral("build"), &qbsError)) { m_buildableCommits << m_currentCommit; return m_currentCommit; } qDebug("Commit %s is not buildable.", qPrintable(m_currentCommit)); m_unbuildableCommits << m_currentCommit; } - throw TestError(QString::fromLatin1("Cannot run test: Failed to find a single commit that " + throw TestError(QStringLiteral("Cannot run test: Failed to find a single commit that " "builds successfully with qbs. The last qbs error was: '%1'").arg(qbsError)); } @@ -184,9 +184,9 @@ void FuzzyTester::runGit(const QStringList &arguments, QString *output) if (!git.waitForStarted()) throw TestError("Failed to start git. It is expected to be in the PATH."); if (!git.waitForFinished(300000) || git.exitStatus() != QProcess::NormalExit) // 5 minutes ought to be enough for everyone - throw TestError(QString::fromLatin1("git failed: %1").arg(git.errorString())); + throw TestError(QStringLiteral("git failed: %1").arg(git.errorString())); if (git.exitCode() != 0) { - throw TestError(QString::fromLatin1("git failed: %1") + throw TestError(QStringLiteral("git failed: %1") .arg(QString::fromLocal8Bit(git.readAllStandardError()))); } if (output) @@ -222,7 +222,7 @@ bool FuzzyTester::runQbs(const QString &buildDir, const QString &command, QStrin commandLine << ("profile:" + m_profile); qbs.start("qbs", commandLine); if (!qbs.waitForStarted()) { - throw TestError(QString::fromLatin1("Failed to start qbs. It is expected to be " + throw TestError(QStringLiteral("Failed to start qbs. It is expected to be " "in the PATH. QProcess error string: '%1'").arg(qbs.errorString())); } if (!qbs.waitForFinished(-1) || qbs.exitCode() != 0) { @@ -237,7 +237,7 @@ void FuzzyTester::removeDir(const QString &dirPath) { QDir dir(dirPath); if (!dir.removeRecursively()) { - throw TestError(QString::fromLatin1("Failed to remove temporary dir '%1'.") + throw TestError(QStringLiteral("Failed to remove temporary dir '%1'.") .arg(dir.absolutePath())); } } @@ -254,7 +254,7 @@ bool FuzzyTester::doCleanBuild(QString *errorMessage) } const QString cleanBuildDir = "fuzzytest-verification-build"; removeDir(cleanBuildDir); - if (runQbs(cleanBuildDir, QLatin1String("build"), errorMessage)) { + if (runQbs(cleanBuildDir, QStringLiteral("build"), errorMessage)) { m_buildableCommits << m_currentCommit; return true; } @@ -266,7 +266,7 @@ void FuzzyTester::throwIncrementalBuildError(const QString &message, const QStringList &commitSequence) { const QString commitSequenceString = commitSequence.join(QLatin1Char(',')); - throw TestError(QString::fromLatin1("Found qbs bug with incremental build!\n" + throw TestError(QStringLiteral("Found qbs bug with incremental build!\n" "%1\n" "The sequence of commits was: %2.").arg(message, commitSequenceString)); } |