summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2009-12-08 08:10:40 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2009-12-08 08:11:04 (GMT)
commitdfbdb86fd4614be9be17cbfb602ed5a3b5a38671 (patch)
tree0710d161164abb6c845ab8e7635ce142f2677312 /tests
parent91c47ba2c156e4dcaf9b2e03f7abf796c4828906 (diff)
downloadQt-dfbdb86fd4614be9be17cbfb602ed5a3b5a38671.zip
Qt-dfbdb86fd4614be9be17cbfb602ed5a3b5a38671.tar.gz
Qt-dfbdb86fd4614be9be17cbfb602ed5a3b5a38671.tar.bz2
Autotest: ensure that QSharedPointer does proper autocasting through
function calls. Seen on qt-interest. Reviewed-by: Trust Me
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qsharedpointer/tst_qsharedpointer.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp
index ed9206c..0cb08f9 100644
--- a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp
+++ b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp
@@ -73,6 +73,7 @@ private slots:
void forwardDeclaration2();
void memoryManagement();
void downCast();
+ void functionCallDownCast();
void upCast();
void qobjectWeakManagement();
void noSharedPointerFromWeakQObject();
@@ -503,6 +504,15 @@ void tst_QSharedPointer::downCast()
QCOMPARE(DerivedData::derivedDestructorCounter, destructorCount + 1);
}
+void functionDataByValue(QSharedPointer<Data> p) { Q_UNUSED(p); };
+void functionDataByRef(const QSharedPointer<Data> &p) { Q_UNUSED(p); };
+void tst_QSharedPointer::functionCallDownCast()
+{
+ QSharedPointer<DerivedData> p(new DerivedData());
+ functionDataByValue(p);
+ functionDataByRef(p);
+}
+
void tst_QSharedPointer::upCast()
{
QSharedPointer<Data> baseptr = QSharedPointer<Data>(new DerivedData);