summaryrefslogtreecommitdiffstats
path: root/tests/auto/qwidget/tst_qwidget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qwidget/tst_qwidget.cpp')
-rw-r--r--tests/auto/qwidget/tst_qwidget.cpp75
1 files changed, 74 insertions, 1 deletions
diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp
index f722f89..ef05b91 100644
--- a/tests/auto/qwidget/tst_qwidget.cpp
+++ b/tests/auto/qwidget/tst_qwidget.cpp
@@ -9742,7 +9742,6 @@ void tst_QWidget::destroyBackingStoreWhenHidden()
QVERIFY(0 != backingStore(child));
// Parent is obscured, therefore its backing store should be destroyed
- QEXPECT_FAIL("", "QTBUG-12406", Continue);
QVERIFY(0 == backingStore(parent));
// Disable full screen
@@ -9758,6 +9757,80 @@ void tst_QWidget::destroyBackingStoreWhenHidden()
QVERIFY(0 != backingStore(parent));
QVERIFY(0 == backingStore(child));
}
+
+ // 6. Partial reveal followed by full reveal
+ {
+ QWidget upper;
+ upper.setAutoFillBackground(true);
+ upper.setPalette(Qt::red);
+ upper.setGeometry(50, 50, 100, 100);
+
+ QWidget lower;
+ lower.setAutoFillBackground(true);
+ lower.setPalette(Qt::green);
+ lower.setGeometry(50, 50, 100, 100);
+
+ lower.show();
+ QTest::qWaitForWindowShown(&lower);
+ upper.show();
+ QTest::qWaitForWindowShown(&upper);
+ upper.raise();
+
+ QVERIFY(0 != backingStore(upper));
+ QVERIFY(0 == backingStore(lower));
+
+ // Check that upper obscures lower
+ QVERIFY(lower.visibleRegion().subtracted(upper.visibleRegion()).isEmpty());
+
+ // Partially reveal lower
+ upper.move(100, 100);
+
+ // Completely reveal lower
+ upper.hide();
+
+ // Hide lower widget - this should cause its backing store to be deleted
+ lower.hide();
+
+ // Check that backing store was deleted
+ WAIT_AND_VERIFY(0 == backingStore(lower));
+ }
+
+ // 7. Reparenting of visible native child widget
+ {
+ QWidget parent1;
+ parent1.setAutoFillBackground(true);
+ parent1.setPalette(Qt::green);
+ parent1.setGeometry(50, 50, 100, 100);
+
+ QWidget *child = new QWidget(&parent1);
+ child->winId();
+ child->setAutoFillBackground(true);
+ child->setPalette(Qt::red);
+ child->setGeometry(10, 10, 30, 30);
+
+ QWidget parent2;
+ parent2.setAutoFillBackground(true);
+ parent2.setPalette(Qt::blue);
+ parent2.setGeometry(150, 150, 100, 100);
+
+ parent1.show();
+ QTest::qWaitForWindowShown(&parent1);
+ QVERIFY(0 != backingStore(parent1));
+
+ parent2.show();
+ QTest::qWaitForWindowShown(&parent2);
+ QVERIFY(0 != backingStore(parent2));
+
+ child->setParent(&parent2);
+ child->setGeometry(10, 10, 30, 30);
+ child->show();
+
+ parent1.hide();
+ WAIT_AND_VERIFY(0 == backingStore(parent1));
+
+ parent2.hide();
+ WAIT_AND_VERIFY(0 == backingStore(parent2));
+ }
}
#undef WAIT_AND_VERIFY