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.cpp24
1 files changed, 21 insertions, 3 deletions
diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp
index 2f221d2..09af941 100644
--- a/tests/auto/qwidget/tst_qwidget.cpp
+++ b/tests/auto/qwidget/tst_qwidget.cpp
@@ -9718,14 +9718,25 @@ void tst_QWidget::destroyBackingStoreWhenHidden()
child.setAutoFillBackground(true);
child.setPalette(Qt::blue);
+ QWidget grandChild(&child);
+ grandChild.setAutoFillBackground(true);
+ grandChild.setPalette(Qt::yellow);
+
QVBoxLayout layout(&parent);
layout.setContentsMargins(10, 10, 10, 10);
layout.addWidget(&child);
parent.setLayout(&layout);
- child.winId();
+ QVBoxLayout childLayout(&child);
+ childLayout.setContentsMargins(10, 10, 10, 10);
+ childLayout.addWidget(&grandChild);
+ child.setLayout(&childLayout);
+
+ // Ensure that this widget and all its ancestors are native
+ grandChild.winId();
parent.show();
+
QTest::qWaitForWindowShown(&parent);
// Check that child window does not obscure parent window
@@ -9734,18 +9745,24 @@ void tst_QWidget::destroyBackingStoreWhenHidden()
// Native child widget should share parent's backing store
QVERIFY(0 != backingStore(parent));
QVERIFY(0 == backingStore(child));
+ QVERIFY(0 == backingStore(grandChild));
// Make child widget full screen
child.setWindowFlags((child.windowFlags() | Qt::Window) ^ Qt::SubWindow);
child.setWindowState(child.windowState() | Qt::WindowFullScreen);
child.show();
+
+ // Paint into the child to ensure that it gets a backing store
+ QPainter painter(&child);
+ painter.fillRect(QRect(0, 0, 90, 90), Qt::white);
+
QTest::qWaitForWindowShown(&child);
// Ensure that 'window hidden' event is received by parent
qApp->processEvents();
// Check that child window obscures parent window
- QVERIFY(parent.visibleRegion().subtracted(child.visibleRegion()).isEmpty());
+ QVERIFY(parent.visibleRegion().subtracted(child.visibleRegion() + grandChild.visibleRegion()).isEmpty());
// Now that extent of child widget goes beyond parent's extent,
// a new backing store should be created for the child widget.
@@ -9761,11 +9778,12 @@ void tst_QWidget::destroyBackingStoreWhenHidden()
QTest::qWaitForWindowShown(&child);
// Check that parent is now visible again
- QVERIFY(!parent.visibleRegion().subtracted(child.visibleRegion()).isEmpty());
+ QVERIFY(!parent.visibleRegion().subtracted(child.visibleRegion() + grandChild.visibleRegion()).isEmpty());
// Native child widget should once again share parent's backing store
QVERIFY(0 != backingStore(parent));
QVERIFY(0 == backingStore(child));
+ QVERIFY(0 == backingStore(grandChild));
}
// 6. Partial reveal followed by full reveal