summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/corelib')
-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
24 files changed, 96 insertions, 96 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;
}
}