summaryrefslogtreecommitdiffstats
path: root/tests/auto/qpointer
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qpointer')
-rw-r--r--tests/auto/qpointer/tst_qpointer.cpp29
1 files changed, 10 insertions, 19 deletions
diff --git a/tests/auto/qpointer/tst_qpointer.cpp b/tests/auto/qpointer/tst_qpointer.cpp
index 9f2c0da..0fb4610 100644
--- a/tests/auto/qpointer/tst_qpointer.cpp
+++ b/tests/auto/qpointer/tst_qpointer.cpp
@@ -60,7 +60,6 @@ private slots:
void dereference_operators();
void disconnect();
void castDuringDestruction();
- void data() const;
void dataSignature() const;
void threadSafety();
};
@@ -183,15 +182,23 @@ void tst_QPointer::isNull()
void tst_QPointer::dereference_operators()
{
QPointer<tst_QPointer> p1 = this;
+ QPointer<tst_QPointer> p2;
+ // operator->() -- only makes sense if not null
QObject *object = p1->me();
QCOMPARE(object, this);
+ // operator*() -- only makes sense if not null
QObject &ref = *p1;
QCOMPARE(&ref, this);
- object = static_cast<QObject *>(p1);
- QCOMPARE(object, this);
+ // operator T*()
+ QCOMPARE(static_cast<QObject *>(p1), this);
+ QCOMPARE(static_cast<QObject *>(p2), static_cast<QObject *>(0));
+
+ // data()
+ QCOMPARE(p1.data(), this);
+ QCOMPARE(p2.data(), static_cast<QObject *>(0));
}
void tst_QPointer::disconnect()
@@ -302,22 +309,6 @@ void tst_QPointer::castDuringDestruction()
}
}
-void tst_QPointer::data() const
-{
- /* Check value of a default constructed object. */
- {
- QPointer<QObject> p;
- QCOMPARE(p.data(), static_cast<QObject *>(0));
- }
-
- /* Check value of a default constructed object. */
- {
- QObject *const object = new QObject();
- QPointer<QObject> p(object);
- QCOMPARE(p.data(), object);
- }
-}
-
void tst_QPointer::dataSignature() const
{
/* data() should be const. */