summaryrefslogtreecommitdiffstats
path: root/tests/auto/qwidget/tst_qwidget.cpp
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2009-11-02 17:01:13 (GMT)
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>2009-11-02 17:01:13 (GMT)
commit20cfe1e790295254370cf472df39813f864de7ea (patch)
tree98ac008f7c468ed37a61c051870810db2bbf2360 /tests/auto/qwidget/tst_qwidget.cpp
parent83e497fdae56e11c79d913cdc665e78615291e9c (diff)
parent2ed925753cb194970712330edca4da8e91fa8f28 (diff)
downloadQt-20cfe1e790295254370cf472df39813f864de7ea.zip
Qt-20cfe1e790295254370cf472df39813f864de7ea.tar.gz
Qt-20cfe1e790295254370cf472df39813f864de7ea.tar.bz2
Merge remote branch 'mainline/4.6' into 4.6
Diffstat (limited to 'tests/auto/qwidget/tst_qwidget.cpp')
-rw-r--r--tests/auto/qwidget/tst_qwidget.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp
index 5630370..3d801cc 100644
--- a/tests/auto/qwidget/tst_qwidget.cpp
+++ b/tests/auto/qwidget/tst_qwidget.cpp
@@ -332,6 +332,7 @@ private slots:
void doubleRepaint();
#ifndef Q_WS_MAC
void resizeInPaintEvent();
+ void opaqueChildren();
#endif
void setMaskInResizeEvent();
@@ -6319,6 +6320,7 @@ void tst_QWidget::compatibilityChildInsertedEvents()
widget.show();
expected =
EventRecorder::EventList()
+ << qMakePair(&widget, QEvent::WinIdChange)
<< qMakePair(&widget, QEvent::Polish)
<< qMakePair(&widget, QEvent::Move)
<< qMakePair(&widget, QEvent::Resize)
@@ -6404,6 +6406,7 @@ void tst_QWidget::compatibilityChildInsertedEvents()
widget.show();
expected =
EventRecorder::EventList()
+ << qMakePair(&widget, QEvent::WinIdChange)
<< qMakePair(&widget, QEvent::Polish)
#ifdef QT_HAS_QT3SUPPORT
<< qMakePair(&widget, QEvent::ChildInserted)
@@ -6501,6 +6504,7 @@ void tst_QWidget::compatibilityChildInsertedEvents()
widget.show();
expected =
EventRecorder::EventList()
+ << qMakePair(&widget, QEvent::WinIdChange)
<< qMakePair(&widget, QEvent::Polish)
#ifdef QT_HAS_QT3SUPPORT
<< qMakePair(&widget, QEvent::ChildInserted)
@@ -8272,6 +8276,47 @@ void tst_QWidget::resizeInPaintEvent()
// Make sure the resize triggers another update.
QTRY_COMPARE(widget.numPaintEvents, 1);
}
+
+void tst_QWidget::opaqueChildren()
+{
+ QWidget widget;
+ widget.resize(200, 200);
+
+ QWidget child(&widget);
+ child.setGeometry(-700, -700, 200, 200);
+
+ QWidget grandChild(&child);
+ grandChild.resize(200, 200);
+
+ QWidget greatGrandChild(&grandChild);
+ greatGrandChild.setGeometry(50, 50, 200, 200);
+ greatGrandChild.setPalette(Qt::red);
+ greatGrandChild.setAutoFillBackground(true); // Opaque child widget.
+
+ widget.show();
+#ifdef Q_WS_X11
+ qt_x11_wait_for_window_manager(&widget);
+#endif
+ QTest::qWait(100);
+
+ // Child, grandChild and greatGrandChild are outside the ancestor clip.
+ QRegion expectedOpaqueRegion(50, 50, 150, 150);
+ QCOMPARE(qt_widget_private(&grandChild)->getOpaqueChildren(), expectedOpaqueRegion);
+
+ // Now they are all inside the ancestor clip.
+ child.setGeometry(50, 50, 150, 150);
+ QCOMPARE(qt_widget_private(&grandChild)->getOpaqueChildren(), expectedOpaqueRegion);
+
+ // Set mask on greatGrandChild.
+ const QRegion mask(10, 10, 50, 50);
+ greatGrandChild.setMask(mask);
+ expectedOpaqueRegion &= mask.translated(50, 50);
+ QCOMPARE(qt_widget_private(&grandChild)->getOpaqueChildren(), expectedOpaqueRegion);
+
+ // Make greatGrandChild "transparent".
+ greatGrandChild.setAutoFillBackground(false);
+ QCOMPARE(qt_widget_private(&grandChild)->getOpaqueChildren(), QRegion());
+}
#endif