sw/CppunitTest_sw_accessible_relation_set.mk           |    1 +
 sw/qa/extras/accessibility/accessible_relation_set.cxx |    7 ++++++-
 test/source/a11y/accessibletestbase.cxx                |    9 ++++++---
 3 files changed, 13 insertions(+), 4 deletions(-)

New commits:
commit 81b29ea15476eaeb588a74e930bfd3f44198fe05
Author:     Michael Weghorn <[email protected]>
AuthorDate: Wed May 21 11:25:20 2025 +0200
Commit:     Michael Weghorn <[email protected]>
CommitDate: Thu May 22 05:49:56 2025 +0200

    a11y test: Don't rely on XWindow being XAccessible
    
    See commit messsage of
    
        Change-Id: Id81ab5f90955ecc600e179164b5f9c7a771182d1
        Author: Michael Weghorn <[email protected]>
        Date:   Wed May 21 11:03:56 2025 +0200
    
            sw a11y test: Don't rely on XWindow being XAccessible
    
    for more background.
    
    Change-Id: Ieda73dc058444ad4b272f1a63a123289ee58bc23
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185599
    Reviewed-by: Michael Weghorn <[email protected]>
    Tested-by: Jenkins

diff --git a/test/source/a11y/accessibletestbase.cxx 
b/test/source/a11y/accessibletestbase.cxx
index 7505dce336d4..dbbdc71e44f6 100644
--- a/test/source/a11y/accessibletestbase.cxx
+++ b/test/source/a11y/accessibletestbase.cxx
@@ -30,9 +30,11 @@
 #include <com/sun/star/util/XCloseable.hpp>
 
 #include <rtl/ustrbuf.hxx>
+#include <toolkit/helper/vclunohelper.hxx>
 #include <vcl/idle.hxx>
 #include <vcl/scheduler.hxx>
 #include <vcl/svapp.hxx>
+#include <vcl/window.hxx>
 
 #include <cppuhelper/implbase.hxx>
 
@@ -82,7 +84,10 @@ void test::AccessibleTestBase::loadFromSrc(const 
rtl::OUString& sSrcPath)
 uno::Reference<accessibility::XAccessibleContext>
 test::AccessibleTestBase::getWindowAccessibleContext()
 {
-    uno::Reference<accessibility::XAccessible> xAccessible(mxWindow, 
uno::UNO_QUERY_THROW);
+    vcl::Window* pWindow = VCLUnoHelper::GetWindow(mxWindow);
+    assert(pWindow);
+    css::uno::Reference<css::accessibility::XAccessible> xAccessible = 
pWindow->GetAccessible();
+    assert(xAccessible.is());
 
     return xAccessible->getAccessibleContext();
 }
commit 3dce350e9059c1badf91972b835d314d77fb2c64
Author:     Michael Weghorn <[email protected]>
AuthorDate: Wed May 21 11:20:47 2025 +0200
Commit:     Michael Weghorn <[email protected]>
CommitDate: Thu May 22 05:49:49 2025 +0200

    a11y tests: Drop unused include
    
    Change-Id: Iaa1baccfb0b95972cd8703da8f80433fdcd62163
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185598
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <[email protected]>

diff --git a/test/source/a11y/accessibletestbase.cxx 
b/test/source/a11y/accessibletestbase.cxx
index c10077823e68..7505dce336d4 100644
--- a/test/source/a11y/accessibletestbase.cxx
+++ b/test/source/a11y/accessibletestbase.cxx
@@ -9,8 +9,6 @@
 
 #include <test/a11y/accessibletestbase.hxx>
 
-#include <string>
-
 #include <com/sun/star/accessibility/AccessibleRelationType.hpp>
 #include <com/sun/star/accessibility/XAccessibleContext.hpp>
 #include <com/sun/star/accessibility/XAccessibleText.hpp>
commit b1f3e41f1015f0166dca1382c5fa1d1223f72fb8
Author:     Michael Weghorn <[email protected]>
AuthorDate: Wed May 21 11:03:56 2025 +0200
Commit:     Michael Weghorn <[email protected]>
CommitDate: Thu May 22 05:49:42 2025 +0200

    sw a11y test: Don't rely on XWindow being XAccessible
    
    The fact that the VCLXWindow (which implements the
    XWindow interface) is currently also the XAccessible
    for most vcl::Window subclasses (see Window::GetAccessible
    and the default implementation in Window::CreateAccessible,
    but which is overriden in some vcl::Window subclasses) is an
    implementation detail and subject to change, so don't rely on that.
    Instead, call Window::GetAccessible on the underlying
    vcl::Window.
    
    See also
    
        commit b608604d0bbecdc24a17175374581b4e2d720658
        Author: Michael Weghorn <[email protected]>
        Date:   Thu Dec 5 14:07:52 2024 +0000
    
            tdf#164093 tdf#157001 wina11y: Use vcl::Window's actual XAccessible
    
    Change-Id: Id81ab5f90955ecc600e179164b5f9c7a771182d1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185597
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <[email protected]>

diff --git a/sw/CppunitTest_sw_accessible_relation_set.mk 
b/sw/CppunitTest_sw_accessible_relation_set.mk
index 90a3caeb189a..5fcbef8af454 100644
--- a/sw/CppunitTest_sw_accessible_relation_set.mk
+++ b/sw/CppunitTest_sw_accessible_relation_set.mk
@@ -26,6 +26,7 @@ $(eval $(call 
gb_CppunitTest_use_libraries,sw_accessible_relation_set, \
     subsequenttest \
     sw \
     test \
+    tk \
        tl \
     unotest \
     utl \
diff --git a/sw/qa/extras/accessibility/accessible_relation_set.cxx 
b/sw/qa/extras/accessibility/accessible_relation_set.cxx
index 378a588a8e01..67e25c3cb418 100644
--- a/sw/qa/extras/accessibility/accessible_relation_set.cxx
+++ b/sw/qa/extras/accessibility/accessible_relation_set.cxx
@@ -33,6 +33,8 @@
 #include <com/sun/star/text/XTextDocument.hpp>
 #include <com/sun/star/text/XTextCursor.hpp>
 #include <com/sun/star/text/ControlCharacter.hpp>
+#include <toolkit/helper/vclunohelper.hxx>
+#include <vcl/window.hxx>
 
 #include <test/a11y/AccessibilityTools.hxx>
 
@@ -82,7 +84,10 @@ void 
AccessibleRelationSet::init(uno::Reference<css::accessibility::XAccessible>
     uno::Reference<frame::XFrame> xFrame(xController->getFrame(), 
uno::UNO_SET_THROW);
     uno::Reference<awt::XWindow> xWindow(xFrame->getComponentWindow(), 
uno::UNO_SET_THROW);
 
-    css::uno::Reference<css::accessibility::XAccessible> xRoot(xWindow, 
uno::UNO_QUERY_THROW);
+    vcl::Window* pWindow = VCLUnoHelper::GetWindow(xWindow);
+    CPPUNIT_ASSERT_MESSAGE("Couldn't retrieve vcl::Window", pWindow);
+    css::uno::Reference<css::accessibility::XAccessible> xRoot = 
pWindow->GetAccessible();
+    CPPUNIT_ASSERT_MESSAGE("Couldn't retrieve window's accessible", 
xRoot.is());
     ctx = AccessibilityTools::getAccessibleObjectForRole(xRoot, 
AccessibleRole::DOCUMENT_TEXT);
     CPPUNIT_ASSERT_MESSAGE("Couldn't get AccessibleRole.DOCUMENT_TEXT object", 
ctx.is());
     para1 = ctx->getAccessibleChild(0);

Reply via email to