diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2016-10-24 18:35:32 +0200 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2016-10-27 15:29:17 +0000 |
commit | 9428bca72e472e5a331976e49a68b5484ccc5f88 (patch) | |
tree | 93615311f2c3177da818c17183ea06c9b0a19b03 /tests/auto/gui/kernel/qwindow | |
parent | d020af90927261ca729d4fcd8e42276da8fb1a34 (diff) |
QWindow: re-order siblings on raise() and lower()
Same behavior as QWidget, and allows platform plugins to maintain order of
native windows based on the QWindow hierarchy, instead of having to manually
keep track of window levels.
Change-Id: Iacc7e9ee2527f0737c9da6debc7cec101064f782
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Diffstat (limited to 'tests/auto/gui/kernel/qwindow')
-rw-r--r-- | tests/auto/gui/kernel/qwindow/tst_qwindow.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp index a41c574454..45be8bf099 100644 --- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp +++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp @@ -65,6 +65,7 @@ private slots: void positioningDuringMinimized(); void childWindowPositioning_data(); void childWindowPositioning(); + void childWindowLevel(); void platformSurface(); void isExposed(); void isActive(); @@ -596,6 +597,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. |