summaryrefslogtreecommitdiffstats
path: root/tests/auto/qexplicitlyshareddatapointer
diff options
context:
space:
mode:
authorJason Barron <jbarron@trolltech.com>2009-08-18 08:34:18 +0200
committerJason Barron <jbarron@trolltech.com>2009-08-18 08:34:18 +0200
commitfd6740b6ade6e7f8e51a9cc558b723e7fae15ccf (patch)
treeaa2ba4ce64d047d73c29ab0616e8a89d352c3abd /tests/auto/qexplicitlyshareddatapointer
parentd24029e3d4639f1300e7a68858936911df969f69 (diff)
parent572e165dcb8cc8fcdfaa4ab9bdab050f6a6cc173 (diff)
Merge commit 'qt/master'
Conflicts: doc/src/examples.qdoc doc/src/plugins-howto.qdoc doc/src/topics.qdoc examples/phonon/musicplayer/mainwindow.cpp src/3rdparty/freetype/src/base/ftobjs.c src/corelib/global/qglobal.h src/corelib/tools/qalgorithms.h src/corelib/tools/qshareddata.cpp src/corelib/tools/qsharedpointer.cpp src/corelib/tools/tools.pri src/corelib/xml/qxmlstream.h src/gui/painting/painting.pri src/gui/widgets/qdatetimeedit.cpp tests/auto/qdesktopservices/qdesktopservices.pro tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp tests/auto/qtextcodec/test/test.pro
Diffstat (limited to 'tests/auto/qexplicitlyshareddatapointer')
-rw-r--r--tests/auto/qexplicitlyshareddatapointer/tst_qexplicitlyshareddatapointer.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/auto/qexplicitlyshareddatapointer/tst_qexplicitlyshareddatapointer.cpp b/tests/auto/qexplicitlyshareddatapointer/tst_qexplicitlyshareddatapointer.cpp
index 4cdeb5c3b7..97e57f1716 100644
--- a/tests/auto/qexplicitlyshareddatapointer/tst_qexplicitlyshareddatapointer.cpp
+++ b/tests/auto/qexplicitlyshareddatapointer/tst_qexplicitlyshareddatapointer.cpp
@@ -61,6 +61,7 @@ private Q_SLOTS:
void clone() const;
void data() const;
void reset() const;
+ void swap() const;
};
class MyClass : public QSharedData
@@ -233,6 +234,25 @@ void tst_QExplicitlySharedDataPointer::reset() const
}
}
+void tst_QExplicitlySharedDataPointer::swap() const
+{
+ QExplicitlySharedDataPointer<MyClass> p1(0), p2(new MyClass());
+ QVERIFY(!p1.data());
+ QVERIFY(p2.data());
+
+ p1.swap(p2);
+ QVERIFY(p1.data());
+ QVERIFY(!p2.data());
+
+ p1.swap(p2);
+ QVERIFY(!p1.data());
+ QVERIFY(p2.data());
+
+ qSwap(p1, p2);
+ QVERIFY(p1.data());
+ QVERIFY(!p2.data());
+}
+
QTEST_MAIN(tst_QExplicitlySharedDataPointer)
#include "tst_qexplicitlyshareddatapointer.moc"