summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/gui/kernel/qwindow/tst_foreignwindow.cpp48
-rw-r--r--tests/shared/nativewindow.h2
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)