summaryrefslogtreecommitdiffstats
path: root/src/testlib
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2009-05-28 08:27:50 (GMT)
committerThierry Bastian <thierry.bastian@nokia.com>2009-05-28 08:31:07 (GMT)
commitf390f9b51cf8686e9ed44f13a33c7349b9e96a09 (patch)
tree162c768769713a7215bca64daf8f2bdc75c9fbee /src/testlib
parent0bb0699d403b7541472a72a4057ecf0ca366a7cd (diff)
downloadQt-f390f9b51cf8686e9ed44f13a33c7349b9e96a09.zip
Qt-f390f9b51cf8686e9ed44f13a33c7349b9e96a09.tar.gz
Qt-f390f9b51cf8686e9ed44f13a33c7349b9e96a09.tar.bz2
improved string operations all over the place
used character operations whenever possible better usage of QLatin1String
Diffstat (limited to 'src/testlib')
-rw-r--r--src/testlib/qbenchmark_p.h2
-rw-r--r--src/testlib/qbenchmarkvalgrind.cpp10
-rw-r--r--src/testlib/qplaintestlogger.cpp4
-rw-r--r--src/testlib/qsignaldumper.cpp10
4 files changed, 13 insertions, 13 deletions
diff --git a/src/testlib/qbenchmark_p.h b/src/testlib/qbenchmark_p.h
index 8bb6e84..b6340f8 100644
--- a/src/testlib/qbenchmark_p.h
+++ b/src/testlib/qbenchmark_p.h
@@ -81,7 +81,7 @@ struct QBenchmarkContext
QString toString() const
{
- QString s = QString(QLatin1String("%1,%2,%3")).arg(slotName).arg(tag).arg(checkpointIndex);
+ QString s = QString::fromLatin1("%1,%2,%3").arg(slotName).arg(tag).arg(checkpointIndex);
return s;
}
diff --git a/src/testlib/qbenchmarkvalgrind.cpp b/src/testlib/qbenchmarkvalgrind.cpp
index bcce147..c61460d 100644
--- a/src/testlib/qbenchmarkvalgrind.cpp
+++ b/src/testlib/qbenchmarkvalgrind.cpp
@@ -133,12 +133,12 @@ QString QBenchmarkValgrindUtils::getNewestFileName()
QString base = QBenchmarkGlobalData::current->callgrindOutFileBase;
Q_ASSERT(!base.isEmpty());
- nameFilters << QString(QLatin1String("%1.*")).arg(base);
+ nameFilters << QString::fromLatin1("%1.*").arg(base);
QFileInfoList fiList = QDir().entryInfoList(nameFilters, QDir::Files | QDir::Readable);
Q_ASSERT(!fiList.empty());
int hiSuffix = -1;
QFileInfo lastFileInfo;
- const QString pattern = QString(QLatin1String("%1.(\\d+)")).arg(base);
+ const QString pattern = QString::fromLatin1("%1.(\\d+)").arg(base);
const QRegExp rx(pattern);
foreach (QFileInfo fileInfo, fiList) {
const int index = rx.indexIn(fileInfo.fileName());
@@ -168,8 +168,8 @@ void QBenchmarkValgrindUtils::cleanup()
QString base = QBenchmarkGlobalData::current->callgrindOutFileBase;
Q_ASSERT(!base.isEmpty());
nameFilters
- << QString(QLatin1String("%1")).arg(base) // overall summary
- << QString(QLatin1String("%1.*")).arg(base); // individual dumps
+ << base // overall summary
+ << QString::fromLatin1("%1.*").arg(base); // individual dumps
QFileInfoList fiList = QDir().entryInfoList(nameFilters, QDir::Files | QDir::Readable);
foreach (QFileInfo fileInfo, fiList) {
const bool removeOk = QFile::remove(fileInfo.fileName());
@@ -180,7 +180,7 @@ void QBenchmarkValgrindUtils::cleanup()
QString QBenchmarkValgrindUtils::outFileBase(qint64 pid)
{
- return QString(QLatin1String("callgrind.out.%1")).arg(
+ return QString::fromLatin1("callgrind.out.%1").arg(
pid != -1 ? pid : QCoreApplication::applicationPid());
}
diff --git a/src/testlib/qplaintestlogger.cpp b/src/testlib/qplaintestlogger.cpp
index 6f10d72..8ffdca2 100644
--- a/src/testlib/qplaintestlogger.cpp
+++ b/src/testlib/qplaintestlogger.cpp
@@ -216,9 +216,9 @@ namespace QTest {
template <typename T> QString formatResult(T number, int significantDigits)
{
if (number < T(0))
- return QString(QLatin1String("NAN"));
+ return QLatin1String("NAN");
if (number == T(0))
- return QString(QLatin1String("0"));
+ return QLatin1String("0");
QString beforeDecimalPoint = QString::number(qint64(number), 'f', 0);
QString afterDecimalPoint = QString::number(number, 'f', 20);
diff --git a/src/testlib/qsignaldumper.cpp b/src/testlib/qsignaldumper.cpp
index 0a32a6d..3a9d75e 100644
--- a/src/testlib/qsignaldumper.cpp
+++ b/src/testlib/qsignaldumper.cpp
@@ -87,7 +87,7 @@ static void qSignalDumperCallback(QObject *caller, int method_index, void **argv
str.fill(' ', QTest::iLevel++ * QTest::IndentSpacesCount);
str += "Signal: ";
str += mo->className();
- str += "(";
+ str += '(';
QString objname = caller->objectName();
str += objname.toLocal8Bit();
@@ -114,15 +114,15 @@ static void qSignalDumperCallback(QObject *caller, int method_index, void **argv
str.append(QByteArray::number(addr, 16));
} else if (typeId != QMetaType::Void) {
str.append(arg)
- .append("(")
+ .append('(')
.append(QVariant(typeId, argv[i + 1]).toString().toLocal8Bit())
- .append(")");
+ .append(')');
}
str.append(", ");
}
if (str.endsWith(", "))
str.chop(2);
- str.append(")");
+ str.append(')');
qPrintMessage(str);
}
@@ -143,7 +143,7 @@ static void qSignalDumperCallbackSlot(QObject *caller, int method_index, void **
str.fill(' ', QTest::iLevel * QTest::IndentSpacesCount);
str += "Slot: ";
str += mo->className();
- str += "(";
+ str += '(';
QString objname = caller->objectName();
str += objname.toLocal8Bit();