From a2a00eb044596f3e3f628b6b20b38a5ba524915c Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 13 Oct 2015 09:46:56 +0200 Subject: Tests: Fix single-character string literals. Use character literals where applicable. Change-Id: I1a026c320079ee5ca6f70be835d5a541deee2dd1 Reviewed-by: Simon Hausmann --- .../corelib/codecs/qtextcodec/tst_qtextcodec.cpp | 4 +- .../auto/corelib/global/qlogging/tst_qlogging.cpp | 2 +- .../corelib/io/qdatastream/tst_qdatastream.cpp | 4 +- tests/auto/corelib/io/qdir/tst_qdir.cpp | 10 ++-- tests/auto/corelib/io/qfile/tst_qfile.cpp | 2 +- tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp | 2 +- tests/auto/corelib/io/qprocess/tst_qprocess.cpp | 10 ++-- tests/auto/corelib/io/qsettings/tst_qsettings.cpp | 2 +- .../corelib/io/qtextstream/tst_qtextstream.cpp | 18 +++---- tests/auto/corelib/io/qurlquery/tst_qurlquery.cpp | 2 +- .../corelib/itemmodels/qitemmodel/modelstotest.cpp | 2 +- .../tst_qsortfilterproxymodel.cpp | 20 +++---- tests/auto/corelib/json/tst_qtjson.cpp | 12 ++--- .../auto/corelib/plugin/qlibrary/tst_qlibrary.cpp | 2 +- .../corelib/tools/collections/tst_collections.cpp | 2 +- .../auto/corelib/tools/qbitarray/tst_qbitarray.cpp | 4 +- .../corelib/tools/qbytearray/tst_qbytearray.cpp | 8 +-- tests/auto/corelib/tools/qchar/tst_qchar.cpp | 2 +- tests/auto/corelib/tools/qdate/tst_qdate.cpp | 2 +- .../auto/corelib/tools/qdatetime/tst_qdatetime.cpp | 4 +- tests/auto/corelib/tools/qlocale/tst_qlocale.cpp | 12 ++--- tests/auto/corelib/tools/qstring/tst_qstring.cpp | 2 +- .../corelib/tools/qstringref/tst_qstringref.cpp | 2 +- .../auto/corelib/xml/qxmlstream/tst_qxmlstream.cpp | 62 +++++++++++----------- tests/auto/dbus/qdbustype/tst_qdbustype.cpp | 4 +- .../image/qicoimageformat/tst_qicoimageformat.cpp | 14 ++--- .../gui/image/qimagereader/tst_qimagereader.cpp | 2 +- .../gui/image/qimagewriter/tst_qimagewriter.cpp | 2 +- .../qstandarditemmodel/tst_qstandarditemmodel.cpp | 10 ++-- .../kernel/qguivariant/test/tst_qguivariant.cpp | 2 +- .../gui/math3d/qquaternion/tst_qquaternion.cpp | 12 ++--- tests/auto/gui/text/qcssparser/tst_qcssparser.cpp | 10 ++-- .../auto/gui/text/qtextlayout/tst_qtextlayout.cpp | 4 +- .../qtextscriptengine/tst_qtextscriptengine.cpp | 2 +- tests/auto/network/access/qftp/tst_qftp.cpp | 4 +- .../access/qnetworkreply/tst_qnetworkreply.cpp | 10 ++-- .../qnetworkinterface/tst_qnetworkinterface.cpp | 2 +- .../socket/qlocalsocket/tst_qlocalsocket.cpp | 4 +- .../network/socket/qtcpsocket/tst_qtcpsocket.cpp | 2 +- .../ssl/qsslcertificate/tst_qsslcertificate.cpp | 2 +- tests/auto/other/atwrapper/atWrapper.cpp | 33 ++++++------ tests/auto/other/macnativeevents/qnativeevents.cpp | 24 ++++----- .../other/qvariant_common/tst_qvariant_common.h | 2 +- tests/auto/sql/kernel/qsqldatabase/tst_databases.h | 14 ++--- .../sql/kernel/qsqldatabase/tst_qsqldatabase.cpp | 2 +- .../auto/sql/kernel/qsqldriver/tst_qsqldriver.cpp | 2 +- tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp | 20 +++---- .../tst_qsqlrelationaltablemodel.cpp | 16 +++--- .../models/qsqltablemodel/tst_qsqltablemodel.cpp | 2 +- tests/auto/tools/qmake/testcompiler.cpp | 2 +- .../dialogs/qfiledialog/tst_qfiledialog.cpp | 2 +- .../dialogs/qfiledialog2/tst_qfiledialog2.cpp | 4 +- .../qfilesystemmodel/tst_qfilesystemmodel.cpp | 2 +- .../dialogs/qmessagebox/tst_qmessagebox.cpp | 2 +- tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp | 6 +-- .../widgets/itemviews/qdirmodel/tst_qdirmodel.cpp | 10 ++-- .../itemviews/qheaderview/tst_qheaderview.cpp | 4 +- .../widgets/itemviews/qlistview/tst_qlistview.cpp | 2 +- .../widgets/itemviews/qtreeview/tst_qtreeview.cpp | 2 +- .../itemviews/qtreewidget/tst_qtreewidget.cpp | 2 +- .../kernel/qapplication/tst_qapplication.cpp | 8 +-- tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp | 2 +- .../widgets/util/qcompleter/tst_qcompleter.cpp | 2 +- tests/baselineserver/src/baselineserver.cpp | 2 +- tests/baselineserver/src/report.cpp | 6 +-- .../benchmarks/corelib/codecs/qtextcodec/main.cpp | 6 +-- tests/benchmarks/corelib/io/qfile/main.cpp | 8 +-- .../GraphicsViewBenchmark/widgets/commandline.cpp | 2 +- .../GraphicsViewBenchmark/widgets/dummydatagen.cpp | 3 +- .../gui/itemviews/qheaderview/qheaderviewbench.cpp | 2 +- tests/benchmarks/sql/kernel/qsqlquery/main.cpp | 2 +- tests/manual/bearerex/bearerex.cpp | 24 +++++---- tests/manual/gestures/graphicsview/main.cpp | 2 +- tests/manual/highdpi/dragwidget.cpp | 2 +- tests/manual/highdpi/main.cpp | 6 +-- tests/manual/lance/main.cpp | 2 +- tests/manual/network_stresstest/minihttpserver.cpp | 2 +- tests/manual/qnetworkaccessmanager/qget/qget.cpp | 2 +- .../qnetworkaccessmanager/qget/transferitem.cpp | 4 +- tests/manual/qscreen/propertyfield.cpp | 2 +- .../device_information/tabletwidget.cpp | 2 +- tests/manual/unc/main.cpp | 2 +- 82 files changed, 264 insertions(+), 260 deletions(-) diff --git a/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp b/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp index a233958894..82ed655390 100644 --- a/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp +++ b/tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp @@ -265,7 +265,7 @@ void tst_QTextCodec::fromUnicode() array is correct (no off by one, no trailing '\0'). */ QByteArray result = codec->fromUnicode(QString("abc")); - if (result.startsWith("a")) { + if (result.startsWith('a')) { QCOMPARE(result.size(), 3); QCOMPARE(result, QByteArray("abc")); } else { @@ -573,7 +573,7 @@ void tst_QTextCodec::utf8Codec_data() str = "Prohl"; str += QChar::ReplacementCharacter; str += QChar::ReplacementCharacter; - str += "e"; + str += QLatin1Char('e'); str += QChar::ReplacementCharacter; str += " plugin"; str += QChar::ReplacementCharacter; diff --git a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp index a65a72313f..e2370665d8 100644 --- a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp +++ b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp @@ -821,7 +821,7 @@ void tst_qmessagehandler::qMessagePattern() // test QT_MESSAGE_PATTERN // QStringList environment = m_baseEnvironment; - environment.prepend("QT_MESSAGE_PATTERN=\"" + pattern + "\""); + environment.prepend("QT_MESSAGE_PATTERN=\"" + pattern + QLatin1Char('"')); process.setEnvironment(environment); process.start(appExe); diff --git a/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp b/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp index 43c644ca43..39c9455b39 100644 --- a/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp +++ b/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp @@ -301,7 +301,7 @@ void tst_QDataStream::cleanupTestCase() static int dataIndex(const QString &tag) { - int pos = tag.lastIndexOf("_"); + int pos = tag.lastIndexOf(QLatin1Char('_')); if (pos >= 0) { int ret = 0; QString count = tag.mid(pos + 1); @@ -338,7 +338,7 @@ void tst_QDataStream::stream_data(int noOfElements) for (int b=0; b<2; b++) { QString byte_order = b == 0 ? "BigEndian" : "LittleEndian"; - QString tag = device + "_" + byte_order; + QString tag = device + QLatin1Char('_') + byte_order; for (int e=0; e("successExpected"); QTest::addColumn("newDir"); - int index = m_dataPath.lastIndexOf("/"); + int index = m_dataPath.lastIndexOf(QLatin1Char('/')); QTest::newRow("cdUp") << m_dataPath << ".." << true << m_dataPath.left(index==0?1:index); QTest::newRow("cdUp non existent (relative dir)") << "anonexistingDir" << ".." << true << m_dataPath; @@ -1107,11 +1107,11 @@ void tst_QDir::setNameFilters_data() QTest::newRow("spaces2") << m_dataPath + "/testdir/spaces" << QStringList("*.bar") << QStringList("foo.bar"); QTest::newRow("spaces3") << m_dataPath + "/testdir/spaces" << QStringList("foo.*") - << QString("foo. bar,foo.bar").split(","); - QTest::newRow("files1") << m_dataPath + "/testdir/dir" << QString("*r.cpp *.pro").split(" ") - << QString("qdir.pro,qrc_qdir.cpp,tst_qdir.cpp").split(","); + << QString("foo. bar,foo.bar").split(QLatin1Char(',')); + QTest::newRow("files1") << m_dataPath + "/testdir/dir" << QString("*r.cpp *.pro").split(QLatin1Char(' ')) + << QString("qdir.pro,qrc_qdir.cpp,tst_qdir.cpp").split(QLatin1Char(',')); QTest::newRow("resources1") << QString(":/tst_qdir/resources/entryList") << QStringList("*.data") - << QString("file1.data,file2.data,file3.data").split(','); + << QString("file1.data,file2.data,file3.data").split(QLatin1Char(',')); } void tst_QDir::setNameFilters() diff --git a/tests/auto/corelib/io/qfile/tst_qfile.cpp b/tests/auto/corelib/io/qfile/tst_qfile.cpp index ae4f1b8774..c1aed842cf 100644 --- a/tests/auto/corelib/io/qfile/tst_qfile.cpp +++ b/tests/auto/corelib/io/qfile/tst_qfile.cpp @@ -1994,7 +1994,7 @@ void tst_QFile::longFileName() QString line = ts.readLine(); QCOMPARE(line, fileName); } - QString newName = fileName + QLatin1String("1"); + QString newName = fileName + QLatin1Char('1'); { QVERIFY(QFile::copy(fileName, newName)); QFile file(newName); diff --git a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp index 7690a0a52b..0319568229 100644 --- a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp +++ b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp @@ -1065,7 +1065,7 @@ void tst_QFileInfo::consistent() QFileInfo fi(file); QCOMPARE(fi.filePath(), expected); - QCOMPARE(fi.dir().path() + "/" + fi.fileName(), expected); + QCOMPARE(fi.dir().path() + QLatin1Char('/') + fi.fileName(), expected); } diff --git a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp index 8c3a96f10d..426c378967 100644 --- a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp +++ b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp @@ -1421,11 +1421,11 @@ void tst_QProcess::spaceArgsTest() QCOMPARE(actual, args); #endif - if (program.contains(" ")) - program = "\"" + program + "\""; + if (program.contains(QLatin1Char(' '))) + program = QLatin1Char('"') + program + QLatin1Char('"'); if (!stringArgs.isEmpty()) - program += QString::fromLatin1(" ") + stringArgs; + program += QLatin1Char(' ') + stringArgs; errorMessage.clear(); process->start(program); @@ -1479,9 +1479,9 @@ void tst_QProcess::nativeArguments() char buf[256]; fgets(buf, 256, file); fclose(file); - QStringList actual = QString::fromLatin1(buf).split("|"); + QStringList actual = QString::fromLatin1(buf).split(QLatin1Char('|')); #else - QStringList actual = QString::fromLatin1(proc.readAll()).split("|"); + QStringList actual = QString::fromLatin1(proc.readAll()).split(QLatin1Char('|')); #endif QVERIFY(!actual.isEmpty()); // not interested in the program name, it might be different. diff --git a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp index 9c2ffa80d4..1dfba368bc 100644 --- a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp +++ b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp @@ -211,7 +211,7 @@ static QString settingsPath(const char *path = "") #else QString tempPath = QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation); #endif - if (tempPath.endsWith("/")) + if (tempPath.endsWith(QLatin1Char('/'))) tempPath.truncate(tempPath.size() - 1); return QDir::toNativeSeparators(tempPath + "/tst_QSettings/" + QLatin1String(path)); } diff --git a/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp b/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp index 36da3b8770..4bcdd1b827 100644 --- a/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp +++ b/tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp @@ -1615,18 +1615,18 @@ void tst_QTextStream::forcePoint() { QString str; QTextStream stream(&str); - stream << fixed << forcepoint << 1.0 << " " << 1 << " " << 0 << " " << -1.0 << " " << -1; + stream << fixed << forcepoint << 1.0 << ' ' << 1 << ' ' << 0 << ' ' << -1.0 << ' ' << -1; QCOMPARE(str, QString("1.000000 1 0 -1.000000 -1")); str.clear(); stream.seek(0); - stream << scientific << forcepoint << 1.0 << " " << 1 << " " << 0 << " " << -1.0 << " " << -1; + stream << scientific << forcepoint << 1.0 << ' ' << 1 << ' ' << 0 << ' ' << -1.0 << ' ' << -1; QCOMPARE(str, QString("1.000000e+00 1 0 -1.000000e+00 -1")); str.clear(); stream.seek(0); stream.setRealNumberNotation(QTextStream::SmartNotation); - stream << forcepoint << 1.0 << " " << 1 << " " << 0 << " " << -1.0 << " " << -1; + stream << forcepoint << 1.0 << ' ' << 1 << ' ' << 0 << ' ' << -1.0 << ' ' << -1; QCOMPARE(str, QString("1.00000 1 0 -1.00000 -1")); } @@ -1636,7 +1636,7 @@ void tst_QTextStream::forceSign() { QString str; QTextStream stream(&str); - stream << forcesign << 1.2 << " " << -1.2 << " " << 0; + stream << forcesign << 1.2 << ' ' << -1.2 << ' ' << 0; QCOMPARE(str, QString("+1.2 -1.2 +0")); } @@ -1773,9 +1773,9 @@ void tst_QTextStream::nanInf() QString s; QTextStream out(&s); - out << qInf() << " " << -qInf() << " " << qQNaN() - << uppercasedigits << " " - << qInf() << " " << -qInf() << " " << qQNaN() + out << qInf() << ' ' << -qInf() << ' ' << qQNaN() + << uppercasedigits << ' ' + << qInf() << ' ' << -qInf() << ' ' << qQNaN() << flush; QCOMPARE(s, QString("inf -inf nan INF -INF NAN")); @@ -2565,7 +2565,7 @@ void tst_QTextStream::useCase1() stream.setCodec(QTextCodec::codecForName("ISO-8859-1")); stream.setAutoDetectUnicode(true); - stream << 4.15 << " " << QByteArray("abc") << " " << QString("ole"); + stream << 4.15 << ' ' << QByteArray("abc") << ' ' << QString("ole"); } file.seek(0); @@ -2601,7 +2601,7 @@ void tst_QTextStream::useCase2() stream.setCodec(QTextCodec::codecForName("ISO-8859-1")); stream.setAutoDetectUnicode(true); - stream << 4.15 << " " << QByteArray("abc") << " " << QString("ole"); + stream << 4.15 << ' ' << QByteArray("abc") << ' ' << QString("ole"); file.close(); QVERIFY(file.open(QFile::ReadWrite)); diff --git a/tests/auto/corelib/io/qurlquery/tst_qurlquery.cpp b/tests/auto/corelib/io/qurlquery/tst_qurlquery.cpp index 14944e7f94..9a4e020aad 100644 --- a/tests/auto/corelib/io/qurlquery/tst_qurlquery.cpp +++ b/tests/auto/corelib/io/qurlquery/tst_qurlquery.cpp @@ -103,7 +103,7 @@ static QByteArray prettyList(const T &items) first = false; result += prettyPair(it); } - result += ")"; + result += QLatin1Char(')'); return result.toLocal8Bit(); } diff --git a/tests/auto/corelib/itemmodels/qitemmodel/modelstotest.cpp b/tests/auto/corelib/itemmodels/qitemmodel/modelstotest.cpp index ba143a31f8..0c8e5690d0 100644 --- a/tests/auto/corelib/itemmodels/qitemmodel/modelstotest.cpp +++ b/tests/auto/corelib/itemmodels/qitemmodel/modelstotest.cpp @@ -233,7 +233,7 @@ QModelIndex ModelsToTest::populateTestArea(QAbstractItemModel *model) { if (QStringListModel *stringListModel = qobject_cast(model)) { QString alphabet = "a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z"; - stringListModel->setStringList( alphabet.split(",") ); + stringListModel->setStringList( alphabet.split(QLatin1Char(',')) ); return QModelIndex(); } diff --git a/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp b/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp index c37d8cd468..12b3d983c0 100644 --- a/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp +++ b/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp @@ -1346,14 +1346,14 @@ void tst_QSortFilterProxyModel::buildHierarchy(const QStringList &l, QAbstractIt QStack parent_stack; for (int i = 0; i < l.count(); ++i) { QString token = l.at(i); - if (token == "<") { // start table + if (token == QLatin1String("<")) { // start table ++ind; parent_stack.push(parent); row_stack.push(row); parent = m->index(row - 1, 0, parent); row = 0; QVERIFY(m->insertColumns(0, 1, parent)); // add column - } else if (token == ">") { // end table + } else if (token == QLatin1String(">")) { // end table --ind; parent = parent_stack.pop(); row = row_stack.pop(); @@ -1376,14 +1376,14 @@ void tst_QSortFilterProxyModel::checkHierarchy(const QStringList &l, const QAbst QStack parent_stack; for (int i = 0; i < l.count(); ++i) { QString token = l.at(i); - if (token == "<") { // start table + if (token == QLatin1String("<")) { // start table ++indent; parent_stack.push(parent); row_stack.push(row); parent = m->index(row - 1, 0, parent); QVERIFY(parent.isValid()); row = 0; - } else if (token == ">") { // end table + } else if (token == QLatin1String(">")) { // end table --indent; parent = parent_stack.pop(); row = row_stack.pop(); @@ -1418,7 +1418,7 @@ void tst_QSortFilterProxyModel::filterTable() filter.setFilterRegExp("9"); for (int i = 0; i < filter.rowCount(); ++i) - QVERIFY(filter.data(filter.index(i, 0)).toString().contains("9")); + QVERIFY(filter.data(filter.index(i, 0)).toString().contains(QLatin1Char('9'))); } void tst_QSortFilterProxyModel::insertAfterSelect() @@ -2625,7 +2625,7 @@ void tst_QSortFilterProxyModel::staticSorting() QSortFilterProxyModel proxy; proxy.setSourceModel(&model); proxy.setDynamicSortFilter(false); - QStringList initial = QString("bateau avion dragon hirondelle flamme camion elephant").split(" "); + QStringList initial = QString("bateau avion dragon hirondelle flamme camion elephant").split(QLatin1Char(' ')); // prepare model QStandardItem *root = model.invisibleRootItem (); @@ -2680,7 +2680,7 @@ void tst_QSortFilterProxyModel::staticSorting() void tst_QSortFilterProxyModel::dynamicSorting() { QStringListModel model1; - const QStringList initial = QString("bateau avion dragon hirondelle flamme camion elephant").split(" "); + const QStringList initial = QString("bateau avion dragon hirondelle flamme camion elephant").split(QLatin1Char(' ')); model1.setStringList(initial); QSortFilterProxyModel proxy1; proxy1.setDynamicSortFilter(false); @@ -3078,7 +3078,7 @@ void tst_QSortFilterProxyModel::appearsAndSort() void tst_QSortFilterProxyModel::unnecessaryDynamicSorting() { QStringListModel model; - const QStringList initial = QString("bravo charlie delta echo").split(" "); + const QStringList initial = QString("bravo charlie delta echo").split(QLatin1Char(' ')); model.setStringList(initial); QSortFilterProxyModel proxy; proxy.setDynamicSortFilter(false); @@ -3162,7 +3162,7 @@ private: void tst_QSortFilterProxyModel::testMultipleProxiesWithSelection() { QStringListModel model; - const QStringList initial = QString("bravo charlie delta echo").split(" "); + const QStringList initial = QString("bravo charlie delta echo").split(QLatin1Char(' ')); model.setStringList(initial); QSortFilterProxyModel proxy; @@ -3196,7 +3196,7 @@ static bool isValid(const QItemSelection &selection) void tst_QSortFilterProxyModel::mapSelectionFromSource() { QStringListModel model; - const QStringList initial = QString("bravo charlie delta echo").split(" "); + const QStringList initial = QString("bravo charlie delta echo").split(QLatin1Char(' ')); model.setStringList(initial); QSortFilterProxyModel proxy; diff --git a/tests/auto/corelib/json/tst_qtjson.cpp b/tests/auto/corelib/json/tst_qtjson.cpp index 1dd00f8727..e8d836683e 100644 --- a/tests/auto/corelib/json/tst_qtjson.cpp +++ b/tests/auto/corelib/json/tst_qtjson.cpp @@ -2555,8 +2555,8 @@ void tst_QtJson::nesting() QVERIFY(!doc.isNull()); QCOMPARE(error.error, QJsonParseError::NoError); - json.prepend("["); - json.append("]"); + json.prepend('['); + json.append(']'); doc = QJsonDocument::fromJson(json, &error); QVERIFY(doc.isNull()); @@ -2574,8 +2574,8 @@ void tst_QtJson::nesting() QVERIFY(!doc.isNull()); QCOMPARE(error.error, QJsonParseError::NoError); - json.prepend("["); - json.append("]"); + json.prepend('['); + json.append(']'); doc = QJsonDocument::fromJson(json, &error); QVERIFY(doc.isNull()); @@ -2589,7 +2589,7 @@ void tst_QtJson::longStrings() // in the data structures (for Latin1String in qjson_p.h) QString s(0x7ff0, 'a'); for (int i = 0x7ff0; i < 0x8010; i++) { - s.append("c"); + s.append(QLatin1Char('c')); QMap map; map["key"] = s; @@ -2608,7 +2608,7 @@ void tst_QtJson::longStrings() s = QString(0xfff0, 'a'); for (int i = 0xfff0; i < 0x10010; i++) { - s.append("c"); + s.append(QLatin1Char('c')); QMap map; map["key"] = s; diff --git a/tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp b/tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp index e87585163b..c613653557 100644 --- a/tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp +++ b/tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp @@ -96,7 +96,7 @@ static QString sys_qualifiedLibraryName(const QString &fileName) { QString appDir = QCoreApplication::applicationDirPath(); - return appDir + "/" + PREFIX + fileName + SUFFIX; + return appDir + QLatin1Char('/') + PREFIX + fileName + SUFFIX; } QT_FORWARD_DECLARE_CLASS(QLibrary) diff --git a/tests/auto/corelib/tools/collections/tst_collections.cpp b/tests/auto/corelib/tools/collections/tst_collections.cpp index ae8ffe48be..4d1dc35817 100644 --- a/tests/auto/corelib/tools/collections/tst_collections.cpp +++ b/tests/auto/corelib/tools/collections/tst_collections.cpp @@ -3482,7 +3482,7 @@ template void foreach_test_arrays(const Container &container) void tst_Collections::foreach_2() { - QStringList strlist = QString::fromLatin1("a,b,c,d,e,f,g,h,ih,kl,mn,op,qr,st,uvw,xyz").split(","); + QStringList strlist = QString::fromLatin1("a,b,c,d,e,f,g,h,ih,kl,mn,op,qr,st,uvw,xyz").split(QLatin1Char(',')); foreach_test_arrays(strlist); foreach_test_arrays(QList(strlist)); foreach_test_arrays(strlist.toVector()); diff --git a/tests/auto/corelib/tools/qbitarray/tst_qbitarray.cpp b/tests/auto/corelib/tools/qbitarray/tst_qbitarray.cpp index d3bbfa338b..5e6459c58b 100644 --- a/tests/auto/corelib/tools/qbitarray/tst_qbitarray.cpp +++ b/tests/auto/corelib/tools/qbitarray/tst_qbitarray.cpp @@ -126,9 +126,9 @@ void tst_QBitArray::size() for (int j=0; j= 0) line = line.left(comment); - if (line.startsWith("@")) { + if (line.startsWith('@')) { if (line.startsWith("@Part") && line.size() > 5 && QChar(line.at(5)).isDigit()) part = QChar(line.at(5)).digitValue(); continue; diff --git a/tests/auto/corelib/tools/qdate/tst_qdate.cpp b/tests/auto/corelib/tools/qdate/tst_qdate.cpp index e515fcf5b9..27988e5b5b 100644 --- a/tests/auto/corelib/tools/qdate/tst_qdate.cpp +++ b/tests/auto/corelib/tools/qdate/tst_qdate.cpp @@ -1047,7 +1047,7 @@ void tst_QDate::fromStringFormat_data() QTest::newRow("data14") << QString("132") << QString("Md") << invalidDate(); QTest::newRow("data15") << february << QString("MMMM") << QDate(defDate().year(), 2, 1); - QString date = mon + " " + august + " 8 2005"; + QString date = mon + QLatin1Char(' ') + august + " 8 2005"; QTest::newRow("data16") << date << QString("ddd MMMM d yyyy") << QDate(2005, 8, 8); QTest::newRow("data17") << QString("2000:00") << QString("yyyy:yy") << QDate(2000, 1, 1); QTest::newRow("data18") << QString("1999:99") << QString("yyyy:yy") << QDate(1999, 1, 1); diff --git a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp index 4ab79909e3..a9f3dc19a2 100644 --- a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp +++ b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp @@ -2096,11 +2096,11 @@ void tst_QDateTime::fromStringStringFormat_data() QTest::newRow("data9") << QString("101010") << QString("dMyy") << QDateTime(QDate(1910, 10, 10), QTime()); QTest::newRow("data10") << QString("101010") << QString("dMyy") << QDateTime(QDate(1910, 10, 10), QTime()); QTest::newRow("data11") << date << QString("dd MMM yy") << QDateTime(QDate(1910, 10, 10), QTime()); - date = fri + " " + december + " 3 2004"; + date = fri + QLatin1Char(' ') + december + " 3 2004"; QTest::newRow("data12") << date << QString("ddd MMMM d yyyy") << QDateTime(QDate(2004, 12, 3), QTime()); QTest::newRow("data13") << QString("30.02.2004") << QString("dd.MM.yyyy") << invalidDateTime(); QTest::newRow("data14") << QString("32.01.2004") << QString("dd.MM.yyyy") << invalidDateTime(); - date = thu + " " + january + " 2004"; + date = thu + QLatin1Char(' ') + january + " 2004"; QTest::newRow("data15") << date << QString("ddd MMMM yyyy") << QDateTime(QDate(2004, 1, 1), QTime()); QTest::newRow("data16") << QString("2005-06-28T07:57:30.001Z") << QString("yyyy-MM-ddThh:mm:ss.zZ") diff --git a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp index 11b6922278..913f770ee1 100644 --- a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp +++ b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp @@ -370,7 +370,7 @@ void tst_QLocale::ctor() && l.country() == QLocale::exp_country, \ QString("requested: \"" + QString(req_lc) + "\", got: " \ + QLocale::languageToString(l.language()) \ - + "/" + QLocale::countryToString(l.country())).toLatin1().constData()); \ + + QLatin1Char('/') + QLocale::countryToString(l.country())).toLatin1().constData()); \ QCOMPARE(l, QLocale(QLocale::exp_lang, QLocale::exp_country)); \ QCOMPARE(qHash(l), qHash(QLocale(QLocale::exp_lang, QLocale::exp_country))); \ } @@ -431,8 +431,8 @@ void tst_QLocale::ctor() && l.country() == QLocale::exp_country, \ QString("requested: \"" + QString(req_lc) + "\", got: " \ + QLocale::languageToString(l.language()) \ - + "/" + QLocale::scriptToString(l.script()) \ - + "/" + QLocale::countryToString(l.country())).toLatin1().constData()); \ + + QLatin1Char('/') + QLocale::scriptToString(l.script()) \ + + QLatin1Char('/') + QLocale::countryToString(l.country())).toLatin1().constData()); \ } TEST_CTOR("zh_CN", Chinese, SimplifiedHanScript, China) @@ -606,7 +606,7 @@ void tst_QLocale::legacyNames() && l.country() == QLocale::exp_country, \ QString("requested: \"" + QString(req_lc) + "\", got: " \ + QLocale::languageToString(l.language()) \ - + "/" + QLocale::countryToString(l.country())).toLatin1().constData()); \ + + QLatin1Char('/') + QLocale::countryToString(l.country())).toLatin1().constData()); \ } TEST_CTOR("mo_MD", Romanian, Moldova) @@ -1460,9 +1460,9 @@ void tst_QLocale::macDefaultLocale() if (timeString.contains(QString("GMT"))) { QString expectedGMTSpecifierBase("GMT"); if (diff >= 0) - expectedGMTSpecifierBase.append("+"); + expectedGMTSpecifierBase.append(QLatin1Char('+')); else - expectedGMTSpecifierBase.append("-"); + expectedGMTSpecifierBase.append(QLatin1Char('-')); QString expectedGMTSpecifier = expectedGMTSpecifierBase + QString("%1").arg(qAbs(diff)); QString expectedGMTSpecifierZeroExtended = expectedGMTSpecifierBase + QString("0%1").arg(qAbs(diff)); diff --git a/tests/auto/corelib/tools/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp index 745cbbfad3..3ca2b76ecd 100644 --- a/tests/auto/corelib/tools/qstring/tst_qstring.cpp +++ b/tests/auto/corelib/tools/qstring/tst_qstring.cpp @@ -1362,7 +1362,7 @@ void tst_QString::indexOf_data() QString s2; s2 += QChar(0x3bc); QTest::newRow( "data58" ) << s1 << s2 << 0 << false << 3; - s2.prepend("C"); + s2.prepend(QLatin1Char('C')); QTest::newRow( "data59" ) << s1 << s2 << 0 << false << 2; QString veryBigHaystack(500, 'a'); diff --git a/tests/auto/corelib/tools/qstringref/tst_qstringref.cpp b/tests/auto/corelib/tools/qstringref/tst_qstringref.cpp index 82d103c460..15bcb1ee2b 100644 --- a/tests/auto/corelib/tools/qstringref/tst_qstringref.cpp +++ b/tests/auto/corelib/tools/qstringref/tst_qstringref.cpp @@ -292,7 +292,7 @@ void tst_QStringRef::indexOf_data() QString s2; s2 += QChar(0x3bc); QTest::newRow("data58") << QString(s1) << QString(s2) << 0 << false << 3; - s2.prepend("C"); + s2.prepend(QLatin1Char('C')); QTest::newRow("data59") << QString(s1) << QString(s2) << 0 << false << 2; QString veryBigHaystack(500, 'a'); diff --git a/tests/auto/corelib/xml/qxmlstream/tst_qxmlstream.cpp b/tests/auto/corelib/xml/qxmlstream/tst_qxmlstream.cpp index 20192a9453..8875355565 100644 --- a/tests/auto/corelib/xml/qxmlstream/tst_qxmlstream.cpp +++ b/tests/auto/corelib/xml/qxmlstream/tst_qxmlstream.cpp @@ -119,7 +119,7 @@ static QByteArray makeCanonical(const QString &filename, if (notation.publicId().isEmpty()) { writeDtd << " SYSTEM \'"; writeDtd << notation.systemId().toString(); - writeDtd << "\'"; + writeDtd << '\''; } else { writeDtd << " PUBLIC \'"; writeDtd << notation.publicId().toString(); @@ -127,10 +127,10 @@ static QByteArray makeCanonical(const QString &filename, if (!notation.systemId().isEmpty() ) { writeDtd << " \'"; writeDtd << notation.systemId().toString(); - writeDtd << "\'"; + writeDtd << '\''; } } - writeDtd << ">"; + writeDtd << '>'; writeDtd << endl; } @@ -687,7 +687,7 @@ QByteArray tst_QXmlStream::readFile(const QString &filename) while (!reader.atEnd()) { reader.readNext(); - writer << reader.tokenString() << "("; + writer << reader.tokenString() << '('; if (reader.isWhitespace()) writer << " whitespace"; if (reader.isCDATA()) @@ -695,42 +695,42 @@ QByteArray tst_QXmlStream::readFile(const QString &filename) if (reader.isStartDocument() && reader.isStandaloneDocument()) writer << " standalone"; if (!reader.text().isEmpty()) - writer << " text=\"" << reader.text().toString() << "\""; + writer << " text=\"" << reader.text().toString() << '"'; if (!reader.processingInstructionTarget().isEmpty()) - writer << " processingInstructionTarget=\"" << reader.processingInstructionTarget().toString() << "\""; + writer << " processingInstructionTarget=\"" << reader.processingInstructionTarget().toString() << '"'; if (!reader.processingInstructionData().isEmpty()) - writer << " processingInstructionData=\"" << reader.processingInstructionData().toString() << "\""; + writer << " processingInstructionData=\"" << reader.processingInstructionData().toString() << '"'; if (!reader.dtdName().isEmpty()) - writer << " dtdName=\"" << reader.dtdName().toString() << "\""; + writer << " dtdName=\"" << reader.dtdName().toString() << '"'; if (!reader.dtdPublicId().isEmpty()) - writer << " dtdPublicId=\"" << reader.dtdPublicId().toString() << "\""; + writer << " dtdPublicId=\"" << reader.dtdPublicId().toString() << '"'; if (!reader.dtdSystemId().isEmpty()) - writer << " dtdSystemId=\"" << reader.dtdSystemId().toString() << "\""; + writer << " dtdSystemId=\"" << reader.dtdSystemId().toString() << '"'; if (!reader.documentVersion().isEmpty()) - writer << " documentVersion=\"" << reader.documentVersion().toString() << "\""; + writer << " documentVersion=\"" << reader.documentVersion().toString() << '"'; if (!reader.documentEncoding().isEmpty()) - writer << " documentEncoding=\"" << reader.documentEncoding().toString() << "\""; + writer << " documentEncoding=\"" << reader.documentEncoding().toString() << '"'; if (!reader.name().isEmpty()) - writer << " name=\"" << reader.name().toString() << "\""; + writer << " name=\"" << reader.name().toString() << '"'; if (!reader.namespaceUri().isEmpty()) - writer << " namespaceUri=\"" << reader.namespaceUri().toString() << "\""; + writer << " namespaceUri=\"" << reader.namespaceUri().toString() << '"'; if (!reader.qualifiedName().isEmpty()) - writer << " qualifiedName=\"" << reader.qualifiedName().toString() << "\""; + writer << " qualifiedName=\"" << reader.qualifiedName().toString() << '"'; if (!reader.prefix().isEmpty()) - writer << " prefix=\"" << reader.prefix().toString() << "\""; + writer << " prefix=\"" << reader.prefix().toString() << '"'; if (reader.attributes().size()) { foreach(QXmlStreamAttribute attribute, reader.attributes()) { writer << endl << " Attribute("; if (!attribute.name().isEmpty()) - writer << " name=\"" << attribute.name().toString() << "\""; + writer << " name=\"" << attribute.name().toString() << '"'; if (!attribute.namespaceUri().isEmpty()) - writer << " namespaceUri=\"" << attribute.namespaceUri().toString() << "\""; + writer << " namespaceUri=\"" << attribute.namespaceUri().toString() << '"'; if (!attribute.qualifiedName().isEmpty()) - writer << " qualifiedName=\"" << attribute.qualifiedName().toString() << "\""; + writer << " qualifiedName=\"" << attribute.qualifiedName().toString() << '"'; if (!attribute.prefix().isEmpty()) - writer << " prefix=\"" << attribute.prefix().toString() << "\""; + writer << " prefix=\"" << attribute.prefix().toString() << '"'; if (!attribute.value().isEmpty()) - writer << " value=\"" << attribute.value().toString() << "\""; + writer << " value=\"" << attribute.value().toString() << '"'; writer << " )" << endl; } } @@ -738,9 +738,9 @@ QByteArray tst_QXmlStream::readFile(const QString &filename) foreach(QXmlStreamNamespaceDeclaration namespaceDeclaration, reader.namespaceDeclarations()) { writer << endl << " NamespaceDeclaration("; if (!namespaceDeclaration.prefix().isEmpty()) - writer << " prefix=\"" << namespaceDeclaration.prefix().toString() << "\""; + writer << " prefix=\"" << namespaceDeclaration.prefix().toString() << '"'; if (!namespaceDeclaration.namespaceUri().isEmpty()) - writer << " namespaceUri=\"" << namespaceDeclaration.namespaceUri().toString() << "\""; + writer << " namespaceUri=\"" << namespaceDeclaration.namespaceUri().toString() << '"'; writer << " )" << endl; } } @@ -748,11 +748,11 @@ QByteArray tst_QXmlStream::readFile(const QString &filename) foreach(QXmlStreamNotationDeclaration notationDeclaration, reader.notationDeclarations()) { writer << endl << " NotationDeclaration("; if (!notationDeclaration.name().isEmpty()) - writer << " name=\"" << notationDeclaration.name().toString() << "\""; + writer << " name=\"" << notationDeclaration.name().toString() << '"'; if (!notationDeclaration.systemId().isEmpty()) - writer << " systemId=\"" << notationDeclaration.systemId().toString() << "\""; + writer << " systemId=\"" << notationDeclaration.systemId().toString() << '"'; if (!notationDeclaration.publicId().isEmpty()) - writer << " publicId=\"" << notationDeclaration.publicId().toString() << "\""; + writer << " publicId=\"" << notationDeclaration.publicId().toString() << '"'; writer << " )" << endl; } } @@ -760,15 +760,15 @@ QByteArray tst_QXmlStream::readFile(const QString &filename) foreach(QXmlStreamEntityDeclaration entityDeclaration, reader.entityDeclarations()) { writer << endl << " EntityDeclaration("; if (!entityDeclaration.name().isEmpty()) - writer << " name=\"" << entityDeclaration.name().toString() << "\""; + writer << " name=\"" << entityDeclaration.name().toString() << '"'; if (!entityDeclaration.notationName().isEmpty()) - writer << " notationName=\"" << entityDeclaration.notationName().toString() << "\""; + writer << " notationName=\"" << entityDeclaration.notationName().toString() << '"'; if (!entityDeclaration.systemId().isEmpty()) - writer << " systemId=\"" << entityDeclaration.systemId().toString() << "\""; + writer << " systemId=\"" << entityDeclaration.systemId().toString() << '"'; if (!entityDeclaration.publicId().isEmpty()) - writer << " publicId=\"" << entityDeclaration.publicId().toString() << "\""; + writer << " publicId=\"" << entityDeclaration.publicId().toString() << '"'; if (!entityDeclaration.value().isEmpty()) - writer << " value=\"" << entityDeclaration.value().toString() << "\""; + writer << " value=\"" << entityDeclaration.value().toString() << '"'; writer << " )" << endl; } } diff --git a/tests/auto/dbus/qdbustype/tst_qdbustype.cpp b/tests/auto/dbus/qdbustype/tst_qdbustype.cpp index 4408729e7c..5634bc20f8 100644 --- a/tests/auto/dbus/qdbustype/tst_qdbustype.cpp +++ b/tests/auto/dbus/qdbustype/tst_qdbustype.cpp @@ -260,11 +260,11 @@ void tst_QDBusType::isValidArray() QFETCH(QString, data); QFETCH(bool, result); - data.prepend("a"); + data.prepend(QLatin1Char('a')); QCOMPARE(bool(q_dbus_signature_validate_single(data.toLatin1(), 0)), result); QCOMPARE(QDBusUtil::isValidSingleSignature(data), result); - data.prepend("a"); + data.prepend(QLatin1Char('a')); QCOMPARE(bool(q_dbus_signature_validate_single(data.toLatin1(), 0)), result); QCOMPARE(QDBusUtil::isValidSingleSignature(data), result); } diff --git a/tests/auto/gui/image/qicoimageformat/tst_qicoimageformat.cpp b/tests/auto/gui/image/qicoimageformat/tst_qicoimageformat.cpp index bff762fd04..ffe3dcfb75 100644 --- a/tests/auto/gui/image/qicoimageformat/tst_qicoimageformat.cpp +++ b/tests/auto/gui/image/qicoimageformat/tst_qicoimageformat.cpp @@ -141,7 +141,7 @@ void tst_QIcoImageFormat::canRead() QFETCH(QString, fileName); QFETCH(int, isValid); - QImageReader reader(m_IconPath + "/" + fileName); + QImageReader reader(m_IconPath + QLatin1Char('/') + fileName); QCOMPARE(reader.canRead(), (isValid == 0 ? false : true)); } @@ -175,7 +175,7 @@ void tst_QIcoImageFormat::SequentialFile() QFETCH(QString, fileName); QFETCH(int, isValid); - QSequentialFile *file = new QSequentialFile(m_IconPath + "/" + fileName); + QSequentialFile *file = new QSequentialFile(m_IconPath + QLatin1Char('/') + fileName); QVERIFY(file); QVERIFY(file->open(QFile::ReadOnly)); QImageReader reader(file); @@ -212,7 +212,7 @@ void tst_QIcoImageFormat::imageCount() QFETCH(QString, fileName); QFETCH(int, count); - QImageReader reader(m_IconPath + "/" + fileName); + QImageReader reader(m_IconPath + QLatin1Char('/') + fileName); QCOMPARE(reader.imageCount(), count); } @@ -240,7 +240,7 @@ void tst_QIcoImageFormat::jumpToNextImage() QFETCH(QString, fileName); QFETCH(int, count); - QImageReader reader(m_IconPath + "/" + fileName); + QImageReader reader(m_IconPath + QLatin1Char('/') + fileName); bool bJumped = reader.jumpToImage(0); while (bJumped) { count--; @@ -263,7 +263,7 @@ void tst_QIcoImageFormat::loopCount() QFETCH(QString, fileName); QFETCH(int, count); - QImageReader reader(m_IconPath + "/" + fileName); + QImageReader reader(m_IconPath + QLatin1Char('/') + fileName); QCOMPARE(reader.loopCount(), count); } @@ -291,7 +291,7 @@ void tst_QIcoImageFormat::nextImageDelay() QFETCH(QString, fileName); QFETCH(int, count); - QImageReader reader(m_IconPath + "/" + fileName); + QImageReader reader(m_IconPath + QLatin1Char('/') + fileName); if (count == -1) { QCOMPARE(reader.nextImageDelay(), 0); } else { @@ -320,7 +320,7 @@ void tst_QIcoImageFormat::pngCompression() QFETCH(int, width); QFETCH(int, height); - QImageReader reader(m_IconPath + "/" + fileName); + QImageReader reader(m_IconPath + QLatin1Char('/') + fileName); QImage image; reader.jumpToImage(index); diff --git a/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp b/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp index 07b75adae4..3f846d25d5 100644 --- a/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp +++ b/tests/auto/gui/image/qimagereader/tst_qimagereader.cpp @@ -158,7 +158,7 @@ private: // helper to skip an autotest when the given image format is not supported #define SKIP_IF_UNSUPPORTED(format) do { \ if (!QByteArray(format).isEmpty() && !QImageReader::supportedImageFormats().contains(format)) \ - QSKIP("\"" + QByteArray(format) + "\" images are not supported"); \ + QSKIP('"' + QByteArray(format) + "\" images are not supported"); \ } while (0) // Testing get/set functions diff --git a/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp b/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp index 4f04e50294..fe6d7493e4 100644 --- a/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp +++ b/tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp @@ -96,7 +96,7 @@ private: // helper to skip an autotest when the given image format is not supported #define SKIP_IF_UNSUPPORTED(format) do { \ if (!QByteArray(format).isEmpty() && !QImageReader::supportedImageFormats().contains(format)) \ - QSKIP("\"" + QByteArray(format) + "\" images are not supported"); \ + QSKIP('"' + QByteArray(format) + "\" images are not supported"); \ } while (0) static void initializePadding(QImage *image) diff --git a/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp b/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp index ae47b2053b..b8cc22cade 100644 --- a/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp +++ b/tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp @@ -1613,14 +1613,14 @@ void tst_QStandardItemModel::removeRowsAndColumns() #define VERIFY_MODEL \ for (int c = 0; c < col_list.count(); c++) \ for (int r = 0; r < row_list.count(); r++) \ - QCOMPARE(model.item(r,c)->text() , row_list[r] + "x" + col_list[c]); + QCOMPARE(model.item(r,c)->text() , row_list[r] + QLatin1Char('x') + col_list[c]); QVector row_list = QString("1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20").split(',').toVector(); QVector col_list = row_list; QStandardItemModel model; for (int c = 0; c < col_list.count(); c++) for (int r = 0; r < row_list.count(); r++) - model.setItem(r, c, new QStandardItem(row_list[r] + "x" + col_list[c])); + model.setItem(r, c, new QStandardItem(row_list[r] + QLatin1Char('x') + col_list[c])); VERIFY_MODEL row_list.remove(3); @@ -1642,14 +1642,14 @@ void tst_QStandardItemModel::removeRowsAndColumns() QList row_taken = model.takeRow(6); QCOMPARE(row_taken.count(), col_list.count()); for (int c = 0; c < col_list.count(); c++) - QCOMPARE(row_taken[c]->text() , row_list[6] + "x" + col_list[c]); + QCOMPARE(row_taken[c]->text() , row_list[6] + QLatin1Char('x') + col_list[c]); row_list.remove(6); VERIFY_MODEL QList col_taken = model.takeColumn(10); QCOMPARE(col_taken.count(), row_list.count()); for (int r = 0; r < row_list.count(); r++) - QCOMPARE(col_taken[r]->text() , row_list[r] + "x" + col_list[10]); + QCOMPARE(col_taken[r]->text() , row_list[r] + QLatin1Char('x') + col_list[10]); col_list.remove(10); VERIFY_MODEL } @@ -1661,7 +1661,7 @@ void tst_QStandardItemModel::itemRoleNames() QStandardItemModel model; for (int c = 0; c < col_list.count(); c++) for (int r = 0; r < row_list.count(); r++) - model.setItem(r, c, new QStandardItem(row_list[r] + "x" + col_list[c])); + model.setItem(r, c, new QStandardItem(row_list[r] + QLatin1Char('x') + col_list[c])); VERIFY_MODEL QHash newRoleNames; diff --git a/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp b/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp index 0e822ced5b..84fdd81f6c 100644 --- a/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp +++ b/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp @@ -380,7 +380,7 @@ void tst_QGuiVariant::toString_data() #ifndef Q_OS_MAC << QString( "Ctrl+A" ); #else - << QString(QChar(0x2318)) + "A"; + << QString(QChar(0x2318)) + QLatin1Char('A'); #endif QFont font( "times", 12 ); diff --git a/tests/auto/gui/math3d/qquaternion/tst_qquaternion.cpp b/tests/auto/gui/math3d/qquaternion/tst_qquaternion.cpp index 1fbad5b829..53d9a987a6 100644 --- a/tests/auto/gui/math3d/qquaternion/tst_qquaternion.cpp +++ b/tests/auto/gui/math3d/qquaternion/tst_qquaternion.cpp @@ -999,16 +999,16 @@ static QByteArray testnameForAxis(const QVector3D &axis) testname = "null"; } else { if (axis.x()) { - testname += axis.x() < 0 ? "-" : "+"; - testname += "X"; + testname += axis.x() < 0 ? '-' : '+'; + testname += 'X'; } if (axis.y()) { - testname += axis.y() < 0 ? "-" : "+"; - testname += "Y"; + testname += axis.y() < 0 ? '-' : '+'; + testname += 'Y'; } if (axis.z()) { - testname += axis.z() < 0 ? "-" : "+"; - testname += "Z"; + testname += axis.z() < 0 ? '-' : '+'; + testname += 'Z'; } } return testname; diff --git a/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp b/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp index b1beb0ffd0..878c03e563 100644 --- a/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp +++ b/tests/auto/gui/text/qcssparser/tst_qcssparser.cpp @@ -185,7 +185,7 @@ static void debug(const QVector &symbols, int index = -1) { qDebug() << "all symbols:"; for (int i = 0; i < symbols.count(); ++i) - qDebug() << "(" << i << "); Token:" << tokenName(symbols.at(i).token) << "; Lexem:" << symbols.at(i).lexem(); + qDebug() << '(' << i << "); Token:" << tokenName(symbols.at(i).token) << "; Lexem:" << symbols.at(i).lexem(); if (index != -1) qDebug() << "failure at index" << index; } @@ -1340,7 +1340,7 @@ void tst_QCssParser::shorthandBackgroundProperty() QVERIFY(doc.setContent(QLatin1String(" "))); css.prepend("dummy {"); - css.append("}"); + css.append(QLatin1Char('}')); QCss::Parser parser(css); QCss::StyleSheet sheet; @@ -1500,7 +1500,7 @@ void tst_QCssParser::gradient() QVERIFY(doc.setContent(QLatin1String(" "))); css.prepend("dummy {"); - css.append("}"); + css.append(QLatin1Char('}')); QCss::Parser parser(css); QCss::StyleSheet sheet; @@ -1560,7 +1560,7 @@ void tst_QCssParser::extractFontFamily() { QFETCH(QString, css); css.prepend("dummy {"); - css.append("}"); + css.append(QLatin1Char('}')); QCss::Parser parser(css); QCss::StyleSheet sheet; @@ -1618,7 +1618,7 @@ void tst_QCssParser::extractBorder() QFETCH(QColor, expectedTopColor); css.prepend("dummy {"); - css.append("}"); + css.append(QLatin1Char('}')); QCss::Parser parser(css); QCss::StyleSheet sheet; diff --git a/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp b/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp index de0c2d6dbe..60ad5d32f5 100644 --- a/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp +++ b/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp @@ -1123,10 +1123,10 @@ void tst_QTextLayout::boundingRectTopLeft() void tst_QTextLayout::graphemeBoundaryForSurrogatePairs() { QString txt; - txt.append("a"); + txt.append(QLatin1Char('a')); txt.append(0xd87e); txt.append(0xdc25); - txt.append("b"); + txt.append(QLatin1Char('b')); QTextLayout layout(txt); QTextEngine *engine = layout.engine(); const QCharAttributes *attrs = engine->attributes(); diff --git a/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp b/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp index 2595bba2a9..37b815c2e3 100644 --- a/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp +++ b/tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp @@ -130,7 +130,7 @@ struct ShapeTable { static void prepareShapingTest(const QFont &font, const ShapeTable *shape_table) { for (const ShapeTable *s = shape_table; s->unicode[0]; ++s) { - QByteArray testName = font.family().toLatin1() + ":"; + QByteArray testName = font.family().toLatin1() + ':'; QString string; for (const ushort *u = s->unicode; *u; ++u) { string.append(QChar(*u)); diff --git a/tests/auto/network/access/qftp/tst_qftp.cpp b/tests/auto/network/access/qftp/tst_qftp.cpp index 795548ccc8..8b5dd40d3e 100644 --- a/tests/auto/network/access/qftp/tst_qftp.cpp +++ b/tests/auto/network/access/qftp/tst_qftp.cpp @@ -2048,10 +2048,10 @@ bool tst_QFtp::dirExists( const QString &host, quint16 port, const QString &user addCommand( QFtp::ConnectToHost, ftp->connectToHost( host, port ) ); addCommand( QFtp::Login, ftp->login( user, password ) ); - if ( dirToCreate.startsWith( "/" ) ) + if ( dirToCreate.startsWith( QLatin1Char('/') ) ) addCommand( QFtp::Cd, ftp->cd( dirToCreate ) ); else - addCommand( QFtp::Cd, ftp->cd( cdDir + "/" + dirToCreate ) ); + addCommand( QFtp::Cd, ftp->cd( cdDir + QLatin1Char('/') + dirToCreate ) ); addCommand( QFtp::Close, ftp->close() ); inFileDirExistsFunction = true; diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp index debdc6bcb3..6c919eb3f9 100644 --- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp @@ -2780,7 +2780,7 @@ void tst_QNetworkReply::postToHttpsMultipart() // hack for testing the setting of the content-type header by hand: if (contentType == "custom") { - QByteArray contentType("multipart/custom; boundary=\"" + multiPart->boundary() + "\""); + QByteArray contentType("multipart/custom; boundary=\"" + multiPart->boundary() + '"'); request.setHeader(QNetworkRequest::ContentTypeHeader, contentType); } @@ -2932,7 +2932,7 @@ void tst_QNetworkReply::connectToIPv6Address() QVERIFY2(waitForFinish(reply) == Success, msgWaitForFinished(reply)); QByteArray content = reply->readAll(); //qDebug() << server.receivedData; - QByteArray hostinfo = "\r\nHost: " + hostfield + ":" + QByteArray::number(server.serverPort()) + "\r\n"; + QByteArray hostinfo = "\r\nHost: " + hostfield + ':' + QByteArray::number(server.serverPort()) + "\r\n"; QVERIFY(server.receivedData.contains(hostinfo)); QCOMPARE(content, dataToSend); QCOMPARE(reply->url(), request.url()); @@ -4943,7 +4943,7 @@ void tst_QNetworkReply::ioGetFromBuiltinHttp() const int allowedDeviation = 16; // TODO find out why the send rate is 13% faster currently const int minRate = rate * 1024 * (100-allowedDeviation) / 100; const int maxRate = rate * 1024 * (100+allowedDeviation) / 100; - qDebug() << minRate << "<="<< server.transferRate << "<=" << maxRate << "?"; + qDebug() << minRate << "<="<< server.transferRate << "<=" << maxRate << '?'; // The test takes too long to run if sending enough data to overwhelm the // reciever's kernel buffers. //QEXPECT_FAIL("http+limited", "Limiting is broken right now, check QTBUG-15065", Continue); @@ -5519,7 +5519,7 @@ void tst_QNetworkReply::sendCookies_data() list.clear(); cookie = QNetworkCookie("a", "b"); cookie.setPath("/"); - cookie.setDomain("." + QtNetworkSettings::serverDomainName()); + cookie.setDomain(QLatin1Char('.') + QtNetworkSettings::serverDomainName()); list << cookie; QTest::newRow("domain-match") << list << "a=b"; @@ -5852,7 +5852,7 @@ void tst_QNetworkReply::httpConnectionCount() QCoreApplication::instance()->processEvents(); for (int i = 0; i < 10; i++) { - QNetworkRequest request (QUrl("http://127.0.0.1:" + QString::number(server.serverPort()) + "/" + QString::number(i))); + QNetworkRequest request (QUrl("http://127.0.0.1:" + QString::number(server.serverPort()) + QLatin1Char('/') + QString::number(i))); QNetworkReply* reply = manager.get(request); reply->setParent(&server); } diff --git a/tests/auto/network/kernel/qnetworkinterface/tst_qnetworkinterface.cpp b/tests/auto/network/kernel/qnetworkinterface/tst_qnetworkinterface.cpp index f7798bbb70..64623df960 100644 --- a/tests/auto/network/kernel/qnetworkinterface/tst_qnetworkinterface.cpp +++ b/tests/auto/network/kernel/qnetworkinterface/tst_qnetworkinterface.cpp @@ -141,7 +141,7 @@ void tst_QNetworkInterface::dump() s.nospace() << ": " << qPrintable(e.ip().toString()); if (!e.netmask().isNull()) s.nospace() << '/' << e.prefixLength() - << " (" << qPrintable(e.netmask().toString()) << ")"; + << " (" << qPrintable(e.netmask().toString()) << ')'; if (!e.broadcast().isNull()) s.nospace() << " broadcast " << qPrintable(e.broadcast().toString()); } diff --git a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp index 847e065aa8..df60501628 100644 --- a/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp +++ b/tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp @@ -534,7 +534,7 @@ void tst_QLocalSocket::sendData() if (server.hasPendingConnections()) { QString testLine = "test"; for (int i = 0; i < 50000; ++i) - testLine += "a"; + testLine += QLatin1Char('a'); QLocalSocket *serverSocket = server.nextPendingConnection(); QVERIFY(serverSocket); QCOMPARE(serverSocket->state(), QLocalSocket::ConnectedState); @@ -1205,7 +1205,7 @@ void tst_QLocalSocket::verifyListenWithDescriptor() QVERIFY2(server.fullServerName().at(0) == at, "abstract sockets should start with a '@'"); } else { QCOMPARE(server.fullServerName(), path); - if (path.contains(QLatin1String("/"))) { + if (path.contains(QLatin1Char('/'))) { QVERIFY2(server.serverName() == path.mid(path.lastIndexOf(QLatin1Char('/'))+1), "server name invalid short name"); } else { QVERIFY2(server.serverName() == path, "servier name doesn't match the path provided"); diff --git a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp index 44b2a5c40e..a5ba405dd4 100644 --- a/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp +++ b/tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp @@ -1776,7 +1776,7 @@ void tst_QTcpSocket::atEnd() // Test server must use some vsFTPd 2.x.x version QVERIFY2(greeting.length() == sizeof("220 (vsFTPd 2.x.x)")-1, qPrintable(greeting)); QVERIFY2(greeting.startsWith("220 (vsFTPd 2."), qPrintable(greeting)); - QVERIFY2(greeting.endsWith(")"), qPrintable(greeting)); + QVERIFY2(greeting.endsWith(QLatin1Char(')')), qPrintable(greeting)); delete socket; } diff --git a/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp b/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp index 4c288fffaf..0e597e39e2 100644 --- a/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp +++ b/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp @@ -1064,7 +1064,7 @@ QString tst_QSslCertificate::toString(const QList& errors) QStringList errorStrings; foreach (const QSslError& error, errors) { - errorStrings.append(QLatin1String("\"") + error.errorString() + QLatin1String("\"")); + errorStrings.append(QLatin1Char('"') + error.errorString() + QLatin1Char('"')); } return QLatin1String("[ ") + errorStrings.join(QLatin1String(", ")) + QLatin1String(" ]"); diff --git a/tests/auto/other/atwrapper/atWrapper.cpp b/tests/auto/other/atwrapper/atWrapper.cpp index 4260ca18b8..a75a7b91bf 100644 --- a/tests/auto/other/atwrapper/atWrapper.cpp +++ b/tests/auto/other/atwrapper/atWrapper.cpp @@ -149,9 +149,10 @@ void atWrapper::ftpMgetDone( bool error) if ( mgetDirList.size() > 1 ) for ( int i = 1; i < mgetDirList.size(); ++i ) { - file = new QFile( QString( output ) + "/" + mgetDirList.at( 0 ) + "/" + mgetDirList.at( i ) ); + file = new QFile( QString( output ) + QLatin1Char('/') + mgetDirList.at( 0 ) + + QLatin1Char('/') + mgetDirList.at( i ) ); if (file->open(QIODevice::WriteOnly)) { - ftp.get( ftpBaseDir + "/" + mgetDirList.at( 0 ) + "/" + mgetDirList.at( i ), file ); + ftp.get( ftpBaseDir + QLatin1Char('/') + mgetDirList.at( 0 ) + QLatin1Char('/') + mgetDirList.at( i ), file ); ftp.list(); //Only there to fill up a slot in the pendingCommands queue. while ( ftp.hasPendingCommands() ) QCoreApplication::instance()->processEvents(); @@ -192,11 +193,11 @@ bool atWrapper::setupFTP() QString dir = ""; ftpMkDir( ftpBaseDir ); - ftpBaseDir += "/" + QLibraryInfo::buildKey(); + ftpBaseDir += QLatin1Char('/') + QLibraryInfo::buildKey(); ftpMkDir( ftpBaseDir ); - ftpBaseDir += "/" + QString( qVersion() ); + ftpBaseDir += QLatin1Char('/') + QString( qVersion() ); ftpMkDir( ftpBaseDir ); @@ -209,9 +210,9 @@ bool atWrapper::setupFTP() { i.next(); //qDebug() << "Creating dir with key:" << i.key(); - ftpMkDir( ftpBaseDir + "/" + QString( i.key() ) + ".failed" ); - ftpMkDir( ftpBaseDir + "/" + QString( i.key() ) + ".diff" ); - if (!ftpMkDir( ftpBaseDir + "/" + QString( i.key() ) + ".baseline" )) + ftpMkDir( ftpBaseDir + QLatin1Char('/') + QString( i.key() ) + ".failed" ); + ftpMkDir( ftpBaseDir + QLatin1Char('/') + QString( i.key() ) + ".diff" ); + if (!ftpMkDir( ftpBaseDir + QLatin1Char('/') + QString( i.key() ) + ".baseline" )) haveBaseline = false; } @@ -226,7 +227,7 @@ bool atWrapper::setupFTP() { j.next(); rmDirList.clear(); - rmDirList << ftpBaseDir + "/" + j.key() + ".failed" + "/"; + rmDirList << ftpBaseDir + QLatin1Char('/') + j.key() + ".failed/"; ftpRmDir( j.key() + ".failed" ); ftp.rmdir( j.key() + ".failed" ); ftp.mkdir( j.key() + ".failed" ); @@ -236,7 +237,7 @@ bool atWrapper::setupFTP() QCoreApplication::instance()->processEvents(); rmDirList.clear(); - rmDirList << ftpBaseDir + "/" + j.key() + ".diff" + "/"; + rmDirList << ftpBaseDir + QLatin1Char('/') + j.key() + ".diff/"; ftpRmDir( j.key() + ".diff" ); ftp.rmdir( j.key() + ".diff" ); ftp.mkdir( j.key() + ".diff" ); @@ -396,7 +397,7 @@ void atWrapper::createBaseline() for (int n = 0; n < list.size(); n++) { QFileInfo fileInfo = list.at( n ); - QFile file( QString( output ) + "/" + i.key() + "/" + fileInfo.fileName() ); + QFile file( QString( output ) + QLatin1Char('/') + i.key() + QLatin1Char('/') + fileInfo.fileName() ); file.open( QIODevice::ReadOnly ); QByteArray fileData = file.readAll(); //qDebug() << "Sending up:" << fileInfo.fileName() << "with file size" << fileData.size(); @@ -470,9 +471,9 @@ bool atWrapper::diff( QString basedir, QString dir, QString target ) //Comparing the two specified files, and then uploading them to //the ftp server if they differ - basedir += "/" + dir; + basedir += QLatin1Char('/') + dir; QString one = basedir + ".baseline/" + target; - QString two = basedir + "/" + target; + QString two = basedir + QLatin1Char('/') + target; QFile file( one ); @@ -517,7 +518,7 @@ void atWrapper::uploadDiff( QString basedir, QString dir, QString filename ) qDebug() << basedir; QImage im1( basedir + ".baseline/" + filename ); - QImage im2( basedir + "/" + filename ); + QImage im2( basedir + QLatin1Char('/') + filename ); QImage im3(im1.size(), QImage::Format_ARGB32); @@ -591,16 +592,16 @@ bool atWrapper::loadConfig( QString path ) QDir::current().mkdir( output ); - output += "/" + QLibraryInfo::buildKey(); + output += QLatin1Char('/') + QLibraryInfo::buildKey(); QDir::current().mkdir( output ); - output += "/" + QString( qVersion() ); + output += QLatin1Char('/') + QString( qVersion() ); QDir::current().mkdir( output ); - ftpBaseDir += "/" + QHostInfo::localHostName().split( "." ).first(); + ftpBaseDir += QLatin1Char('/') + QHostInfo::localHostName().split( QLatin1Char('.') ).first(); /* diff --git a/tests/auto/other/macnativeevents/qnativeevents.cpp b/tests/auto/other/macnativeevents/qnativeevents.cpp index 1402182042..db8f2bd193 100644 --- a/tests/auto/other/macnativeevents/qnativeevents.cpp +++ b/tests/auto/other/macnativeevents/qnativeevents.cpp @@ -222,46 +222,46 @@ QDebug operator<<(QDebug d, const QNativeEvent &e) QTextStream &operator<<(QTextStream &s, QNativeEvent *e) { - return s << e->eventId << " " << e->modifiers << " QNativeEvent"; + return s << e->eventId << ' ' << e->modifiers << " QNativeEvent"; } QTextStream &operator<<(QTextStream &s, QNativeMouseEvent *e) { - return s << e->eventId << " " << e->globalPos.x() << " " << e->globalPos.y() << " " << e->modifiers << " " << e->toString(); + return s << e->eventId << ' ' << e->globalPos.x() << ' ' << e->globalPos.y() << ' ' << e->modifiers << ' ' << e->toString(); } QTextStream &operator<<(QTextStream &s, QNativeMouseMoveEvent *e) { - return s << e->eventId << " " << e->globalPos.x() << " " << e->globalPos.y() << " " << e->modifiers << " " << e->toString(); + return s << e->eventId << ' ' << e->globalPos.x() << ' ' << e->globalPos.y() << ' ' << e->modifiers << ' ' << e->toString(); } QTextStream &operator<<(QTextStream &s, QNativeMouseButtonEvent *e) { - return s << e->eventId << " " << e->globalPos.x() << " " << e->globalPos.y() << " " << e->button - << " " << e->clickCount << " " << e->modifiers << " " << e->toString(); + return s << e->eventId << ' ' << e->globalPos.x() << ' ' << e->globalPos.y() << ' ' << e->button + << ' ' << e->clickCount << ' ' << e->modifiers << ' ' << e->toString(); } QTextStream &operator<<(QTextStream &s, QNativeMouseDragEvent *e) { - return s << e->eventId << " " << e->globalPos.x() << " " << e->globalPos.y() << " " << e->button << " " << e->clickCount - << " " << e->modifiers << " " << e->toString(); + return s << e->eventId << ' ' << e->globalPos.x() << ' ' << e->globalPos.y() << ' ' << e->button << ' ' << e->clickCount + << ' ' << e->modifiers << ' ' << e->toString(); } QTextStream &operator<<(QTextStream &s, QNativeMouseWheelEvent *e) { - return s << e->eventId << " " << e->globalPos.x() << " " << e->globalPos.y() << " " << e->delta - << " " << e->modifiers << " " << e->toString(); + return s << e->eventId << ' ' << e->globalPos.x() << ' ' << e->globalPos.y() << ' ' << e->delta + << ' ' << e->modifiers << ' ' << e->toString(); } QTextStream &operator<<(QTextStream &s, QNativeKeyEvent *e) { - return s << e->eventId << " " << e->press << " " << e->nativeKeyCode << " " << e->character - << " " << e->modifiers << " " << e->toString(); + return s << e->eventId << ' ' << e->press << ' ' << e->nativeKeyCode << ' ' << e->character + << ' ' << e->modifiers << ' ' << e->toString(); } QTextStream &operator<<(QTextStream &s, QNativeModifierEvent *e) { - return s << e->eventId << " " << e->modifiers << " " << e->nativeKeyCode << " " << e->toString(); + return s << e->eventId << ' ' << e->modifiers << ' ' << e->nativeKeyCode << ' ' << e->toString(); } diff --git a/tests/auto/other/qvariant_common/tst_qvariant_common.h b/tests/auto/other/qvariant_common/tst_qvariant_common.h index 79a5707de8..6a7c125089 100644 --- a/tests/auto/other/qvariant_common/tst_qvariant_common.h +++ b/tests/auto/other/qvariant_common/tst_qvariant_common.h @@ -72,7 +72,7 @@ protected: currentName.chop(1); ok &= (msg.contains(", " + currentName) || msg.contains(", 0x0")); } - ok &= msg.endsWith(")"); + ok &= msg.endsWith(QLatin1Char(')')); QVERIFY2(ok, (QString::fromLatin1("Message is not correctly finished: '") + msg + '\'').toLatin1().constData()); } diff --git a/tests/auto/sql/kernel/qsqldatabase/tst_databases.h b/tests/auto/sql/kernel/qsqldatabase/tst_databases.h index fe8a3689b0..3ba4833dd5 100644 --- a/tests/auto/sql/kernel/qsqldatabase/tst_databases.h +++ b/tests/auto/sql/kernel/qsqldatabase/tst_databases.h @@ -119,7 +119,7 @@ inline static QString qTableName(const QString& prefix, QSqlDatabase db) QString tableStr; if (db.driverName().toLower().contains("ODBC")) tableStr += QLatin1String("_odbc"); - return fixupTableName(QString(db.driver()->escapeIdentifier(prefix + tableStr + "_" + + return fixupTableName(QString(db.driver()->escapeIdentifier(prefix + tableStr + QLatin1Char('_') + qGetHostName(), QSqlDriver::TableName)),db); } @@ -219,12 +219,12 @@ public: } // construct a stupid unique name - QString cName = QString::number( counter++ ) + "_" + driver + "@"; + QString cName = QString::number( counter++ ) + QLatin1Char('_') + driver + QLatin1Char('@'); cName += host.isEmpty() ? dbName : host; if ( port > 0 ) - cName += ":" + QString::number( port ); + cName += QLatin1Char(':') + QString::number( port ); db = QSqlDatabase::addDatabase( driver, cName ); @@ -364,7 +364,7 @@ public: // for debugging only: outputs the connection as string static QString dbToString( const QSqlDatabase db ) { - QString res = db.driverName() + "@"; + QString res = db.driverName() + QLatin1Char('@'); if ( db.driverName().startsWith( "QODBC" ) || db.driverName().startsWith( "QOCI" ) ) { res += db.databaseName(); @@ -373,7 +373,7 @@ public: } if ( db.port() > 0 ) { - res += ":" + QString::number( db.port() ); + res += QLatin1Char(':') + QString::number( db.port() ); } return res; @@ -522,7 +522,7 @@ public: result += '\''; if(!err.driverText().isEmpty()) result += err.driverText() + "' || '"; - result += err.databaseText() + "'"; + result += err.databaseText() + QLatin1Char('\''); return result.toLocal8Bit(); } @@ -534,7 +534,7 @@ public: result += '\''; if(!err.driverText().isEmpty()) result += err.driverText() + "' || '"; - result += err.databaseText() + "'"; + result += err.databaseText() + QLatin1Char('\''); return result.toLocal8Bit(); } diff --git a/tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp b/tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp index 83cf0394f9..5738f20f15 100644 --- a/tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp +++ b/tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp @@ -217,7 +217,7 @@ struct FieldDef { { QString rt = typeName; rt.replace(QRegExp("\\s"), QString("_")); - int i = rt.indexOf("("); + int i = rt.indexOf(QLatin1Char('(')); if (i == -1) i = rt.length(); if (i > 20) diff --git a/tests/auto/sql/kernel/qsqldriver/tst_qsqldriver.cpp b/tests/auto/sql/kernel/qsqldriver/tst_qsqldriver.cpp index 2f48b65e74..5273632138 100644 --- a/tests/auto/sql/kernel/qsqldriver/tst_qsqldriver.cpp +++ b/tests/auto/sql/kernel/qsqldriver/tst_qsqldriver.cpp @@ -79,7 +79,7 @@ void tst_QSqlDriver::recreateTestTables(QSqlDatabase db) tst_Databases::safeDropTable( db, relTEST1 ); QString doubleField = (dbType == QSqlDriver::SQLite) ? "more_data double" : "more_data double(8,7)"; QVERIFY_SQL( q, exec("create table " + relTEST1 + - " (id int not null primary key, name varchar(20), title_key int, another_title_key int, " + doubleField + ")")); + " (id int not null primary key, name varchar(20), title_key int, another_title_key int, " + doubleField + QLatin1Char(')'))); QVERIFY_SQL( q, exec("insert into " + relTEST1 + " values(1, 'harry', 1, 2, 1.234567)")); QVERIFY_SQL( q, exec("insert into " + relTEST1 + " values(2, 'trond', 2, 1, 8.901234)")); QVERIFY_SQL( q, exec("insert into " + relTEST1 + " values(3, 'vohi', 1, 2, 5.678901)")); diff --git a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp index b98ab68ae9..6311e4c480 100644 --- a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp +++ b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp @@ -959,14 +959,14 @@ void tst_QSqlQuery::value() if (dbType == QSqlDriver::Interbase) QVERIFY( q.value( 1 ).toString().startsWith( "VarChar" + QString::number( i ) ) ); - else if ( q.value( 1 ).toString().right( 1 ) == " " ) + else if ( q.value( 1 ).toString().endsWith(QLatin1Char(' '))) QCOMPARE( q.value( 1 ).toString(), ( "VarChar" + QString::number( i ) + " " ) ); else QCOMPARE( q.value( 1 ).toString(), ( "VarChar" + QString::number( i ) ) ); if (dbType == QSqlDriver::Interbase) QVERIFY( q.value( 2 ).toString().startsWith( "Char" + QString::number( i ) ) ); - else if ( q.value( 2 ).toString().right( 1 ) != " " ) + else if (!q.value( 2 ).toString().endsWith(QLatin1Char(' '))) QCOMPARE( q.value( 2 ).toString(), ( "Char" + QString::number( i ) ) ); else QCOMPARE( q.value( 2 ).toString(), ( "Char" + QString::number( i ) + " " ) ); @@ -3145,7 +3145,7 @@ void tst_QSqlQuery::sqlServerReturn0() "SELECT * FROM "+tableName+" WHERE ID = 2 " "RETURN 0")); - QVERIFY_SQL(q, exec("{CALL "+procName+"}")); + QVERIFY_SQL(q, exec("{CALL " + procName + QLatin1Char('}'))); QVERIFY_SQL(q, next()); } @@ -3162,7 +3162,7 @@ void tst_QSqlQuery::QTBUG_551() TYPE IntType IS TABLE OF INTEGER INDEX BY BINARY_INTEGER;\n\ TYPE VCType IS TABLE OF VARCHAR2(60) INDEX BY BINARY_INTEGER;\n\ PROCEDURE P (Inp IN IntType, Outp OUT VCType);\n\ - END "+pkgname+";")); + END "+ pkgname + QLatin1Char(';'))); QVERIFY_SQL(q, exec("CREATE OR REPLACE PACKAGE BODY "+pkgname+" IS\n\ PROCEDURE P (Inp IN IntType, Outp OUT VCType)\n\ @@ -3172,7 +3172,7 @@ void tst_QSqlQuery::QTBUG_551() Outp(2) := '2. Value is ' ||TO_CHAR(Inp(2));\n\ Outp(3) := '3. Value is ' ||TO_CHAR(Inp(3));\n\ END p;\n\ - END "+pkgname+";")); + END " + pkgname + QLatin1Char(';'))); QVariantList inLst, outLst, res_outLst; @@ -3310,7 +3310,7 @@ void tst_QSqlQuery::QTBUG_6421() QVERIFY_SQL(q, exec("create index INDEX2 on "+tableName+" (COL2 desc)")); QVERIFY_SQL(q, exec("create index INDEX3 on "+tableName+" (COL3 desc)")); q.setForwardOnly(true); - QVERIFY_SQL(q, exec("select COLUMN_EXPRESSION from ALL_IND_EXPRESSIONS where TABLE_NAME='"+tableName+"'")); + QVERIFY_SQL(q, exec("select COLUMN_EXPRESSION from ALL_IND_EXPRESSIONS where TABLE_NAME='" + tableName + QLatin1Char('\''))); QVERIFY_SQL(q, next()); QCOMPARE(q.value(0).toString(), QLatin1String("\"COL1\"")); QVERIFY_SQL(q, next()); @@ -3338,7 +3338,7 @@ void tst_QSqlQuery::QTBUG_6618() "begin\n" " raiserror('" + errorString + "', 16, 1)\n" "end\n" )); - q.exec("{call " + qTableName("tst_raiseError", __FILE__, db) + "}"); + q.exec("{call " + qTableName("tst_raiseError", __FILE__, db) + QLatin1Char('}')); QVERIFY(q.lastError().text().contains(errorString)); } @@ -3430,7 +3430,7 @@ void tst_QSqlQuery::QTBUG_21884() QStringList stList; QString tableName(qTableName("bug21884", __FILE__, db)); stList << "create table " + tableName + "(id integer primary key, note string)"; - stList << "select * from " + tableName + ";"; + stList << "select * from " + tableName + QLatin1Char(';'); stList << "select * from " + tableName + "; \t\n\r"; stList << "drop table " + tableName; @@ -3984,7 +3984,7 @@ void runIntegralTypesMysqlTest(QSqlDatabase &db, const QString &tableName, const { QSqlQuery q(db); QVERIFY_SQL(q, exec("DROP TABLE IF EXISTS " + tableName)); - QVERIFY_SQL(q, exec("CREATE TABLE " + tableName + " (id " + type + ")")); + QVERIFY_SQL(q, exec("CREATE TABLE " + tableName + " (id " + type + ')')); const int steps = 20; const T increment = max / steps - min / steps; @@ -4001,7 +4001,7 @@ void runIntegralTypesMysqlTest(QSqlDatabase &db, const QString &tableName, const q.bindValue(0, v); QVERIFY_SQL(q, exec()); } else { - QVERIFY_SQL(q, exec("INSERT INTO " + tableName + " (id) VALUES (" + QString::number(v) + ")")); + QVERIFY_SQL(q, exec("INSERT INTO " + tableName + " (id) VALUES (" + QString::number(v) + QLatin1Char(')'))); } values[i] = v; v += increment; diff --git a/tests/auto/sql/models/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp b/tests/auto/sql/models/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp index 3702631275..fbc583f341 100644 --- a/tests/auto/sql/models/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp +++ b/tests/auto/sql/models/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp @@ -1115,7 +1115,7 @@ void tst_QSqlRelationalTableModel::casing() QCOMPARE( rec.count(), 0); //try an owner that does exist - rec = db.driver()->record(db.userName() + "." + qTableName("CASETEST1", db).toUpper()); + rec = db.driver()->record(db.userName() + QLatin1Char('.') + qTableName("CASETEST1", db).toUpper()); QCOMPARE( rec.count(), 4); } QSqlRecord rec = db.driver()->record(qTableName("CASETEST1", db).toUpper()); @@ -1464,13 +1464,13 @@ void tst_QSqlRelationalTableModel::psqlSchemaTest() QSqlQuery q(db); QVERIFY_SQL(q, exec("create schema " + qTableName("QTBUG_5373", __FILE__, db))); QVERIFY_SQL(q, exec("create schema " + qTableName("QTBUG_5373_s2", __FILE__, db))); - QVERIFY_SQL(q, exec("create table " + qTableName("QTBUG_5373", __FILE__, db) + "." + qTableName("document", __FILE__, db) + + QVERIFY_SQL(q, exec("create table " + qTableName("QTBUG_5373", __FILE__, db) + QLatin1Char('.') + qTableName("document", __FILE__, db) + "(document_id int primary key, relatingid int, userid int)")); - QVERIFY_SQL(q, exec("create table " + qTableName("QTBUG_5373_s2", __FILE__, db) + "." + qTableName("user", __FILE__, db) + + QVERIFY_SQL(q, exec("create table " + qTableName("QTBUG_5373_s2", __FILE__, db) + QLatin1Char('.') + qTableName("user", __FILE__, db) + "(userid int primary key, username char(40))")); - model.setTable(qTableName("QTBUG_5373", __FILE__, db) + "." + qTableName("document", __FILE__, db)); - model.setRelation(1, QSqlRelation(qTableName("QTBUG_5373_s2", __FILE__, db) + "." + qTableName("user", __FILE__, db), "userid", "username")); - model.setRelation(2, QSqlRelation(qTableName("QTBUG_5373_s2", __FILE__, db) + "." + qTableName("user", __FILE__, db), "userid", "username")); + model.setTable(qTableName("QTBUG_5373", __FILE__, db) + QLatin1Char('.') + qTableName("document", __FILE__, db)); + model.setRelation(1, QSqlRelation(qTableName("QTBUG_5373_s2", __FILE__, db) + QLatin1Char('.') + qTableName("user", __FILE__, db), "userid", "username")); + model.setRelation(2, QSqlRelation(qTableName("QTBUG_5373_s2", __FILE__, db) + QLatin1Char('.') + qTableName("user", __FILE__, db), "userid", "username")); QVERIFY_SQL(model, select()); model.setJoinMode(QSqlRelationalTableModel::LeftJoin); @@ -1515,14 +1515,14 @@ void tst_QSqlRelationalTableModel::relationOnFirstColumn() //prepare test1 table QSqlQuery q(db); QVERIFY_SQL(q, exec("CREATE TABLE " + testTable1 + " (val1 INTEGER, id1 INTEGER PRIMARY KEY);")); - QVERIFY_SQL(q, exec("DELETE FROM " + testTable1 + ";")); + QVERIFY_SQL(q, exec("DELETE FROM " + testTable1 + QLatin1Char(';'))); QVERIFY_SQL(q, exec("INSERT INTO " + testTable1 + " (id1, val1) VALUES(1, 10);")); QVERIFY_SQL(q, exec("INSERT INTO " + testTable1 + " (id1, val1) VALUES(2, 20);")); QVERIFY_SQL(q, exec("INSERT INTO " + testTable1 + " (id1, val1) VALUES(3, 30);")); //prepare test2 table QVERIFY_SQL(q, exec("CREATE TABLE " + testTable2 + " (id INTEGER PRIMARY KEY, name TEXT);")); - QVERIFY_SQL(q, exec("DELETE FROM " + testTable2 + ";")); + QVERIFY_SQL(q, exec("DELETE FROM " + testTable2 + QLatin1Char(';'))); QVERIFY_SQL(q, exec("INSERT INTO " + testTable2 + " (id, name) VALUES (10, 'Hervanta');")); QVERIFY_SQL(q, exec("INSERT INTO " + testTable2 + " (id, name) VALUES (20, 'Keskusta');")); QVERIFY_SQL(q, exec("INSERT INTO " + testTable2 + " (id, name) VALUES (30, 'Annala');")); diff --git a/tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp b/tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp index 2ace79973b..fff9811e60 100644 --- a/tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp +++ b/tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp @@ -1987,7 +1987,7 @@ void tst_QSqlTableModel::tableModifyWithBlank() //set a filter on the table so the only record we get is the one we just made //I could just do another setData command, but I want to make sure the TableModel //matches exactly what is stored in the database - model.setFilter("column1='"+timeString+"'"); //filter to get just the newly entered row + model.setFilter("column1='" + timeString + QLatin1Char('\'')); //filter to get just the newly entered row QVERIFY_SQL(model, select()); //Make sure we only get one record, and that it is the one we just made diff --git a/tests/auto/tools/qmake/testcompiler.cpp b/tests/auto/tools/qmake/testcompiler.cpp index 601d626b5c..23a7012af7 100644 --- a/tests/auto/tools/qmake/testcompiler.cpp +++ b/tests/auto/tools/qmake/testcompiler.cpp @@ -296,7 +296,7 @@ bool TestCompiler::make( const QString &workPath, const QString &target, bool ex bool TestCompiler::exists( const QString &destDir, const QString &exeName, BuildType buildType, const QString &version ) { - QFileInfo f(destDir + "/" + targetName(buildType, exeName, version)); + QFileInfo f(destDir + QLatin1Char('/') + targetName(buildType, exeName, version)); return f.exists(); } diff --git a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp index cc321bb137..fbd368d077 100644 --- a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp +++ b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp @@ -956,7 +956,7 @@ void tst_QFiledialog::selectFiles() QListView* listView = fd.findChild("listView"); QVERIFY(listView); for (int i = 0; i < list.count(); ++i) { - fd.selectFile(fd.directory().path() + "/" + list.at(i)); + fd.selectFile(fd.directory().path() + QLatin1Char('/') + list.at(i)); QTRY_VERIFY(!listView->selectionModel()->selectedRows().isEmpty()); toSelect.append(listView->selectionModel()->selectedRows().last()); } diff --git a/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp b/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp index 7e6e5908ee..1e9cbe6578 100644 --- a/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp +++ b/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp @@ -514,7 +514,7 @@ protected: path = parentIndex.child(source_row,0).data(Qt::DisplayRole).toString(); do { - path = parentIndex.data(Qt::DisplayRole).toString() + "/" + path; + path = parentIndex.data(Qt::DisplayRole).toString() + QLatin1Char('/') + path; parentIndex = parentIndex.parent(); } while(parentIndex.isValid()); @@ -897,7 +897,7 @@ void tst_QFileDialog2::task228844_ensurePreviousSorting() #else QTest::qWait(500); #endif - QCOMPARE(fd2.selectedFiles().first(), current.absolutePath() + QChar('/') + QLatin1String("g")); + QCOMPARE(fd2.selectedFiles().first(), current.absolutePath() + QLatin1String("/g")); QNonNativeFileDialog fd3(0, "This is a third file dialog", tempFile->fileName()); fd3.restoreState(fd.saveState()); diff --git a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp index 0e7f760b4e..bbe027fbc6 100644 --- a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp +++ b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp @@ -1097,7 +1097,7 @@ void tst_QFileSystemModel::permissions() // checks QTBUG-20503 QFETCH(bool, readOnly); const QString tmp = flatDirTestPath; - const QString file = tmp + '/' + "f"; + const QString file = tmp + QLatin1String("/f"); QVERIFY(createFiles(tmp, QStringList() << "f")); QVERIFY(QFile::setPermissions(file, QFile::Permissions(permissions))); diff --git a/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp b/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp index 97cfec8171..fd78bd870b 100644 --- a/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp +++ b/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp @@ -606,7 +606,7 @@ void tst_QMessageBox::detailsButtonText() QAbstractButton* btn = NULL; foreach(btn, list) { if (btn && (btn->inherits("QPushButton"))) { - if (btn->text().remove("&") != QMessageBox::tr("OK") + if (btn->text().remove(QLatin1Char('&')) != QMessageBox::tr("OK") && btn->text() != QMessageBox::tr("Show Details...")) { QFAIL(qPrintable(QString("Unexpected messagebox button text: %1").arg(btn->text()))); } diff --git a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp index b2bdbac79a..5fddaf21ea 100644 --- a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp +++ b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp @@ -547,8 +547,8 @@ void tst_QWizard::setDefaultProperty() // make sure the data structure is reasonable for (int i = 0; i < 200000; ++i) { - wizard.setDefaultProperty("QLineEdit", QByteArray("x" + QByteArray::number(i)).constData(), 0); - wizard.setDefaultProperty("QLabel", QByteArray("y" + QByteArray::number(i)).constData(), 0); + wizard.setDefaultProperty("QLineEdit", QByteArray('x' + QByteArray::number(i)).constData(), 0); + wizard.setDefaultProperty("QLabel", QByteArray('y' + QByteArray::number(i)).constData(), 0); } } @@ -2115,7 +2115,7 @@ void tst_QWizard::combinations() } if (minSizeTest) - qDebug() << "minimum sizes" << reason.latin1() << ";" << wizard.minimumSizeHint() + qDebug() << "minimum sizes" << reason.latin1() << ';' << wizard.minimumSizeHint() << otor.latin1() << refMinSize; if (imageTest) diff --git a/tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp b/tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp index f12876f745..63cf7b2751 100644 --- a/tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp +++ b/tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp @@ -416,14 +416,14 @@ void tst_QDirModel::rowsAboutToBeRemoved_data() bool tst_QDirModel::rowsAboutToBeRemoved_init(const QString &test_path, const QStringList &initial_files) { - QString path = QDir::currentPath() + "/" + test_path; + QString path = QDir::currentPath() + QLatin1Char('/') + test_path; if (!QDir::current().mkdir(test_path) && false) { // FIXME qDebug() << "failed to create dir" << path; return false; } for (int i = 0; i < initial_files.count(); ++i) { - QFile file(path + "/" + initial_files.at(i)); + QFile file(path + QLatin1Char('/') + initial_files.at(i)); if (!file.open(QIODevice::WriteOnly)) { qDebug() << "failed to open file" << initial_files.at(i); return false; @@ -443,7 +443,7 @@ bool tst_QDirModel::rowsAboutToBeRemoved_init(const QString &test_path, const QS bool tst_QDirModel::rowsAboutToBeRemoved_cleanup(const QString &test_path) { - QString path = QDir::currentPath() + "/" + test_path; + QString path = QDir::currentPath() + QLatin1Char('/') + test_path; QDir dir(path, "*", QDir::SortFlags(QDir::Name|QDir::IgnoreCase), QDir::Files); QStringList files = dir.entryList(); @@ -584,8 +584,8 @@ void tst_QDirModel::filePath() QString path = SRCDIR; #else QString path = QFileInfo(SRCDIR).absoluteFilePath(); - if (!path.endsWith("/")) - path += "/"; + if (!path.endsWith(QLatin1Char('/'))) + path += QLatin1Char('/'); #endif QCOMPARE(model.filePath(index), path + QString( "test.lnk")); model.setResolveSymlinks(true); diff --git a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp index 7e73c19539..6738ab60df 100644 --- a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp +++ b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp @@ -2492,7 +2492,7 @@ void tst_QHeaderView::calculateAndCheck(int cppline, const int precalced_compare QString msg = "semantic problem at " + QString(__FILE__) + " (" + sline + ")"; msg += "\nThe *expected* result was : {" + istr(x[0]) + istr(x[1]) + istr(x[2]) + istr(x[3]) - + istr(x[4]) + istr(x[5]) + istr(x[6], false) + "}"; + + istr(x[4]) + istr(x[5]) + istr(x[6], false) + QLatin1Char('}'); msg += "\nThe calculated result was : {"; msg += istr(chk_visual) + istr(chk_logical) + istr(chk_sizes) + istr(chk_hidden_size) + istr(chk_lookup_visual) + istr(chk_lookup_logical) + istr(header_lenght, false) + "};"; @@ -2570,7 +2570,7 @@ void tst_QHeaderView::additionalInit() for (int i = 0; i < model->rowCount(); ++i) { model->setData(model->index(i, 0), QVariant(i)); s.setNum(i); - s += "."; + s += QLatin1Char('.'); s += 'a' + (i % 25); model->setData(model->index(i, 1), QVariant(s)); } diff --git a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp index fc671fdc9f..f066f526eb 100644 --- a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp +++ b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp @@ -2083,7 +2083,7 @@ void tst_QListView::taskQTBUG_12308_wrongFlowLayout() QListWidgetItem *item = new QListWidgetItem(); item->setText(QString("Item %L1").arg(i)); lw.addItem(item); - if (!item->text().contains(QString::fromLatin1("1"))) + if (!item->text().contains(QLatin1Char('1'))) item->setHidden(true); } lw.show(); diff --git a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp index 6d5f5a1c60..7c808b9655 100644 --- a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp +++ b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp @@ -4286,7 +4286,7 @@ void tst_QTreeView::testInitialFocus() { QTreeWidget treeWidget; treeWidget.setColumnCount(5); - new QTreeWidgetItem(&treeWidget, QStringList(QString("1;2;3;4;5").split(";"))); + new QTreeWidgetItem(&treeWidget, QStringList(QString("1;2;3;4;5").split(QLatin1Char(';')))); treeWidget.setTreePosition(2); treeWidget.header()->hideSection(0); // make sure we skip hidden section(s) treeWidget.header()->swapSections(1, 2); // make sure that we look for first visual index (and not first logical) diff --git a/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp b/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp index 117c53a2bb..afc61025ba 100644 --- a/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp +++ b/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp @@ -2007,7 +2007,7 @@ void tst_QTreeWidget::columnCount() void tst_QTreeWidget::setHeaderLabels() { - QStringList list = QString("a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z").split(","); + QStringList list = QString("a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z").split(QLatin1Char(',')); testWidget->setHeaderLabels(list); QCOMPARE(testWidget->header()->count(), list.count()); } diff --git a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp index 9f5b9b71f4..8f8b4313e2 100644 --- a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp +++ b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp @@ -502,7 +502,7 @@ static QString cstrings2QString( char **args ) while ( args[i] ) { string += args[i]; if ( args[i+1] ) - string += " "; + string += QLatin1Char(' '); ++i; } return string; @@ -1060,16 +1060,16 @@ void tst_QApplication::libraryPaths_qt_plugin_path_2() #ifdef Q_OS_UNIX QByteArray validPath = QDir("/tmp").canonicalPath().toLatin1(); QByteArray nonExistentPath = "/nonexistent"; - QByteArray pluginPath = validPath + ":" + nonExistentPath; + QByteArray pluginPath = validPath + ':' + nonExistentPath; #elif defined(Q_OS_WIN) # ifdef Q_OS_WINCE QByteArray validPath = "/Temp"; QByteArray nonExistentPath = "/nonexistent"; - QByteArray pluginPath = validPath + ";" + nonExistentPath; + QByteArray pluginPath = validPath + ';' + nonExistentPath; # else QByteArray validPath = "C:\\windows"; QByteArray nonExistentPath = "Z:\\nonexistent"; - QByteArray pluginPath = validPath + ";" + nonExistentPath; + QByteArray pluginPath = validPath + ';' + nonExistentPath; # endif #endif diff --git a/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp b/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp index 4d15ac9a93..5413b274d4 100644 --- a/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp +++ b/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp @@ -195,7 +195,7 @@ void tst_QLayout::smartMaxSize() int width = sz.width(); int expectedWidth = expectedWidths[expectedIndex]; if (width != expectedWidth) { - qDebug() << "error at index" << expectedIndex << ":" << sizePolicy.horizontalPolicy() << align << minSize << sizeHint << maxSize << width; + qDebug() << "error at index" << expectedIndex << ':' << sizePolicy.horizontalPolicy() << align << minSize << sizeHint << maxSize << width; ++regressionCount; } ++expectedIndex; diff --git a/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp b/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp index e8ac9aa5d2..e8369ef9bd 100644 --- a/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp +++ b/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp @@ -61,7 +61,7 @@ public: protected: QStringList splitPath(const QString &path) const { - return csv ? path.split(",") : QCompleter::splitPath(path); + return csv ? path.split(QLatin1Char(',')) : QCompleter::splitPath(path); } private: diff --git a/tests/baselineserver/src/baselineserver.cpp b/tests/baselineserver/src/baselineserver.cpp index 4a36c022eb..b82ef6aed1 100644 --- a/tests/baselineserver/src/baselineserver.cpp +++ b/tests/baselineserver/src/baselineserver.cpp @@ -259,7 +259,7 @@ bool BaselineHandler::establishConnection() logMsg += key + QLS(": '") + clientInfo.value(key) + QLS("', "); } qDebug() << runId << logtime() << "Connection established with" << clientInfo.value(PI_HostName) - << "[" << qPrintable(clientInfo.value(PI_HostAddress)) << "]" << logMsg + << '[' << qPrintable(clientInfo.value(PI_HostAddress)) << ']' << logMsg << "Overrides:" << clientInfo.overrides() << "AdHoc-Run:" << clientInfo.isAdHocRun(); // ### Hardcoded backwards compatibility: add project field for certain existing clients that lack it diff --git a/tests/baselineserver/src/report.cpp b/tests/baselineserver/src/report.cpp index 2f04b0509e..527c1c065c 100644 --- a/tests/baselineserver/src/report.cpp +++ b/tests/baselineserver/src/report.cpp @@ -309,7 +309,7 @@ void Report::writeFunctionResults(const ImageItemList &list) out << "No mismatch reported"; break; default: - out << "?"; + out << '?'; break; } out << "\n"; @@ -401,14 +401,14 @@ QString Report::writeResultsXmlFiles() if (!cwd.exists(dir)) cwd.mkpath(dir); foreach (const QString &func, itemLists.keys()) { - QFile f(dir + "/" + func + "-results.xml"); + QFile f(dir + QLatin1Char('/') + func + "-results.xml"); if (!f.open(QIODevice::WriteOnly)) continue; QXmlStreamWriter s(&f); s.setAutoFormatting(true); s.writeStartDocument(); foreach (QString key, plat.keys()) { - QString cmt = " " + key + "=\"" + plat.value(key) +"\" "; + QString cmt = QLatin1Char(' ') + key + "=\"" + plat.value(key) +"\" "; s.writeComment(cmt.replace("--", "[-]")); } s.writeStartElement("testsuite"); diff --git a/tests/benchmarks/corelib/codecs/qtextcodec/main.cpp b/tests/benchmarks/corelib/codecs/qtextcodec/main.cpp index aa42c11fc7..ef6e41f4f3 100644 --- a/tests/benchmarks/corelib/codecs/qtextcodec/main.cpp +++ b/tests/benchmarks/corelib/codecs/qtextcodec/main.cpp @@ -56,11 +56,11 @@ void tst_QTextCodec::codecForName() const QBENCHMARK { foreach(const QByteArray& c, codecs) { QVERIFY(QTextCodec::codecForName(c)); - QVERIFY(QTextCodec::codecForName(c + "-")); + QVERIFY(QTextCodec::codecForName(c + '-')); } foreach(const QByteArray& c, codecs) { - QVERIFY(QTextCodec::codecForName(c + "+")); - QVERIFY(QTextCodec::codecForName(c + "*")); + QVERIFY(QTextCodec::codecForName(c + '+')); + QVERIFY(QTextCodec::codecForName(c + '*')); } } } diff --git a/tests/benchmarks/corelib/io/qfile/main.cpp b/tests/benchmarks/corelib/io/qfile/main.cpp index 8e836ebdff..13e1cb9e2f 100644 --- a/tests/benchmarks/corelib/io/qfile/main.cpp +++ b/tests/benchmarks/corelib/io/qfile/main.cpp @@ -602,7 +602,7 @@ void tst_qfile::createSmallFiles() for (int i = 0; i < 1000; ++i) #endif { - QFile f(tmpDirName+"/"+QString::number(i)); + QFile f(tmpDirName + QLatin1Char('/') + QString::number(i)); f.open(QIODevice::WriteOnly); f.seek(511); f.putChar('\n'); @@ -641,7 +641,7 @@ void tst_qfile::readSmallFiles() case(QFileBenchmark): { QList fileList; Q_FOREACH(QString file, files) { - QFile *f = new QFile(tmpDirName+ "/" + file); + QFile *f = new QFile(tmpDirName + QLatin1Char('/') + file); f->open(QIODevice::ReadOnly|textMode|bufferedMode); fileList.append(f); } @@ -664,7 +664,7 @@ void tst_qfile::readSmallFiles() case(QFSFileEngineBenchmark): { QList fileList; Q_FOREACH(QString file, files) { - QFSFileEngine *fse = new QFSFileEngine(tmpDirName+ "/" + file); + QFSFileEngine *fse = new QFSFileEngine(tmpDirName + QLatin1Char('/') + file); fse->open(QIODevice::ReadOnly|textMode|bufferedMode); fileList.append(fse); } @@ -685,7 +685,7 @@ void tst_qfile::readSmallFiles() case(PosixBenchmark): { QList fileList; Q_FOREACH(QString file, files) { - fileList.append(::fopen(QFile::encodeName(tmpDirName+ "/" + file).constData(), "rb")); + fileList.append(::fopen(QFile::encodeName(tmpDirName + QLatin1Char('/') + file).constData(), "rb")); } QBENCHMARK { diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/commandline.cpp b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/commandline.cpp index 7e82b1ca53..7c4dc97591 100644 --- a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/commandline.cpp +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/commandline.cpp @@ -100,7 +100,7 @@ bool readSettingsFromCommandLine(int argc, char *argv[], return false; } else { - QStringList res = QString(argv[i+1]).split("x"); + QStringList res = QString(argv[i+1]).split(QLatin1Char('x')); if (res.count() != 2) { printf("-resolution parameter UI resolution should be set in format WxH where width and height are positive values\n"); usage(argv[0]); diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/dummydatagen.cpp b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/dummydatagen.cpp index 4dbb24211c..64c91da5f2 100644 --- a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/dummydatagen.cpp +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/widgets/dummydatagen.cpp @@ -81,7 +81,8 @@ QString DummyDataGenerator::randomPhoneNumber(QString indexNumber) QString beginNumber = QString::number(555-index*2); QString endNumber = QString("0").repeated(4-indexNumber.length()) + indexNumber; - return countryCode +" " + areaCode +" " + beginNumber +" " + endNumber; + return countryCode + QLatin1Char(' ') + areaCode +QLatin1Char(' ') + beginNumber + + QLatin1Char(' ') + endNumber; } QString DummyDataGenerator::randomFirstName() diff --git a/tests/benchmarks/gui/itemviews/qheaderview/qheaderviewbench.cpp b/tests/benchmarks/gui/itemviews/qheaderview/qheaderviewbench.cpp index 9cc8f1e6bb..5b75d1ecd6 100644 --- a/tests/benchmarks/gui/itemviews/qheaderview/qheaderviewbench.cpp +++ b/tests/benchmarks/gui/itemviews/qheaderview/qheaderviewbench.cpp @@ -130,7 +130,7 @@ void BenchQHeaderView::init() for (int i = 0; i < m_model->rowCount(); ++i) { m_model->setData(m_model->index(i, 0), QVariant(i)); s.setNum(i); - s += "."; + s += QLatin1Char('.'); s += 'a' + (i % 25); m_model->setData(m_model->index(i, 1), QVariant(s)); } diff --git a/tests/benchmarks/sql/kernel/qsqlquery/main.cpp b/tests/benchmarks/sql/kernel/qsqlquery/main.cpp index b5937b76b0..942266313f 100644 --- a/tests/benchmarks/sql/kernel/qsqlquery/main.cpp +++ b/tests/benchmarks/sql/kernel/qsqlquery/main.cpp @@ -285,7 +285,7 @@ void tst_QSqlQuery::benchmarkSelectPrepared() int expectedSum = 0; QString fillQuery = "INSERT INTO " + tableName + " VALUES (0)"; for (int i = 1; i < NUM_ROWS; ++i) { - fillQuery += ", (" + QString::number(i) + ")"; + fillQuery += ", (" + QString::number(i) + QLatin1Char(')'); expectedSum += i; } QVERIFY_SQL(q, exec(fillQuery)); diff --git a/tests/manual/bearerex/bearerex.cpp b/tests/manual/bearerex/bearerex.cpp index fe96c55636..2b04bd8bda 100644 --- a/tests/manual/bearerex/bearerex.cpp +++ b/tests/manual/bearerex/bearerex.cpp @@ -147,7 +147,7 @@ void BearerEx::on_createSessionButton_clicked() QNetworkConfiguration networkConfiguration = qvariant_cast(item->data(Qt::UserRole)); int newTabIndex = mainTabWidget->count(); SessionTab* newTab = new SessionTab(&networkConfiguration,&m_NetworkConfigurationManager,eventListWidget,newTabIndex-1); - QString label = QString("S")+QString::number(newTabIndex-1); + QString label = QLatin1Char('S') + QString::number(newTabIndex-1); mainTabWidget->insertTab(newTabIndex,newTab,label); mainTabWidget->setCurrentIndex(newTabIndex); } @@ -271,9 +271,11 @@ SessionTab::SessionTab(QNetworkConfiguration* apNetworkConfiguration, snapLabel->hide(); snapLineEdit->hide(); alrButton->hide(); - iapLineEdit->setText(apNetworkConfiguration->name()+" ("+apNetworkConfiguration->identifier()+")"); + iapLineEdit->setText(apNetworkConfiguration->name()+ " (" + apNetworkConfiguration->identifier() + + QLatin1Char(')')); } else if (apNetworkConfiguration->type() == QNetworkConfiguration::ServiceNetwork) { - snapLineEdit->setText(apNetworkConfiguration->name()+" ("+apNetworkConfiguration->identifier()+")"); + snapLineEdit->setText(apNetworkConfiguration->name()+ " (" + apNetworkConfiguration->identifier() + + QLatin1Char(')')); } bearerLineEdit->setText(apNetworkConfiguration->bearerTypeName()); sentRecDataLineEdit->setText(QString::number(m_NetworkSession->bytesWritten())+ @@ -380,7 +382,7 @@ void SessionTab::newConfigurationActivated() msgBox.setDefaultButton(QMessageBox::Yes); if (msgBox.exec() == QMessageBox::Yes) { m_NetworkSession->accept(); - iapLineEdit->setText(m_config.name()+" ("+m_config.identifier()+")"); + iapLineEdit->setText(m_config.name() + " (" + m_config.identifier() + QLatin1Char(')')); } else { m_NetworkSession->reject(); } @@ -391,7 +393,7 @@ void SessionTab::preferredConfigurationChanged(const QNetworkConfiguration& conf m_config = config; QMessageBox msgBox; msgBox.setText("Roaming to new configuration."); - msgBox.setInformativeText("Do you want to migrate to "+config.name()+"?"); + msgBox.setInformativeText("Do you want to migrate to " + config.name() + QLatin1Char('?')); msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No); msgBox.setDefaultButton(QMessageBox::Yes); if (msgBox.exec() == QMessageBox::Yes) { @@ -407,7 +409,7 @@ void SessionTab::opened() QFont font = listItem->font(); font.setBold(true); listItem->setFont(font); - listItem->setText(QString("S")+QString::number(m_index)+QString(" - ")+QString("Opened")); + listItem->setText(QLatin1Char('S') + QString::number(m_index) + QLatin1String(" - Opened")); m_eventListWidget->addItem(listItem); QVariant identifier = m_NetworkSession->sessionProperty("ActiveConfiguration"); @@ -415,7 +417,7 @@ void SessionTab::opened() QString configId = identifier.toString(); QNetworkConfiguration config = m_ConfigManager->configurationFromIdentifier(configId); if (config.isValid()) { - iapLineEdit->setText(config.name()+" ("+config.identifier()+")"); + iapLineEdit->setText(config.name() + " (" + config.identifier() + QLatin1Char(')')); } } newState(m_NetworkSession->state()); // Update the "(open)" @@ -438,7 +440,7 @@ void SessionTab::closed() QFont font = listItem->font(); font.setBold(true); listItem->setFont(font); - listItem->setText(QString("S")+QString::number(m_index)+QString(" - ")+QString("Closed")); + listItem->setText(QLatin1Char('S') + QString::number(m_index) + QLatin1String(" - Closed")); m_eventListWidget->addItem(listItem); } @@ -489,7 +491,7 @@ void SessionTab::stateChanged(QNetworkSession::State state) newState(state); QListWidgetItem* listItem = new QListWidgetItem(); - listItem->setText(QString("S")+QString::number(m_index)+QString(" - ")+stateString(state)); + listItem->setText(QLatin1Char('S') + QString::number(m_index) + QLatin1String(" - ") + stateString(state)); m_eventListWidget->addItem(listItem); } @@ -500,7 +502,7 @@ void SessionTab::newState(QNetworkSession::State state) QString configId = identifier.toString(); QNetworkConfiguration config = m_ConfigManager->configurationFromIdentifier(configId); if (config.isValid()) { - iapLineEdit->setText(config.name()+" ("+config.identifier()+")"); + iapLineEdit->setText(config.name() + " (" + config.identifier() + QLatin1Char(')')); bearerLineEdit->setText(config.bearerTypeName()); } } else { @@ -539,7 +541,7 @@ void SessionTab::error(QNetworkSession::SessionError error) errorString = "InvalidConfigurationError"; break; } - listItem->setText(QString("S")+QString::number(m_index)+QString(" - ")+errorString); + listItem->setText(QLatin1Char('S') + QString::number(m_index) + QString(" - ") + errorString); m_eventListWidget->addItem(listItem); msgBox.setText(errorString); diff --git a/tests/manual/gestures/graphicsview/main.cpp b/tests/manual/gestures/graphicsview/main.cpp index 062a1643df..30fd79ec8f 100644 --- a/tests/manual/gestures/graphicsview/main.cpp +++ b/tests/manual/gestures/graphicsview/main.cpp @@ -175,7 +175,7 @@ void MainWindow::setDirectory(const QString &path) QDir dir(path); QStringList files = dir.entryList(QDir::Files | QDir::Readable | QDir::NoDotAndDotDot); foreach(const QString &file, files) { - QImageReader img(path + QLatin1String("/")+file); + QImageReader img(path + QLatin1Char('/') +file); QImage image = img.read(); if (!image.isNull()) { { diff --git a/tests/manual/highdpi/dragwidget.cpp b/tests/manual/highdpi/dragwidget.cpp index b203566696..dacafef203 100644 --- a/tests/manual/highdpi/dragwidget.cpp +++ b/tests/manual/highdpi/dragwidget.cpp @@ -166,7 +166,7 @@ void DragWidget::mousePressEvent(QMouseEvent *event) QMimeData *mimeData = new QMimeData; mimeData->setText(child->text()); mimeData->setData("application/x-hotspot", - QByteArray::number(hotSpot.x()) + " " + QByteArray::number(hotSpot.y())); + QByteArray::number(hotSpot.x()) + ' ' + QByteArray::number(hotSpot.y())); QPixmap pixmap(child->size()); child->render(&pixmap); diff --git a/tests/manual/highdpi/main.cpp b/tests/manual/highdpi/main.cpp index 692a60d511..3e0073dd52 100644 --- a/tests/manual/highdpi/main.cpp +++ b/tests/manual/highdpi/main.cpp @@ -139,7 +139,7 @@ private slots: // update label, add ".0" if needed. QString number = QString::number(scalefactorF); - if (!number.contains(".")) + if (!number.contains(QLatin1Char('.'))) number.append(".0"); m_label->setText(number); } @@ -203,8 +203,8 @@ DemoController::DemoController(DemoContainerList *demos, QCommandLineParser *par foreach (QScreen *screen, screens) { // create scale control line QSize screenSize = screen->geometry().size(); - QString screenId = screen->name() + " " + QString::number(screenSize.width()) - + " " + QString::number(screenSize.height()); + QString screenId = screen->name() + QLatin1Char(' ') + QString::number(screenSize.width()) + + QLatin1Char(' ') + QString::number(screenSize.height()); LabelSlider *slider = new LabelSlider(this, screenId, layout, layoutRow++); slider->setValue(getScreenFactorWithoutPixelDensity(screen) * 10); diff --git a/tests/manual/lance/main.cpp b/tests/manual/lance/main.cpp index 6c0a651ce6..79e72cb5b3 100644 --- a/tests/manual/lance/main.cpp +++ b/tests/manual/lance/main.cpp @@ -602,7 +602,7 @@ int main(int argc, char **argv) pcmd.setType(type); pcmd.setCheckersBackground(checkers_background); pcmd.setContents(content); - QString file = QString(files.at(j)).replace(".", "_") + ".ps"; + QString file = QString(files.at(j)).replace(QLatin1Char('.'), QLatin1Char('_')) + ".ps"; QPrinter p(highres ? QPrinter::HighResolution : QPrinter::ScreenResolution); if (printdlg) { diff --git a/tests/manual/network_stresstest/minihttpserver.cpp b/tests/manual/network_stresstest/minihttpserver.cpp index d97fd7ec96..1a5fefcce7 100644 --- a/tests/manual/network_stresstest/minihttpserver.cpp +++ b/tests/manual/network_stresstest/minihttpserver.cpp @@ -141,7 +141,7 @@ void MiniHttpServerConnection::handlePendingRequest() } QUrl uri = QUrl::fromEncoded(request.mid(4, eol - int(strlen(http11)) - 4)); - source.setFileName(":" + uri.path()); + source.setFileName(QLatin1Char(':') + uri.path()); // connection-close? request = request.toLower(); diff --git a/tests/manual/qnetworkaccessmanager/qget/qget.cpp b/tests/manual/qnetworkaccessmanager/qget/qget.cpp index 000e268c6e..cb435a792c 100644 --- a/tests/manual/qnetworkaccessmanager/qget/qget.cpp +++ b/tests/manual/qnetworkaccessmanager/qget/qget.cpp @@ -159,7 +159,7 @@ int main(int argc, char *argv[]) headersFile=str.mid(10); else if (str == "--serial") dl.setQueueMode(DownloadManager::Serial); - else if (str.startsWith("-")) + else if (str.startsWith(QLatin1Char('-'))) qDebug() << "unsupported option" << str; else { QUrl url(QUrl::fromUserInput(str)); diff --git a/tests/manual/qnetworkaccessmanager/qget/transferitem.cpp b/tests/manual/qnetworkaccessmanager/qget/transferitem.cpp index 13fba9f2e5..2e975cdfb2 100644 --- a/tests/manual/qnetworkaccessmanager/qget/transferitem.cpp +++ b/tests/manual/qnetworkaccessmanager/qget/transferitem.cpp @@ -42,9 +42,9 @@ TransferItem::TransferItem(const QNetworkRequest &r, const QString &u, const QSt void TransferItem::progress(qint64 sent, qint64 total) { if (total > 0) - qDebug() << (sent*100/total) << "%"; + qDebug() << (sent*100/total) << '%'; else - qDebug() << sent << "B"; + qDebug() << sent << 'B'; } void TransferItem::start() diff --git a/tests/manual/qscreen/propertyfield.cpp b/tests/manual/qscreen/propertyfield.cpp index 01f38624d4..a8cf90c9bb 100644 --- a/tests/manual/qscreen/propertyfield.cpp +++ b/tests/manual/qscreen/propertyfield.cpp @@ -87,7 +87,7 @@ void PropertyField::propertyChanged() m_lastChangeTime = QTime::currentTime().addSecs(-5); } - qDebug() << " " << QString::fromUtf8(m_prop.name()) << ":" << val; + qDebug() << " " << QString::fromUtf8(m_prop.name()) << ':' << val; // If the value has recently changed, show the change if (text != m_lastText || m_lastChangeTime.elapsed() < 1000) { setText(m_lastTextShowing + " -> " + text); diff --git a/tests/manual/qtabletevent/device_information/tabletwidget.cpp b/tests/manual/qtabletevent/device_information/tabletwidget.cpp index 2462bb3701..f868d5a910 100644 --- a/tests/manual/qtabletevent/device_information/tabletwidget.cpp +++ b/tests/manual/qtabletevent/device_information/tabletwidget.cpp @@ -201,7 +201,7 @@ QString TabletWidget::buttonsToString(Qt::MouseButtons bs) if (bs.testFlag(b)) ret << buttonToString(b); } - return ret.join("|"); + return ret.join(QLatin1Char('|')); } void TabletWidget::tabletEvent(QTabletEvent *event) diff --git a/tests/manual/unc/main.cpp b/tests/manual/unc/main.cpp index d507bb2ba4..b5893eda20 100644 --- a/tests/manual/unc/main.cpp +++ b/tests/manual/unc/main.cpp @@ -63,7 +63,7 @@ protected: label->setTextInteractionFlags(Qt::TextBrowserInteraction); label->setOpenExternalLinks(true); - QString link("" + path + ""); + QString link(""); label->setText(link); return label; -- cgit v1.2.3