summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2015-10-13 09:46:56 +0200
committerFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2015-10-13 18:14:27 +0000
commita2a00eb044596f3e3f628b6b20b38a5ba524915c (patch)
treeefcf26def4cdf70e95134ba9b86b561346646862 /tests/auto
parente86f889de7a38208d0cb0a8ca4cd1fb027894b3c (diff)
Tests: Fix single-character string literals.
Use character literals where applicable. Change-Id: I1a026c320079ee5ca6f70be835d5a541deee2dd1 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/corelib/codecs/qtextcodec/tst_qtextcodec.cpp4
-rw-r--r--tests/auto/corelib/global/qlogging/tst_qlogging.cpp2
-rw-r--r--tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp4
-rw-r--r--tests/auto/corelib/io/qdir/tst_qdir.cpp10
-rw-r--r--tests/auto/corelib/io/qfile/tst_qfile.cpp2
-rw-r--r--tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp2
-rw-r--r--tests/auto/corelib/io/qprocess/tst_qprocess.cpp10
-rw-r--r--tests/auto/corelib/io/qsettings/tst_qsettings.cpp2
-rw-r--r--tests/auto/corelib/io/qtextstream/tst_qtextstream.cpp18
-rw-r--r--tests/auto/corelib/io/qurlquery/tst_qurlquery.cpp2
-rw-r--r--tests/auto/corelib/itemmodels/qitemmodel/modelstotest.cpp2
-rw-r--r--tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp20
-rw-r--r--tests/auto/corelib/json/tst_qtjson.cpp12
-rw-r--r--tests/auto/corelib/plugin/qlibrary/tst_qlibrary.cpp2
-rw-r--r--tests/auto/corelib/tools/collections/tst_collections.cpp2
-rw-r--r--tests/auto/corelib/tools/qbitarray/tst_qbitarray.cpp4
-rw-r--r--tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp8
-rw-r--r--tests/auto/corelib/tools/qchar/tst_qchar.cpp2
-rw-r--r--tests/auto/corelib/tools/qdate/tst_qdate.cpp2
-rw-r--r--tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp4
-rw-r--r--tests/auto/corelib/tools/qlocale/tst_qlocale.cpp12
-rw-r--r--tests/auto/corelib/tools/qstring/tst_qstring.cpp2
-rw-r--r--tests/auto/corelib/tools/qstringref/tst_qstringref.cpp2
-rw-r--r--tests/auto/corelib/xml/qxmlstream/tst_qxmlstream.cpp62
-rw-r--r--tests/auto/dbus/qdbustype/tst_qdbustype.cpp4
-rw-r--r--tests/auto/gui/image/qicoimageformat/tst_qicoimageformat.cpp14
-rw-r--r--tests/auto/gui/image/qimagereader/tst_qimagereader.cpp2
-rw-r--r--tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp2
-rw-r--r--tests/auto/gui/itemmodels/qstandarditemmodel/tst_qstandarditemmodel.cpp10
-rw-r--r--tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp2
-rw-r--r--tests/auto/gui/math3d/qquaternion/tst_qquaternion.cpp12
-rw-r--r--tests/auto/gui/text/qcssparser/tst_qcssparser.cpp10
-rw-r--r--tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp4
-rw-r--r--tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp2
-rw-r--r--tests/auto/network/access/qftp/tst_qftp.cpp4
-rw-r--r--tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp10
-rw-r--r--tests/auto/network/kernel/qnetworkinterface/tst_qnetworkinterface.cpp2
-rw-r--r--tests/auto/network/socket/qlocalsocket/tst_qlocalsocket.cpp4
-rw-r--r--tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp2
-rw-r--r--tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp2
-rw-r--r--tests/auto/other/atwrapper/atWrapper.cpp33
-rw-r--r--tests/auto/other/macnativeevents/qnativeevents.cpp24
-rw-r--r--tests/auto/other/qvariant_common/tst_qvariant_common.h2
-rw-r--r--tests/auto/sql/kernel/qsqldatabase/tst_databases.h14
-rw-r--r--tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp2
-rw-r--r--tests/auto/sql/kernel/qsqldriver/tst_qsqldriver.cpp2
-rw-r--r--tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp20
-rw-r--r--tests/auto/sql/models/qsqlrelationaltablemodel/tst_qsqlrelationaltablemodel.cpp16
-rw-r--r--tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp2
-rw-r--r--tests/auto/tools/qmake/testcompiler.cpp2
-rw-r--r--tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp2
-rw-r--r--tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp4
-rw-r--r--tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp2
-rw-r--r--tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp2
-rw-r--r--tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp6
-rw-r--r--tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp10
-rw-r--r--tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp4
-rw-r--r--tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp2
-rw-r--r--tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp2
-rw-r--r--tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp2
-rw-r--r--tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp8
-rw-r--r--tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp2
-rw-r--r--tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp2
63 files changed, 222 insertions, 221 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<noOfElements; e++) {
QTest::newRow(qPrintable(tag + QString("_%1").arg(e))) << device << QString(byte_order);
}
diff --git a/tests/auto/corelib/io/qdir/tst_qdir.cpp b/tests/auto/corelib/io/qdir/tst_qdir.cpp
index 7672ee030a..8a1777d7fd 100644
--- a/tests/auto/corelib/io/qdir/tst_qdir.cpp
+++ b/tests/auto/corelib/io/qdir/tst_qdir.cpp
@@ -1063,7 +1063,7 @@ void tst_QDir::cd_data()
QTest::addColumn<bool>("successExpected");
QTest::addColumn<QString>("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<QStringListModel *>(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<QModelIndex> 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<QModelIndex> 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 <QString, QVariant> 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 <QString, QVariant> 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<class Container> 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<QString>(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<len; j++) {
bool b = a[j];
if (b)
- S+= "1";
+ S+= QLatin1Char('1');
else
- S+= "0";
+ S+= QLatin1Char('0');
}
QTEST(S,"res");
}
diff --git a/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp b/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp
index 79d1568d40..7a94d922c9 100644
--- a/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp
+++ b/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp
@@ -1984,15 +1984,15 @@ void tst_QByteArray::movablity()
QCOMPARE(array.isEmpty(), newIsEmpty);
QCOMPARE(array.isNull(), newIsNull);
QCOMPARE(array.capacity(), newCapacity);
- QVERIFY(array.startsWith("a"));
- QVERIFY(array.endsWith("b"));
+ QVERIFY(array.startsWith('a'));
+ QVERIFY(array.endsWith('b'));
QCOMPARE(copy.size(), newSize);
QCOMPARE(copy.isEmpty(), newIsEmpty);
QCOMPARE(copy.isNull(), newIsNull);
QCOMPARE(copy.capacity(), newCapacity);
- QVERIFY(copy.startsWith("a"));
- QVERIFY(copy.endsWith("b"));
+ QVERIFY(copy.startsWith('a'));
+ QVERIFY(copy.endsWith('b'));
// try to not crash
array.squeeze();
diff --git a/tests/auto/corelib/tools/qchar/tst_qchar.cpp b/tests/auto/corelib/tools/qchar/tst_qchar.cpp
index f80d6e6d93..3a24c82f9e 100644
--- a/tests/auto/corelib/tools/qchar/tst_qchar.cpp
+++ b/tests/auto/corelib/tools/qchar/tst_qchar.cpp
@@ -756,7 +756,7 @@ void tst_QChar::normalization_data()
if (comment >= 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<QString> 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<QString> 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<QStandardItem *> 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<QStandardItem *> 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<int, QByteArray> 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<QCss::Symbol> &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("<!DOCTYPE test><test> <dummy/> </test>")));
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("<!DOCTYPE test><test> <dummy/> </test>")));
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<QSslError>& 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<QListView*>("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: