summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/corelib')
-rw-r--r--tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.cpp26
-rw-r--r--tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp6
-rw-r--r--tests/auto/corelib/tools/qstring/tst_qstring.cpp9
3 files changed, 20 insertions, 21 deletions
diff --git a/tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.cpp b/tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.cpp
index 5825bdb6d6..2a93250ba5 100644
--- a/tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.cpp
+++ b/tests/auto/corelib/tools/qregularexpression/tst_qregularexpression.cpp
@@ -61,6 +61,9 @@ struct Match
QStringList captured;
QHash<QString, QString> namedCaptured;
};
+QT_BEGIN_NAMESPACE
+Q_DECLARE_TYPEINFO(Match, Q_MOVABLE_TYPE);
+QT_END_NAMESPACE
Q_DECLARE_METATYPE(Match)
@@ -85,9 +88,9 @@ bool operator==(const QRegularExpressionMatch &rem, const Match &m)
}
}
- Q_FOREACH (const QString &name, m.namedCaptured.keys()) {
- QString remCaptured = rem.captured(name);
- QString mCaptured = m.namedCaptured.value(name);
+ for (auto it = m.namedCaptured.begin(), end = m.namedCaptured.end(); it != end; ++it) {
+ const QString remCaptured = rem.captured(it.key());
+ const QString mCaptured = it.value();
if (remCaptured != mCaptured
|| remCaptured.isNull() != mCaptured.isNull()
|| remCaptured.isEmpty() != mCaptured.isEmpty()) {
@@ -115,12 +118,11 @@ bool operator!=(const Match &m, const QRegularExpressionMatch &rem)
}
-bool operator==(const QRegularExpressionMatchIterator &iterator, const QList<Match> &expectedMatchList)
+bool operator==(const QRegularExpressionMatchIterator &iterator, const QVector<Match> &expectedMatchList)
{
QRegularExpressionMatchIterator i = iterator;
- foreach (const Match &expectedMatch, expectedMatchList)
- {
+ for (const Match &expectedMatch : expectedMatchList) {
if (!i.hasNext())
return false;
@@ -135,17 +137,17 @@ bool operator==(const QRegularExpressionMatchIterator &iterator, const QList<Mat
return true;
}
-bool operator==(const QList<Match> &expectedMatchList, const QRegularExpressionMatchIterator &iterator)
+bool operator==(const QVector<Match> &expectedMatchList, const QRegularExpressionMatchIterator &iterator)
{
return operator==(iterator, expectedMatchList);
}
-bool operator!=(const QRegularExpressionMatchIterator &iterator, const QList<Match> &expectedMatchList)
+bool operator!=(const QRegularExpressionMatchIterator &iterator, const QVector<Match> &expectedMatchList)
{
return !operator==(iterator, expectedMatchList);
}
-bool operator!=(const QList<Match> &expectedMatchList, const QRegularExpressionMatchIterator &iterator)
+bool operator!=(const QVector<Match> &expectedMatchList, const QRegularExpressionMatchIterator &iterator)
{
return !operator==(expectedMatchList, iterator);
}
@@ -1117,9 +1119,9 @@ void tst_QRegularExpression::globalMatch_data()
QTest::addColumn<int>("offset");
QTest::addColumn<QRegularExpression::MatchType>("matchType");
QTest::addColumn<QRegularExpression::MatchOptions>("matchOptions");
- QTest::addColumn<QList<Match> >("matchList");
+ QTest::addColumn<QVector<Match> >("matchList");
- QList<Match> matchList;
+ QVector<Match> matchList;
Match m;
matchList.clear();
@@ -1375,7 +1377,7 @@ void tst_QRegularExpression::globalMatch()
QFETCH(int, offset);
QFETCH(QRegularExpression::MatchType, matchType);
QFETCH(QRegularExpression::MatchOptions, matchOptions);
- QFETCH(QList<Match>, matchList);
+ QFETCH(QVector<Match>, matchList);
testMatch<QRegularExpressionMatchIterator>(regexp,
static_cast<QREGlobalMatchStringPMF>(&QRegularExpression::globalMatch),
diff --git a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp
index 1bba41816b..d0a0feb125 100644
--- a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp
+++ b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp
@@ -1738,9 +1738,6 @@ void tst_QSharedPointer::creating()
void tst_QSharedPointer::creatingVariadic()
{
-#if !defined(Q_COMPILER_RVALUE_REFS) || !defined(Q_COMPILER_VARIADIC_TEMPLATES)
- QSKIP("This compiler is not in C++11 mode or it doesn't support rvalue refs and variadic templates");
-#else
int i = 42;
{
@@ -1768,12 +1765,10 @@ void tst_QSharedPointer::creatingVariadic()
QCOMPARE(ptr->i, 2);
QCOMPARE(ptr->ptr, (void*)0);
-#ifdef Q_COMPILER_NULLPTR
NoDefaultConstructor2(nullptr, 3); // control check
ptr = QSharedPointer<NoDefaultConstructor2>::create(nullptr, 3);
QCOMPARE(ptr->i, 3);
QCOMPARE(ptr->ptr, (void*)nullptr);
-#endif
}
{
NoDefaultConstructorRef1 x(i); // control check
@@ -1809,7 +1804,6 @@ void tst_QSharedPointer::creatingVariadic()
QCOMPARE(ptr->str, QString("bytearray"));
QCOMPARE(ptr->i, 42);
}
-#endif
}
void tst_QSharedPointer::creatingQObject()
diff --git a/tests/auto/corelib/tools/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp
index 8f0f599622..a0a872710c 100644
--- a/tests/auto/corelib/tools/qstring/tst_qstring.cpp
+++ b/tests/auto/corelib/tools/qstring/tst_qstring.cpp
@@ -84,11 +84,11 @@ public:
template <typename MemFun>
void apply0(QString &s, MemFun mf) const
- { Q_FOREACH (QChar ch, this->pinned) (s.*mf)(ch); }
+ { for (QChar ch : qAsConst(this->pinned)) (s.*mf)(ch); }
template <typename MemFun, typename A1>
void apply1(QString &s, MemFun mf, A1 a1) const
- { Q_FOREACH (QChar ch, this->pinned) (s.*mf)(a1, ch); }
+ { for (QChar ch : qAsConst(this->pinned)) (s.*mf)(a1, ch); }
};
template <>
@@ -254,6 +254,9 @@ public:
};
} // unnamed namespace
+QT_BEGIN_NAMESPACE
+Q_DECLARE_TYPEINFO(CharStarContainer, Q_PRIMITIVE_TYPE);
+QT_END_NAMESPACE
Q_DECLARE_METATYPE(CharStarContainer)
@@ -645,7 +648,7 @@ QString verifyZeroTermination(const QString &str)
} while (0) \
/**/
-typedef QList<int> IntList;
+typedef QVector<int> IntList;
tst_QString::tst_QString()
{