summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/gui/kernel/qwindow/tst_qwindow.cpp7
-rw-r--r--tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp4
-rw-r--r--tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp28
-rw-r--r--tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp29
4 files changed, 66 insertions, 2 deletions
diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
index c4983f4462..259c840ae7 100644
--- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
+++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
@@ -177,7 +177,7 @@ void tst_QWindow::resizeEventAfterResize()
Window window;
window.setGeometry(geometry);
- window.show();
+ window.showNormal();
QTRY_COMPARE(window.received(QEvent::Resize), 1);
@@ -843,7 +843,10 @@ void tst_QWindow::activateAndClose()
{
for (int i = 0; i < 10; ++i) {
QWindow window;
- window.show();
+ // qWaitForWindowActive will block for the duration of
+ // of the timeout if the window is at 0,0
+ window.setGeometry(QGuiApplication::primaryScreen()->availableGeometry().adjusted(1, 1, -1, -1));
+ window.showNormal();
window.requestActivate();
QVERIFY(QTest::qWaitForWindowActive(&window));
QCOMPARE(qGuiApp->focusWindow(), &window);
diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
index 03d6c1cdbd..7bb5fd4614 100644
--- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
+++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
@@ -7192,6 +7192,10 @@ void tst_QWidget::hideOpaqueChildWhileHidden()
#if !defined(Q_OS_WINCE)
void tst_QWidget::updateWhileMinimized()
{
+#ifdef Q_OS_UNIX
+ if (qgetenv("XDG_CURRENT_DESKTOP").contains("Unity"))
+ QSKIP("This test fails on Unity."); // Minimized windows are not unmapped for some reason.
+#endif // Q_OS_UNIX
UpdateWidget widget;
// Filter out activation change and focus events to avoid update() calls in QWidget.
widget.updateOnActivationChangeAndFocusIn = false;
diff --git a/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp b/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp
index 1bbbfd610e..f5585c583a 100644
--- a/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp
+++ b/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp
@@ -91,6 +91,8 @@ private slots:
void tst_showWithoutActivating();
void tst_paintEventOnSecondShow();
+ void obscuredNativeMapped();
+
#ifndef QT_NO_DRAGANDDROP
void tst_dnd();
#endif
@@ -368,6 +370,32 @@ void tst_QWidget_window::tst_paintEventOnSecondShow()
QTRY_VERIFY(w.paintEventReceived);
}
+// QTBUG-33520, a toplevel fully obscured by native children should still receive Qt::WA_Mapped
+void tst_QWidget_window::obscuredNativeMapped()
+{
+ enum { size = 200 };
+
+ QWidget topLevel;
+ topLevel.setWindowFlags(Qt::FramelessWindowHint);
+ QWidget *child = new QWidget(&topLevel);
+ child->resize(size, size);
+ topLevel.resize(size, size);
+ topLevel.move(QGuiApplication::primaryScreen()->availableGeometry().center() - QPoint(size /2 , size / 2));
+ child->winId();
+ topLevel.show();
+ QTRY_VERIFY(topLevel.testAttribute(Qt::WA_Mapped));
+#if defined(Q_OS_MAC)
+ QSKIP("This test fails on Mac."); // Minimized windows are not unmapped for some reason.
+#elif defined(Q_OS_UNIX)
+ if (qgetenv("XDG_CURRENT_DESKTOP").contains("Unity"))
+ QSKIP("This test fails on Unity."); // Minimized windows are not unmapped for some reason.
+#endif // Q_OS_UNIX
+ topLevel.setWindowState(Qt::WindowMinimized);
+ QTRY_VERIFY(!topLevel.testAttribute(Qt::WA_Mapped));
+ topLevel.setWindowState(Qt::WindowNoState);
+ QTRY_VERIFY(topLevel.testAttribute(Qt::WA_Mapped));
+}
+
#ifndef QT_NO_DRAGANDDROP
/* DnD test for QWidgetWindow (handleDrag*Event() functions).
diff --git a/tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp b/tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp
index c17a03e058..cd6433bbe7 100644
--- a/tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp
+++ b/tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp
@@ -46,6 +46,8 @@
#include <qwindow.h>
#include <qwidget.h>
+#include <qdockwidget.h>
+#include <qmainwindow.h>
class Window : public QWindow
@@ -80,6 +82,7 @@ private slots:
void testUnparenting();
void testActivation();
void testAncestorChange();
+ void testDockWidget();
};
@@ -278,6 +281,7 @@ void tst_QWindowContainer::testAncestorChange()
newRoot->setGeometry(100, 100, 200, 200);
newRoot->show();
QVERIFY(QTest::qWaitForWindowExposed(newRoot));
+ QCOMPARE(newRoot->windowHandle(), window->parent());
// newRoot
// + right
// + container
@@ -285,6 +289,31 @@ void tst_QWindowContainer::testAncestorChange()
QCOMPARE(window->geometry(), QRect(100, 0, 100, 100));
}
+
+void tst_QWindowContainer::testDockWidget()
+{
+ QMainWindow mainWindow;
+ mainWindow.resize(200, 200);
+
+ QDockWidget *dock = new QDockWidget();
+ QWindow *window = new QWindow();
+ QWidget *container = QWidget::createWindowContainer(window);
+ dock->setWidget(container);
+ mainWindow.addDockWidget(Qt::RightDockWidgetArea, dock);
+
+ mainWindow.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&mainWindow));
+ QVERIFY(window->parent() == mainWindow.window()->windowHandle());
+
+ QTest::qWait(1000);
+ dock->setFloating(true);
+ QTRY_VERIFY(window->parent() != mainWindow.window()->windowHandle());
+
+ QTest::qWait(1000);
+ dock->setFloating(false);
+ QTRY_VERIFY(window->parent() == mainWindow.window()->windowHandle());
+}
+
QTEST_MAIN(tst_QWindowContainer)
#include "tst_qwindowcontainer.moc"