diff options
Diffstat (limited to 'tests/auto/corelib/tools')
6 files changed, 31 insertions, 11 deletions
diff --git a/tests/auto/corelib/tools/qlatin1string/tst_qlatin1string.cpp b/tests/auto/corelib/tools/qlatin1string/tst_qlatin1string.cpp index c8373b6ae9..dcfb0aa042 100644 --- a/tests/auto/corelib/tools/qlatin1string/tst_qlatin1string.cpp +++ b/tests/auto/corelib/tools/qlatin1string/tst_qlatin1string.cpp @@ -86,7 +86,7 @@ void tst_QLatin1String::nullString() // default ctor { QLatin1String l1; - QCOMPARE(static_cast<const void*>(l1.data()), static_cast<const void*>(Q_NULLPTR)); + QCOMPARE(static_cast<const void*>(l1.data()), static_cast<const void*>(nullptr)); QCOMPARE(l1.size(), 0); QString s = l1; @@ -95,9 +95,9 @@ void tst_QLatin1String::nullString() // from nullptr { - const char *null = Q_NULLPTR; + const char *null = nullptr; QLatin1String l1(null); - QCOMPARE(static_cast<const void*>(l1.data()), static_cast<const void*>(Q_NULLPTR)); + QCOMPARE(static_cast<const void*>(l1.data()), static_cast<const void*>(nullptr)); QCOMPARE(l1.size(), 0); QString s = l1; @@ -111,7 +111,7 @@ void tst_QLatin1String::nullString() QLatin1String l1(null); QEXPECT_FAIL("", "null QByteArrays become non-null QLatin1Strings...", Continue); - QCOMPARE(static_cast<const void*>(l1.data()), static_cast<const void*>(Q_NULLPTR)); + QCOMPARE(static_cast<const void*>(l1.data()), static_cast<const void*>(nullptr)); QCOMPARE(l1.size(), 0); QString s = l1; diff --git a/tests/auto/corelib/tools/qringbuffer/tst_qringbuffer.cpp b/tests/auto/corelib/tools/qringbuffer/tst_qringbuffer.cpp index 145ba7ff72..deee7171b1 100644 --- a/tests/auto/corelib/tools/qringbuffer/tst_qringbuffer.cpp +++ b/tests/auto/corelib/tools/qringbuffer/tst_qringbuffer.cpp @@ -68,7 +68,7 @@ void tst_QRingBuffer::constructing() QCOMPARE(ringBuffer.size(), Q_INT64_C(0)); QVERIFY(ringBuffer.isEmpty()); QCOMPARE(ringBuffer.nextDataBlockSize(), Q_INT64_C(0)); - QVERIFY(ringBuffer.readPointer() == Q_NULLPTR); + QVERIFY(ringBuffer.readPointer() == nullptr); QCOMPARE(ringBuffer.skip(5), Q_INT64_C(0)); QCOMPARE(ringBuffer.read(), QByteArray()); QCOMPARE(ringBuffer.getChar(), -1); diff --git a/tests/auto/corelib/tools/qscopedpointer/tst_qscopedpointer.cpp b/tests/auto/corelib/tools/qscopedpointer/tst_qscopedpointer.cpp index a4b06d1b3b..b943b04e23 100644 --- a/tests/auto/corelib/tools/qscopedpointer/tst_qscopedpointer.cpp +++ b/tests/auto/corelib/tools/qscopedpointer/tst_qscopedpointer.cpp @@ -68,6 +68,7 @@ void tst_QScopedPointer::defaultConstructor() /* Check that the members, one, is correctly initialized. */ QScopedPointer<int> p; QCOMPARE(p.data(), static_cast<int *>(0)); + QCOMPARE(p.get(), static_cast<int *>(0)); } void tst_QScopedPointer::dataOnDefaultConstructed() @@ -75,6 +76,7 @@ void tst_QScopedPointer::dataOnDefaultConstructed() QScopedPointer<int> p; QCOMPARE(p.data(), static_cast<int *>(0)); + QCOMPARE(p.get(), static_cast<int *>(0)); } class MyClass @@ -113,6 +115,7 @@ void tst_QScopedPointer::reset() QScopedPointer<int> p; p.reset(); QCOMPARE(p.data(), static_cast<int *>(0)); + QCOMPARE(p.get(), static_cast<int *>(0)); } /* Call reset() on an active value. */ @@ -120,6 +123,7 @@ void tst_QScopedPointer::reset() QScopedPointer<int> p(new int(3)); p.reset(); QCOMPARE(p.data(), static_cast<int *>(0)); + QCOMPARE(p.get(), static_cast<int *>(0)); } /* Call reset() with a value, on an active value. */ @@ -129,6 +133,7 @@ void tst_QScopedPointer::reset() int *const value = new int(9); p.reset(value); QCOMPARE(*p.data(), 9); + QCOMPARE(*p.get(), 9); } /* Call reset() with a value, on default constructed value. */ @@ -138,6 +143,7 @@ void tst_QScopedPointer::reset() int *const value = new int(9); p.reset(value); QCOMPARE(*p.data(), 9); + QCOMPARE(*p.get(), 9); } } diff --git a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp index 442d4d089c..c684af5418 100644 --- a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp +++ b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp @@ -272,6 +272,7 @@ void tst_QSharedPointer::basics() QCOMPARE(!ptr, isNull); QCOMPARE(ptr.data(), aData); + QCOMPARE(ptr.get(), aData); QCOMPARE(ptr.operator->(), aData); if (!isNull) { Data &dataReference = *ptr; @@ -316,6 +317,7 @@ void tst_QSharedPointer::basics() QCOMPARE(copy.isNull(), isNull); QCOMPARE(copy.data(), aData); + QCOMPARE(copy.get(), aData); QVERIFY(copy == aData); } QVERIFY(!refCountData(ptr) || refCountData(ptr)->weakref.load() == 1); @@ -349,6 +351,7 @@ void tst_QSharedPointer::basics() QVERIFY(strong == weak); QVERIFY(strong == ptr); QCOMPARE(strong.data(), aData); + QCOMPARE(strong.get(), aData); } QVERIFY(!refCountData(ptr) || refCountData(ptr)->weakref.load() == 1); QVERIFY(!refCountData(ptr) || refCountData(ptr)->strongref.load() == 1); @@ -362,11 +365,14 @@ void tst_QSharedPointer::operators() QSharedPointer<char> p2(new char); qptrdiff diff = p2.data() - p1.data(); QVERIFY(p1.data() != p2.data()); + QVERIFY(p1.get() != p2.get()); QVERIFY(diff != 0); // operator- QCOMPARE(p2 - p1.data(), diff); + QCOMPARE(p2 - p1.get(), diff); QCOMPARE(p2.data() - p1, diff); + QCOMPARE(p2.get() - p1, diff); QCOMPARE(p2 - p1, diff); QCOMPARE(p1 - p2, -diff); QCOMPARE(p1 - p1, qptrdiff(0)); @@ -374,7 +380,9 @@ void tst_QSharedPointer::operators() // operator< QVERIFY(p1 < p2.data()); + QVERIFY(p1 < p2.get()); QVERIFY(p1.data() < p2); + QVERIFY(p1.get() < p2); QVERIFY(p1 < p2); QVERIFY(!(p2 < p1)); QVERIFY(!(p2 < p2)); @@ -382,7 +390,9 @@ void tst_QSharedPointer::operators() // qHash QCOMPARE(qHash(p1), qHash(p1.data())); + QCOMPARE(qHash(p1), qHash(p1.get())); QCOMPARE(qHash(p2), qHash(p2.data())); + QCOMPARE(qHash(p2), qHash(p2.get())); } void tst_QSharedPointer::nullptrOps() @@ -396,11 +406,13 @@ void tst_QSharedPointer::nullptrOps() QVERIFY(nullptr == p1); QVERIFY(!p1); QVERIFY(!p1.data()); + QVERIFY(!p1.get()); QVERIFY(p2 == null); QVERIFY(p2 == nullptr); QVERIFY(nullptr == p2); QVERIFY(!p2); QVERIFY(!p2.data()); + QVERIFY(!p2.get()); QVERIFY(p1 == p2); QSharedPointer<char> p3 = p1; @@ -409,6 +421,7 @@ void tst_QSharedPointer::nullptrOps() QVERIFY(p3 == nullptr); QVERIFY(nullptr == p3); QVERIFY(!p3.data()); + QVERIFY(!p3.get()); p3 = nullptr; @@ -421,6 +434,7 @@ void tst_QSharedPointer::nullptrOps() QSharedPointer<char> p4(new char); QVERIFY(p4); QVERIFY(p4.data()); + QVERIFY(p4.get()); QVERIFY(p4 != nullptr); QVERIFY(nullptr != p4); QVERIFY(p4 != p1); diff --git a/tests/auto/corelib/tools/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp index 70ccc72630..f6840e60a8 100644 --- a/tests/auto/corelib/tools/qstring/tst_qstring.cpp +++ b/tests/auto/corelib/tools/qstring/tst_qstring.cpp @@ -249,7 +249,7 @@ class CharStarContainer { const char *str; public: - explicit Q_DECL_CONSTEXPR CharStarContainer(const char *s = Q_NULLPTR) : str(s) {} + explicit Q_DECL_CONSTEXPR CharStarContainer(const char *s = nullptr) : str(s) {} Q_DECL_CONSTEXPR operator const char *() const { return str; } }; @@ -1483,7 +1483,7 @@ void tst_QString::indexOf() QRegularExpression re(QRegularExpression::escape(needle), options); QCOMPARE( haystack.indexOf(re, startpos), resultpos ); - QCOMPARE(haystack.indexOf(re, startpos, Q_NULLPTR), resultpos); + QCOMPARE(haystack.indexOf(re, startpos, nullptr), resultpos); QRegularExpressionMatch match; QVERIFY(!match.hasMatch()); @@ -1608,7 +1608,7 @@ void tst_QString::indexOfInvalidRegex() QTest::ignoreMessage(QtWarningMsg, "QString::indexOf: invalid QRegularExpression object"); QCOMPARE(QString("invalid regex\\").indexOf(QRegularExpression("invalid regex\\")), -1); QTest::ignoreMessage(QtWarningMsg, "QString::indexOf: invalid QRegularExpression object"); - QCOMPARE(QString("invalid regex\\").indexOf(QRegularExpression("invalid regex\\"), -1, Q_NULLPTR), -1); + QCOMPARE(QString("invalid regex\\").indexOf(QRegularExpression("invalid regex\\"), -1, nullptr), -1); QRegularExpressionMatch match; QVERIFY(!match.hasMatch()); @@ -1706,7 +1706,7 @@ void tst_QString::lastIndexOf() QRegularExpression re(QRegularExpression::escape(needle), options); QCOMPARE(haystack.lastIndexOf(re, from), expected); - QCOMPARE(haystack.lastIndexOf(re, from, Q_NULLPTR), expected); + QCOMPARE(haystack.lastIndexOf(re, from, nullptr), expected); QRegularExpressionMatch match; QVERIFY(!match.hasMatch()); QCOMPARE(haystack.lastIndexOf(re, from, &match), expected); @@ -1743,7 +1743,7 @@ void tst_QString::lastIndexOfInvalidRegex() QTest::ignoreMessage(QtWarningMsg, "QString::lastIndexOf: invalid QRegularExpression object"); QCOMPARE(QString("invalid regex\\").lastIndexOf(QRegularExpression("invalid regex\\"), 0), -1); QTest::ignoreMessage(QtWarningMsg, "QString::lastIndexOf: invalid QRegularExpression object"); - QCOMPARE(QString("invalid regex\\").lastIndexOf(QRegularExpression("invalid regex\\"), -1, Q_NULLPTR), -1); + QCOMPARE(QString("invalid regex\\").lastIndexOf(QRegularExpression("invalid regex\\"), -1, nullptr), -1); QRegularExpressionMatch match; QVERIFY(!match.hasMatch()); diff --git a/tests/auto/corelib/tools/qvector/tst_qvector.cpp b/tests/auto/corelib/tools/qvector/tst_qvector.cpp index 374fec221e..56daea31fe 100644 --- a/tests/auto/corelib/tools/qvector/tst_qvector.cpp +++ b/tests/auto/corelib/tools/qvector/tst_qvector.cpp @@ -2803,7 +2803,7 @@ void tst_QVector::detachThreadSafety() const static const uint threadsCount = 5; struct : QThread { - void run() Q_DECL_OVERRIDE + void run() override { QVector<T> copy(*detachThreadSafetyData<T>()->load()); QVERIFY(!copy.isDetached()); |