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/auto | |
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/auto')
-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 |
7 files changed, 103 insertions, 103 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() |