From 37b702dc124235e469b4ef0a810f3ddeaa33565e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20de=20la=20Rocha?= Date: Thu, 31 Mar 2022 00:54:45 -0300 Subject: [PATCH] Windows: Fix accessibility tests Accessibility tests were not being built on Windows as they were depending on a WindowsUIAutomationSupport internal module that no longer exists, as the UI Automation support classes are now in QtGui. The patch also fixes a test that was calculating widget geometry incorrectly on high DPI screens. Pick-to: 6.2 6.3 Change-Id: Iefed0f6d147853484dfab4b16838b9088fd32dcf Reviewed-by: Volker Hilsheimer --- tests/auto/other/qaccessibility/CMakeLists.txt | 6 ------ tests/auto/other/qaccessibility/tst_qaccessibility.cpp | 7 ++++++- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/tests/auto/other/qaccessibility/CMakeLists.txt b/tests/auto/other/qaccessibility/CMakeLists.txt index c516188396..1d7b1c3901 100644 --- a/tests/auto/other/qaccessibility/CMakeLists.txt +++ b/tests/auto/other/qaccessibility/CMakeLists.txt @@ -4,12 +4,6 @@ if(NOT QT_FEATURE_accessibility) return() endif() -# special case begin -if (WIN32 AND NOT TARGET Qt::WindowsUIAutomationSupport) - return() -endif() -# special case end - ##################################################################### ## tst_qaccessibility Test: ##################################################################### diff --git a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp index a593a91525..95223057a0 100644 --- a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp @@ -3867,7 +3867,12 @@ void tst_QAccessibility::bridgeTest() RECT rect; hr = buttonElement->get_CurrentBoundingRectangle(&rect); QVERIFY(SUCCEEDED(hr)); - QCOMPARE(buttonRect, QRect(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top)); + const QRect boundingRect(rect.left, rect.top, rect.right - rect.left + 1, rect.bottom - rect.top + 1); + const QRectF nativeRect = QHighDpi::toNativePixels(QRectF(buttonRect), window.windowHandle()); + const QRect truncRect(int(nativeRect.left()), int(nativeRect.top()), + int(nativeRect.right()) - int(nativeRect.left()) + 1, + int(nativeRect.bottom()) - int(nativeRect.top()) + 1); + QCOMPARE(truncRect, boundingRect); buttonElement->Release();