Stabilize tst_ForeignWindow::embedForeignWindow()

We only care about no longer being a child of the old parent window,
not what the system does when we reparent to nullptr.

Pick-to: 6.6
Change-Id: Ibd670432f0fd2595195d3951014a570dfdb7a998
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This commit is contained in:
Tor Arne Vestbø 2023-11-17 13:53:57 +01:00
parent 635774fc32
commit 340b972995

View File

@ -82,17 +82,13 @@ void tst_ForeignWindow::embedForeignWindow()
NativeWindow nativeWindow;
QVERIFY(nativeWindow);
// Top level windows may not have 0 as their winId, e.g. on
// XCB the root window of the screen is used.
const auto originalParentWinId = nativeWindow.parentWinId();
// As a prerequisite to that, we must be able to reparent the foreign window
std::unique_ptr<QWindow> foreignWindow(QWindow::fromWinId(nativeWindow));
foreignWindow->setParent(&parentWindow);
QTRY_COMPARE(nativeWindow.parentWinId(), parentWindow.winId());
foreignWindow->setParent(nullptr);
QTRY_COMPARE(nativeWindow.parentWinId(), originalParentWinId);
QTRY_VERIFY(nativeWindow.parentWinId() != parentWindow.winId());
}
void tst_ForeignWindow::embedInForeignWindow()