Add a test for move assignment to tst_QPalette
It was simply missing. Change-Id: I6645bb9fe9c81aec9c46ac5efc7d2295a3784ff6 Reviewed-by: J-P Nurmi <jpnurmi@digia.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
This commit is contained in:
parent
d8dc664b94
commit
b88d4b0384
@ -50,6 +50,7 @@ class tst_QPalette : public QObject
|
||||
private Q_SLOTS:
|
||||
void roleValues_data();
|
||||
void roleValues();
|
||||
void moveSemantics();
|
||||
};
|
||||
|
||||
void tst_QPalette::roleValues_data()
|
||||
@ -89,5 +90,26 @@ void tst_QPalette::roleValues()
|
||||
QCOMPARE(role, value);
|
||||
}
|
||||
|
||||
void tst_QPalette::moveSemantics()
|
||||
{
|
||||
#ifdef Q_COMPILER_RVALUE_REFS
|
||||
QPalette src(Qt::red), dst;
|
||||
const QPalette control = src;
|
||||
QVERIFY(src != dst);
|
||||
QCOMPARE(src, control);
|
||||
QVERIFY(!dst.isCopyOf(src));
|
||||
QVERIFY(!dst.isCopyOf(control));
|
||||
dst = qMove(src); // move assignment
|
||||
QVERIFY(!dst.isCopyOf(src)); // isCopyOf() works on moved-from palettes, too
|
||||
QVERIFY(dst.isCopyOf(control));
|
||||
QCOMPARE(dst, control);
|
||||
src = control; // check moved-from 'src' can still be assigned to (doesn't crash)
|
||||
QVERIFY(src.isCopyOf(dst));
|
||||
QVERIFY(src.isCopyOf(control));
|
||||
#else
|
||||
QSKIP("Compiler doesn't support C++11 move semantics");
|
||||
#endif
|
||||
}
|
||||
|
||||
QTEST_MAIN(tst_QPalette)
|
||||
#include "tst_qpalette.moc"
|
||||
|
Loading…
Reference in New Issue
Block a user