tst_QSharedPointer: add more tests for forward-declared payloads
It is not sufficient that QSharedPointer<ForwardDeclared>'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 <ogoffart@woboq.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
901515a008
commit
18d781af74
@ -397,6 +397,26 @@ void tst_QSharedPointer::useOfForwardDeclared()
|
||||
{
|
||||
// this just a compile test: use the forward-declared class
|
||||
QSharedPointer<ForwardDeclared> sp;
|
||||
|
||||
// copying should work, too:
|
||||
QSharedPointer<ForwardDeclared> sp2 = sp;
|
||||
|
||||
// and assignment:
|
||||
QSharedPointer<ForwardDeclared> sp3;
|
||||
sp3 = sp;
|
||||
|
||||
// move assignment:
|
||||
QSharedPointer<ForwardDeclared> sp4;
|
||||
sp4 = qMove(sp);
|
||||
|
||||
// and move constuction:
|
||||
QSharedPointer<ForwardDeclared> sp5 = qMove(sp2);
|
||||
|
||||
// swapping:
|
||||
sp4.swap(sp3);
|
||||
qSwap(sp4, sp3);
|
||||
|
||||
// and, of course, destruction
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user