From dfbdb86fd4614be9be17cbfb602ed5a3b5a38671 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 8 Dec 2009 09:10:40 +0100 Subject: Autotest: ensure that QSharedPointer does proper autocasting through function calls. Seen on qt-interest. Reviewed-by: Trust Me --- tests/auto/qsharedpointer/tst_qsharedpointer.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 p) { Q_UNUSED(p); }; +void functionDataByRef(const QSharedPointer &p) { Q_UNUSED(p); }; +void tst_QSharedPointer::functionCallDownCast() +{ + QSharedPointer p(new DerivedData()); + functionDataByValue(p); + functionDataByRef(p); +} + void tst_QSharedPointer::upCast() { QSharedPointer baseptr = QSharedPointer(new DerivedData); -- cgit v0.12