[Libreoffice-commits] core.git: configure.ac

2023-08-04 Thread Colomban Wendling (via logerrit)
 configure.ac |   23 ++-
 1 file changed, 10 insertions(+), 13 deletions(-)

New commits:
commit 0f0a4c68bec8bf7e995142961925f74b83e1ed90
Author: Colomban Wendling 
AuthorDate: Thu Aug 3 15:49:43 2023 +0200
Commit: Stephan Bergmann 
CommitDate: Fri Aug 4 13:42:29 2023 +0200

Fix --disable-atspi-tests when requirement are found

Drop `test_atspi_tests` altogether which only adds complexity, and fix
the case where using `--disable-atspi-tests` was not disabling
anything.

Change-Id: Iadcb5b757433917a2150801c8de0ba4634c7e2fe
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155288
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/configure.ac b/configure.ac
index 667e3748cc7c..9596d04b117f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1199,8 +1199,6 @@ test "${test_gtk3_kde5+set}" != set -a "$test_kf5" = yes 
-a "$test_gtk3" = yes &
 test "${test_system_fontconfig+set}" != set -a "${test_system_freetype+set}" = 
set && test_system_fontconfig="$test_system_freetype"
 test "${test_system_freetype+set}" != set -a "${test_system_fontconfig+set}" = 
set && test_system_freetype="$test_system_fontconfig"
 
-test "${test_atspi_tests+set}" = set || test_atspi_tests="$test_gtk3"
-
 # convenience / platform overriding "fixes"
 # Don't sort!
 test "$test_kf5" = yes -a "$test_qt5" = no && test_kf5=no
@@ -11784,14 +11782,13 @@ if test "$enable_introspection" = yes; then
 fi
 
 # AT-SPI2 tests require gtk3, xvfb-run, dbus-launch and atspi-2
-test enable_atspi_tests = yes && test_atspi_tests=yes
-if test "$test_atspi_tests" = yes && ! test "$ENABLE_GTK3" = TRUE; then
+if ! test "$ENABLE_GTK3" = TRUE; then
 if test "$enable_atspi_tests" = yes; then
 AC_MSG_ERROR([--enable-atspi-tests requires --enable-gtk3])
 fi
-test_atspi_tests=no
+enable_atspi_tests=no
 fi
-if test "$test_atspi_tests" = yes; then
+if ! test "$enable_atspi_tests" = no; then
 AC_PATH_PROGS([XVFB_RUN], [xvfb-run], no)
 if ! test "$XVFB_RUN" = no; then
 dnl make sure the found xvfb-run actually works
@@ -11807,27 +11804,27 @@ if test "$test_atspi_tests" = yes; then
 if test "$enable_atspi_tests" = yes; then
 AC_MSG_ERROR([xvfb-run required by --enable-atspi-tests not found])
 fi
-test_atspi_tests=no
+enable_atspi_tests=no
 fi
 fi
-if test "$test_atspi_tests" = yes; then
+if ! test "$enable_atspi_tests" = no; then
 AC_PATH_PROGS([DBUS_LAUNCH], [dbus-launch], no)
 if test "$DBUS_LAUNCH" = no; then
 if test "$enable_atspi_tests" = yes; then
 AC_MSG_ERROR([dbus-launch required by --enable-atspi-tests not 
found])
 fi
-test_atspi_tests=no
+enable_atspi_tests=no
 fi
 fi
-if test "$test_atspi_tests" = yes; then
+if ! test "$enable_atspi_tests" = no; then
 PKG_CHECK_MODULES([ATSPI2], [atspi-2 gobject-2.0],,
   [if test "$enable_atspi_tests" = yes; then
AC_MSG_ERROR([$ATSPI2_PKG_ERRORS])
else
-   test_atspi_tests=no
+   enable_atspi_tests=no
fi])
 fi
-if test "x$test_atspi_tests" = xyes; then
+if ! test "x$enable_atspi_tests" = xno; then
 PKG_CHECK_MODULES([ATSPI2_2_32], [atspi-2 >= 2.32],
   [have_atspi_scroll_to=1],
   [have_atspi_scroll_to=0])
@@ -11835,7 +11832,7 @@ if test "x$test_atspi_tests" = xyes; then
[Whether AT-SPI2 has the scrollTo API])
 fi
 ENABLE_ATSPI_TESTS=
-test "$test_atspi_tests" = yes && ENABLE_ATSPI_TESTS=TRUE
+test "$enable_atspi_tests" = no || ENABLE_ATSPI_TESTS=TRUE
 AC_SUBST([ENABLE_ATSPI_TESTS])
 
 dnl ===


[Libreoffice-commits] core.git: vcl/qa

2023-08-03 Thread Colomban Wendling (via logerrit)
 vcl/qa/cppunit/a11y/atspi2/atspi2testbase.hxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 150a1528882347882e857649290fe81d5aa08345
Author: Colomban Wendling 
AuthorDate: Thu Aug 3 16:09:27 2023 +0200
Commit: Michael Weghorn 
CommitDate: Fri Aug 4 07:55:55 2023 +0200

gtk3 a11y tests: Increase DBus timeout

We apparently get recurrent spurious timeout failures in the CI
related to DBus timeout, so increase that value.

The chosen value is a bit arbitrary, but is below the maximum
recommended by the documentation (even though the recommendation hardly
applies to our use case), and more than 3 times larger than the
default.  That will hopefully be enough.

Change-Id: I244f711f46353009743015d00b303aeb87332936
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155310
Tested-by: Jenkins
Reviewed-by: Michael Weghorn 

diff --git a/vcl/qa/cppunit/a11y/atspi2/atspi2testbase.hxx 
b/vcl/qa/cppunit/a11y/atspi2/atspi2testbase.hxx
index 12a58da79d4b..bcde764aa981 100644
--- a/vcl/qa/cppunit/a11y/atspi2/atspi2testbase.hxx
+++ b/vcl/qa/cppunit/a11y/atspi2/atspi2testbase.hxx
@@ -79,6 +79,9 @@ public:
 {
 if (!atspi_is_initialized())
 atspi_init();
+
+// increase timeout to avoid spurious avoid CI failures
+atspi_set_timeout(2500, 15000);
 }
 
 virtual void setUp() override


[Libreoffice-commits] core.git: compilerplugins/clang config_host/config_atspi.h.in config_host.mk.in configure.ac distro-configs/Jenkins include/test test/source vcl/CppunitTest_vcl_gtk3_a11y.mk vcl/

2023-07-27 Thread Colomban Wendling (via logerrit)
 compilerplugins/clang/staticmethods.cxx |4 
 config_host.mk.in   |5 
 config_host/config_atspi.h.in   |   14 
 configure.ac|   62 
 distro-configs/Jenkins/linux_clang_dbgutil_64   |1 
 distro-configs/Jenkins/linux_gcc_release_64 |1 
 include/test/a11y/AccessibilityTools.hxx|2 
 test/source/a11y/AccessibilityTools.cxx |6 
 vcl/CppunitTest_vcl_gtk3_a11y.mk|   61 
 vcl/Module_vcl.mk   |6 
 vcl/qa/cppunit/a11y/atspi2/atspi2.cxx   |  498 +++
 vcl/qa/cppunit/a11y/atspi2/atspi2.hxx   |   45 
 vcl/qa/cppunit/a11y/atspi2/atspi2testbase.hxx   |   94 +
 vcl/qa/cppunit/a11y/atspi2/atspi2text.cxx   | 1017 
 vcl/qa/cppunit/a11y/atspi2/atspiwrapper.cxx |   22 
 vcl/qa/cppunit/a11y/atspi2/atspiwrapper.hxx |  784 
 vcl/qa/cppunit/a11y/atspi2/testdocuments/ecclectic.fodt |  258 
 17 files changed, 2879 insertions(+), 1 deletion(-)

New commits:
commit 3426dcfec2b4d5c755024c355f323ecc9f656e4a
Author: Colomban Wendling 
AuthorDate: Wed Apr 5 15:39:25 2023 +0200
Commit: Michael Weghorn 
CommitDate: Thu Jul 27 20:01:17 2023 +0200

vcl gtk3: Introduce AT-SPI2 tests for the GTK3 accessibility layer

Add tests for the GTK3 accessibility platform layer.  These tests
compare the internal LO representation with what is visible to the
platform, and thus the user's accessibility tools.

In most cases the tests are fairly trivial as LO's internals are not
far off AT-SPI2's expectations.  There are however notable exceptions
like for example the text attributes, that have a wildly different
representation and require more complex checks matching what LO's
platform layer does, the other way around.

These tests use libatspi2 directly, but as the C API is awful to work
with regarding resource management, there are wrappers to handle the
complexity using RAII.  The resulting API is fairly trivial to use.

As these tests require using the GTK3 VCL plugin and for the a11y tree
to be visible to AT-SPI2, they are run under XVFB using a separate dbus
session through dbus-launch.

Working on this has already lead to reporting and/or solving some
issues:

* https://gerrit.libreoffice.org/c/core/+/151303
* https://gerrit.libreoffice.org/c/core/+/151650
* https://gerrit.libreoffice.org/c/core/+/152456
* https://gerrit.libreoffice.org/c/core/+/152457
* https://bugs.documentfoundation.org/show_bug.cgi?id=155625
* https://bugs.documentfoundation.org/show_bug.cgi?id=155705
* https://gerrit.libreoffice.org/c/core/+/152748

Only a subset of the a11y APIs are covered for the moment, but the
current state should make it easy to extend upon.

Change-Id: I1a047864ce8dc1f1bc3056ad00159f7fd5e5b7d3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153069
Tested-by: Jenkins
Reviewed-by: Michael Weghorn 

diff --git a/compilerplugins/clang/staticmethods.cxx 
b/compilerplugins/clang/staticmethods.cxx
index 4651a4a3d060..38180c1daa2c 100644
--- a/compilerplugins/clang/staticmethods.cxx
+++ b/compilerplugins/clang/staticmethods.cxx
@@ -184,7 +184,9 @@ bool StaticMethods::TraverseCXXMethodDecl(const 
CXXMethodDecl * pCXXMethodDecl)
 .GlobalNamespace())
 || (fdc.Function("Read_Majority").Class("SwWW8ImplReader")
 .GlobalNamespace())
-|| fdc.Function("Ignore").Class("SwWrtShell").GlobalNamespace())
+|| fdc.Function("Ignore").Class("SwWrtShell").GlobalNamespace()
+|| 
(cdc.Class("AttributesChecker").AnonymousNamespace().GlobalNamespace()
+&& startsWith(pCXXMethodDecl->getNameAsString(), "check")))
 {
 return true;
 }
diff --git a/config_host.mk.in b/config_host.mk.in
index acb868b8f05f..85089efb254e 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -31,6 +31,8 @@ export ASSERT_ALWAYS_ABORT=@ASSERT_ALWAYS_ABORT@
 export ATL_INCLUDE=@ATL_INCLUDE@
 export ATL_LIB=@ATL_LIB@
 export ATOMIC_LIB=@ATOMIC_LIB@
+export ATSPI2_CFLAGS=$(gb_SPACE)@ATSPI2_CFLAGS@
+export ATSPI2_LIBS=$(gb_SPACE)@ATSPI2_LIBS@
 export AVAHI_CFLAGS=$(gb_SPACE)@AVAHI_CFLAGS@
 export AVAHI_LIBS=$(gb_SPACE)@AVAHI_LIBS@
 export LIBATOMIC_OPS_CFLAGS=$(gb_SPACE)@LIBATOMIC_OPS_CFLAGS@
@@ -123,6 +125,7 @@ export DBUS_LIBS=$(gb_SPACE)@DBUS_LIBS@
 export DBUS_GLIB_CFLAGS=$(gb_SPACE)@DBUS_GLIB_CFLAGS@
 export DBUS_GLIB_LIBS=$(gb_SPACE)@DBUS_GLIB_LIBS@
 export DBUS_HAVE_GLIB=@DBUS_HAVE_GLIB@
+export DBUS_LAUNCH=@DBUS_LAUNCH@
 export DCONF_CFLAGS=@DCONF_CFLAGS@
 export DCONF_LIBS=@DCONF_LIBS@
 export DEFAULT_BRAND_IMAGES=@DEFAULT_BRAND_IMAGES@
@@ -153,6 +156,7 @@ export ENABLE_COINMP=@ENABLE_COINMP@
 

[Libreoffice-commits] core.git: sw/CppunitTest_sw_a11y.mk sw/qa

2023-07-13 Thread Colomban Wendling (via logerrit)
 sw/CppunitTest_sw_a11y.mk   |1 
 sw/qa/extras/accessibility/tdf155705.cxx|   57 +++
 sw/qa/extras/accessibility/testdocuments/tdf155705.fodt |  130 
 3 files changed, 188 insertions(+)

New commits:
commit d54a48c008dc9c9cf206d7c7dd37b8d2fdd4e86d
Author: Colomban Wendling 
AuthorDate: Tue Jun 6 15:29:20 2023 +0200
Commit: Michael Weghorn 
CommitDate: Fri Jul 14 07:39:05 2023 +0200

Add test case for tdf#155705

Change-Id: Ib70bcd6ab8e269f21f7182e544490e6d19f2c940
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154130
Tested-by: Jenkins
Reviewed-by: Michael Weghorn 

