diff options
| author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2024-05-08 09:42:08 +0000 |
|---|---|---|
| committer | The Qt Project <gerrit-noreply@qt-project.org> | 2024-05-08 14:28:10 +0000 |
| commit | c195fe7d33decbd5ddd47ae46dbf8e0d9c20ba85 (patch) | |
| tree | 9b7a0ce97c70e21b2db2c7206b7b9266707157aa /tests | |
| parent | 3eb0c8007c9a8423a8c3476c3c1091c284bb2e52 (diff) | |
This reverts commit 4d5aedac1de02ec21bc6f4ae8c66e1e7bfc665a4.
It broke window activation on iOS somehow.
Change-Id: I01fc476d23a65f39aa33d9abd06417ffcd13b5aa
Task-number: QTBUG-125142
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/auto/gui/kernel/qwindow/tst_foreignwindow.cpp | 48 | ||||
| -rw-r--r-- | tests/shared/nativewindow.h | 2 |
2 files changed, 1 insertions, 49 deletions
diff --git a/tests/auto/gui/kernel/qwindow/tst_foreignwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_foreignwindow.cpp index 526abd6ea37..e7b05e70374 100644 --- a/tests/auto/gui/kernel/qwindow/tst_foreignwindow.cpp +++ b/tests/auto/gui/kernel/qwindow/tst_foreignwindow.cpp @@ -26,9 +26,6 @@ private slots: void embedForeignWindow(); void embedInForeignWindow(); - - void destroyExplicitly(); - void destroyWhenParentIsDestroyed(); }; void tst_ForeignWindow::fromWinId() @@ -141,50 +138,5 @@ void tst_ForeignWindow::embedInForeignWindow() } } -void tst_ForeignWindow::destroyExplicitly() -{ - NativeWindow nativeWindow; - QVERIFY(nativeWindow); - - std::unique_ptr<QWindow> foreignWindow(QWindow::fromWinId(nativeWindow)); - QVERIFY(foreignWindow->handle()); - - // Explicitly destroying a foreign window is a no-op, as - // the documentation claims that it "releases the native - // platform resources associated with this window.", which - // is not technically true for foreign windows. - auto *windowHandleBeforeDestroy = foreignWindow->handle(); - foreignWindow->destroy(); - QCOMPARE(foreignWindow->handle(), windowHandleBeforeDestroy); -} - -void tst_ForeignWindow::destroyWhenParentIsDestroyed() -{ - QWindow parentWindow; - - NativeWindow nativeWindow; - QVERIFY(nativeWindow); - - std::unique_ptr<QWindow> foreignWindow(QWindow::fromWinId(nativeWindow)); - foreignWindow->setParent(&parentWindow); - QTRY_COMPARE(nativeWindow.parentWinId(), parentWindow.winId()); - - // Reparenting into a window will result in creating it - QVERIFY(parentWindow.handle()); - - // Destroying the parent window of the foreign window results - // in destroying the foreign window as well, as the foreign - // window no longer has a parent it can be embedded in. - QVERIFY(foreignWindow->handle()); - parentWindow.destroy(); - QVERIFY(!foreignWindow->handle()); - - // But the foreign window can be recreated again, and will - // continue to be a native child of the parent window. - foreignWindow->create(); - QVERIFY(foreignWindow->handle()); - QTRY_COMPARE(nativeWindow.parentWinId(), parentWindow.winId()); -} - #include <tst_foreignwindow.moc> QTEST_MAIN(tst_ForeignWindow) diff --git a/tests/shared/nativewindow.h b/tests/shared/nativewindow.h index 957f84f9494..6acb9b85d59 100644 --- a/tests/shared/nativewindow.h +++ b/tests/shared/nativewindow.h @@ -238,7 +238,7 @@ WId NativeWindow::parentWinId() const xcb_query_tree_reply_t *tree = xcb_query_tree_reply( connection, xcb_query_tree(connection, m_handle), nullptr); const auto cleanup = qScopeGuard([&]{ free(tree); }); - return tree ? tree->parent : 0; + return tree->parent; } bool NativeWindow::isParentOf(WId childWinId) |
