summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/kernel
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2014-08-17 20:23:22 +0200
committerMarc Mutz <marc.mutz@kdab.com>2015-06-17 07:09:57 +0000
commit2d9700c041b7d19f8204d96b2dc8b37859fbf4f5 (patch)
treebcdf2d21611deeee694721a938ad4342b9d7d874 /tests/auto/corelib/kernel
parent9f1646b0d9b1ffb61ffa69b4027d7c45766b0e98 (diff)
QPointer: add member-swap
Change-Id: I5704badc86f98e549c586656ec8df3915632ce15 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'tests/auto/corelib/kernel')
-rw-r--r--tests/auto/corelib/kernel/qpointer/tst_qpointer.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/auto/corelib/kernel/qpointer/tst_qpointer.cpp b/tests/auto/corelib/kernel/qpointer/tst_qpointer.cpp
index 814c4bb691..d7cce4ada4 100644
--- a/tests/auto/corelib/kernel/qpointer/tst_qpointer.cpp
+++ b/tests/auto/corelib/kernel/qpointer/tst_qpointer.cpp
@@ -50,6 +50,7 @@ private slots:
void destructor();
void assignment_operators();
void equality_operators();
+ void swap();
void isNull();
void dereference_operators();
void disconnect();
@@ -169,6 +170,22 @@ void tst_QPointer::equality_operators()
#endif
}
+void tst_QPointer::swap()
+{
+ QPointer<QObject> c1, c2;
+ {
+ QObject o;
+ c1 = &o;
+ QVERIFY(c2.isNull());
+ QCOMPARE(c1.data(), &o);
+ c1.swap(c2);
+ QVERIFY(c1.isNull());
+ QCOMPARE(c2.data(), &o);
+ }
+ QVERIFY(c1.isNull());
+ QVERIFY(c2.isNull());
+}
+
void tst_QPointer::isNull()
{
QPointer<QObject> p1;