diff --git a/sw/CppunitTest_sw_a11y.mk b/sw/CppunitTest_sw_a11y.mk
index 070f0e402d88..a0d76a20d53a 100644
--- a/sw/CppunitTest_sw_a11y.mk
+++ b/sw/CppunitTest_sw_a11y.mk
@@ -13,6 +13,7 @@ $(eval $(call gb_CppunitTest_add_exception_objects,sw_a11y, \
sw/qa/extras/accessibility/basics \
sw/qa/extras/accessibility/dialogs \
sw/qa/extras/accessibility/unicode \
+   sw/qa/extras/accessibility/tdf155705 \
 ))
 
 $(eval $(call gb_CppunitTest_use_libraries,sw_a11y, \
diff --git a/sw/qa/extras/accessibility/tdf155705.cxx 
b/sw/qa/extras/accessibility/tdf155705.cxx
new file mode 100644
index ..ebaf4600142a
--- /dev/null
+++ b/sw/qa/extras/accessibility/tdf155705.cxx
@@ -0,0 +1,57 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; 
fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+#include 
+
+using namespace css;
+
+/* This test only works if spell checking is available for en_US */
+CPPUNIT_TEST_FIXTURE(test::SwAccessibleTestBase, tdf155705)
+{
+loadFromSrc(u"/sw/qa/extras/accessibility/testdocuments/tdf155705.fodt");
+
+/* we need to give it a second to fully set up the XAccessibleTextMarkup, 
otherwise we get a
+ * dysfunctional one that asserts out on m_pTextFrame */
+Scheduler::ProcessEventsToIdle();
+
+uno::Reference xLSM2
+= linguistic2::LinguServiceManager::create(m_xContext);
+uno::Reference 
xSpell(xLSM2->getSpellChecker(), uno::UNO_QUERY);
+if (!xSpell.is() || 
!xSpell->hasLanguage(static_cast(LANGUAGE_ENGLISH_US)))
+return;
+
+auto xContext = getDocumentAccessibleContext();
+CPPUNIT_ASSERT(xContext.is());
+
+auto xChildContext = getAllChildren(xContext).back();
+uno::Reference xMarkup(xChildContext,
+ 
uno::UNO_QUERY_THROW);
+
+// make sure the idle spellcheck pass runs
+AccessibilityTools::Await(
+[]() { return 0 < 
xMarkup->getTextMarkupCount(text::TextMarkupType::SPELLCHECK); });
+
+CPPUNIT_ASSERT_GREATER(sal_Int32(0),
+   
xMarkup->getTextMarkupCount(text::TextMarkupType::SPELLCHECK));
+auto aSegment = xMarkup->getTextMarkup(0, 
text::TextMarkupType::SPELLCHECK);
+CPPUNIT_ASSERT_GREATEREQUAL(sal_Int32(0), aSegment.SegmentStart);
+CPPUNIT_ASSERT_GREATER(aSegment.SegmentStart, aSegment.SegmentEnd);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/sw/qa/extras/accessibility/testdocuments/tdf155705.fodt 
b/sw/qa/extras/accessibility/testdocuments/tdf155705.fodt
new file mode 100644
index ..8a22551ca911
--- /dev/null
+++ b/sw/qa/extras/accessibility/testdocuments/tdf155705.fodt
@@ -0,0 +1,130 @@
+
+http://www.w3.org/TR/css3-text/; 
xmlns:grddl="http://www.w3.org/2003/g/data-view#; 
xmlns:xhtml="http://www.w3.org/1999/xhtml; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema; 
xmlns:xforms="http://www.w3.org/2002/xforms; 
xmlns:dom="http://www.w3.org/2001/xml-events; 
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" 
xmlns:math="http://www.w3.org/1998/Math/MathML; 
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
xmlns:ooo="http://openoffice.org/2004/office; 
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" 
xmlns:ooow="http://openoffice.org/2004/writer; 
xmlns:xlink="http://www.w3.org/1999/xlink; 
xmlns:drawooo="http://openoffice.org/2010/draw; 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 xmlns:meta="u
 rn:oasis:names:tc:opendocument:xmlns:meta:1.0" 
xmlns:oooc="http://openoffice.org/2004/calc; 
xmlns:dc="http://purl.org/dc/elements/1.1/; 
xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0"
 

[Libreoffice-commits] core.git: Branch 'libreoffice-7-6' - sw/source

2023-06-11 Thread Colomban Wendling (via logerrit)
 sw/source/core/access/accpara.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 5899f2d6794a02112f8b4e2983fb1d41527bf2d4
Author: Colomban Wendling 
AuthorDate: Thu Jun 8 17:43:49 2023 +0200
Commit: Adolfo Jayme Barrientos 
CommitDate: Sun Jun 11 21:39:04 2023 +0200

sw: Fix crash accessing default accessible attributes

Fix crash accessing the name of the MMToPixelRatio item in the sequence
returned by SwAccessibleParagraph::getDefaultAttributes(), because a
temporary local was used as the property name, but got destroyed when
the method returns.

This was introduced in 46ce0d28b4c765076c7871358375c4e85e44534b,
probably by inadvertently removing the `static` qualifier.

Change-Id: I1d5004b0b0fdf9651781b9c71b67afeba61c284c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152748
Reviewed-by: Noel Grandin 
Tested-by: Noel Grandin 
(cherry picked from commit 235b0a4d30598631218dcc289a9efa85cd52ed3a)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152766
Tested-by: Jenkins
Reviewed-by: Adolfo Jayme Barrientos 

diff --git a/sw/source/core/access/accpara.cxx 
b/sw/source/core/access/accpara.cxx
index bf88bda18bc4..c0599dbe3695 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -1598,7 +1598,7 @@ uno::Sequence< PropertyValue > 
SwAccessibleParagraph::getDefaultAttributes(
 _getDefaultAttributesImpl( aRequestedAttributes, aDefAttrSeq );
 
 // #i92233#
-constexpr OUStringLiteral sMMToPixelRatio = u"MMToPixelRatio";
+static constexpr OUStringLiteral sMMToPixelRatio = u"MMToPixelRatio";
 bool bProvideMMToPixelRatio( !aRequestedAttributes.hasElements() ||
  (comphelper::findValue(aRequestedAttributes, 
sMMToPixelRatio) != -1) );
 


[Libreoffice-commits] core.git: sw/source

2023-06-08 Thread Colomban Wendling (via logerrit)
 sw/source/core/access/accpara.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 235b0a4d30598631218dcc289a9efa85cd52ed3a
Author: Colomban Wendling 
AuthorDate: Thu Jun 8 17:43:49 2023 +0200
Commit: Noel Grandin 
CommitDate: Thu Jun 8 22:44:26 2023 +0200

sw: Fix crash accessing default accessible attributes

Fix crash accessing the name of the MMToPixelRatio item in the sequence
returned by SwAccessibleParagraph::getDefaultAttributes(), because a
temporary local was used as the property name, but got destroyed when
the method returns.

This was introduced in 46ce0d28b4c765076c7871358375c4e85e44534b,
probably by inadvertently removing the `static` qualifier.

Change-Id: I1d5004b0b0fdf9651781b9c71b67afeba61c284c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152748
Reviewed-by: Noel Grandin 
Tested-by: Noel Grandin 

diff --git a/sw/source/core/access/accpara.cxx 
b/sw/source/core/access/accpara.cxx
index bf88bda18bc4..c0599dbe3695 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -1598,7 +1598,7 @@ uno::Sequence< PropertyValue > 
SwAccessibleParagraph::getDefaultAttributes(
 _getDefaultAttributesImpl( aRequestedAttributes, aDefAttrSeq );
 
 // #i92233#
-constexpr OUStringLiteral sMMToPixelRatio = u"MMToPixelRatio";
+static constexpr OUStringLiteral sMMToPixelRatio = u"MMToPixelRatio";
 bool bProvideMMToPixelRatio( !aRequestedAttributes.hasElements() ||
  (comphelper::findValue(aRequestedAttributes, 
sMMToPixelRatio) != -1) );
 


[Libreoffice-commits] core.git: 2 commits - vcl/unx

2023-06-04 Thread Colomban Wendling (via logerrit)
 vcl/unx/gtk3/a11y/atkwrapper.cxx |4 
 1 file changed, 4 insertions(+)

New commits:
commit 8698b354ca9cd3b48aee513dd1564e46ca513261
Author: Colomban Wendling 
AuthorDate: Wed May 31 19:20:40 2023 +0200
Commit: Michael Weghorn 
CommitDate: Mon Jun 5 06:37:29 2023 +0200

gtk3 a11y: Consolidate reporting accessible name

Just like in I61c4d8d4713b2b82ebb40d9de2a8a773405591ba, avoid the any
assumption on what the parent would do in its own implementation, and
return ourselves when we mean to.

The case of AtkObjectWrapper::get_name() is actually currently fine,
because AtkObject::get_name() does what we think it does, and
GtkWidgetAccessible doesn't override it, but it's safer not to rely on
those assumptions.

Change-Id: Ib500d8efa8501206da66c3cca4f6b93bd426cb7d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152457
Tested-by: Jenkins
Reviewed-by: Michael Weghorn 

diff --git a/vcl/unx/gtk3/a11y/atkwrapper.cxx b/vcl/unx/gtk3/a11y/atkwrapper.cxx
index b8cb62cf8b30..f322987dbbcd 100644
--- a/vcl/unx/gtk3/a11y/atkwrapper.cxx
+++ b/vcl/unx/gtk3/a11y/atkwrapper.cxx
@@ -377,6 +377,8 @@ wrapper_get_name( AtkObject *atk_obj )
 if( atk_obj->name )
 g_free(atk_obj->name);
 atk_obj->name = g_strdup(aName.getStr());
+
+return atk_obj->name;
 }
 }
 catch(const uno::Exception&) {
commit ac643f1ae48bae7af6e7c0a5cc5a8dc83beac49b
Author: Colomban Wendling 
AuthorDate: Wed May 31 19:12:33 2023 +0200
Commit: Michael Weghorn 
CommitDate: Mon Jun 5 06:37:22 2023 +0200

gtk3 a11y: Fix reporting accessible description

AtkObjectWrapper::get_description() sets the AtkObject::description
field and chains up to its parent, expecting it to return that member
to the caller.

This is a questionable assumption, but that's what AtkObject does.
However, since f3b0a95f9c2f85604808c21485e46e43aebbbfed which fixed
tdf#150496, the direct parent is GtkWidgetAccessible, not AtkObject.
And the assumption about returning AtkObject::description doesn't hold
then, because GtkWidgetAccessible short-circuits the call if it can't
find the associate GtkWidget, which doesn't exist.

To fix this, return the member directly when we set it, but leave it
to the parent if we don't have anything better in case it could
actually do something useful, and because it's customary.

Change-Id: I61c4d8d4713b2b82ebb40d9de2a8a773405591ba
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152456
Tested-by: Jenkins
Reviewed-by: Michael Weghorn 

diff --git a/vcl/unx/gtk3/a11y/atkwrapper.cxx b/vcl/unx/gtk3/a11y/atkwrapper.cxx
index 22a6715d3037..b8cb62cf8b30 100644
--- a/vcl/unx/gtk3/a11y/atkwrapper.cxx
+++ b/vcl/unx/gtk3/a11y/atkwrapper.cxx
@@ -404,6 +404,8 @@ wrapper_get_description( AtkObject *atk_obj )
 
 g_free(atk_obj->description);
 atk_obj->description = g_strdup(aDescription.getStr());
+
+return atk_obj->description;
 }
 catch(const uno::Exception&) {
 g_warning( "Exception in getAccessibleDescription()" );


[Libreoffice-commits] core.git: vcl/unx

2023-05-23 Thread Colomban Wendling (via logerrit)
 vcl/unx/gtk3/a11y/atktext.cxx |7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

New commits:
commit 4dc2d5ec7a375f5543f3fba8c1e56988c0e8067f
Author: Colomban Wendling 
AuthorDate: Tue May 9 18:30:12 2023 +0200
Commit: Michael Weghorn 
CommitDate: Tue May 23 21:44:27 2023 +0200

gtk a11y: Return 0x for invalid characters

Make get_character_at_offset() return 0x if fetching the
character fails, including when querying an unpaired surrogate.

https://docs.gtk.org/atspi2/method.Text.get_character_at_offset.html

Change-Id: If5e2e3b6bbd4cbc86b2b8524f305f8f0d843019d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151591
Tested-by: Jenkins
Reviewed-by: Michael Weghorn 

diff --git a/vcl/unx/gtk3/a11y/atktext.cxx b/vcl/unx/gtk3/a11y/atktext.cxx
index b898538095cf..e8ceab3bb657 100644
--- a/vcl/unx/gtk3/a11y/atktext.cxx
+++ b/vcl/unx/gtk3/a11y/atktext.cxx
@@ -22,6 +22,7 @@
 #include 
 
 #include 
+#include 
 
 #include 
 #include 
@@ -101,6 +102,10 @@ adjust_boundaries( 
css::uno::Reference cons
 switch(boundary_type)
 {
 case ATK_TEXT_BOUNDARY_CHAR:
+if ((rTextSegment.SegmentEnd - rTextSegment.SegmentStart) == 1
+&& rtl::isSurrogate(rTextSegment.SegmentText[0]))
+return nullptr;
+[[fallthrough]];
 case ATK_TEXT_BOUNDARY_LINE_START:
 case ATK_TEXT_BOUNDARY_LINE_END:
 case ATK_TEXT_BOUNDARY_SENTENCE_START:
@@ -351,7 +356,7 @@ text_wrapper_get_character_at_offset (AtkText  
*text,
   gint offset)
 {
 gint start, end;
-gunichar uc = 0;
+gunichar uc = 0x;
 
 gchar * char_as_string =
 text_wrapper_get_text_at_offset(text, offset, ATK_TEXT_BOUNDARY_CHAR,


[Libreoffice-commits] core.git: comphelper/source sc/source starmath/source sw/CppunitTest_sw_a11y.mk sw/qa sw/source

2023-05-23 Thread Colomban Wendling (via logerrit)
 comphelper/source/misc/accessibletexthelper.cxx   |   25 ++-
 sc/source/ui/Accessibility/AccessibleCsvControl.cxx   |   16 +-
 starmath/source/accessibility.cxx |   28 ++-
 sw/CppunitTest_sw_a11y.mk |1 
 sw/qa/extras/accessibility/testdocuments/unicode.fodf |  135 ++
 sw/qa/extras/accessibility/unicode.cxx|  102 +
 sw/source/core/access/accpara.cxx |   19 +-
 sw/source/core/access/accpara.hxx |1 
 8 files changed, 300 insertions(+), 27 deletions(-)

New commits:
commit bd5c3582581f37513f45b518e348f443d5d57334
Author: Colomban Wendling 
AuthorDate: Tue May 2 20:50:52 2023 +0200
Commit: Michael Weghorn 
CommitDate: Tue May 23 18:39:08 2023 +0200

a11y: Fix returning unpaired surrogates when retrieving characters

Fix implementations of XAccessibleText's getTextAtIndex(),
getTextBeforeIndex() and getTextBehindIndex() when called with
AccessibleTextType::CHARACTER to return the whole code point rather
than an unpaired surrogate.

This is still not perfect because XAccessibleText::getCharacterCount()
will return an incorrect value (code units rather than code points),
but it fixes the most useful case of retrieving the character at e.g.
the caret offset.

This fixes the GTK3 and Windows backends as well without further
changes.  Qt6 also mostly works according to Michael Weghorn, but for a
bug on Qt's side (https://bugreports.qt.io/browse/QTBUG-113438).
MacOS backend doesn't seem to be affected in the first place.

Change-Id: I53f07bcba78c6b267939257542a521b106101e96
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151303
Tested-by: Jenkins
Reviewed-by: Michael Weghorn 

diff --git a/comphelper/source/misc/accessibletexthelper.cxx 
b/comphelper/source/misc/accessibletexthelper.cxx
index da39ac1ce252..06752ba88ded 100644
--- a/comphelper/source/misc/accessibletexthelper.cxx
+++ b/comphelper/source/misc/accessibletexthelper.cxx
@@ -297,9 +297,12 @@ namespace comphelper
 {
 if ( implIsValidIndex( nIndex, nLength ) )
 {
-aResult.SegmentText = sText.copy( nIndex, 1 );
+auto nIndexEnd = nIndex;
+sText.iterateCodePoints();
+
+aResult.SegmentText = sText.copy( nIndex, nIndexEnd - 
nIndex );
 aResult.SegmentStart = nIndex;
-aResult.SegmentEnd = nIndex+1;
+aResult.SegmentEnd = nIndexEnd;
 }
 }
 break;
@@ -401,9 +404,12 @@ namespace comphelper
 {
 if ( implIsValidIndex( nIndex - 1, nLength ) )
 {
-aResult.SegmentText = sText.copy( nIndex - 1, 1 );
-aResult.SegmentStart = nIndex-1;
-aResult.SegmentEnd = nIndex;
+sText.iterateCodePoints(, -1);
+auto nIndexEnd = nIndex;
+sText.iterateCodePoints();
+aResult.SegmentText = sText.copy(nIndex, nIndexEnd - 
nIndex);
+aResult.SegmentStart = nIndex;
+aResult.SegmentEnd = nIndexEnd;
 }
 }
 break;
@@ -525,9 +531,12 @@ namespace comphelper
 {
 if ( implIsValidIndex( nIndex + 1, nLength ) )
 {
-aResult.SegmentText = sText.copy( nIndex + 1, 1 );
-aResult.SegmentStart = nIndex+1;
-aResult.SegmentEnd = nIndex+2;
+sText.iterateCodePoints();
+auto nIndexEnd = nIndex;
+sText.iterateCodePoints();
+aResult.SegmentText = sText.copy(nIndex, nIndexEnd - 
nIndex);
+aResult.SegmentStart = nIndex;
+aResult.SegmentEnd = nIndexEnd;
 }
 }
 break;
diff --git a/sc/source/ui/Accessibility/AccessibleCsvControl.cxx 
b/sc/source/ui/Accessibility/AccessibleCsvControl.cxx
index 6ebe5041ba14..c7050d04 100644
--- a/sc/source/ui/Accessibility/AccessibleCsvControl.cxx
+++ b/sc/source/ui/Accessibility/AccessibleCsvControl.cxx
@@ -48,6 +48,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using ::utl::AccessibleRelationSetHelper;
 using ::accessibility::AccessibleStaticTextBase;
@@ -454,7 +455,10 @@ TextSegment SAL_CALL ScAccessibleCsvRuler::getTextAtIndex( 
sal_Int32 nIndex, sal
 case AccessibleTextType::CHARACTER:
 {
 aResult.SegmentStart = nIndex;
-aResultText.append(maBuffer[nIndex]);
+aResult.SegmentEnd = nIndex;
+o3tl::iterateCodePoints(maBuffer, );
+for (; nIndex < aResult.SegmentEnd; nIndex++)
+aResultText.append(maBuffer[nIndex]);
   

[Libreoffice-commits] core.git: sw/source

2023-05-17 Thread Colomban Wendling (via logerrit)
 sw/source/core/access/accpara.cxx |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 1fe4d37caa983dea9815082e3e955337a03034e9
Author: Colomban Wendling 
AuthorDate: Wed May 10 11:39:12 2023 +0200
Commit: Michael Weghorn 
CommitDate: Wed May 17 16:19:00 2023 +0200

sw a11y: Replace some uses of magic numbers with proper constants

Change-Id: I61b1924c22a66a08ac165546811daeaf20176954
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151650
Tested-by: Jenkins
Reviewed-by: Michael Weghorn 

diff --git a/sw/source/core/access/accpara.cxx 
b/sw/source/core/access/accpara.cxx
index 832afcd02859..d00a49d10227 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -2326,7 +2326,7 @@ OUString SwAccessibleParagraph::getTextRange(
 }
 
 // now skip to previous word
-if (nTextType==2 || nTextType == 3)
+if (nTextType == AccessibleTextType::WORD || nTextType == 
AccessibleTextType::SENTENCE)
 {
 i18n::Boundary preBound = aBound;
 while(preBound.startPos==aBound.startPos && nIndex > 0)
@@ -2409,7 +2409,7 @@ OUString SwAccessibleParagraph::getTextRange(
 sal_Bool bWord = sal_False;
 bWord = GetTextBoundary( aBound, rText, nIndex, nTextType );
 
-if (nTextType==2)
+if (nTextType == AccessibleTextType::WORD)
 {
 Boundary nexBound=aBound;
 


[Libreoffice-commits] core.git: include/test sw/qa test/qa test/source

2023-03-03 Thread Colomban Wendling (via logerrit)
 include/test/a11y/accessibletestbase.hxx |2 ++
 sw/qa/extras/accessibility/dialogs.cxx   |   24 
 test/qa/cppunit/dialog.cxx   |9 -
 test/source/a11y/accessibletestbase.cxx  |9 -
 4 files changed, 18 insertions(+), 26 deletions(-)

New commits:
commit d1589ade91cfadf860c31ca30c97a60f95afa928
Author: Colomban Wendling 
AuthorDate: Thu Feb 23 16:34:49 2023 +0100
Commit: Michael Weghorn 
CommitDate: Fri Mar 3 10:58:22 2023 +

Disable test::AccessibleTestBase::awaitDialog() on macos altogether

The API doesn't actually work there yet because we don't get any event,
so there's no point in exposing it there, and it makes it clear it
isn't available there, avoiding future user to wonder why their tests
do not behave there.

Change-Id: I38dcc98ad3bc3b669df64bc1c53c91ef48a0d717
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147574
Tested-by: Jenkins
Reviewed-by: Michael Weghorn 

diff --git a/include/test/a11y/accessibletestbase.hxx 
b/include/test/a11y/accessibletestbase.hxx
index 1445d0eb4737..e23c2e12467e 100644
--- a/include/test/a11y/accessibletestbase.hxx
+++ b/include/test/a11y/accessibletestbase.hxx
@@ -181,6 +181,7 @@ protected:
   const 
css::uno::Reference& xChild,
   const EventPosterHelperBase* pEventPosterHelper = 
nullptr);
 
+#if !defined(MACOSX)
 /* Dialog handling */
 class Dialog : public test::AccessibleEventPosterHelper
 {
@@ -286,6 +287,7 @@ protected:
 static std::shared_ptr awaitDialog(const std::u16string_view 
name,
  
std::function callback,
  bool bAutoClose = true);
+#endif //defined(MACOSX)
 
 public:
 virtual void setUp() override;
diff --git a/sw/qa/extras/accessibility/dialogs.cxx 
b/sw/qa/extras/accessibility/dialogs.cxx
index e6e3ac84c068..7997f7743b1e 100644
--- a/sw/qa/extras/accessibility/dialogs.cxx
+++ b/sw/qa/extras/accessibility/dialogs.cxx
@@ -17,8 +17,9 @@
 
 using namespace css;
 
-// FIXME: dialog doesn't pop up on macos...
+// FIXME: dialog API doesn't work on macos yet
 #if !defined(MACOSX)
+
 CPPUNIT_TEST_FIXTURE(test::SwAccessibleTestBase, 
BasicTestSpecialCharactersDialog)
 {
 load(u"private:factory/swriter");
@@ -62,10 +63,7 @@ CPPUNIT_TEST_FIXTURE(test::SwAccessibleTestBase, 
BasicTestSpecialCharactersDialo
 
 CPPUNIT_ASSERT_EQUAL(rtl::OUString(u"©"), 
collectText());
 }
-#endif
 
-// FIXME: dialog doesn't pop up on macos...
-#if !defined(MACOSX)
 /* checks for the fix from https://gerrit.libreoffice.org/c/core/+/147660 */
 CPPUNIT_TEST_FIXTURE(test::SwAccessibleTestBase, 
TestSpecialCharactersDialogFocus)
 {
@@ -96,10 +94,7 @@ CPPUNIT_TEST_FIXTURE(test::SwAccessibleTestBase, 
TestSpecialCharactersDialogFocu
 
 CPPUNIT_ASSERT_EQUAL(rtl::OUString(u"0"), 
collectText());
 }
-#endif
 
-// FIXME: dialog doesn't pop up on macos...
-#if !defined(MACOSX)
 CPPUNIT_TEST_FIXTURE(test::SwAccessibleTestBase, BasicTestHyperlinkDialog)
 {
 load(u"private:factory/swriter");
@@ -123,10 +118,7 @@ CPPUNIT_TEST_FIXTURE(test::SwAccessibleTestBase, 
BasicTestHyperlinkDialog)
 
CPPUNIT_ASSERT_EQUAL(rtl::OUString("https://libreoffice.org/"),
  collectText());
 }
-#endif
 
-// FIXME: dialog doesn't pop up on macos...
-#if !defined(MACOSX)
 CPPUNIT_TEST_FIXTURE(test::SwAccessibleTestBase, BasicTestBookmarkDialog)
 {
 load(u"private:factory/swriter");
@@ -150,10 +142,7 @@ CPPUNIT_TEST_FIXTURE(test::SwAccessibleTestBase, 
BasicTestBookmarkDialog)
 CPPUNIT_ASSERT_EQUAL(rtl::OUString("#Test Bookmark 1 Bookmark 
"),
  collectText());
 }
-#endif
 
-// FIXME: dialog doesn't pop up on macos...
-#if !defined(MACOSX)
 CPPUNIT_TEST_FIXTURE(test::SwAccessibleTestBase, BasicTestSectionDialog)
 {
 load(u"private:factory/swriter");
@@ -171,10 +160,7 @@ CPPUNIT_TEST_FIXTURE(test::SwAccessibleTestBase, 
BasicTestSectionDialog)
 
 CPPUNIT_ASSERT_EQUAL(rtl::OUString(""), 
collectText());
 }
-#endif
 
-// FIXME: dialog doesn't pop up on macos...
-#if !defined(MACOSX)
 CPPUNIT_TEST_FIXTURE(test::SwAccessibleTestBase, BasicTestFontworkDialog)
 {
 load(u"private:factory/swriter");
@@ -195,10 +181,7 @@ CPPUNIT_TEST_FIXTURE(test::SwAccessibleTestBase, 
BasicTestFontworkDialog)
   "description=\"Paragraph: 0 
Simple\">Simple"),
 collectText());
 }
-#endif
 
-// FIXME: dialog doesn't pop up on macos...
-#if !defined(MACOSX)
 CPPUNIT_TEST_FIXTURE(test::SwAccessibleTestBase, BasicTestFrameDialog)
 {
 load(u"private:factory/swriter");
@@ -216,6 +199,7 @@ CPPUNIT_TEST_FIXTURE(test::SwAccessibleTestBase, 
BasicTestFrameDialog)
 rtl::OUString(""),
 collectText());
 }
-#endif
+
+#endif //defined(MACOSX)
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff 

[Libreoffice-commits] core.git: include/test test/source

2023-03-03 Thread Colomban Wendling (via logerrit)
 include/test/a11y/accessibletestbase.hxx |   11 ++-
 test/source/a11y/accessibletestbase.cxx  |   97 +++
 2 files changed, 69 insertions(+), 39 deletions(-)

New commits:
commit 8a449f2de0d926967331436adfd3d5dd0b9e2db8
Author: Colomban Wendling 
AuthorDate: Tue Feb 7 16:32:22 2023 +0100
Commit: Michael Weghorn 
CommitDate: Fri Mar 3 10:58:05 2023 +

test: Use css::awt::XExtentdedToolkit::addTopWindowListener()

Use awt::XExtentdedToolkit::addTopWindowListener() instead of
Application::AddEventListener() for lower dependency on vcl::Window.

We however still require some vcl::Window for EventPosterHelper to work
without which we cannot post events to the dialog.  It however doesn't
really have to be the top-level window itself, any vcl::Window high
enough the event tree would probably work.

Change-Id: I40b56a6c9e45f4e2ef2cab27a735856baef7e3c2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146634
Tested-by: Jenkins
Reviewed-by: Michael Weghorn 

diff --git a/include/test/a11y/accessibletestbase.hxx 
b/include/test/a11y/accessibletestbase.hxx
index 5f5fb54aff4b..1445d0eb4737 100644
--- a/include/test/a11y/accessibletestbase.hxx
+++ b/include/test/a11y/accessibletestbase.hxx
@@ -18,6 +18,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -181,23 +182,25 @@ protected:
   const EventPosterHelperBase* pEventPosterHelper = 
nullptr);
 
 /* Dialog handling */
-class Dialog : public test::EventPosterHelper
+class Dialog : public test::AccessibleEventPosterHelper
 {
 private:
 bool mbAutoClose;
+css::uno::Reference mxDialog2;
+css::uno::Reference mxAccessible;
 
 public:
-Dialog(vcl::Window* pWindow, bool bAutoClose = true);
+Dialog(css::uno::Reference& xDialog2, bool 
bAutoClose = true);
 virtual ~Dialog();
 
 void setAutoClose(bool bAutoClose) { mbAutoClose = bAutoClose; }
 
 css::uno::Reference getAccessible() 
const
 {
-return mxWindow ? mxWindow->GetAccessible() : nullptr;
+return mxAccessible;
 }
 
-bool close(sal_Int32 result = VclResponseType::RET_CANCEL);
+void close(sal_Int32 result = VclResponseType::RET_CANCEL);
 
 css::uno::Reference
 tabTo(const sal_Int16 role, const std::u16string_view name)
diff --git a/test/source/a11y/accessibletestbase.cxx 
b/test/source/a11y/accessibletestbase.cxx
index bcfdcc89db1d..20d6c88a5e19 100644
--- a/test/source/a11y/accessibletestbase.cxx
+++ b/test/source/a11y/accessibletestbase.cxx
@@ -17,7 +17,9 @@
 #include 
 #include 
 #include 
+#include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -30,7 +32,8 @@
 #include 
 #include 
 #include 
-#include 
+
+#include 
 
 #include 
 
@@ -347,12 +350,22 @@ bool test::AccessibleTestBase::tabTo(
 
 /* Dialog handling */
 
-test::AccessibleTestBase::Dialog::Dialog(vcl::Window* pWindow, bool bAutoClose)
-: test::EventPosterHelper(pWindow)
-, mbAutoClose(bAutoClose)
+test::AccessibleTestBase::Dialog::Dialog(uno::Reference& 
xDialog2, bool bAutoClose)
+: mbAutoClose(bAutoClose)
+, mxDialog2(xDialog2)
 {
-CPPUNIT_ASSERT(pWindow);
-CPPUNIT_ASSERT(pWindow->IsDialog());
+CPPUNIT_ASSERT(xDialog2.is());
+
+mxAccessible.set(xDialog2, uno::UNO_QUERY);
+if (mxAccessible)
+setWindow(mxAccessible);
+else
+{
+std::cerr << "WARNING: AccessibleTestBase::Dialog() constructed with 
awt::XDialog2 '"
+  << xDialog2->getTitle()
+  << "' not implementing accessibility::XAccessible. Event 
delivery will not work."
+  << std::endl;
+}
 }
 
 test::AccessibleTestBase::Dialog::~Dialog()
@@ -361,16 +374,13 @@ test::AccessibleTestBase::Dialog::~Dialog()
 close();
 }
 
-bool test::AccessibleTestBase::Dialog::close(sal_Int32 result)
+void test::AccessibleTestBase::Dialog::close(sal_Int32 result)
 {
-if (mxWindow && !mxWindow->isDisposed())
+if (mxDialog2)
 {
-uno::Reference 
xDialog2(mxWindow->GetComponentInterface(),
-   uno::UNO_QUERY_THROW);
-xDialog2->endDialog(result);
-return mxWindow->isDisposed();
+mxDialog2->endDialog(result);
+mxDialog2.clear();
 }
-return true;
 }
 
 std::shared_ptr
@@ -387,7 +397,7 @@ test::AccessibleTestBase::awaitDialog(const 
std::u16string_view name,
 class ListenerHelper : public DialogWaiter
 {
 DialogCancelMode miPreviousDialogCancelMode;
-Link mLink;
+uno::Reference mxToolkit;
 bool mbWaitingForDialog;
 std::exception_ptr mpException;
 std::u16string_view msName;
@@ -395,14 +405,14 @@ test::AccessibleTestBase::awaitDialog(const 
std::u16string_view name,
 bool mbAutoClose;
 Timer maTimeoutTimer;
 Idle 

[Libreoffice-commits] core.git: include/test sw/qa test/qa test/source

2023-03-03 Thread Colomban Wendling (via logerrit)
 include/test/a11y/accessibletestbase.hxx |5 ---
 sw/qa/extras/accessibility/dialogs.cxx   |   28 ++--
 test/qa/cppunit/dialog.cxx   |8 ++---
 test/source/a11y/accessibletestbase.cxx  |   43 +++
 4 files changed, 51 insertions(+), 33 deletions(-)

New commits:
commit 655f6164e38c2f675beb5272fc6a9780f4767429
Author: Colomban Wendling 
AuthorDate: Tue Jan 31 11:25:28 2023 +0100
Commit: Michael Weghorn 
CommitDate: Fri Mar 3 10:57:11 2023 +

test: Run user dialog callback in idle time

On e.g. Windows we need to let the dialogs fully finish starting up
before we can properly interact with them, and especially close them
again.

We notice new dialogs with the WindowActivate event, but this will
happen before the dialog is fully set up internally, leading to
failures on Windows.  In practice, the WindowActivate event might be
dispatched before the dialog setup function finishes, leading to an
intermediate state at WindowActivate time.

Work around this by running the user code in an idle timer in response
to the WindowActivate event, so that the setup code can return before
the callback is dispatched.

Based on findings by Michael Weghorn, thanks!

Change-Id: Ieecee09d84144570fe1943ca12dc1db6d9f64524
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146378
Tested-by: Jenkins
Reviewed-by: Michael Weghorn 

diff --git a/include/test/a11y/accessibletestbase.hxx 
b/include/test/a11y/accessibletestbase.hxx
index 0048edcd8589..5f5fb54aff4b 100644
--- a/include/test/a11y/accessibletestbase.hxx
+++ b/include/test/a11y/accessibletestbase.hxx
@@ -183,14 +183,11 @@ protected:
 /* Dialog handling */
 class Dialog : public test::EventPosterHelper
 {
-friend class AccessibleTestBase;
-
 private:
 bool mbAutoClose;
 
-Dialog(vcl::Window* pWindow, bool bAutoClose = true);
-
 public:
+Dialog(vcl::Window* pWindow, bool bAutoClose = true);
 virtual ~Dialog();
 
 void setAutoClose(bool bAutoClose) { mbAutoClose = bAutoClose; }
diff --git a/sw/qa/extras/accessibility/dialogs.cxx 
b/sw/qa/extras/accessibility/dialogs.cxx
index 13c2fd0cb750..e6e3ac84c068 100644
--- a/sw/qa/extras/accessibility/dialogs.cxx
+++ b/sw/qa/extras/accessibility/dialogs.cxx
@@ -17,8 +17,8 @@
 
 using namespace css;
 
-// FIXME: dialog doesn't pop up on macos and doesn't close on win32...
-#if !defined(_WIN32) && !defined(MACOSX)
+// FIXME: dialog doesn't pop up on macos...
+#if !defined(MACOSX)
 CPPUNIT_TEST_FIXTURE(test::SwAccessibleTestBase, 
BasicTestSpecialCharactersDialog)
 {
 load(u"private:factory/swriter");
@@ -64,8 +64,8 @@ CPPUNIT_TEST_FIXTURE(test::SwAccessibleTestBase, 
BasicTestSpecialCharactersDialo
 }
 #endif
 
-// FIXME: dialog doesn't pop up on macos and doesn't close on win32...
-#if !defined(_WIN32) && !defined(MACOSX)
+// FIXME: dialog doesn't pop up on macos...
+#if !defined(MACOSX)
 /* checks for the fix from https://gerrit.libreoffice.org/c/core/+/147660 */
 CPPUNIT_TEST_FIXTURE(test::SwAccessibleTestBase, 
TestSpecialCharactersDialogFocus)
 {
@@ -98,8 +98,8 @@ CPPUNIT_TEST_FIXTURE(test::SwAccessibleTestBase, 
TestSpecialCharactersDialogFocu
 }
 #endif
 
-// FIXME: dialog doesn't pop up on macos and doesn't close on win32...
-#if !defined(_WIN32) && !defined(MACOSX)
+// FIXME: dialog doesn't pop up on macos...
+#if !defined(MACOSX)
 CPPUNIT_TEST_FIXTURE(test::SwAccessibleTestBase, BasicTestHyperlinkDialog)
 {
 load(u"private:factory/swriter");
@@ -125,8 +125,8 @@ CPPUNIT_TEST_FIXTURE(test::SwAccessibleTestBase, 
BasicTestHyperlinkDialog)
 }
 #endif
 
-// FIXME: dialog doesn't pop up on macos and doesn't close on win32...
-#if !defined(_WIN32) && !defined(MACOSX)
+// FIXME: dialog doesn't pop up on macos...
+#if !defined(MACOSX)
 CPPUNIT_TEST_FIXTURE(test::SwAccessibleTestBase, BasicTestBookmarkDialog)
 {
 load(u"private:factory/swriter");
@@ -152,8 +152,8 @@ CPPUNIT_TEST_FIXTURE(test::SwAccessibleTestBase, 
BasicTestBookmarkDialog)
 }
 #endif
 
-// FIXME: dialog doesn't pop up on macos and doesn't close on win32...
-#if !defined(_WIN32) && !defined(MACOSX)
+// FIXME: dialog doesn't pop up on macos...
+#if !defined(MACOSX)
 CPPUNIT_TEST_FIXTURE(test::SwAccessibleTestBase, BasicTestSectionDialog)
 {
 load(u"private:factory/swriter");
@@ -173,8 +173,8 @@ CPPUNIT_TEST_FIXTURE(test::SwAccessibleTestBase, 
BasicTestSectionDialog)
 }
 #endif
 
-// FIXME: dialog doesn't pop up on macos and doesn't close on win32...
-#if !defined(_WIN32) && !defined(MACOSX)
+// FIXME: dialog doesn't pop up on macos...
+#if !defined(MACOSX)
 CPPUNIT_TEST_FIXTURE(test::SwAccessibleTestBase, BasicTestFontworkDialog)
 {
 load(u"private:factory/swriter");
@@ -197,8 +197,8 @@ CPPUNIT_TEST_FIXTURE(test::SwAccessibleTestBase, 
BasicTestFontworkDialog)
 }
 #endif
 
-// FIXME: dialog doesn't pop up on macos and doesn't 

[Libreoffice-commits] core.git: include/test test/source

2023-03-03 Thread Colomban Wendling (via logerrit)
 include/test/a11y/AccessibilityTools.hxx |2 +
 test/source/a11y/AccessibilityTools.cxx  |   53 +++
 2 files changed, 55 insertions(+)

New commits:
commit 1791b26d75bd50971fe58627c6554f1711890817
Author: Colomban Wendling 
AuthorDate: Thu Nov 3 15:17:46 2022 +0100
Commit: Michael Weghorn 
CommitDate: Fri Mar 3 10:56:31 2023 +

test: Add debug print support for XAccessibleAction

Change-Id: Ic511f2abc62703ead40a585989c54345cf3c17ae
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142261
Tested-by: Jenkins
Reviewed-by: Michael Weghorn 

diff --git a/include/test/a11y/AccessibilityTools.hxx 
b/include/test/a11y/AccessibilityTools.hxx
index 749be0635198..38a76ce407f1 100644
--- a/include/test/a11y/AccessibilityTools.hxx
+++ b/include/test/a11y/AccessibilityTools.hxx
@@ -28,6 +28,7 @@
 
 #include 
 #include 
+#include 
 #include 
 
 class OOO_DLLPUBLIC_TEST AccessibilityTools
@@ -256,6 +257,7 @@ private:
 static OUString debugName(css::accessibility::XAccessibleContext* xctx);
 static OUString debugName(css::accessibility::XAccessible* xacc);
 static OUString debugName(const css::accessibility::AccessibleEventObject* 
evobj);
+static OUString debugName(css::accessibility::XAccessibleAction* xAct);
 };
 
 CPPUNIT_NS_BEGIN
diff --git a/test/source/a11y/AccessibilityTools.cxx 
b/test/source/a11y/AccessibilityTools.cxx
index 137b1bdc3a97..b754f46d2f69 100644
--- a/test/source/a11y/AccessibilityTools.cxx
+++ b/test/source/a11y/AccessibilityTools.cxx
@@ -24,8 +24,11 @@
 #include 
 #include 
 #include 
+#include 
 #include 
+#include 
 
+#include 
 #include 
 #include 
 #include 
@@ -647,6 +650,56 @@ OUString 
AccessibilityTools::debugName(accessibility::XAccessible* acc)
 return debugName(acc->getAccessibleContext().get());
 }
 
+OUString AccessibilityTools::debugName(accessibility::XAccessibleAction* xAct)
+{
+OUStringBuffer r = "actions=[";
+
+const sal_Int32 nActions = xAct->getAccessibleActionCount();
+for (sal_Int32 i = 0; i < nActions; i++)
+{
+if (i > 0)
+r.append(", ");
+
+r.append("description=\"");
+r.append(xAct->getAccessibleActionDescription(i));
+r.append('"');
+
+const auto& xKeyBinding = xAct->getAccessibleActionKeyBinding(i);
+if (xKeyBinding)
+{
+r.append(" keybindings=[");
+const sal_Int32 nKeyBindings = 
xKeyBinding->getAccessibleKeyBindingCount();
+for (sal_Int32 j = 0; j < nKeyBindings; j++)
+{
+if (j > 0)
+r.append(", ");
+
+int k = 0;
+for (const auto& keyStroke : 
xKeyBinding->getAccessibleKeyBinding(j))
+{
+if (k++ > 0)
+r.append(", ");
+
+r.append('"');
+if (keyStroke.Modifiers & awt::KeyModifier::MOD1)
+r.append("");
+if (keyStroke.Modifiers & awt::KeyModifier::MOD2)
+r.append("");
+if (keyStroke.Modifiers & awt::KeyModifier::MOD3)
+r.append("");
+if (keyStroke.Modifiers & awt::KeyModifier::SHIFT)
+r.append("");
+r.append(keyStroke.KeyChar);
+r.append('"');
+}
+}
+r.append("]");
+}
+}
+r.append("]");
+return r.makeStringAndClear();
+}
+
 OUString AccessibilityTools::debugName(const 
accessibility::AccessibleEventObject* evobj)
 {
 return "(AccessibleEventObject) { id=" + getEventIdName(evobj->EventId)


[Libreoffice-commits] core.git: include/test sw/qa test/source

2023-03-03 Thread Colomban Wendling (via logerrit)
 include/test/a11y/AccessibilityTools.hxx |   97 +++
 include/test/a11y/accessibletestbase.hxx |9 ++
 sw/qa/extras/accessibility/dialogs.cxx   |   81 +
 test/source/a11y/AccessibilityTools.cxx  |   20 ++
 test/source/a11y/accessibletestbase.cxx  |   27 
 5 files changed, 234 insertions(+)

New commits:
commit 7801b5f7562a8d1660053a2745b4f6e97b555bb2
Author: Colomban Wendling 
AuthorDate: Thu Nov 3 15:39:38 2022 +0100
Commit: Michael Weghorn 
CommitDate: Fri Mar 3 10:49:20 2023 +

test: Add helpers to get a specific object and tab to it

Add a tabTo() variant that accepts a target object that should gain
focus. This is useful to work around focus issues in the implementation
(although they should be reported and fixed), and it's a simpler and
more efficient API if the caller happens to already have a reference to
the target object.

This also adds AccessibilityTools::getAccessibleObjectForName() as a
usually more useful alternative to
AccessibilityTools::getAccessibleObjectForRole() as it allows to easily
match both role and name. There is also a template version accepting
multiple role and name pairs to further refine the selected object.

Together, it makes it easy to obtain the target object and tab to it,
in situations where the other tabTo() variant either doesn't work for
some reason (as mentioned above), or is not the slickest solution.

Change-Id: I6a41b147331132711ac84776bb43ad24a091ba24
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142260
Tested-by: Jenkins
Reviewed-by: Michael Weghorn 

diff --git a/include/test/a11y/AccessibilityTools.hxx 
b/include/test/a11y/AccessibilityTools.hxx
index 88276bac700d..749be0635198 100644
--- a/include/test/a11y/AccessibilityTools.hxx
+++ b/include/test/a11y/AccessibilityTools.hxx
@@ -53,6 +53,103 @@ public:
 getAccessibleObjectForRole(const 
css::uno::Reference& xacc,
sal_Int16 role);
 
+/**
+ * @brief Gets a descendant of @p xCtx (or @p xCtx itself) that matches 
the given role and name.
+ * @param xCtx An accessible context object to start the search from
+ * @param role The role of the object to look up.
+ * @param name The name of the object to look up.
+ * @returns The found object, or @c nullptr if not found.
+ *
+ * Finds a descendant of @p xCtx (or @p xCtx itself) that matches @p role 
and @p name.
+ * @code
+ * AccessibilityTools::getAccessibleObjectForName(
+ * css::accessibility::AccessibleRole::PUSH_BUTTON, u"Insert");
+ * @endcode
+ *
+ * @see AccessibilityTools::getAccessibleObjectForPredicate() */
+static css::uno::Reference 
getAccessibleObjectForName(
+const css::uno::Reference& 
xCtx,
+const sal_Int16 role, std::u16string_view name);
+static inline css::uno::Reference
+getAccessibleObjectForName(const 
css::uno::Reference& xAcc,
+   const sal_Int16 role, std::u16string_view name)
+{
+return getAccessibleObjectForName(xAcc->getAccessibleContext(), role, 
name);
+}
+
+/**
+ * @brief Gets a descendant of @p xCtx (or @p xCtx itself) that matches 
the last given role and
+ *name pair, and has ancestors matching the leading pairs in the 
given order.
+ * @param xCtx An accessible context to start the search from.
+ * @param role The role of the first ancestor to match.
+ * @param name The name of the first ancestor to match.
+ * @param Ts...args Additional role and name pairs of ancestors, ending 
with the role and name
+ *  pair of the target object to match.
+ * @returns The found object, or @c nullptr if not found.
+ *
+ * Specialized version allowing specifying arbitrary objects on the path 
to the target one. Not
+ * all objects have to be matched, but there have to be ancestors matching 
in the given order.
+ * This is useful to easily solve conflicts if there are more than one 
possible match.
+ *
+ * This can be used to find an "Insert" push button inside a panel named 
"Some group" for
+ * example, as shown below:
+ *
+ * @code
+ * AccessibilityTools::getAccessibleObjectForName(
+ * css::accessibility::AccessibleRole::PANEL, u"Some group",
+ * css::accessibility::AccessibleRole::PUSH_BUTTON, u"Insert");
+ * @endcode
+ *
+ * @note This returns the first match in the object tree when walking it 
depth-first.  Depending
+ *   on the tree, this might not be able to find the expected match, 
e.g. if there is a
+ *   first match with intermediate unmatched objects, and the target 
has the same tree but
+ *   without intermediate objects that can be used to refine the 
search and prevent the
+ *   unwanted tree to match.  The same issue arises with two 

[Libreoffice-commits] core.git: include/test sw/CppunitTest_sw_a11y.mk sw/qa test/Library_subsequenttest.mk test/source

2023-03-03 Thread Colomban Wendling (via logerrit)
 include/test/a11y/accessibletestbase.hxx |   60 -
 include/test/a11y/eventposter.hxx|  132 +
 sw/CppunitTest_sw_a11y.mk|1 
 sw/qa/extras/accessibility/dialogs.cxx   |  140 +++
 test/Library_subsequenttest.mk   |1 
 test/source/a11y/accessibletestbase.cxx  |   84 ++
 test/source/a11y/eventposter.cxx |   46 ++
 7 files changed, 458 insertions(+), 6 deletions(-)

New commits:
commit be86c74bb5bf04347846261243c8eb21dc8d7200
Author: Colomban Wendling 
AuthorDate: Thu Nov 3 15:08:25 2022 +0100
Commit: Michael Weghorn 
CommitDate: Fri Mar 3 09:58:46 2023 +

test: Add a few basic dialog tests and helpers

This adds basic tests for a few dialogues, showcasing and exercising
the dialog handling code.  Those tests are extremely basic but show
that it is trivial enough to interact with a dialog.

This adds a few helpers to navigate the UI using keyboard events as
well, because it's one of the best methods to verify the actual
interaction works for a user of assistive technologies.

Change-Id: Idc1f279f35ff01769138c3addb10ef851ca0dbb8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142259
Tested-by: Jenkins
Reviewed-by: Michael Weghorn 

diff --git a/include/test/a11y/accessibletestbase.hxx 
b/include/test/a11y/accessibletestbase.hxx
index e174c0cb4b8a..745f9fae2458 100644
--- a/include/test/a11y/accessibletestbase.hxx
+++ b/include/test/a11y/accessibletestbase.hxx
@@ -28,6 +28,7 @@
 
 #include 
 #include 
+#include 
 
 #include "AccessibilityTools.hxx"
 
@@ -130,13 +131,57 @@ protected:
 return activateMenuItem(menuBar, names...);
 }
 
+/**
+ * @brief Gets the focused accessible object at @p xAcc level or below
+ * @param xAcc An accessible object
+ * @returns The accessible context of the focused object, or @c nullptr
+ *
+ * Finds the accessible object context at or under @p xAcc that has the 
focused state (and is
+ * showing).  Normally only one such object should exist in a given 
hierarchy, but in all cases
+ * this function will return the first one found.
+ *
+ * @see AccessibilityTools::getAccessibleObjectForPredicate()
+ */
+static css::uno::Reference
+getFocusedObject(const 
css::uno::Reference& xCtx);
+
+static inline css::uno::Reference
+getFocusedObject(const 
css::uno::Reference& xAcc)
+{
+return getFocusedObject(xAcc->getAccessibleContext());
+}
+
+/**
+ * @brief Navigates through focusable elements using the Tab keyboard 
shortcut.
+ * @param xRoot The root element to look for focused elements in.
+ * @param role The accessible role of the element to tab to.
+ * @param name The accessible name of the element to tab to.
+ * @param pEventPosterHelper Pointer to a @c EventPosterHelper instance, 
or @c nullptr to obtain
+ *   it from @p xRoot.
+ * @returns The element tabbed to, or @c nullptr if not found.
+ *
+ * Navigates through focusable elements in the top level containing @p 
xRoot using the Tab
+ * keyboard key until the focused elements matches @p role and @p name.
+ *
+ * Note that usually @p xRoot should be the toplevel accessible, or at 
least contain all
+ * focusable elements within that window.  It is however *not* a 
requirement, but only elements
+ * actually inside it will be candidate for a match, and thus if focus 
goes outside it, it might
+ * lead to not finding the target element.
+ *
+ * If @p pEventPosterHelper is @c nullptr, this function will try to 
construct one from
+ * @p xRoot.  @see EventPosterHelper.
+ */
+static css::uno::Reference
+tabTo(const css::uno::Reference& xRoot, 
const sal_Int16 role,
+  const std::u16string_view name,
+  const EventPosterHelperBase* pEventPosterHelper = nullptr);
+
 /* Dialog handling */
-class Dialog
+class Dialog : public test::EventPosterHelper
 {
 friend class AccessibleTestBase;
 
 private:
-VclPtr mxWindow;
 bool mbAutoClose;
 
 Dialog(vcl::Window* pWindow, bool bAutoClose = true);
@@ -144,9 +189,6 @@ protected:
 public:
 virtual ~Dialog();
 
-explicit operator bool() const { return mxWindow && 
!mxWindow->isDisposed(); }
-bool operator!() const { return !bool(*this); }
-
 void setAutoClose(bool bAutoClose) { mbAutoClose = bAutoClose; }
 
 css::uno::Reference getAccessible() 
const
@@ -155,6 +197,12 @@ protected:
 }
 
 bool close(sal_Int32 result = VclResponseType::RET_CANCEL);
+
+css::uno::Reference
+tabTo(const sal_Int16 role, const std::u16string_view name)
+{
+return AccessibleTestBase::tabTo(getAccessible(), role, name, 
this);
+}
 };
 
 class 

[Libreoffice-commits] core.git: test/source

2023-03-03 Thread Colomban Wendling (via logerrit)
 test/source/a11y/accessibletestbase.cxx |   27 +++
 1 file changed, 27 insertions(+)

New commits:
commit ab0681dadc15b569027c5ce637441ea95eae1631
Author: Colomban Wendling 
AuthorDate: Tue Jan 24 18:07:52 2023 +0100
Commit: Michael Weghorn 
CommitDate: Fri Mar 3 09:58:06 2023 +

test: Fail earlier if we don't get WindowActivate events

Instead of waiting for the CI itself to timeout after 45 minutes, or
for an interactive caller to kill us sometime, don't wait more than 60
seconds for a WindowActivate event to show up.

This should not happen in the working code paths, but can help when
something's going wrong.  Currently, this could help macos jobs to fail
sooner.

Change-Id: Iabce82b31440c14fd16478f1e574ce376027441c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146099
Tested-by: Jenkins
Reviewed-by: Michael Weghorn 

diff --git a/test/source/a11y/accessibletestbase.cxx 
b/test/source/a11y/accessibletestbase.cxx
index 47a77e864932..857df519f136 100644
--- a/test/source/a11y/accessibletestbase.cxx
+++ b/test/source/a11y/accessibletestbase.cxx
@@ -283,12 +283,14 @@ test::AccessibleTestBase::awaitDialog(const 
std::u16string_view name,
 std::u16string_view msName;
 std::function mCallback;
 bool mbAutoClose;
+Timer maTimeoutTimer;
 
 public:
 virtual ~ListenerHelper()
 {
 Application::SetDialogCancelMode(miPreviousDialogCancelMode);
 Application::RemoveEventListener(mLink);
+maTimeoutTimer.Stop();
 }
 
 ListenerHelper(const std::u16string_view& name, 
std::function callback,
@@ -297,15 +299,38 @@ test::AccessibleTestBase::awaitDialog(const 
std::u16string_view name,
 , msName(name)
 , mCallback(callback)
 , mbAutoClose(bAutoClose)
+, maTimeoutTimer("workaround timer if we don't catch 
WindowActivate")
 {
 mLink = LINK(this, ListenerHelper, eventListener);
 Application::AddEventListener(mLink);
 
+maTimeoutTimer.SetInvokeHandler(LINK(this, ListenerHelper, 
timeoutTimerHandler));
+maTimeoutTimer.SetTimeout(6);
+maTimeoutTimer.Start();
+
 miPreviousDialogCancelMode = Application::GetDialogCancelMode();
 Application::SetDialogCancelMode(DialogCancelMode::Off);
 }
 
 private:
+// mimic IMPL_LINK inline
+static void LinkStubtimeoutTimerHandler(void* instance, Timer* timer)
+{
+static_cast(instance)->timeoutTimerHandler(timer);
+}
+
+void timeoutTimerHandler(Timer*)
+{
+std::cerr << "timeout waiting for dialog '" << OUString(msName) << 
"' to show up"
+  << std::endl;
+
+assert(mbWaitingForDialog);
+
+// This is not very nice, but it should help fail earlier if we 
never catch the dialog
+// yet we're in a sub-loop and waitEndDialog() didn't have a 
chance to run yet.
+throw new css::uno::RuntimeException("Timeout waiting for dialog");
+}
+
 // mimic IMPL_LINK inline
 static void LinkStubeventListener(void* instance, VclSimpleEvent& 
event)
 {
@@ -328,6 +353,8 @@ test::AccessibleTestBase::awaitDialog(const 
std::u16string_view name,
 
 // remove ourselves, we don't want to run again
 Application::RemoveEventListener(mLink);
+maTimeoutTimer.ClearInvokeHandler();
+maTimeoutTimer.Stop();
 
 /* bind the dialog before checking its name so auto-close can kick 
in if anything
  * fails/throws */


[Libreoffice-commits] core.git: include/test test/CppunitTest_test_a11y.mk test/Module_test.mk test/qa test/source

2023-02-24 Thread Colomban Wendling (via logerrit)
 include/test/a11y/accessibletestbase.hxx |   99 +++
 test/CppunitTest_test_a11y.mk|   31 ++
 test/Module_test.mk  |1 
 test/qa/cppunit/dialog.cxx   |   66 +
 test/source/a11y/accessibletestbase.cxx  |  156 +++
 5 files changed, 353 insertions(+)

New commits:
commit 0ccea0dd6e50199af4a7aae75d691b32c853b177
Author: Colomban Wendling 
AuthorDate: Thu Oct 27 19:07:44 2022 +0200
Commit: Michael Weghorn 
CommitDate: Fri Feb 24 15:13:39 2023 +

test: Add accessibility test dialog infrastructure

Interacting with dialogues in tests is non-trivial, so introduce
helpers to make it simpler and less error-prone.

Add tests for the infrastructure itself as well.

Change-Id: I8ea6087a61380194eb2b5ec9f25091db00f5a550
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142258
Reviewed-by: Michael Weghorn 
Tested-by: Jenkins

diff --git a/include/test/a11y/accessibletestbase.hxx 
b/include/test/a11y/accessibletestbase.hxx
index 50a39f63a7dd..913e24221353 100644
--- a/include/test/a11y/accessibletestbase.hxx
+++ b/include/test/a11y/accessibletestbase.hxx
@@ -24,6 +24,7 @@
 #include 
 
 #include 
+#include 
 
 #include 
 #include 
@@ -129,6 +130,104 @@ protected:
 return activateMenuItem(menuBar, names...);
 }
 
+/* Dialog handling */
+class Dialog
+{
+friend class AccessibleTestBase;
+
+private:
+VclPtr mxWindow;
+bool mbAutoClose;
+
+Dialog(vcl::Window* pWindow, bool bAutoClose = true);
+
+public:
+virtual ~Dialog();
+
+explicit operator bool() const { return mxWindow && 
!mxWindow->isDisposed(); }
+bool operator!() const { return !bool(*this); }
+
+void setAutoClose(bool bAutoClose) { mbAutoClose = bAutoClose; }
+
+css::uno::Reference getAccessible() 
const
+{
+return mxWindow ? mxWindow->GetAccessible() : nullptr;
+}
+
+bool close(sal_Int32 result = VclResponseType::RET_CANCEL);
+};
+
+class DialogWaiter
+{
+public:
+virtual ~DialogWaiter() {}
+
+/**
+ * @brief Waits for the associated dialog to close
+ * @param nTimeoutMs Maximum delay to wait the dialog for
+ * @returns @c true if the dialog closed, @c false if timeout was 
reached
+ *
+ * @throws css::uno::RuntimeException if an unexpected dialog poped up 
instead of the
+ * expected one.
+ * @throws Any exception that the user callback supplied to 
awaitDialog() might have thrown.
+ */
+virtual bool waitEndDialog(sal_uInt64 nTimeoutMs = 3000) = 0;
+};
+
+/**
+ * @brief Helper to call user code when a given dialog opens
+ * @param name The title of the dialog window to wait for
+ * @param callback The user code to run when the given dialog opens
+ * @param bAutoClose Whether to automatically cancel the dialog after the 
user code finished, if
+ *   the dialog is still there.  You should leave this to 
@c true unless you
+ *   know exactly what you are doing, see below.
+ * @returns A @c DialogWaiter wrapper on which call waitEndDialog() after 
having triggered the
+ *  dialog in some way.
+ *
+ * This function makes it fairly easy and safe to execute code once a 
dialog pops up:
+ * @code
+ * auto waiter = awaitDialog(u"Special Characters", [this](Dialog ) 
{
+ * // for example, something like this:
+ * // something();
+ * // CPPUNIT_ASSERT(somethingElse);
+ * });
+ * CPPUNIT_ASSERT(activateMenuItem(u"Some menu", u"Some Item Triggering a 
Dialog..."));
+ * CPPUNIT_ASSERT(waiter->waitEndDialog());
+ * @endcode
+ *
+ * @note The user code might actually be executed before 
DialogWaiter::waitEndDialog() is
+ *   called.  It is actually likely to be called at the time the call 
that triggers the
+ *   dialog happens.  However, as letting an exception slip in a event 
handler is likely to
+ *   cause problems, exceptions are forwarded to the 
DialogWaiter::waitEndDialog() call.
+ *   However, note that you cannot rely on something like this:
+ *   @code
+ *   int foo = 0;
+ *   auto waiter = awaitDialog(u"Some Dialog", [](Dialog&) {
+ *   CPPUNIT_ASSERT_EQUAL(1, foo);
+ *   });
+ *   CPPUNIT_ASSERT(activateMenuItem(u"Some menu", u"Some Item 
Triggering a Dialog..."));
+ *   foo = 1; // here, the callback likely already ran as a result of 
the
+ *// Scheduler::ProcessEventsToIdle() call that 
activateMenuItem() did.
+ *   CPPUNIT_ASSERT(waiter->waitEndDialog());
+ *   @endcode
+ *
+ * @warning You should almost certainly always leave @p bAutoClose to @c 
true. If it is set to
+ * 

[Libreoffice-commits] core.git: toolkit/qa

2023-02-22 Thread Colomban Wendling (via logerrit)
 toolkit/qa/cppunit/a11y/AccessibleStatusBarTest.cxx |   67 +++-
 1 file changed, 11 insertions(+), 56 deletions(-)

New commits:
commit c75e975a20258650baa6c906ac8cc1bc4e8f6244
Author: Colomban Wendling 
AuthorDate: Tue Feb 14 11:45:29 2023 +0100
Commit: Michael Weghorn 
CommitDate: Wed Feb 22 16:53:41 2023 +

toolkit: Port AccessibleStatusBarTest to test::AccessibleTestBase

Now we have test::AccessibleTestBase we can use it instead of
performing some setup operations manually.

The only actual change is that we don't pass OpenFlags=S when creating
an Impress document, but it never seemed useful (it was only ported
from Java out of zeal), and I can't even find what the S option is for.
In all cases, this doesn't affect the tests themselves.

Change-Id: Ic8d56dd9bc3ec957891868b23bb241ba3bf33049
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147003
Tested-by: Jenkins
Reviewed-by: Michael Weghorn 

diff --git a/toolkit/qa/cppunit/a11y/AccessibleStatusBarTest.cxx 
b/toolkit/qa/cppunit/a11y/AccessibleStatusBarTest.cxx
index 20d8b42f8c0c..5bf522fb2e2e 100644
--- a/toolkit/qa/cppunit/a11y/AccessibleStatusBarTest.cxx
+++ b/toolkit/qa/cppunit/a11y/AccessibleStatusBarTest.cxx
@@ -24,18 +24,13 @@
 #include 
 #include 
 #include 
-#include 
-#include 
 #include 
 #include 
-#include 
 #include 
 #include 
-#include 
 
-#include 
 #include 
-#include 
+#include 
 #include 
 
 #include 
@@ -48,15 +43,12 @@ using namespace css;
 
 namespace
 {
-class AccessibleStatusBarTest : public test::BootstrapFixture
+class AccessibleStatusBarTest : public test::AccessibleTestBase
 {
 private:
-uno::Reference mxDesktop;
-
 uno::Reference
 getTestObject(const uno::Reference& xWindow);
-void runAllTests(const uno::Reference& xWindow);
-uno::Reference openDocument(std::string_view sKind);
+void runAllTests();
 void testDocument(std::string_view sKind);
 
 void testWriterDoc() { testDocument("swriter"); }
@@ -66,8 +58,6 @@ private:
 void testCalcDoc() { testDocument("scalc"); }
 
 public:
-virtual void setUp() override;
-
 CPPUNIT_TEST_SUITE(AccessibleStatusBarTest);
 CPPUNIT_TEST(testWriterDoc);
 CPPUNIT_TEST(testMathDoc);
@@ -77,13 +67,6 @@ public:
 CPPUNIT_TEST_SUITE_END();
 };
 
-void AccessibleStatusBarTest::setUp()
-{
-test::BootstrapFixture::setUp();
-
-mxDesktop = frame::Desktop::create(mxComponentContext);
-}
-
 uno::Reference
 AccessibleStatusBarTest::getTestObject(const uno::Reference& 
xWindow)
 {
@@ -108,9 +91,9 @@ AccessibleStatusBarTest::getTestObject(const 
uno::Reference& xWind
 return xContext;
 }
 
-void AccessibleStatusBarTest::runAllTests(const uno::Reference& 
xWindow)
+void AccessibleStatusBarTest::runAllTests()
 {
-auto xContext = getTestObject(xWindow);
+auto xContext = getTestObject(mxWindow);
 
 uno::Reference 
xAccessibleComponent(xContext,
  
uno::UNO_QUERY_THROW);
@@ -127,53 +110,25 @@ void AccessibleStatusBarTest::runAllTests(const 
uno::Reference& xW
 
 uno::Reference 
xAccessibleEventBroadcaster(
 xContext, uno::UNO_QUERY_THROW);
-XAccessibleEventBroadcasterTester 
eventBroadcasterTester(xAccessibleEventBroadcaster, xWindow);
+XAccessibleEventBroadcasterTester 
eventBroadcasterTester(xAccessibleEventBroadcaster, mxWindow);
 eventBroadcasterTester.testAll();
 }
 
-uno::Reference 
AccessibleStatusBarTest::openDocument(std::string_view sKind)
+void AccessibleStatusBarTest::testDocument(std::string_view sKind)
 {
-/* not sure what's that about, but from SOfficeFactory.java:openDoc() */
-// that noargs thing for load attributes
-std::vector aArgs;
-if (sKind == "simpress")
-{
-beans::PropertyValue aValue;
-aValue.Name = "OpenFlags";
-aValue.Handle = -1;
-aValue.Value <<= OUString("S");
-aValue.State = beans::PropertyState_DIRECT_VALUE;
-aArgs.push_back(aValue);
-}
-
 rtl::OUStringBuffer sURL("private:factory/");
 sURL.appendAscii(sKind.data(), sKind.length());
 
-return mxDesktop->loadComponentFromURL(sURL.makeStringAndClear(), 
"_blank", 40,
-   
comphelper::containerToSequence(aArgs));
-}
+load(sURL.makeStringAndClear());
 
-void AccessibleStatusBarTest::testDocument(std::string_view sKind)
-{
-auto xDoc = openDocument(sKind);
-std::cout << "got document: " << xDoc << std::endl;
-CPPUNIT_ASSERT(xDoc.is());
-uno::Reference xModel(xDoc, uno::UNO_QUERY_THROW);
-std::cout << "got model: " << xModel << std::endl;
-uno::Reference xWindow(
-xModel->getCurrentController()->getFrame()->getContainerWindow());
-std::cout << "got window: " << xWindow << std::endl;
-uno::Reference xTopWindow(xWindow, uno::UNO_QUERY_THROW);
-std::cout << "got top window: " << xTopWindow << std::endl;

[Libreoffice-commits] core.git: include/test

2023-02-03 Thread Colomban Wendling (via logerrit)
 include/test/a11y/AccessibilityTools.hxx |1 -
 1 file changed, 1 deletion(-)

New commits:
commit fb42b73d50eb3856a96c8c6f269e37d9da2181f2
Author: Colomban Wendling 
AuthorDate: Thu Feb 2 11:08:37 2023 +0100
Commit: Noel Grandin 
CommitDate: Fri Feb 3 17:11:12 2023 +

test/a11y: Remove declaration for undefined method

getStateName() has been removed and superseded by
debugAccessibleStateSet() in 8d8e6c84e512c1a8b33aac75965b84481d1a1d13
but its declaration was still there.

Change-Id: I3c7a9dc74b7230cde2fc61a86ca7659e35ba2bdf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146496
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/include/test/a11y/AccessibilityTools.hxx 
b/include/test/a11y/AccessibilityTools.hxx
index 65116a2d19d4..88276bac700d 100644
--- a/include/test/a11y/AccessibilityTools.hxx
+++ b/include/test/a11y/AccessibilityTools.hxx
@@ -78,7 +78,6 @@ public:
 }
 
 static OUString getRoleName(const sal_Int16 role);
-static OUString getStateName(const sal_Int16 state);
 static OUString getEventIdName(const sal_Int16 event_id);
 static OUString getRelationTypeName(const sal_Int16 rel_type);
 


[Libreoffice-commits] core.git: include/test test/Library_subsequenttest.mk test/source

2023-01-25 Thread Colomban Wendling (via logerrit)
 include/test/a11y/AccessibilityTools.hxx |   19 ++
 test/Library_subsequenttest.mk   |1 
 test/source/a11y/AccessibilityTools.cxx  |   41 +++
 test/source/a11y/accessibletestbase.cxx  |   28 -
 4 files changed, 62 insertions(+), 27 deletions(-)

New commits:
commit 293db294e3408eda3f3133925fd307011b13c8d8
Author: Colomban Wendling 
AuthorDate: Wed Oct 19 18:31:43 2022 +0200
Commit: Michael Weghorn 
CommitDate: Wed Jan 25 08:22:01 2023 +

test: Add AccessibilityTools::nameEquals()

Some accessible names contain a suffix when OSL_DEBUG_LEVEL > 0, which
makes it tricky to compare to a known value.  To fix that, introduce a
helper that knows how and when to deal with the suffix properly that
can then be used to easily check accessible names.

As we already have a similar, yet private, helper for menu items on
Windows (that include the keybinding label as a suffix), merge the two
together in a unified solution for comparing names.

Change-Id: I7e67edbc7817218ef3e097062d25888172056c21
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142257
Tested-by: Jenkins
Reviewed-by: Michael Weghorn 

diff --git a/include/test/a11y/AccessibilityTools.hxx 
b/include/test/a11y/AccessibilityTools.hxx
index 1efd0b9f2960..65116a2d19d4 100644
--- a/include/test/a11y/AccessibilityTools.hxx
+++ b/include/test/a11y/AccessibilityTools.hxx
@@ -58,6 +58,25 @@ public:
 static bool equals(const 
css::uno::Reference& xctx1,
const 
css::uno::Reference& xctx2);
 
+/**
+ * @brief Compares the accessible name against a string
+ * @param xCtx A XAccessibleContext on which compare the name
+ * @param name The string to compare to
+ * @returns @c true if @p xCtx name matches @p name.
+ *
+ * This is conceptually equivalent to @code xCtx->getAccessibleName() == 
name @endcode, but
+ * handles the case OSL debugging is active and inserts a type suffix.  
Unless you know for
+ * sure the accessible you are comparing is not subject to those suffixes 
under debugging,
+ * always use this function instead of direct comparison.
+ */
+static bool nameEquals(const 
css::uno::Reference& xCtx,
+   const std::u16string_view name);
+static bool nameEquals(const 
css::uno::Reference& xAcc,
+   const std::u16string_view name)
+{
+return nameEquals(xAcc->getAccessibleContext(), name);
+}
+
 static OUString getRoleName(const sal_Int16 role);
 static OUString getStateName(const sal_Int16 state);
 static OUString getEventIdName(const sal_Int16 event_id);
diff --git a/test/Library_subsequenttest.mk b/test/Library_subsequenttest.mk
index 98eb17a5a557..1e94db958852 100644
--- a/test/Library_subsequenttest.mk
+++ b/test/Library_subsequenttest.mk
@@ -29,6 +29,7 @@ $(eval $(call gb_Library_use_libraries,subsequenttest,\
sal \
sfx \
test \
+   tk \
tl \
utl \
unotest \
diff --git a/test/source/a11y/AccessibilityTools.cxx 
b/test/source/a11y/AccessibilityTools.cxx
index 7a89ac2ac80f..8afc1687c889 100644
--- a/test/source/a11y/AccessibilityTools.cxx
+++ b/test/source/a11y/AccessibilityTools.cxx
@@ -27,8 +27,10 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
+#include 
 
 using namespace css;
 
@@ -136,6 +138,45 @@ bool AccessibilityTools::equals(const 
uno::ReferencegetAccessibleParent(), xctx2->getAccessibleParent());
 }
 
+bool AccessibilityTools::nameEquals(const 
uno::Reference& xCtx,
+const std::u16string_view name)
+{
+auto ctxName = xCtx->getAccessibleName();
+OUString rest;
+
+if (!ctxName.startsWith(name, ))
+return false;
+if (rest == u"")
+return true;
+
+#if defined(_WIN32)
+// see OAccessibleMenuItemComponent::GetAccessibleName():
+// on Win32, ignore a \tSHORTCUT suffix on a menu item
+switch (xCtx->getAccessibleRole())
+{
+case accessibility::AccessibleRole::MENU_ITEM:
+case accessibility::AccessibleRole::RADIO_MENU_ITEM:
+case accessibility::AccessibleRole::CHECK_MENU_ITEM:
+return rest[0] == '\t';
+
+default:
+break;
+}
+#endif
+
+#if OSL_DEBUG_LEVEL > 0
+// see VCLXAccessibleComponent::getAccessibleName()
+auto pVCLXAccessibleComponent = 
dynamic_cast(xCtx.get());
+if (pVCLXAccessibleComponent)
+{
+auto windowType = pVCLXAccessibleComponent->GetWindow()->GetType();
+if (rest == u" (Type = " + 
OUString::number(static_cast(windowType)) + ")")
+return true;
+}
+#endif
+return false;
+}
+
 static OUString unknownName(const sal_Int64 value)
 {
 return "unknown (" + OUString::number(value) + ")";
diff --git a/test/source/a11y/accessibletestbase.cxx 
b/test/source/a11y/accessibletestbase.cxx
index 

[Libreoffice-commits] core.git: sd/CppunitTest_sd_a11y.mk sd/Module_sd.mk sd/qa

2022-08-02 Thread Colomban Wendling (via logerrit)
 sd/CppunitTest_sd_a11y.mk   |   38 +
 sd/Module_sd.mk |1 
 sd/qa/unit/a11y/data/tdf150064.fodp |  796 
 sd/qa/unit/a11y/layout.cxx  |  154 ++
 4 files changed, 989 insertions(+)

New commits:
commit 6185a27db46bf5cba404e669eaf3a1c78f4a8607
Author: Colomban Wendling 
AuthorDate: Sun Jul 31 17:20:03 2022 +0200
Commit: Michael Weghorn 
CommitDate: Tue Aug 2 16:30:47 2022 +0200

tdf#150064 Add tests for a11y tree order

Check the tree order is stable across loads and page switches.

Change-Id: I8850eb8b230d9193c4f2497150a44fd555030a9b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137681
Reviewed-by: Michael Weghorn 
Tested-by: Michael Weghorn 

diff --git a/sd/CppunitTest_sd_a11y.mk b/sd/CppunitTest_sd_a11y.mk
new file mode 100644
index ..6b0c228607e6
--- /dev/null
+++ b/sd/CppunitTest_sd_a11y.mk
@@ -0,0 +1,38 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_CppunitTest_CppunitTest,sd_a11y))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,sd_a11y, \
+   sd/qa/unit/a11y/layout \
+))
+
+$(eval $(call gb_CppunitTest_use_libraries,sd_a11y, \
+   sal \
+   cppu \
+   subsequenttest \
+   test \
+   unotest \
+   vcl \
+))
+
+$(eval $(call gb_CppunitTest_use_api,sd_a11y,\
+   offapi \
+   udkapi \
+))
+
+$(eval $(call gb_CppunitTest_use_sdk_api,sd_a11y))
+$(eval $(call gb_CppunitTest_use_rdb,sd_a11y,services))
+$(eval $(call gb_CppunitTest_use_ure,sd_a11y))
+$(eval $(call gb_CppunitTest_use_vcl,sd_a11y))
+
+$(eval $(call gb_CppunitTest_use_instdir_configuration,sd_a11y))
+$(eval $(call gb_CppunitTest_use_common_configuration,sd_a11y))
+
+# vim: set noet sw=4 ts=4:
diff --git a/sd/Module_sd.mk b/sd/Module_sd.mk
index 0ac7b5763607..38edf0d8009d 100644
--- a/sd/Module_sd.mk
+++ b/sd/Module_sd.mk
@@ -49,6 +49,7 @@ $(eval $(call gb_Module_add_slowcheck_targets,sd,\
 CppunitTest_sd_png_export_tests \
 CppunitTest_sd_filter_eppt \
 CppunitTest_sd_shape_import_export_tests \
+CppunitTest_sd_a11y \
 ))
 endif
 
diff --git a/sd/qa/unit/a11y/data/tdf150064.fodp 
b/sd/qa/unit/a11y/data/tdf150064.fodp
new file mode 100644
index ..6eda6b630cce
--- /dev/null
+++ b/sd/qa/unit/a11y/data/tdf150064.fodp
@@ -0,0 +1,796 @@
+
+http://www.w3.org/TR/css3-text/; 
xmlns:grddl="http://www.w3.org/2003/g/data-view#; 
xmlns:xhtml="http://www.w3.org/1999/xhtml; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema; 
xmlns:xforms="http://www.w3.org/2002/xforms; 
xmlns:dom="http://www.w3.org/2001/xml-events; 
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" 
xmlns:math="http://www.w3.org/1998/Math/MathML; 
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
xmlns:ooo="http://openoffice.org/2004/office; 
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" 
xmlns:ooow="http://ope
 noffice.org/2004/writer" xmlns:xlink="http://www.w3.org/1999/xlink; 
xmlns:drawooo="http://openoffice.org/2010/draw; 
xmlns:oooc="http://openoffice.org/2004/calc; 
xmlns:dc="http://purl.org/dc/elements/1.1/; 
xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0"
 xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:tableooo="http://openoffice.org/2009/table; 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
xmlns:rpt="http://openoffice.org/2005/report; 
xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0"
 xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
xmlns:officeooo="http://openoffice.org/2009/office; 
xmlns:table="urn:oasis:names:tc:opendocument:x
 mlns:table:1.0" 
xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 office:version="1.3" 
office:mimetype="application/vnd.oasis.opendocument.presentation">
+ 
2022-07-30T14:38:24.9165100222022-07-30T15:14:00.484240506PT35M43S1LibreOfficeDev/7.5.0.0.alpha0$Linux_X86_64
 

[Libreoffice-commits] core.git: include/test sc/CppunitTest_sc_a11y.mk sc/Module_sc.mk sc/qa sw/CppunitTest_sw_a11y.mk sw/Module_sw.mk sw/qa test/Library_subsequenttest.mk test/source

2022-08-01 Thread Colomban Wendling (via logerrit)
 include/test/a11y/AccessibilityTools.hxx   |   12 +
 include/test/a11y/accessibletestbase.hxx   |  138 +++
 include/test/a11y/swaccessibletestbase.hxx |   58 ++
 sc/CppunitTest_sc_a11y.mk  |   39 
 sc/Module_sc.mk|1 
 sc/qa/extras/accessibility/basics.cxx  |   90 ++
 sw/CppunitTest_sw_a11y.mk  |   38 
 sw/Module_sw.mk|1 
 sw/qa/extras/accessibility/basics.cxx  |   96 ++
 test/Library_subsequenttest.mk |2 
 test/source/a11y/AccessibilityTools.cxx|   50 -
 test/source/a11y/accessibletestbase.cxx|  260 +
 test/source/a11y/swaccessibletestbase.cxx  |  135 +++
 13 files changed, 907 insertions(+), 13 deletions(-)

New commits:
commit 0185ddd6d5f0324ba57b3fa36229103a6b27138e
Author: Colomban Wendling 
AuthorDate: Thu Jul 21 21:51:21 2022 +0200
Commit: Michael Weghorn 
CommitDate: Mon Aug 1 17:03:40 2022 +0200

Add infrastructure and basic tests including slight UI interaction

This introduces a couple helper base classes for implementing
accessibility tests more easily, and includes a few tests as examples,
including basic document layout check and minimal UI interaction
through menus.

Change-Id: I8961af8be1e7d52dc55fe27c758806d9b4c3c5d9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137337
Tested-by: Jenkins
Reviewed-by: Michael Weghorn 

diff --git a/include/test/a11y/AccessibilityTools.hxx 
b/include/test/a11y/AccessibilityTools.hxx
index e56c68c9bebb..1efd0b9f2960 100644
--- a/include/test/a11y/AccessibilityTools.hxx
+++ b/include/test/a11y/AccessibilityTools.hxx
@@ -37,6 +37,18 @@ public:
  * Calc which has a million elements, if not more. */
 static const sal_Int32 MAX_CHILDREN = 500;
 
+static css::uno::Reference
+getAccessibleObjectForPredicate(
+const css::uno::Reference& 
xCtx,
+const std::function<
+bool(const 
css::uno::Reference&)>& cPredicate);
+static css::uno::Reference
+getAccessibleObjectForPredicate(
+const css::uno::Reference& xAcc,
+const std::function<
+bool(const 
css::uno::Reference&)>& cPredicate);
+static css::uno::Reference 
getAccessibleObjectForRole(
+const css::uno::Reference& 
xCtx, sal_Int16 role);
 static css::uno::Reference
 getAccessibleObjectForRole(const 
css::uno::Reference& xacc,
sal_Int16 role);
diff --git a/include/test/a11y/accessibletestbase.hxx 
b/include/test/a11y/accessibletestbase.hxx
new file mode 100644
index ..50a39f63a7dd
--- /dev/null
+++ b/include/test/a11y/accessibletestbase.hxx
@@ -0,0 +1,138 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; 
fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+#include 
+
+#include "AccessibilityTools.hxx"
+
+namespace test
+{
+class OOO_DLLPUBLIC_TEST AccessibleTestBase : public test::BootstrapFixture
+{
+protected:
+css::uno::Reference mxDesktop;
+css::uno::Reference mxDocument;
+css::uno::Reference mxWindow;
+
+static bool isDocumentRole(const sal_Int16 role);
+
+virtual void load(const rtl::OUString& sURL);
+virtual void loadFromSrc(const rtl::OUString& sSrcPath);
+void close();
+css::uno::Reference 
getWindowAccessibleContext();
+virtual css::uno::Reference
+getDocumentAccessibleContext();
+
+void documentPostKeyEvent(int nType, int nCharCode, int nKeyCode)
+{
+vcl::ITiledRenderable* pTiledRenderable
+= dynamic_cast(mxDocument.get());
+CPPUNIT_ASSERT(pTiledRenderable);
+pTiledRenderable->postKeyEvent(nType, nCharCode, nKeyCode);
+}
+
+static css::uno::Reference 
getFirstRelationTargetOfType(
+const css::uno::Reference& 
xContext,
+sal_Int16 relationType);
+
+/**
+ * @brief Tries to list all children of an accessible
+ * @param xContext An XAccessibleContext object
+ * @returns The list of all children (but no more than @c 
AccessibilityTools::MAX_CHILDREN)
+ *
+ * This fetches children of @p xContext.  This would ideally just be the 
same than iterating
+ * over children the regular way up to @c 
AccessibilityTools::MAX_CHILDREN, but unfortunately
+ * some components (Writer, Impress, ...) do not provide all their 
children the regular way and
+ * require specifics to include them.
+ *
+ * There is no guarantee on *which* children 

[Libreoffice-commits] core.git: test/source

2022-07-27 Thread Colomban Wendling (via logerrit)
 test/source/a11y/AccessibilityTools.cxx |   14 +++---
 1 file changed, 11 insertions(+), 3 deletions(-)

New commits:
commit d6ce547a1a24379bf1783387e22cbf8d39866757
Author: Colomban Wendling 
AuthorDate: Thu Jul 21 17:43:34 2022 +0200
Commit: Michael Weghorn 
CommitDate: Wed Jul 27 17:35:03 2022 +0200

Better report unknown constant names by including their values

Change-Id: Id93dedf39ad0e2d1968e80878dd1a1bb07d94b61
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137336
Tested-by: Jenkins
Reviewed-by: Michael Weghorn 

diff --git a/test/source/a11y/AccessibilityTools.cxx 
b/test/source/a11y/AccessibilityTools.cxx
index 266e536dd3ba..44b168b54a94 100644
--- a/test/source/a11y/AccessibilityTools.cxx
+++ b/test/source/a11y/AccessibilityTools.cxx
@@ -112,6 +112,11 @@ bool AccessibilityTools::equals(const 
uno::ReferencegetAccessibleParent(), xctx2->getAccessibleParent());
 }
 
+static OUString unknownName(const sal_Int64 value)
+{
+return "unknown (" + OUString::number(value) + ")";
+}
+
 OUString AccessibilityTools::getRoleName(const sal_Int16 role)
 {
 switch (role)
@@ -291,7 +296,7 @@ OUString AccessibilityTools::getRoleName(const sal_Int16 
role)
 case accessibility::AccessibleRole::WINDOW:
 return "WINDOW";
 };
-return "unknown";
+return unknownName(role);
 }
 
 OUString AccessibilityTools::debugAccessibleStateSet(const sal_Int64 
nCombinedState)
@@ -411,6 +416,9 @@ OUString AccessibilityTools::debugAccessibleStateSet(const 
sal_Int64 nCombinedSt
 case accessibility::AccessibleStateType::VISIBLE:
 name = "VISIBLE";
 break;
+default:
+name = unknownName(state);
+break;
 }
 if (combinedName.getLength())
 combinedName += " | ";
@@ -509,7 +517,7 @@ OUString AccessibilityTools::getEventIdName(const sal_Int16 
event_id)
 case accessibility::AccessibleEventId::VISIBLE_DATA_CHANGED:
 return "VISIBLE_DATA_CHANGED";
 }
-return "unknown";
+return unknownName(event_id);
 }
 
 OUString AccessibilityTools::getRelationTypeName(const sal_Int16 rel_type)
@@ -539,7 +547,7 @@ OUString AccessibilityTools::getRelationTypeName(const 
sal_Int16 rel_type)
 case accessibility::AccessibleRelationType::SUB_WINDOW_OF:
 return "SUB_WINDOW_OF";
 }
-return "unknown";
+return unknownName(rel_type);
 }
 
 OUString AccessibilityTools::debugName(accessibility::XAccessibleContext* ctx)


[Libreoffice-commits] core.git: sw/qa

2022-07-27 Thread Colomban Wendling (via logerrit)
 sw/qa/extras/accessibility/accessible_relation_set.cxx |   11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

New commits:
commit 98180644fe2125027dc3a5df637618d717a54e86
Author: Colomban Wendling 
AuthorDate: Wed Jul 27 15:29:36 2022 +0200
Commit: Michael Weghorn 
CommitDate: Wed Jul 27 17:19:24 2022 +0200

Don't use magic numbers or off-range enum values

Stop using magic numbers standing for enumeration items.  It makes the
code clearer, and this test is not here to verify the API stays stable
but that the semantics are correct so there's no need for magic values.

Also don't use placeholder values outside the enumeration range and
replace them with the legitimate and pretty appropriate INVALID value,
which has the same effect in the context of this test, and avoids
abusing the APIs.

Change-Id: Ib5c9d768ba83470d41c65e00ebe3e8878ce32f3f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137505
Reviewed-by: Michael Weghorn 
Tested-by: Jenkins

diff --git a/sw/qa/extras/accessibility/accessible_relation_set.cxx 
b/sw/qa/extras/accessibility/accessible_relation_set.cxx
index 3839a61d0504..9220606be3d0 100644
--- a/sw/qa/extras/accessibility/accessible_relation_set.cxx
+++ b/sw/qa/extras/accessibility/accessible_relation_set.cxx
@@ -133,7 +133,8 @@ void AccessibleRelationSet::contents_flows_to_and_from()
 css::uno::Reference set2
 = oObj2->getAccessibleRelationSet();
 
-sal_Int16 relationtypes[2] = { -1, -1 };
+sal_Int16 relationtypes[2] = { 
accessibility::AccessibleRelationType::INVALID,
+   
accessibility::AccessibleRelationType::INVALID };
 css::uno::Reference atargets[2];
 
 if (set2.is())
@@ -141,14 +142,14 @@ void AccessibleRelationSet::contents_flows_to_and_from()
 CPPUNIT_ASSERT_EQUAL_MESSAGE("didn't gain correct count of relations", 
sal_Int32(2),
  set2->getRelationCount());
 sal_Int16 tmprelation = set2->getRelation(0).RelationType;
-if (tmprelation == 1)
+if (tmprelation == 
accessibility::AccessibleRelationType::CONTENT_FLOWS_FROM)
 {
 css::uno::Reference adummy(
 set2->getRelation(0).TargetSet[0], uno::UNO_QUERY_THROW);
 atargets[0] = adummy;
 relationtypes[0] = tmprelation;
 }
-else if (tmprelation == 2)
+else if (tmprelation == 
accessibility::AccessibleRelationType::CONTENT_FLOWS_TO)
 {
 css::uno::Reference adummy(
 set2->getRelation(0).TargetSet[0], uno::UNO_QUERY_THROW);
@@ -160,14 +161,14 @@ void AccessibleRelationSet::contents_flows_to_and_from()
 CPPUNIT_FAIL("didn't gain correct relation type");
 }
 tmprelation = set2->getRelation(1).RelationType;
-if (tmprelation == 1)
+if (tmprelation == 
accessibility::AccessibleRelationType::CONTENT_FLOWS_FROM)
 {
 css::uno::Reference adummy(
 set2->getRelation(1).TargetSet[0], uno::UNO_QUERY_THROW);
 atargets[0] = adummy;
 relationtypes[0] = tmprelation;
 }
-else if (tmprelation == 2)
+else if (tmprelation == 
accessibility::AccessibleRelationType::CONTENT_FLOWS_TO)
 {
 css::uno::Reference adummy(
 set2->getRelation(1).TargetSet[0], uno::UNO_QUERY_THROW);


[Libreoffice-commits] core.git: test/source

2022-07-27 Thread Colomban Wendling (via logerrit)
 test/source/a11y/AccessibilityTools.cxx |   21 +
 1 file changed, 21 insertions(+)

New commits:
commit 150f89d3b39fd062af56e21aa6d185758af67c0e
Author: Colomban Wendling 
AuthorDate: Thu Jul 21 16:36:32 2022 +0200
Commit: Michael Weghorn 
CommitDate: Wed Jul 27 17:04:17 2022 +0200

Fix comparing some Writer objects

Offscreen objects in Writer are not exposed as children of their
parent, but might be reachable through relations. In this case, similar
objects can easily be mistakenly deemed equal (e.g. empty paragraphs
will have the same role, empty name and description, etc.).

Try to avoid this by taking into account the object's relations, which
should at least have different targets if they are not the same.

Change-Id: Ie6e1aaf388006b76d014ba2bd26aabef88d7dd6b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137335
Reviewed-by: Michael Weghorn 
Tested-by: Jenkins

diff --git a/test/source/a11y/AccessibilityTools.cxx 
b/test/source/a11y/AccessibilityTools.cxx
index f727bd41087f..266e536dd3ba 100644
--- a/test/source/a11y/AccessibilityTools.cxx
+++ b/test/source/a11y/AccessibilityTools.cxx
@@ -88,6 +88,27 @@ bool AccessibilityTools::equals(const 
uno::ReferencegetAccessibleIndexInParent() != 
xctx2->getAccessibleIndexInParent())
 return false;
 
+/* because in Writer at least some children only are referenced by their 
relations to others
+ * objects, we need to account for that as their index in parent is 
incorrect (so not
+ * necessarily unique) */
+auto relset1 = xctx1->getAccessibleRelationSet();
+auto relset2 = xctx2->getAccessibleRelationSet();
+if (relset1.is() != relset2.is())
+return false;
+else if (relset1.is())
+{
+auto relCount1 = relset1->getRelationCount();
+auto relCount2 = relset2->getRelationCount();
+if (relCount1 != relCount2)
+return false;
+
+for (sal_Int32 i = 0; i < relCount1; ++i)
+{
+if (relset1->getRelation(i) != relset2->getRelation(i))
+return false;
+}
+}
+
 return equals(xctx1->getAccessibleParent(), xctx2->getAccessibleParent());
 }
 


[Libreoffice-commits] core.git: include/test sw/qa test/Library_subsequenttest.mk test/source toolkit/CppunitTest_toolkit_a11y.mk toolkit/qa

2022-07-27 Thread Colomban Wendling (via logerrit)
 include/test/a11y/AccessibilityTools.hxx  |5 
 sw/qa/extras/accessibility/accessible_relation_set.cxx|   67 ++
 test/Library_subsequenttest.mk|1 
 test/source/a11y/AccessibilityTools.cxx   |   35 -
 toolkit/CppunitTest_toolkit_a11y.mk   |2 
 toolkit/qa/cppunit/a11y/AccessibleStatusBarTest.cxx   |2 
 toolkit/qa/cppunit/a11y/XAccessibleComponentTester.cxx|2 
 toolkit/qa/cppunit/a11y/XAccessibleComponentTester.hxx|2 
 toolkit/qa/cppunit/a11y/XAccessibleContextTester.cxx  |2 
 toolkit/qa/cppunit/a11y/XAccessibleEventBroadcasterTester.cxx |2 
 10 files changed, 58 insertions(+), 62 deletions(-)

New commits:
commit 8fe5a832b02ea6c5113c573f5b9c23e58049a4d2
Author: Colomban Wendling 
AuthorDate: Thu Jul 21 15:58:16 2022 +0200
Commit: Michael Weghorn 
CommitDate: Wed Jul 27 10:41:03 2022 +0200

Make AccessibilityTools available more widely and use it

Move AccessibilityTools helper to test/ and use it in 
accessible_relation_set
test replacing the copied over feature and consolidating the test as well.

Change-Id: Ia5ea69bb08bb2a86e3eb6c3dba2ab182b612561d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137307
Tested-by: Jenkins
Reviewed-by: Michael Weghorn 

diff --git a/toolkit/qa/cppunit/a11y/AccessibilityTools.hxx 
b/include/test/a11y/AccessibilityTools.hxx
similarity index 97%
rename from toolkit/qa/cppunit/a11y/AccessibilityTools.hxx
rename to include/test/a11y/AccessibilityTools.hxx
index 96afe4377f94..e56c68c9bebb 100644
--- a/toolkit/qa/cppunit/a11y/AccessibilityTools.hxx
+++ b/include/test/a11y/AccessibilityTools.hxx
@@ -19,6 +19,8 @@
 
 #pragma once
 
+#include 
+
 #include 
 #include 
 
@@ -28,7 +30,7 @@
 #include 
 #include 
 
-class AccessibilityTools
+class OOO_DLLPUBLIC_TEST AccessibilityTools
 {
 public:
 /** Maximum number of children to work on. This is especially useful for
@@ -47,6 +49,7 @@ public:
 static OUString getRoleName(const sal_Int16 role);
 static OUString getStateName(const sal_Int16 state);
 static OUString getEventIdName(const sal_Int16 event_id);
+static OUString getRelationTypeName(const sal_Int16 rel_type);
 
 template  static std::string debugString(const 
css::uno::Reference& x)
 {
diff --git a/sw/qa/extras/accessibility/accessible_relation_set.cxx 
b/sw/qa/extras/accessibility/accessible_relation_set.cxx
index ce053c95b07b..3839a61d0504 100644
--- a/sw/qa/extras/accessibility/accessible_relation_set.cxx
+++ b/sw/qa/extras/accessibility/accessible_relation_set.cxx
@@ -20,6 +20,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -33,54 +34,13 @@
 #include 
 #include 
 
+#include 
+
 using namespace com::sun::star;
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::accessibility;
 using namespace css::lang;
 
-namespace
-{
-class AccessibilityTools
-{
-public:
-static css::uno::Reference
-getAccessibleObjectForRole(const 
css::uno::Reference& xacc,
-   sal_Int16 role);
-};
-}
-
-css::uno::Reference
-AccessibilityTools::getAccessibleObjectForRole(
-const css::uno::Reference& xacc, 
sal_Int16 role)
-{
-css::uno::Reference ac = 
xacc->getAccessibleContext();
-bool isShowing = ac->getAccessibleStateSet() & 
AccessibleStateType::SHOWING;
-
-if ((ac->getAccessibleRole() == role) && isShowing)
-{
-return ac;
-}
-else
-{
-int k = ac->getAccessibleChildCount();
-if (ac->getAccessibleChildCount() > 100)
-{
-k = 50;
-}
-
-for (int i = 0; i < k; i++)
-{
-css::uno::Reference ac2
-= 
AccessibilityTools::getAccessibleObjectForRole(ac->getAccessibleChild(i), role);
-if (ac2.is())
-{
-return ac2;
-}
-}
-}
-return nullptr;
-}
-
 class AccessibleRelationSet : public UnoApiTest
 {
 public:
@@ -137,9 +97,6 @@ 
AccessibleRelationSet::init(uno::Reference& par
 void AccessibleRelationSet::contents_flows_to_and_from()
 {
 //contents_flows_to
-std::vector types{ "INVALID",   "CONTENT_FLOWS_FROM", 
"CONTENT_FLOWS_TO",
- "CONTROLLED_BY", "CONTROLLER_FOR", 
"LABEL_FOR",
- "LABELED_BY","MEMBER_OF",  
"SUB_WINDOW_OF" };
 
 css::uno::Reference para1;
 css::uno::Reference para2;
@@ -160,8 +117,10 @@ void AccessibleRelationSet::contents_flows_to_and_from()
 css::uno::Reference adummy(
 set->getRelation(0).TargetSet[0], uno::UNO_QUERY_THROW);
 atarget = adummy;
-CPPUNIT_ASSERT_EQUAL_MESSAGE("didn't gain correct relation type for 
paragraph 0", types[2],
- types[firstrelation]);
+

[Libreoffice-commits] core.git: sc/CppunitTest_sc_cond_format_merge.mk sc/CppunitTest_sc_new_cond_format_api.mk solenv/gbuild test/Package_unittest.mk test/user-template

2022-07-12 Thread Colomban Wendling (via logerrit)
 sc/CppunitTest_sc_cond_format_merge.mk   |2 -
 sc/CppunitTest_sc_new_cond_format_api.mk |2 -
 solenv/gbuild/CppunitTest.mk |   18 -
 test/Package_unittest.mk |3 +-
 test/user-template/registry-common/modifications.xcd |9 
 test/user-template/registry-user-ui/user-ui.xcd  |   20 +++
 6 files changed, 35 insertions(+), 19 deletions(-)

New commits:
commit 2dde21ea74223ca68865ee87558baad0d3eb4e46
Author: Colomban Wendling 
AuthorDate: Tue Jul 12 12:14:35 2022 +0200
Commit: Stephan Bergmann 
CommitDate: Tue Jul 12 16:27:18 2022 +0200

unittest: Split out registry entries to alter UI definition search path

Accessibility tests will require testing the normal UI, so will need
not alter the search path for definitions.  It will however benefit
from other environmental overrides (locale, fonts, etc.).

The solution here splits out to a separate registry the piece of
configuration that alter the UI, so users can select the features set
they need.

The default gb_CppunitTest_use_configuration is updated to keep working
the same as before, using both layers.

gb_CppunitTest_use_unittest_configuration is replaced by specific ones
for each configuration layer, and the two direct call sites removed as
they were redundant anyway (gb_CppunitTest_use_unittest_configuration
is only a subset of gb_CppunitTest_use_configuration).
New macros are gb_CppunitTest_use_common_configuration for the common
layer and gb_CppunitTest_use_user_ui_configuration for the UI one.

Change-Id: I75f82092079752b4e173e48ab463636e7b7515b6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136997
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/sc/CppunitTest_sc_cond_format_merge.mk 
b/sc/CppunitTest_sc_cond_format_merge.mk
index 2752b392b0d0..c588e44580ff 100644
--- a/sc/CppunitTest_sc_cond_format_merge.mk
+++ b/sc/CppunitTest_sc_cond_format_merge.mk
@@ -120,6 +120,4 @@ $(eval $(call 
gb_CppunitTest_use_components,sc_cond_format_merge,\
 
 $(eval $(call gb_CppunitTest_use_configuration,sc_cond_format_merge))
 
-$(eval $(call gb_CppunitTest_use_unittest_configuration,sc_cond_format_merge))
-
 # vim: set noet sw=4 ts=4:
diff --git a/sc/CppunitTest_sc_new_cond_format_api.mk 
b/sc/CppunitTest_sc_new_cond_format_api.mk
index b158ffc23495..365c5fc81e66 100644
--- a/sc/CppunitTest_sc_new_cond_format_api.mk
+++ b/sc/CppunitTest_sc_new_cond_format_api.mk
@@ -72,6 +72,4 @@ $(eval $(call 
gb_CppunitTest_use_components,sc_new_cond_format_api,\
 
 $(eval $(call gb_CppunitTest_use_configuration,sc_new_cond_format_api))
 
-$(eval $(call 
gb_CppunitTest_use_unittest_configuration,sc_new_cond_format_api))
-
 # vim: set noet sw=4 ts=4:
diff --git a/solenv/gbuild/CppunitTest.mk b/solenv/gbuild/CppunitTest.mk
index 9545f0c52f1d..7900c8f05ac5 100644
--- a/solenv/gbuild/CppunitTest.mk
+++ b/solenv/gbuild/CppunitTest.mk
@@ -354,17 +354,25 @@ $(call 
gb_CppunitTest__use_configuration,$(1),xcsxcu,$(INSTROOT)/$(LIBO_SHARE_FO
 
 endef
 
-# Use configuration in $(WORKDIR)/unittest/registry.
-define gb_CppunitTest_use_unittest_configuration
+# Use configuration in $(WORKDIR)/unittest/registry-common.
+define gb_CppunitTest_use_common_configuration
 $(call gb_CppunitTest_get_target,$(1)) : $(call 
gb_Package_get_target,test_unittest)
-$(call 
gb_CppunitTest__use_configuration,$(1),xcsxcu,$(WORKDIR)/unittest/registry)
+$(call 
gb_CppunitTest__use_configuration,$(1),xcsxcu,$(WORKDIR)/unittest/registry-common)
 
 endef
 
-# Use standard configuration: instdir config + unittest config (in this order!)
+# Use configuration in $(WORKDIR)/unittest/registry-user-ui
+define gb_CppunitTest_use_user_ui_configuration
+$(call gb_CppunitTest_get_target,$(1)) : $(call 
gb_Package_get_target,test_unittest)
+$(call 
gb_CppunitTest__use_configuration,$(1),xcsxcu,$(WORKDIR)/unittest/registry-user-ui)
+
+endef
+
+# Use standard configuration: instdir config + common + user-ui config (in 
this order!)
 define gb_CppunitTest_use_configuration
 $(call gb_CppunitTest_use_instdir_configuration,$(1))
-$(call gb_CppunitTest_use_unittest_configuration,$(1))
+$(call gb_CppunitTest_use_common_configuration,$(1))
+$(call gb_CppunitTest_use_user_ui_configuration,$(1))
 
 endef
 
diff --git a/test/Package_unittest.mk b/test/Package_unittest.mk
index 2aabc9272eb4..a187fcf8b1ef 100644
--- a/test/Package_unittest.mk
+++ b/test/Package_unittest.mk
@@ -11,7 +11,8 @@ $(eval $(call 
gb_Package_Package,test_unittest,$(SRCDIR)/test/user-template))
 
 $(eval $(call gb_Package_set_outdir,test_unittest,$(WORKDIR)))
 
-$(eval $(call 
gb_Package_add_file,test_unittest,unittest/registry/modifications.xcd,registry/modifications.xcd))
+$(eval $(call 
gb_Package_add_file,test_unittest,unittest/registry-common/modifications.xcd,registry-common/modifications.xcd))
+$(eval 

[Libreoffice-commits] core.git: toolkit/CppunitTest_toolkit_a11y.mk toolkit/Module_toolkit.mk toolkit/qa

2022-06-08 Thread Colomban Wendling (via logerrit)
 toolkit/CppunitTest_toolkit_a11y.mk|   65 +
 toolkit/Module_toolkit.mk  |1 
 toolkit/qa/complex/toolkit/AccessibleStatusBar.java|  315 --
 toolkit/qa/cppunit/a11y/AccessibilityTools.cxx |  515 
++
 toolkit/qa/cppunit/a11y/AccessibilityTools.hxx |  158 +++
 toolkit/qa/cppunit/a11y/AccessibleStatusBarTest.cxx|  184 +++
 toolkit/qa/cppunit/a11y/XAccessibleComponentTester.cxx |  290 +
 toolkit/qa/cppunit/a11y/XAccessibleComponentTester.hxx |   66 +
 toolkit/qa/cppunit/a11y/XAccessibleContextTester.cxx   |  164 +++
 toolkit/qa/cppunit/a11y/XAccessibleContextTester.hxx   |   62 +
 toolkit/qa/cppunit/a11y/XAccessibleEventBroadcasterTester.cxx  |  186 +++
 toolkit/qa/cppunit/a11y/XAccessibleEventBroadcasterTester.hxx  |   54 +
 toolkit/qa/cppunit/a11y/XAccessibleExtendedComponentTester.cxx |   53 +
 toolkit/qa/cppunit/a11y/XAccessibleExtendedComponentTester.hxx |   50 
 toolkit/qa/unoapi/toolkit_1.sce|1 
 15 files changed, 1848 insertions(+), 316 deletions(-)

New commits:
commit d2a5b4bc0b8c8d1dd82133719a3ef5cc01b0cbbe
Author: Colomban Wendling 
AuthorDate: Tue Apr 26 16:56:56 2022 +0200
Commit: Caolán McNamara 
CommitDate: Wed Jun 8 12:51:01 2022 +0200

toolkit: convert AccessibleStatusBar test to C++

Just translate the test and add required or handy CppUnit helpers.

Change-Id: Ib8ccd3490876c6302cca85e69f4d61600f7aec84
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133844
Tested-by: Jenkins
Tested-by: Caolán McNamara 
Reviewed-by: Caolán McNamara 

diff --git a/toolkit/CppunitTest_toolkit_a11y.mk 
b/toolkit/CppunitTest_toolkit_a11y.mk
new file mode 100644
index ..9739ec7f9666
--- /dev/null
+++ b/toolkit/CppunitTest_toolkit_a11y.mk
@@ -0,0 +1,65 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_CppunitTest_CppunitTest,toolkit_a11y))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,toolkit_a11y, \
+   toolkit/qa/cppunit/a11y/AccessibleStatusBarTest \
+   toolkit/qa/cppunit/a11y/AccessibilityTools \
+   toolkit/qa/cppunit/a11y/XAccessibleComponentTester \
+   toolkit/qa/cppunit/a11y/XAccessibleContextTester \
+   toolkit/qa/cppunit/a11y/XAccessibleEventBroadcasterTester \
+   toolkit/qa/cppunit/a11y/XAccessibleExtendedComponentTester \
+))
+
+$(eval $(call gb_CppunitTest_use_libraries,toolkit_a11y, \
+   basegfx \
+   comphelper \
+   cppu \
+   cppuhelper \
+   sal \
+   salhelper \
+   test \
+   tk \
+   tl \
+   unotest \
+   vcl \
+))
+
+$(eval $(call gb_CppunitTest_use_api,toolkit_a11y,\
+   offapi \
+   udkapi \
+))
+
+$(eval $(call gb_CppunitTest_use_externals,toolkit_a11y,\
+boost_headers \
+))
+
+$(eval $(call gb_CppunitTest_use_sdk_api,toolkit_a11y))
+
+$(eval $(call gb_CppunitTest_use_ure,toolkit_a11y))
+
+$(eval $(call gb_CppunitTest_use_configuration,toolkit_a11y))
+
+$(eval $(call gb_CppunitTest_use_vcl,toolkit_a11y))
+
+$(eval $(call gb_CppunitTest_use_rdb,toolkit_a11y,services))
+
+#~ $(eval $(call gb_CppunitTest_use_components,toolkit_a11y,\
+#~ comphelper/util/comphelp \
+#~ configmgr/source/configmgr \
+#~ framework/util/fwk \
+#~ i18npool/util/i18npool \
+#~ sfx2/util/sfx \
+#~ toolkit/util/tk \
+#~ ucb/source/core/ucb1 \
+#~ ucb/source/ucp/file/ucpfile1 \
+#~ ))
+
+# vim: set noet sw=4 ts=4:
diff --git a/toolkit/Module_toolkit.mk b/toolkit/Module_toolkit.mk
index 21fd5ae92cdc..d039559316aa 100644
--- a/toolkit/Module_toolkit.mk
+++ b/toolkit/Module_toolkit.mk
@@ -27,6 +27,7 @@ $(eval $(call gb_Module_add_targets,toolkit,\
 ifneq ($(OS),WNT)
 $(eval $(call gb_Module_add_check_targets,toolkit,\
 CppunitTest_toolkit \
+CppunitTest_toolkit_a11y \
 ))
 endif
 
diff --git a/toolkit/qa/complex/toolkit/AccessibleStatusBar.java 
b/toolkit/qa/complex/toolkit/AccessibleStatusBar.java
deleted file mode 100644
index abed29c5680c..
--- a/toolkit/qa/complex/toolkit/AccessibleStatusBar.java
+++ /dev/null
@@ -1,315 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with 

[Libreoffice-commits] core.git: qadevOOo/tests

2022-05-10 Thread Colomban Wendling (via logerrit)
 qadevOOo/tests/java/ifc/accessibility/_XAccessibleComponent.java |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 920558267bbd1e91e1639dd854beb8d56fc7b5c3
Author: Colomban Wendling 
AuthorDate: Thu Mar 17 11:18:12 2022 +0100
Commit: Christian Lohmaier 
CommitDate: Tue May 10 16:13:03 2022 +0200

qa: Fix occlusion check coordinates in _XAccessibleComponent.java

This could erroneously skip a check because the child was erroneously
deemed obscured by another object.

Change-Id: I67d76ea272874671ae328266bdbdeb037c0dc625
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133842
Tested-by: Jenkins
Reviewed-by: Christian Lohmaier 

diff --git a/qadevOOo/tests/java/ifc/accessibility/_XAccessibleComponent.java 
b/qadevOOo/tests/java/ifc/accessibility/_XAccessibleComponent.java
index 574b4763bac5..52dad680183e 100644
--- a/qadevOOo/tests/java/ifc/accessibility/_XAccessibleComponent.java
+++ b/qadevOOo/tests/java/ifc/accessibility/_XAccessibleComponent.java
@@ -265,7 +265,7 @@ public class _XAccessibleComponent extends MultiMethodTest {
  chBnd.Y + curY));
 
 
-Point p = new Point(chBnd.X + curX,chBnd.X + curX);
+Point p = new Point(chBnd.X + curX,chBnd.Y + curY);
 
 if (isCovered(p)) {
 log.println(


[Libreoffice-commits] core.git: accessibility/inc accessibility/source editeng/source include/editeng include/svx offapi/com offapi/UnoApi_offapi.mk sc/source sdext/source starmath/source svx/source s

2020-05-07 Thread Colomban Wendling (via logerrit)
 accessibility/inc/extended/AccessibleBrowseBoxTableCell.hxx  |2 
 accessibility/inc/extended/AccessibleGridControlTableCell.hxx|2 
 accessibility/inc/extended/accessibleiconchoicectrlentry.hxx |2 
 accessibility/inc/extended/accessiblelistboxentry.hxx|2 
 accessibility/inc/extended/textwindowaccessibility.hxx   |3 
 accessibility/inc/standard/vclxaccessibleedit.hxx|2 
 accessibility/inc/standard/vclxaccessiblelistitem.hxx|2 
 accessibility/inc/standard/vclxaccessiblemenuitem.hxx|2 
 accessibility/inc/standard/vclxaccessiblestatusbaritem.hxx   |2 
 accessibility/inc/standard/vclxaccessibletabpage.hxx |2 
 accessibility/inc/standard/vclxaccessibletextcomponent.hxx   |2 
 accessibility/inc/standard/vclxaccessibletoolboxitem.hxx |2 
 accessibility/source/extended/AccessibleBrowseBoxTableCell.cxx   |4 
 accessibility/source/extended/AccessibleGridControlTableCell.cxx |4 
 accessibility/source/extended/accessibleiconchoicectrlentry.cxx  |5 
 accessibility/source/extended/accessiblelistboxentry.cxx |5 
 accessibility/source/extended/textwindowaccessibility.cxx|6 
 accessibility/source/standard/vclxaccessibleedit.cxx |4 
 accessibility/source/standard/vclxaccessiblelistitem.cxx |5 
 accessibility/source/standard/vclxaccessiblemenuitem.cxx |5 
 accessibility/source/standard/vclxaccessiblestatusbaritem.cxx|5 
 accessibility/source/standard/vclxaccessibletabpage.cxx  |5 
 accessibility/source/standard/vclxaccessibletextcomponent.cxx|4 
 accessibility/source/standard/vclxaccessibletoolboxitem.cxx  |5 
 editeng/source/accessibility/AccessibleEditableTextPara.cxx  |5 
 editeng/source/accessibility/AccessibleStaticTextBase.cxx|5 
 include/editeng/AccessibleEditableTextPara.hxx   |2 
 include/editeng/AccessibleStaticTextBase.hxx |2 
 include/svx/AccessibleShape.hxx  |2 
 offapi/UnoApi_offapi.mk  |1 
 offapi/com/sun/star/accessibility/AccessibleScrollType.idl   |   81 
++
 offapi/com/sun/star/accessibility/XAccessibleText.idl|   27 +++
 sc/source/ui/Accessibility/AccessibleCsvControl.cxx  |5 
 sc/source/ui/inc/AccessibleCsvControl.hxx|3 
 sdext/source/presenter/PresenterAccessibility.cxx|   14 +
 starmath/source/accessibility.cxx|5 
 starmath/source/accessibility.hxx|2 
 svx/source/accessibility/AccessibleShape.cxx |1 
 sw/source/core/access/accnotextframe.cxx |1 
 sw/source/core/access/accnotextframe.hxx |2 
 sw/source/core/access/accpara.cxx|   67 

 sw/source/core/access/accpara.hxx|2 
 vcl/unx/gtk3/a11y/gtk3atktext.cxx|   56 ++
 43 files changed, 365 insertions(+)

New commits:
commit b46a0a7f9f88a0213b0a5ca2712b6eb93b74d088
Author: Colomban Wendling 
AuthorDate: Thu Apr 30 10:49:37 2020 +0200
Commit: Stephan Bergmann 
CommitDate: Thu May 7 12:11:33 2020 +0200

tdf#118418 implement scrollSubstringTo() for gtk

Define & use new accessibility scroll type compatible with IAccessible2
and extend the XAccessibleText interface to require scrollSubstringTo().

Co-authored-by: Martin Pieuchot 
Change-Id: Id3b2e8616892d7dcbfb41a14b72a8a457fd1dbf6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89851
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/accessibility/inc/extended/AccessibleBrowseBoxTableCell.hxx 
b/accessibility/inc/extended/AccessibleBrowseBoxTableCell.hxx
index 6823fa67eb7a..89569914c516 100644
--- a/accessibility/inc/extended/AccessibleBrowseBoxTableCell.hxx
+++ b/accessibility/inc/extended/AccessibleBrowseBoxTableCell.hxx
@@ -21,6 +21,7 @@
 #include 
 #include 
 #include 
+#include 
 
 namespace accessibility
 {
@@ -114,6 +115,7 @@ namespace accessibility
 virtual css::accessibility::TextSegment SAL_CALL getTextBeforeIndex( 
sal_Int32 nIndex, sal_Int16 aTextType ) override;
 virtual css::accessibility::TextSegment SAL_CALL getTextBehindIndex( 
sal_Int32 nIndex, sal_Int16 aTextType ) override;
 virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 
nEndIndex ) override;
+virtual sal_Bool SAL_CALL scrollSubstringTo( sal_Int32 nStartIndex, 
sal_Int32 nEndIndex, css::accessibility::AccessibleScrollType aScrollType) 
override;
 };
 }
 
diff --git a/accessibility/inc/extended/AccessibleGridControlTableCell.hxx