summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/gui/kernel/qwindow/tst_qwindow.cpp')
-rw-r--r--tests/auto/gui/kernel/qwindow/tst_qwindow.cpp48
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
index 6ec0268d96..36ec28de8d 100644
--- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
+++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
@@ -56,6 +56,7 @@ private slots:
void create();
void setParent();
void setVisible();
+ void setVisibleFalseDoesNotCreateWindow();
void eventOrderOnShow();
void resizeEventAfterResize();
void exposeEventOnShrink_QTBUG54040();
@@ -65,6 +66,7 @@ private slots:
void positioningDuringMinimized();
void childWindowPositioning_data();
void childWindowPositioning();
+ void childWindowLevel();
void platformSurface();
void isExposed();
void isActive();
@@ -101,6 +103,7 @@ private slots:
void initTestCase();
void stateChange_data();
void stateChange();
+ void flags();
void cleanup();
private:
@@ -232,6 +235,16 @@ void tst_QWindow::setVisible()
QVERIFY(QTest::qWaitForWindowExposed(&i));
}
+void tst_QWindow::setVisibleFalseDoesNotCreateWindow()
+{
+ QWindow w;
+ QVERIFY(!w.handle());
+ w.setVisible(false);
+ QVERIFY2(!w.handle(), "Hiding a non-created window doesn't create it");
+ w.setVisible(true);
+ QVERIFY2(w.handle(), "Showing a non-created window creates it");
+}
+
void tst_QWindow::mapGlobal()
{
QWindow a;
@@ -596,6 +609,29 @@ void tst_QWindow::childWindowPositioning()
QCOMPARE(childWindowAfter.framePosition(), topLeftOrigin);
}
+void tst_QWindow::childWindowLevel()
+{
+ ColoredWindow topLevel(Qt::green);
+ topLevel.setObjectName("topLevel");
+ ColoredWindow yellowChild(Qt::yellow, &topLevel);
+ yellowChild.setObjectName("yellowChild");
+ ColoredWindow redChild(Qt::red, &topLevel);
+ redChild.setObjectName("redChild");
+ ColoredWindow blueChild(Qt::blue, &topLevel);
+ blueChild.setObjectName("blueChild");
+
+ const QObjectList &siblings = topLevel.children();
+
+ QCOMPARE(siblings.constFirst(), &yellowChild);
+ QCOMPARE(siblings.constLast(), &blueChild);
+
+ yellowChild.raise();
+ QCOMPARE(siblings.constLast(), &yellowChild);
+
+ blueChild.lower();
+ QCOMPARE(siblings.constFirst(), &blueChild);
+}
+
// QTBUG-49709: Verify that the normal geometry is correctly restored
// when executing a sequence of window state changes. So far, Windows
// only where state changes have immediate effect.
@@ -2170,6 +2206,18 @@ void tst_QWindow::requestUpdate()
QTRY_COMPARE(window.received(QEvent::UpdateRequest), 2);
}
+void tst_QWindow::flags()
+{
+ Window window;
+ const auto baseFlags = window.flags();
+ window.setFlags(window.flags() | Qt::FramelessWindowHint);
+ QCOMPARE(window.flags(), baseFlags | Qt::FramelessWindowHint);
+ window.setFlag(Qt::WindowStaysOnTopHint, true);
+ QCOMPARE(window.flags(), baseFlags | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
+ window.setFlag(Qt::FramelessWindowHint, false);
+ QCOMPARE(window.flags(), baseFlags | Qt::WindowStaysOnTopHint);
+}
+
#include <tst_qwindow.moc>
QTEST_MAIN(tst_QWindow)