diff --git a/tests/auto/gui/kernel/qpalette/tst_qpalette.cpp b/tests/auto/gui/kernel/qpalette/tst_qpalette.cpp index 662e35dfaf..c3c1fc6ea6 100644 --- a/tests/auto/gui/kernel/qpalette/tst_qpalette.cpp +++ b/tests/auto/gui/kernel/qpalette/tst_qpalette.cpp @@ -50,6 +50,7 @@ class tst_QPalette : public QObject private Q_SLOTS: void roleValues_data(); void roleValues(); + void copySemantics(); void moveSemantics(); }; @@ -90,6 +91,27 @@ void tst_QPalette::roleValues() QCOMPARE(role, value); } +void tst_QPalette::copySemantics() +{ + QPalette src(Qt::red), dst; + const QPalette control = src; // copy construction + QVERIFY(src != dst); + QVERIFY(!src.isCopyOf(dst)); + QCOMPARE(src, control); + QVERIFY(src.isCopyOf(control)); + dst = src; // copy assignment + QCOMPARE(dst, src); + QCOMPARE(dst, control); + QVERIFY(dst.isCopyOf(src)); + + dst = QPalette(Qt::green); + QVERIFY(dst != src); + QVERIFY(dst != control); + QCOMPARE(src, control); + QVERIFY(!dst.isCopyOf(src)); + QVERIFY(src.isCopyOf(control)); +} + void tst_QPalette::moveSemantics() { #ifdef Q_COMPILER_RVALUE_REFS