From 18d781af741a44ef232fa3bf2fe2a95883f44b72 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sun, 9 Mar 2014 11:50:18 +0100 Subject: [PATCH] tst_QSharedPointer: add more tests for forward-declared payloads It is not sufficient that QSharedPointer's default ctor and dtor compile. Copy/move assignment/construction and swapping should work, too. Arguably, there are more functions that should compile with just a forward-declared payload, but this is a start. Change-Id: I75470e3d4ba949c3e735c4078cbc123d53ec3007 Reviewed-by: Olivier Goffart Reviewed-by: Thiago Macieira --- .../qsharedpointer/tst_qsharedpointer.cpp | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp index 5b1a2cf076..8c76e6b440 100644 --- a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp +++ b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp @@ -397,6 +397,26 @@ void tst_QSharedPointer::useOfForwardDeclared() { // this just a compile test: use the forward-declared class QSharedPointer sp; + + // copying should work, too: + QSharedPointer sp2 = sp; + + // and assignment: + QSharedPointer sp3; + sp3 = sp; + + // move assignment: + QSharedPointer sp4; + sp4 = qMove(sp); + + // and move constuction: + QSharedPointer sp5 = qMove(sp2); + + // swapping: + sp4.swap(sp3); + qSwap(sp4, sp3); + + // and, of course, destruction }