From 3cb3c1d9a8e5cfe262be8d6e9800f604d4d48c97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Tue, 15 Aug 2023 21:04:46 +0200 Subject: xcb: Implement native window helper for embeddedwindows/foreign window test Pick-to: 6.6 Change-Id: I73720f8f49a5d7e5df7c95bf4b17ef910180e01c Reviewed-by: Liang Qi --- tests/auto/gui/kernel/qwindow/CMakeLists.txt | 6 +++++- tests/auto/gui/kernel/qwindow/tst_foreignwindow.cpp | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'tests/auto/gui/kernel/qwindow') diff --git a/tests/auto/gui/kernel/qwindow/CMakeLists.txt b/tests/auto/gui/kernel/qwindow/CMakeLists.txt index 0c4a6e877e..5824989ac3 100644 --- a/tests/auto/gui/kernel/qwindow/CMakeLists.txt +++ b/tests/auto/gui/kernel/qwindow/CMakeLists.txt @@ -20,7 +20,7 @@ qt_internal_add_test(tst_qwindow Qt::GuiPrivate ) -if(APPLE OR WIN32) +if(APPLE OR WIN32 OR QT_FEATURE_xcb) qt_internal_add_test(tst_foreignwindow LOWDPI SOURCES @@ -36,6 +36,10 @@ if(APPLE OR WIN32) set_source_files_properties(tst_foreignwindow.cpp PROPERTIES LANGUAGE OBJCXX) set_property(TARGET tst_foreignwindow PROPERTY PROPERTY MACOSX_BUNDLE TRUE) endif() + + if(QT_FEATURE_xcb) + target_link_libraries(tst_foreignwindow PRIVATE XCB::XCB) + endif() endif() ## Scopes: diff --git a/tests/auto/gui/kernel/qwindow/tst_foreignwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_foreignwindow.cpp index 04c70e5fee..ce4d9f28c8 100644 --- a/tests/auto/gui/kernel/qwindow/tst_foreignwindow.cpp +++ b/tests/auto/gui/kernel/qwindow/tst_foreignwindow.cpp @@ -60,12 +60,15 @@ void tst_ForeignWindow::initialState() const QRect initialGeometry(123, 456, 321, 654); nativeWindow.setGeometry(initialGeometry); + QTRY_COMPARE(nativeWindow.geometry(), initialGeometry); std::unique_ptr foreignWindow(QWindow::fromWinId(nativeWindow)); QCOMPARE(nativeWindow.geometry(), initialGeometry); // For extra bonus points, the foreign window should actually // reflect the state of the native window. + if (!QGuiApplication::platformName().compare(QLatin1String("xcb"), Qt::CaseInsensitive)) + QEXPECT_FAIL("", "QXcbWindow does not pick up foreign window geometry", Continue); QCOMPARE(foreignWindow->geometry(), initialGeometry); } @@ -83,7 +86,7 @@ void tst_ForeignWindow::embedForeignWindow() // As a prerequisite to that, we must be able to reparent the foreign window std::unique_ptr foreignWindow(QWindow::fromWinId(nativeWindow)); foreignWindow.release()->setParent(&parentWindow); - QCOMPARE(nativeWindow.parentWinId(), parentWindow.winId()); + QTRY_COMPARE(nativeWindow.parentWinId(), parentWindow.winId()); } #include -- cgit v1.2.3