summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui/kernel/qwindow
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2023-08-02 12:22:28 +0200
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2023-08-07 17:58:53 +0200
commit546d4c9d33ffe9c66b69798fef04a0355fe3f0b8 (patch)
tree6b6a7125ed51399edea15c94e2bc12c8d773f181 /tests/auto/gui/kernel/qwindow
parentf50e29568066e293a54104086a11e72c3abb3823 (diff)
tst_foreignwindow: Add basic test of foreign window reparenting
Pick-to: 6.6 Change-Id: I008fad0f6527503a13ded4818eec5cb280f65cf4 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'tests/auto/gui/kernel/qwindow')
-rw-r--r--tests/auto/gui/kernel/qwindow/tst_foreignwindow.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/auto/gui/kernel/qwindow/tst_foreignwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_foreignwindow.cpp
index dc82d8b833..04c70e5fee 100644
--- a/tests/auto/gui/kernel/qwindow/tst_foreignwindow.cpp
+++ b/tests/auto/gui/kernel/qwindow/tst_foreignwindow.cpp
@@ -23,6 +23,8 @@ private slots:
void fromWinId();
void initialState();
+
+ void embedForeignWindow();
};
void tst_ForeignWindow::fromWinId()
@@ -67,5 +69,22 @@ void tst_ForeignWindow::initialState()
QCOMPARE(foreignWindow->geometry(), initialGeometry);
}
+void tst_ForeignWindow::embedForeignWindow()
+{
+ // A foreign window embedded into a Qt UI requires that the rest of Qt
+ // is to be able to treat the foreign child window as any other window
+ // that it can show, hide, stack, and move around.
+
+ QWindow parentWindow;
+
+ NativeWindow nativeWindow;
+ QVERIFY(nativeWindow);
+
+ // As a prerequisite to that, we must be able to reparent the foreign window
+ std::unique_ptr<QWindow> foreignWindow(QWindow::fromWinId(nativeWindow));
+ foreignWindow.release()->setParent(&parentWindow);
+ QCOMPARE(nativeWindow.parentWinId(), parentWindow.winId());
+}
+
#include <tst_foreignwindow.moc>
QTEST_MAIN(tst_ForeignWindow)