diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2023-08-15 21:04:46 +0200 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2023-09-12 02:47:24 +0200 |
commit | 3cb3c1d9a8e5cfe262be8d6e9800f604d4d48c97 (patch) | |
tree | 282d3ef55ac040a7981315de68498af37c0ee550 /tests/auto/gui/kernel | |
parent | bbf0022d99b223239c7ce7769af9f58c01fc5c68 (diff) |
xcb: Implement native window helper for embeddedwindows/foreign window test
Pick-to: 6.6
Change-Id: I73720f8f49a5d7e5df7c95bf4b17ef910180e01c
Reviewed-by: Liang Qi <liang.qi@qt.io>
Diffstat (limited to 'tests/auto/gui/kernel')
-rw-r--r-- | tests/auto/gui/kernel/qwindow/CMakeLists.txt | 6 | ||||
-rw-r--r-- | tests/auto/gui/kernel/qwindow/tst_foreignwindow.cpp | 5 |
2 files changed, 9 insertions, 2 deletions
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<QWindow> 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<QWindow> foreignWindow(QWindow::fromWinId(nativeWindow)); foreignWindow.release()->setParent(&parentWindow); - QCOMPARE(nativeWindow.parentWinId(), parentWindow.winId()); + QTRY_COMPARE(nativeWindow.parentWinId(), parentWindow.winId()); } #include <tst_foreignwindow.moc> |