include/test/a11y/accessibletestbase.hxx | 13 ++++++------ sw/CppunitTest_sw_a11y.mk | 2 + test/CppunitTest_test_a11y.mk | 2 + test/source/a11y/accessibletestbase.cxx | 21 ++++---------------- toolkit/qa/cppunit/a11y/AccessibleStatusBarTest.cxx | 2 - vcl/CppunitTest_vcl_gtk3_a11y.mk | 2 + vcl/qa/cppunit/a11y/atspi2/atspi2.cxx | 6 ++--- vcl/qt5/QtWidget.cxx | 4 --- 8 files changed, 23 insertions(+), 29 deletions(-)
New commits: commit 46b99f4010196ac9a4d9b9255cb08d59a6565b69 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Wed Jul 30 17:20:02 2025 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Fri Aug 1 11:32:15 2025 +0200 a11y tests: Switch AccessibleTestBase::Dialog::mxAccessible to OAccessible Change-Id: I64ce2da7cbee4e82f4fff3766f250a8f1dd8d5f0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188636 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/include/test/a11y/accessibletestbase.hxx b/include/test/a11y/accessibletestbase.hxx index 4f01681e7e46..4c275183e6d2 100644 --- a/include/test/a11y/accessibletestbase.hxx +++ b/include/test/a11y/accessibletestbase.hxx @@ -208,7 +208,7 @@ protected: private: bool mbAutoClose; css::uno::Reference<css::awt::XDialog2> mxDialog2; - css::uno::Reference<css::accessibility::XAccessible> mxAccessible; + rtl::Reference<comphelper::OAccessible> mpAccessible; public: Dialog(const css::uno::Reference<css::awt::XDialog2>& xDialog2, bool bAutoClose = true); @@ -216,9 +216,9 @@ protected: void setAutoClose(bool bAutoClose) { mbAutoClose = bAutoClose; } - const css::uno::Reference<css::accessibility::XAccessible>& getAccessible() const + css::uno::Reference<css::accessibility::XAccessible> getAccessible() const { - return mxAccessible; + return mpAccessible; } void close(sal_Int32 result = VclResponseType::RET_CANCEL); diff --git a/test/source/a11y/accessibletestbase.cxx b/test/source/a11y/accessibletestbase.cxx index 2e5d670f16ae..665da17b4c99 100644 --- a/test/source/a11y/accessibletestbase.cxx +++ b/test/source/a11y/accessibletestbase.cxx @@ -483,9 +483,9 @@ test::AccessibleTestBase::Dialog::Dialog(const uno::Reference<awt::XDialog2>& xD uno::Reference<css::awt::XWindow> xWindow(xDialog2, uno::UNO_QUERY_THROW); vcl::Window* pWindow = VCLUnoHelper::GetWindow(xWindow); assert(pWindow); - mxAccessible = pWindow->GetAccessible(); - if (mxAccessible) - setWindow(mxAccessible); + mpAccessible = pWindow->GetAccessible(); + if (mpAccessible) + setWindow(mpAccessible); else { std::cerr << "WARNING: AccessibleTestBase::Dialog() constructed with awt::XDialog2 '" commit dd19b689eee092de9fe886c5776b0a2afdf578e5 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Wed Jul 30 17:16:33 2025 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Fri Aug 1 11:32:09 2025 +0200 a11y tests: Use OAccessible for Window accessible Let test::AccessibleTestBase::getWindowAccessible return an OAccessible and drop test::AccessibleTestBase::getWindowAccessibleContext, as OAccessible implements the XAccessibleContext interface as well. Change-Id: I50308897a1539521f09fae0b13a56813077c7cc4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188635 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/include/test/a11y/accessibletestbase.hxx b/include/test/a11y/accessibletestbase.hxx index 187a345f64e0..4f01681e7e46 100644 --- a/include/test/a11y/accessibletestbase.hxx +++ b/include/test/a11y/accessibletestbase.hxx @@ -23,6 +23,7 @@ #include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/uno/Reference.hxx> +#include <comphelper/OAccessible.hxx> #include <vcl/ITiledRenderable.hxx> #include <vcl/window.hxx> @@ -51,8 +52,7 @@ protected: virtual void load(const rtl::OUString& sURL); virtual void loadFromSrc(const rtl::OUString& sSrcPath); void close(); - css::uno::Reference<css::accessibility::XAccessible> getWindowAccessible(); - css::uno::Reference<css::accessibility::XAccessibleContext> getWindowAccessibleContext(); + rtl::Reference<comphelper::OAccessible> getWindowAccessible(); virtual css::uno::Reference<css::accessibility::XAccessibleContext> getDocumentAccessibleContext(); @@ -146,7 +146,8 @@ protected: template <typename... Ts> bool activateMenuItem(Ts... names) { auto menuBar = AccessibilityTools::getAccessibleObjectForRole( - getWindowAccessibleContext(), css::accessibility::AccessibleRole::MENU_BAR); + css::uno::Reference<css::accessibility::XAccessibleContext>(getWindowAccessible()), + css::accessibility::AccessibleRole::MENU_BAR); CPPUNIT_ASSERT(menuBar.is()); return activateMenuItem(menuBar, names...); } diff --git a/sw/CppunitTest_sw_a11y.mk b/sw/CppunitTest_sw_a11y.mk index 9ad6e4bcb6ac..38a801229522 100644 --- a/sw/CppunitTest_sw_a11y.mk +++ b/sw/CppunitTest_sw_a11y.mk @@ -18,7 +18,9 @@ $(eval $(call gb_CppunitTest_add_exception_objects,sw_a11y, \ $(eval $(call gb_CppunitTest_use_libraries,sw_a11y, \ sal \ + comphelper \ cppu \ + cppuhelper \ cui \ subsequenttest \ test \ diff --git a/test/CppunitTest_test_a11y.mk b/test/CppunitTest_test_a11y.mk index 8c12e4c00959..64daf10ede4e 100644 --- a/test/CppunitTest_test_a11y.mk +++ b/test/CppunitTest_test_a11y.mk @@ -15,7 +15,9 @@ $(eval $(call gb_CppunitTest_add_exception_objects,test_a11y, \ $(eval $(call gb_CppunitTest_use_libraries,test_a11y, \ sal \ + comphelper \ cppu \ + cppuhelper \ subsequenttest \ test \ )) diff --git a/test/source/a11y/accessibletestbase.cxx b/test/source/a11y/accessibletestbase.cxx index ce9cb3a2d517..2e5d670f16ae 100644 --- a/test/source/a11y/accessibletestbase.cxx +++ b/test/source/a11y/accessibletestbase.cxx @@ -81,22 +81,11 @@ void test::AccessibleTestBase::loadFromSrc(const rtl::OUString& sSrcPath) load(m_directories.getURLFromSrc(sSrcPath)); } -uno::Reference<accessibility::XAccessible> test::AccessibleTestBase::getWindowAccessible() +rtl::Reference<comphelper::OAccessible> test::AccessibleTestBase::getWindowAccessible() { vcl::Window* pWindow = VCLUnoHelper::GetWindow(mxWindow); assert(pWindow); - css::uno::Reference<css::accessibility::XAccessible> xAccessible = pWindow->GetAccessible(); - - return xAccessible; -} - -uno::Reference<accessibility::XAccessibleContext> -test::AccessibleTestBase::getWindowAccessibleContext() -{ - css::uno::Reference<css::accessibility::XAccessible> xAccessible = getWindowAccessible(); - assert(xAccessible.is()); - - return xAccessible->getAccessibleContext(); + return pWindow->GetAccessible(); } bool test::AccessibleTestBase::isDocumentRole(const sal_Int16 role) diff --git a/toolkit/qa/cppunit/a11y/AccessibleStatusBarTest.cxx b/toolkit/qa/cppunit/a11y/AccessibleStatusBarTest.cxx index 56a929e83d34..e87e2b84f526 100644 --- a/toolkit/qa/cppunit/a11y/AccessibleStatusBarTest.cxx +++ b/toolkit/qa/cppunit/a11y/AccessibleStatusBarTest.cxx @@ -69,7 +69,7 @@ public: uno::Reference<accessibility::XAccessibleContext> AccessibleStatusBarTest::getTestObject() { - uno::Reference<accessibility::XAccessibleContext> xWinContext = getWindowAccessibleContext(); + uno::Reference<accessibility::XAccessibleContext> xWinContext = getWindowAccessible(); std::cout << "got accessible: " << xWinContext << std::endl; std::cout << "accessible name: " << AccessibilityTools::debugString(xWinContext) << std::endl; diff --git a/vcl/CppunitTest_vcl_gtk3_a11y.mk b/vcl/CppunitTest_vcl_gtk3_a11y.mk index dbfefbf1cc59..90260acda7bf 100644 --- a/vcl/CppunitTest_vcl_gtk3_a11y.mk +++ b/vcl/CppunitTest_vcl_gtk3_a11y.mk @@ -38,7 +38,9 @@ $(eval $(call gb_CppunitTest_add_libs,vcl_gtk3_a11y,\ $(eval $(call gb_CppunitTest_use_libraries,vcl_gtk3_a11y, \ sal \ + comphelper \ cppu \ + cppuhelper \ subsequenttest \ test \ i18nlangtag \ diff --git a/vcl/qa/cppunit/a11y/atspi2/atspi2.cxx b/vcl/qa/cppunit/a11y/atspi2/atspi2.cxx index b510d3243067..13cb6e6b1318 100644 --- a/vcl/qa/cppunit/a11y/atspi2/atspi2.cxx +++ b/vcl/qa/cppunit/a11y/atspi2/atspi2.cxx @@ -477,10 +477,10 @@ CPPUNIT_TEST_FIXTURE(Atspi2TestTree, Test1) accessibility::AccessibleRelationType_CONTENT_FLOWS_TO)); // END HACK - auto xContext = getWindowAccessibleContext(); - CPPUNIT_ASSERT(xContext.is()); + rtl::Reference<comphelper::OAccessible> pAccessible = getWindowAccessible(); + CPPUNIT_ASSERT(pAccessible.is()); - //~ dumpA11YTree(xContext); + //~ dumpA11YTree(pAccessible); // get the window manager frame auto xAtspiWindow = getDescendentAtPath(m_pAtspiApp, 0, ATSPI_ROLE_FRAME); commit 5255279d639a1dcb93613ba1c9e037d4ea159163 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Wed Jul 30 17:07:06 2025 +0200 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Fri Aug 1 11:32:02 2025 +0200 qt a11y: Drop getAccessibleContext call It's not needed, because the OAccessible that Window::GetAccessible returns by now also implements the XAccessibleContext iface itself. Change-Id: I88710f9f37fed6fa28b8890d0269c318e6faa8a1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188634 Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> Tested-by: Jenkins diff --git a/vcl/qt5/QtWidget.cxx b/vcl/qt5/QtWidget.cxx index 1d68099f1599..3e3ec91d98d1 100644 --- a/vcl/qt5/QtWidget.cxx +++ b/vcl/qt5/QtWidget.cxx @@ -672,9 +672,7 @@ static bool lcl_retrieveSurrounding(sal_Int32& rPosition, sal_Int32& rAnchor, QS uno::Reference<accessibility::XAccessibleEditableText> xText; try { - uno::Reference<accessibility::XAccessible> xAccessible(pFocusWin->GetAccessible()); - if (xAccessible.is()) - xText = FindFocusedEditableText(xAccessible->getAccessibleContext()); + xText = FindFocusedEditableText(pFocusWin->GetAccessible()); } catch (const uno::Exception&) {