Use QLatin1String::arg() directly

No need to wrap the QLatin1String in a QString() to get at arg now.

Change-Id: Iac90e052b88077b9c2bd3e7eca6bc31935baa4b8
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Edward Welbourne 2021-09-24 17:41:37 +02:00
parent 91e8d8027d
commit 7586e1980f

View File

@ -112,13 +112,13 @@ void QTeamCityLogger::startLogging()
flowID = tcEscapedString(QString::fromUtf8(QTestResult::currentTestObjectName()));
QString str = QString(QLatin1String("##teamcity[testSuiteStarted name='%1' flowId='%1']\n")).arg(flowID);
QString str = QLatin1String("##teamcity[testSuiteStarted name='%1' flowId='%1']\n").arg(flowID);
outputString(qPrintable(str));
}
void QTeamCityLogger::stopLogging()
{
QString str = QString(QLatin1String("##teamcity[testSuiteFinished name='%1' flowId='%1']\n")).arg(flowID);
QString str = QLatin1String("##teamcity[testSuiteFinished name='%1' flowId='%1']\n").arg(flowID);
outputString(qPrintable(str));
QAbstractTestLogger::stopLogging();
@ -146,7 +146,7 @@ void QTeamCityLogger::addIncident(IncidentTypes type, const char *description,
QString tmpFuncName = escapedTestFuncName();
if (tmpFuncName != currTestFuncName) {
buf = QString(QLatin1String("##teamcity[testStarted name='%1' flowId='%2']\n")).arg(tmpFuncName, flowID);
buf = QLatin1String("##teamcity[testStarted name='%1' flowId='%2']\n").arg(tmpFuncName, flowID);
outputString(qPrintable(buf));
}
@ -157,21 +157,17 @@ void QTeamCityLogger::addIncident(IncidentTypes type, const char *description,
return;
}
QString detailedText = QString::fromUtf8(description);
detailedText = tcEscapedString(detailedText);
QString detailedText = tcEscapedString(QString::fromUtf8(description));
// Test failed
if (type == Fail || type == XPass) {
QString messageText(QLatin1String("Failure!"));
if (file)
messageText += QString(QLatin1String(" |[Loc: %1(%2)|]")).arg(QString::fromUtf8(file)).arg(line);
messageText += QLatin1String(" |[Loc: %1(%2)|]").arg(QString::fromUtf8(file)).arg(line);
buf = QString(QLatin1String("##teamcity[testFailed name='%1' message='%2' details='%3' flowId='%4']\n"))
.arg(tmpFuncName,
messageText,
detailedText,
flowID);
buf = QLatin1String("##teamcity[testFailed name='%1' message='%2' details='%3' flowId='%4']\n")
.arg(tmpFuncName, messageText, detailedText, flowID);
outputString(qPrintable(buf));
} else if (type == Skip) {
@ -185,7 +181,7 @@ void QTeamCityLogger::addIncident(IncidentTypes type, const char *description,
}
if (!pendingMessages.isEmpty()) {
buf = QString(QLatin1String("##teamcity[testStdOut name='%1' out='%2' flowId='%3']\n"))
buf = QLatin1String("##teamcity[testStdOut name='%1' out='%2' flowId='%3']\n")
.arg(tmpFuncName, pendingMessages, flowID);
outputString(qPrintable(buf));
@ -193,7 +189,7 @@ void QTeamCityLogger::addIncident(IncidentTypes type, const char *description,
pendingMessages.clear();
}
buf = QString(QLatin1String("##teamcity[testFinished name='%1' flowId='%2']\n")).arg(tmpFuncName, flowID);
buf = QLatin1String("##teamcity[testFinished name='%1' flowId='%2']\n").arg(tmpFuncName, flowID);
outputString(qPrintable(buf));
}
@ -262,15 +258,13 @@ void QTeamCityLogger::addPendingMessage(const char *type, const QString &msg, co
pendMessage += QLatin1String("|n");
if (file) {
pendMessage += QString(QLatin1String("%1 |[Loc: %2(%3)|]: %4"))
pendMessage += QLatin1String("%1 |[Loc: %2(%3)|]: %4")
.arg(QString::fromUtf8(type), QString::fromUtf8(file))
.arg(line)
.arg(msg);
}
else {
pendMessage += QString(QLatin1String("%1: %2"))
.arg(QString::fromUtf8(type), msg);
} else {
pendMessage += QLatin1String("%1: %2").arg(QString::fromUtf8(type), msg);
}
pendingMessages.append(pendMessage);