diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2014-07-25 23:17:55 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2014-08-06 13:52:24 +0200 |
commit | de8a9dee5aa7c8db3b390c9a19f65c919d201c3c (patch) | |
tree | 7e141452814d2c38e932d571a63d2d0b0e5e6697 /tests/auto/gui | |
parent | fa31f9761ac378807747a19589b7476546e4fae4 (diff) |
QPalette: add move constructor
As with many other implicitly shared classes, efficient move semantics
requires setting the d-pointer to nullptr, which then needs to be checked
for in the dtor and the copy assignment operator.
Change-Id: I654d181a1dfdd9a16e2f9fb96b57475cdd0b4561
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Diffstat (limited to 'tests/auto/gui')
-rw-r--r-- | tests/auto/gui/kernel/qpalette/tst_qpalette.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/auto/gui/kernel/qpalette/tst_qpalette.cpp b/tests/auto/gui/kernel/qpalette/tst_qpalette.cpp index b2c0ff979c..662e35dfaf 100644 --- a/tests/auto/gui/kernel/qpalette/tst_qpalette.cpp +++ b/tests/auto/gui/kernel/qpalette/tst_qpalette.cpp @@ -106,6 +106,14 @@ void tst_QPalette::moveSemantics() src = control; // check moved-from 'src' can still be assigned to (doesn't crash) QVERIFY(src.isCopyOf(dst)); QVERIFY(src.isCopyOf(control)); + QPalette dst2(qMove(src)); // move construction + QVERIFY(!src.isCopyOf(dst)); + QVERIFY(!src.isCopyOf(dst2)); + QVERIFY(!src.isCopyOf(control)); + QCOMPARE(dst2, control); + QVERIFY(dst2.isCopyOf(dst)); + QVERIFY(dst2.isCopyOf(control)); + // check moved-from 'src' can still be destroyed (doesn't crash) #else QSKIP("Compiler doesn't support C++11 move semantics"); #endif |