Re: ESC meeting minutes: 2023-12-21

2023-12-21 Thread Colomban Wendling

Le 21/12/2023 à 16:27, Stephan Bergmann a écrit :

[…]
  14 CppunitTest_test_a11y    gerrit_windows

That doesn't look too good…

From a couple failing jobs, I see a weird error that barely seem related:


[_RUN_] SelfTestIncorrectDialog::TestBody
warn:sfx.appl:16560:16772:sfx2/source/appl/app.cxx:147: No DDE-Service 
possible. Error: 16399
warn:unotools.misc:16560:16772:unotools/source/misc/mediadescriptor.cxx:372: url: 
'private:factory/swriter' com.sun.star.ucb.ContentCreationException message: "No 
Content Provider available for URL: private:factory/swriter at 
C:/cygwin/home/tdf/lode/jenkins/workspace/gerrit_windows/ucbhelper/source/client/content.cxx:205"
 eError: (com.sun.star.ucb.ContentCreationError) NO_CONTENT_PROVIDER


Any idea of what that can be?

Or has this been solved already somehow?  Though, it seems flaky, at 
least from https://gerrit.libreoffice.org/c/core/+/160450 in which it 
looks like a mere re-trigger "fixed" it.


Regards,
Colomban


Re: New tests: GTK3 platform accessibility

2023-09-14 Thread Colomban Wendling

Le 13/09/2023 à 22:56, Michael Weghorn a écrit :

On 2023-09-12 10:49, Colomban Wendling wrote:

All that is a bit confusing to me, but let me try ton understand:
- On a system using dbus-broker, when logged in under GNOME, test fails?
- On *the same system*, but logging-in through SSH works!??


Yes, that's what I've observed in a Fedora 38 VM.

That's worrying, as it suggests the running environment has too much 
influence on the test run, which is not good.


However, IIUC you suggest it might be a dbus/dbus-borken conflict 
somehow?


That's what it looked like to me during first analysis.

What might be happening is that at-spi-bus-launcher detects a systemd 
environment that makes it think running dbus-broker should work, but 
something about the systemd/D-Bus environment in the virtual X session 
provided by xfvb-run and dbus-launch doesn't match what's 
expected/required.


[…]


Ah, makes some sense indeed.  I guess if at-spi itself is not using the 
same DBus implementation as the app is it might not work indeed…  and 
IIUC here the ap will be using the dbus-launch one, which IIUC is gonna 
be dbus-daemon, and at-spi2 is using dbus-broker.


I am not knowledgeable about that, but maybe we could run in a separate 
cgroup to escape this?


Or maybe we could have a dbus-broker compatibility, either as you 
mention below (that I don't fully follow without diving deeper), or 
simply emulating the bits we need like --exit-with-session which should 
not be that hard to mimic (basically watch the Xvfb session lifetime, 
e.g. with `xprop -root -spy` and terminate our own dbus-broker when it 
exits).


I'm on vacation this week, but could give this another try in my Fedora 
VM sometime afterwards. Or, if you're also attending LibreOffice 
conference next week in person, we could also take a look at it together 
then for example.


I'll be there, we can indeed try and pull some hairs together on this 
then :)


Re: New tests: GTK3 platform accessibility

2023-09-12 Thread Colomban Wendling

Le 29/08/2023 à 14:36, Michael Weghorn a écrit :

[…]

This shows that there is an attempt to start a dbus session using 
dbus-broker-launch. This seems surprising at first, since 
dbus-run-session (and dbus-launch) use dbus-daemon in $PATH by default.


But then, there's an at-spi-bus-launcher involved for running a separate 
bus for AT-SPI/a11y, and the README [1] mentions that that is a separate 
instance of dbus-daemon or dbus-broker. From a first look into the 
source code [2], it looks like it prefers dbus-broker-launch when built 
with the corresponding option and running under systemd, but that 
apparently fails at that stage.


Sorry for the delay, I have been on vacation with minimal to no Internet.

All that is a bit confusing to me, but let me try ton understand:
- On a system using dbus-broker, when logged in under GNOME, test fails?
- On *the same system*, but logging-in through SSH works!??

That's worrying, as it suggests the running environment has too much 
influence on the test run, which is not good.


However, IIUC you suggest it might be a dbus/dbus-borken conflict 
somehow?  What if we try `dbus-broker-launch` (assuming it's compatible) 
instead of `dbus-launch` if the former is available?  Would that help?


I don't have any system to test this with yet, and it might take some 
time before I can have a F38 VM up and running with a LO build setup, 
but I'll try and see to this soon if it's a concern.


Regards,
Colomban


Re: [Libreoffice-qa] Libreoffice-qa Digest, Vol 146, Issue 1

2023-08-08 Thread Colomban Wendling

Hello Sophie,

Le 04/08/2023 à 10:34, Sophie Sipasseuth a écrit :

Currently, I work with Ilmari.
I have only a foundation level in tests.
And my computer has Windows 10.
So, if a total beginner in accessibility tests could help you with the 
accessibility of LibreOffice, I am interested in this task.


Sure, there are many tests that don't require a lot of expertise to get 
started, yet you'll get some along the way :)


You can try to write a test for an actual known issue, which would 
validate a fix, but you can also add tests for working parts that seem 
relevant (e.g. that have already been fixed recently, or just that are 
not tested yet -- which is a lot of ground to cover ATM), so it won't be 
hard to find something to do I believe :)



In August, I am on vacation, so my work is random.
But in September, I would like to increase my participation to work more 
on LibreOffice gradually.

Before my vacation, I worked 10 hours per week on LibreOffice.
I would like to try to work 15 to 20 hours per week.

So I think I could work on tests with Ilmari and with you.


That's great!  Sure, I'll help as much as I can :)  I'll also be off in 
August, but back around the second week of September, so that aligns well :)
Note that I don't work on LO only, and can often only allocate a subset 
of my time to it, but I'll be there to help and answer questions 
nonetheless, don't hesitate.


Regards,
Colomban



Best Regards,

Sophie Sipasseuth

On Wed, 2 Aug 2023 at 14:00, 
<mailto:libreoffice-qa-requ...@lists.freedesktop.org>> wrote:


Send Libreoffice-qa mailing list submissions to
libreoffice-qa@lists.freedesktop.org
<mailto:libreoffice-qa@lists.freedesktop.org>

To subscribe or unsubscribe via the World Wide Web, visit
https://lists.freedesktop.org/mailman/listinfo/libreoffice-qa
<https://lists.freedesktop.org/mailman/listinfo/libreoffice-qa>
or, via email, send a message with subject or body 'help' to
libreoffice-qa-requ...@lists.freedesktop.org
<mailto:libreoffice-qa-requ...@lists.freedesktop.org>

You can reach the person managing the list at
libreoffice-qa-ow...@lists.freedesktop.org
<mailto:libreoffice-qa-ow...@lists.freedesktop.org>

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Libreoffice-qa digest..."


Today's Topics:

    1. New tests: GTK3 platform accessibility (Colomban Wendling)


--

Message: 1
Date: Tue, 1 Aug 2023 19:30:05 +0200
From: Colomban Wendling mailto:cwendl...@hypra.fr>>
To: libreoffice-qa@lists.freedesktop.org
<mailto:libreoffice-qa@lists.freedesktop.org>,
libreoff...@lists.freedesktop.org
<mailto:libreoff...@lists.freedesktop.org>
Subject: [Libreoffice-qa] New tests: GTK3 platform accessibility
Message-ID: <05958ff6-cd12-7738-aa0e-8c51f877b...@hypra.fr
<mailto:05958ff6-cd12-7738-aa0e-8c51f877b...@hypra.fr>>
Content-Type: text/plain; charset=UTF-8; format=flowed

Hello everyone,

Platform accessibility (a11y) conformance tests for the GTK3 VCL [1]
have been merged a couple days ago.  This is a set of tests validating
that the a11y exposed to the platform on Linux using the GTK3 VCL is
coherent with the internal representation in LO.  This can catch (and
already had caught) issues in the VCL layer not correctly transmitting
data over -- and even more [2].  You can read a bit more on the
technical side of things on the wiki page [3].

These tests are enabled by default if all dependencies are available.
That is a working Xvfb [4], dbus-launch, and the AT-SPI2 library [5]
which is used to communicate with the platform accessibility
daemon.  It
is also possible to either enable or disable them forcefully, using
--enable-atspi-test and --disable-atspi-tests respectively.

Linux CIs are running these tests, but anybody willing is encouraged to
enable those locally and report any issue (don't hesitate to CC me).

Anybody interested is also more than welcome to extend coverage of
these
tests!  At the moment only a subset of the a11y APIs are checked,
yet it
should not be very hard to add more.  If you're interested, give [3] a
look and again, don't hesitate to get in touch with me.
If you're interested in making this work with another VCL (Qt6, GTK4,
etc.) it would also be great, but probably require a tad more work.  It
would however be very interesting, and would add coverage for another
substantial module :)

You're also more than welcome to build on the concept for other
platforms (e.g. Window or macos).  I expect those to look fairly
similar, but require a wholly different platform wrapping layer
(obviously they'd use something other than libatspi, and they might

[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


Re: New tests: GTK3 platform accessibility

2023-08-03 Thread Colomban Wendling

Le 03/08/2023 à 16:51, Stephan Bergmann a écrit :

On 8/3/23 16:37, Colomban Wendling wrote:
Do you have an error rate value?  So I know how many successful CI 
runs I need to suggest it did indeed improve something :)


Sorry, I at least cannot provide any useful numbers here.  I've noticed 
it both occasionally with the Jenkins builds of Gerrit patches of mine, 
and when browsing the  mailing 
list (see <https://listarchives.libreoffice.org/global/libreoffice-ci/>, 
where most of the "Tinderbox on Master for Linux-DbgUtil" reported in 
the last few days are due to this issue).


OK… that's already quite a lot.  As CI passes on that changes (well, the 
relevant ones passed, the pending ones are irrelevant for this change), 
what about merging it and seeing if that number goes down?


Re: New tests: GTK3 platform accessibility

2023-08-03 Thread Colomban Wendling

Le 03/08/2023 à 10:01, Stephan Bergmann a écrit :

On 8/1/23 19:30, Colomban Wendling wrote:
Linux CIs are running these tests, but anybody willing is encouraged 
to enable those locally and report any issue (don't hesitate to CC me).


That CppunitTest_vcl_gtk3_a11y appears to be a frequent cause of failure 
now on Jenkins, with the typically failure log containing some


[...]


Hum… I never hit that locally, but that looks like the CI machine could 
be overloaded somewhat, and just be very slow (normally the timeout 
should be 800+ms).  Anyway, I created 
https://gerrit.libreoffice.org/c/core/+/155310 which is a tentative 
workaround (increment the timeout), we can see if it still happen with this.


Do you have an error rate value?  So I know how many successful CI runs 
I need to suggest it did indeed improve something :)


Regards,
Colomban


found run attribute: MMToPixelRatio=
  matching atspi attribute is: mm-to-pixel-ratio=1.1
unknown:0:Test1::TestBody
An uncaught exception of type com.sun.star.uno.RuntimeException
- timeout from dbind at 
/home/tdf/lode/jenkins/workspace/lo_tb_master_linux_dbg/vcl/qa/cppunit/a11y/atspi2/atspiwrapper.hxx:302


warn:sw.core:19780:19780:sw/source/core/attr/calbck.cxx:196: a 
16SwTextFormatColl client added as listener to a 16SwTextFormatColl 
during client iteration.
warn:sw.core:19780:19780:sw/source/core/attr/calbck.cxx:196: a 
16SwLineNumberInfo client added as listener to a 12SwCharFormat during 
client iteration.

Test1::TestBody finished in: 153317ms
##Failure Location unknown## : Error
Test name: Test1::TestBody
An uncaught exception of type com.sun.star.uno.RuntimeException
- timeout from dbind at 
/home/tdf/lode/jenkins/workspace/lo_tb_master_linux_dbg/vcl/qa/cppunit/a11y/atspi2/atspiwrapper.hxx:302


Failures !!!
Run: 1   Failure total: 1   Failures: 0   Errors: 1

(cppunittester:19780): GLib-GObject-CRITICAL **: 20:29:18.296: 
g_object_unref: assertion 'G_IS_OBJECT (object)' failed


(cppunittester:19780): GLib-GObject-CRITICAL **: 20:29:18.296: 
g_object_unref: assertion 'G_IS_OBJECT (object)' failed


(cppunittester:19780): GLib-GObject-CRITICAL **: 20:29:18.296: 
g_object_unref: assertion 'G_IS_OBJECT (object)' failed

[...]

(<https://ci.libreoffice.org//job/lo_tb_master_linux_dbg/44396/>)





[Libreoffice-qa] New tests: GTK3 platform accessibility

2023-08-01 Thread Colomban Wendling

Hello everyone,

Platform accessibility (a11y) conformance tests for the GTK3 VCL [1] 
have been merged a couple days ago.  This is a set of tests validating 
that the a11y exposed to the platform on Linux using the GTK3 VCL is 
coherent with the internal representation in LO.  This can catch (and 
already had caught) issues in the VCL layer not correctly transmitting 
data over -- and even more [2].  You can read a bit more on the 
technical side of things on the wiki page [3].


These tests are enabled by default if all dependencies are available. 
That is a working Xvfb [4], dbus-launch, and the AT-SPI2 library [5] 
which is used to communicate with the platform accessibility daemon.  It 
is also possible to either enable or disable them forcefully, using 
--enable-atspi-test and --disable-atspi-tests respectively.


Linux CIs are running these tests, but anybody willing is encouraged to 
enable those locally and report any issue (don't hesitate to CC me).


Anybody interested is also more than welcome to extend coverage of these 
tests!  At the moment only a subset of the a11y APIs are checked, yet it 
should not be very hard to add more.  If you're interested, give [3] a 
look and again, don't hesitate to get in touch with me.
If you're interested in making this work with another VCL (Qt6, GTK4, 
etc.) it would also be great, but probably require a tad more work.  It 
would however be very interesting, and would add coverage for another 
substantial module :)


You're also more than welcome to build on the concept for other 
platforms (e.g. Window or macos).  I expect those to look fairly 
similar, but require a wholly different platform wrapping layer 
(obviously they'd use something other than libatspi, and they might need 
to adapt to differences in the platform's expectations, although they 
are actually fairly similar).


Happy testing!
Regards,
Colomban

PS: huge thanks to everyone that helped me getting this finally done, 
including but not limited to testing, fixing blocker bugs, adjust CI 
environment, and everything else :)


[1] https://gerrit.libreoffice.org/c/core/+/153069
[2] e.g. https://bugs.documentfoundation.org/show_bug.cgi?id=155625
[3] 
https://wiki.documentfoundation.org/Development/Accessibility_Unit_Tests#Platform_accessibility_tests

[4] https://en.wikipedia.org/wiki/Xvfb
[5] https://docs.gtk.org/atspi2/index.html


New tests: GTK3 platform accessibility

2023-08-01 Thread Colomban Wendling

Hello everyone,

Platform accessibility (a11y) conformance tests for the GTK3 VCL [1] 
have been merged a couple days ago.  This is a set of tests validating 
that the a11y exposed to the platform on Linux using the GTK3 VCL is 
coherent with the internal representation in LO.  This can catch (and 
already had caught) issues in the VCL layer not correctly transmitting 
data over -- and even more [2].  You can read a bit more on the 
technical side of things on the wiki page [3].


These tests are enabled by default if all dependencies are available. 
That is a working Xvfb [4], dbus-launch, and the AT-SPI2 library [5] 
which is used to communicate with the platform accessibility daemon.  It 
is also possible to either enable or disable them forcefully, using 
--enable-atspi-test and --disable-atspi-tests respectively.


Linux CIs are running these tests, but anybody willing is encouraged to 
enable those locally and report any issue (don't hesitate to CC me).


Anybody interested is also more than welcome to extend coverage of these 
tests!  At the moment only a subset of the a11y APIs are checked, yet it 
should not be very hard to add more.  If you're interested, give [3] a 
look and again, don't hesitate to get in touch with me.
If you're interested in making this work with another VCL (Qt6, GTK4, 
etc.) it would also be great, but probably require a tad more work.  It 
would however be very interesting, and would add coverage for another 
substantial module :)


You're also more than welcome to build on the concept for other 
platforms (e.g. Window or macos).  I expect those to look fairly 
similar, but require a wholly different platform wrapping layer 
(obviously they'd use something other than libatspi, and they might need 
to adapt to differences in the platform's expectations, although they 
are actually fairly similar).


Happy testing!
Regards,
Colomban

PS: huge thanks to everyone that helped me getting this finally done, 
including but not limited to testing, fixing blocker bugs, adjust CI 
environment, and everything else :)


[1] https://gerrit.libreoffice.org/c/core/+/153069
[2] e.g. https://bugs.documentfoundation.org/show_bug.cgi?id=155625
[3] 
https://wiki.documentfoundation.org/Development/Accessibility_Unit_Tests#Platform_accessibility_tests

[4] https://en.wikipedia.org/wiki/Xvfb
[5] https://docs.gtk.org/atspi2/index.html


[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_

[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

Re: Unsafe directory

2023-07-13 Thread Colomban Wendling

Hello Régis,

Le 13/07/2023 à 09:00, Regis Perdreau a écrit :

I'm trying to build master under Windows 11/cygwin.
Build failed with the message "autogen.sh: unsafe home directory: 
`/home/Régis Perdreau"


I'm not knowledgeable about Windows/CygWin, but I have two wild guesses:
- the directory name contains non-ASCII characters ("é")
- the directory name contains a space

If it's anything like gnupg, it's likely the space (see the hardly 
readable check in https://github.com/gpg/gnupg/blob/master/autogen.sh#L127)


You probably can work around this by either actually changing CygWin's 
homedir, or just adjust $HOME to point to some directory without those 
characters (e.g. HOME=/tmp/homedir, or anything less temporary yet still 
without spaces).


HTH
- Colomban


Re: Welcome Michael Weghorn, new Developer at TDF

2023-07-04 Thread Colomban Wendling

Le 04/07/2023 à 11:36, Mike Saunders a écrit :

Hi everyone,

At The Document Foundation, we have a new Developer, initially focusing 
on accessibility improvements


Hey, it's great to hear you'll be focusing even more on this, although 
you were already very helpful in these area!


I'm thrilled :)

Cheers,
Colomban


[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[nIn

[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(""),
 collec

[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::u16strin

[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::SwAccessibleTest

[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
+   

[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, 
th

[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
+ *
+ * @warn

[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 &

[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

Help on interacting with dialogs in unit tests on Windows and MacOS

2022-11-14 Thread Colomban Wendling

Hello everyone!

I'm still working on my accessibility cppunit tests framework.

Right now I'm trying to submit a set of changes to be able to have tests 
interact with dialogs [1].  It was actually slightly easier than I 
anticipated to get that working on my local linux/gcc build -- although 
I does require some non-trivial trickery [2].  I had to tweak it a bit 
for the clang_dbgutil job on Jenkins, because apparently there I can't 
throw from a event handler -- but easily enough after some fiddling [3] 
I was able to delay the final throwing to a user call, actually making 
the API a bit nicer in the process.  So Linux is happy, yay!


Unfortunately, I'm not getting so lucky on Windows and MacOS, and my 
debug fiddling [4] don't seem to get me anywhere, so I'm asking for some 
help if anybody has anything to contribute :)  What I see is that:


- On MacOS, I don't get any WindowActivate events on the dialogs (and 
focus seems (?) not to be there)
- On Windows, I can't seem to close some (?) dialogs, no matter how hard 
I try.


This is funnily kind of opposite issues, but irony aside that doesn't 
really help me :)  You can see a bit more in the Jenkins runs for each.


Thanks for reading through, and in advance for any help!
Colomban


[1] https://gerrit.libreoffice.org/c/core/+/142258 (and rest of the 
relation chain)

[2] see test::AccessibleTestBase::awaitDialog() in the above
[3] see PS history on the above
[4] https://gerrit.libreoffice.org/c/core/+/142494


Interacting with AT-SPI2 in CI environment

2022-11-03 Thread Colomban Wendling

Hello everyone,

As part of my effort to improve accessibility test infrastructure and 
coverage [1], I'll have to work on covering the platform layer.


The chosen approach, after discussing with Florian Effenberger (back in 
late 2021 I think), is communicating with a LO process through AT-SPI2 
on Linux.  This is because it's the true outer layer, and that GTK4 does 
not use ATK anymore, so tests relying on simply checking the ATK 
implementations in the GTK3 VCL would not be future-proof, and don't 
seem sensible to invest on nowadays.  Using AT-SPI2 directly would also 
allow testing the Qt VCLs.


This means that to perform tests I'll have to run LO in the CI 
environment in a way where it can use the gtk3/4 VCL, and have a working 
AT-SPI2 bus so they can communicate.  The tests themselves would then 
simply use the exposed AT-SPI2 interfaces and control they behave as 
expected.


We at Hypra already have done similar setups (even with LO itself) using 
xvfb-run (or xvnc, but that's not very useful in CI) and dbus-launch, 
and then interacting through AT-SPI2 using Python and the excellent 
dogtail module [2].


My question here is: what would be acceptable in CIs, and how would it 
work to add such CI dependencies?  I'd rather not rebuild xvfb & al for 
each CI run, as it seems heavy and not very sensible: it's a fairly 
standard piece of software and I wouldn't need any specific version of it.


A follow-up question would be whether you have any pointers in how to 
integrate this kind of things to the build?  I didn't start 
investigating because I'd like to make sure I'm not pursuing the wrong 
path, but anything that could save me reading a hundred gbuild files 
would be much appreciated :)


Thanks in advance,
Colomban

[1] 
https://blog.documentfoundation.org/blog/2021/10/13/tender-to-implement-c-accessibility-tests-202110-01/

[2] https://gitlab.com/dogtail/dogtail


[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:documentfoundati

[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 in

[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

Review for subsequent C++ accessibility test infrastructure

2022-07-26 Thread Colomban Wendling

Hello everyone!

I'm again looking for review on a few changests related to CppUnit a11y 
tests:

- https://gerrit.libreoffice.org/c/core/+/137307
- https://gerrit.libreoffice.org/c/core/+/137335
- https://gerrit.libreoffice.org/c/core/+/137336
- https://gerrit.libreoffice.org/c/core/+/137337

All changests depend on the first one that moves things around for use 
more widely, and the first and last are the bigger ones (third is trivial).


I have a bizarre test failure on Windows with the last one, and I'm not 
sure what to do about it, see 
https://gerrit.libreoffice.org/c/core/+/137337/comments/7f98e83b_4de322ee 
-- any advice would be much appreciated.


I'm not sure whether I should add reviewers myself based on the ones 
from the previous submissions in that area or if that'd be a tad 
inconsiderate.


Thanks in advance,
Colomban


[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

Re: Accessing main window menus during C++ test run

2022-07-12 Thread Colomban Wendling

Hi Miklos,

Le 01/07/2022 à 15:13, Miklos Vajna a écrit :

[…]

One think you could try (to unblock yourself) is to introduce one more
"default config" file: similar to what junit and cppunit tests get, but
this one for a11y testing. And then your cppunit tests could opt in to
use the a11y config, not the default cppunit one, with a single line in
the CppunitTest_foo.mk file.

I believe that would allow you to bypass the problematic config, without
having to fix all existing tests to work with your preferred config. And
then you don't have to undo anything, as your config would be free from
the problematic settings.


Yeah I have been working with a locally-modified version of 
modifications.xcu in the meantime and it allowed me to move forward 
(with no other significant bumps so far).


So with your suggestion in mind, I put together a patch 
(https://gerrit.libreoffice.org/c/core/+/136997) that actually splits 
off the part that is problematic for me, so to avoid to copy over the 
pieces the rest (that, as mentioned, seem relevant for my tests as 
well).  I hope this approach is acceptable; otherwise I'll just prepare 
a copy that only includes the part I want, regardless of redundancy.


Thanks for all the help :)
Colomban


Re: Accessing main window menus during C++ test run

2022-06-30 Thread Colomban Wendling

Hi Miklos, sorry for the delay.

Le 24/06/2022 à 12:21, Miklos Vajna a écrit :

Hi Colomban,

On Tue, Jun 21, 2022 at 04:04:34PM +0200, Colomban Wendling 
 wrote:

I'm not sure what's the use of these UIConfig overrides in the first place
as I can't seem to track the history down to something useful, but anyway:
how would I de-override that for a specific test?


Some pointers:

- this UIConfig disabling was added in commit
   d371b20db44b5fcbb22030511c65563010fdd010 without much reasoning, I
   assume some test would fail if you revert it


Yeah I found that one already, but as you mention there's not much of a 
rationale I could find there.



- 8e68391fc99b34702d76526e6b3ab4720ac017e4 gives some hints which tests
   would fail without that


Interesting -- though it's not really reflecting what I'm seeing (see 
below).



But still, it would be good to test if there is any breakage if you
remove that today.


I just tried commenting that part out of modifications.xcu, and I get 
some extra failures (make check, and then exercised the specific failures):


- CppunitTest_sw_uiwriter4::testTableRemoveHasTextChangesOnly()
: crash

- CppunitTest_sw_ooxmlexport2::testCustomProperties()
: XPath assertion failure.  Consistently fails for me with this change 
and doesn't without, which seem quite odd to me, but I'm not sure what 
that test does exactly -- doesn't seem very UI-related though.


I get failures with and without it, not sure why:

- UITest_sw_styleInspector::test_metadata()
: identical assertion failure

- CppunitTest_sw_layoutwriter::testAbi11870()
: identical crash

- CppunitTest_sw_layoutwriter2
: similar but not identical crash (backtrace is partially different).  I 
ran it a couple times in both states, and I get consistently different 
results, so there's some kind of an effect.


I'm using 964eb2f1dd24d68bd1d6caf8d0f349305a2642ec which is no latest, 
but re-running a full build+check is not so fast on my end so I'll have 
to do that a bit later.  Anyhow, it probably shouldn't make much 
difference as to what tests are affected.



Other than that, it's probably possible to make c++
calls that would undo this in the configmgr for a11y tests, and then you
would get what you need, without changing the default.


That's interesting, would you have pointers for me to try that?  I tried 
to give it a look, but I couldn't seem to find a example to work with 
(configmgr/qa/unit/test.cxx seemed interesting but maybe too complex and 
not reflecting the expected API usage?), so I could really do with some 
guidance :)


Thanks,
Colomban


Re: Accessing main window menus during C++ test run

2022-06-21 Thread Colomban Wendling

Hi Miklos,

Le 17/06/2022 à 08:28, Miklos Vajna a écrit :

[…]

Hmm, so far you tried out of process + SAL_USE_VCLPLUGIN=svp and
in-process + --headless.

Try experimenting with the in-process + SAL_USE_VCLPLUGIN=svp
combination, perhaps that would give you what you need.


OK I played with this (after digging around on how the test was actually 
launched), and --headless actually has nothing to do with my issue: the 
reason I don't see menus is because of 
test/user-template/registry/modifications.xcd from 
gb_CppunitTest_use_configuration, which overrides all UI config, and 
thus menu and toolbar contents, and places nothing in them.


I'm not sure what's the use of these UIConfig overrides in the first 
place as I can't seem to track the history down to something useful, but 
anyway: how would I de-override that for a specific test?


I figured I could use gb_CppunitTest_use_instdir_configuration instead 
of gb_CppunitTest_use_configuration so that drops that part of it, but 
the unittest overrides also seem to contain useful stuff like locale, 
font set, file locking options, etc. that I probably should be using.


In any case, thanks a lot for the suggestions, that lead me to playing 
with the right bit :)



Be aware that in case of in-process tests your test code is running on
the main thread, so if you depend on any idles, you need to manually
spin the main loop with Scheduler::ProcessEventsToIdle() (vs out of
process tests, where this is done for you automatically).


Yeah thanks, I already am doing some of this, but I indeed might need to 
be careful about it, and possibly use event handlers in some places.


Regards,
Colomban


Re: Accessing main window menus during C++ test run

2022-06-16 Thread Colomban Wendling

Hello Miklos, thanks for your message.

Le 16/06/2022 à 12:13, Miklos Vajna a écrit :

I think the root of the difference is that UITests are out of process:
they start a soffice.bin process (with SAL_USE_VCLPLUGIN=svp, so it's
not visible) and then remote-control it.

[…]

Perhaps you can look at CppunitTest_smoketest, which seems to be a
cppunit test that actually spawns a soffice process?


Bingo, hooking in there do give me the accessible tree I'm hoping for, 
as with the Python UITest, thanks.


Unfortunately, I'm supposed to write in-process tests [1], so that 
wouldn't really be an option.  If really it's the only way I'd bring the 
discussion and see if that requirement can be lifted, but then maybe I 
should just switch to Python directly as it's probably more 
beginner-friendly as it's one of the aims of the work I'm on.  Anyway, 
for the moment that's not the option I'm hoping for :)



Most of our cppunit tests run in-process, using --headless, so if there
would be any dialogs popping up, we would instantly cancel them.


OK, that's an interesting info.  However, I'm not anywhere close to 
dealing with dialogs or even popups yet, all I'm after is the accessible 
objects representing the menu items.  This shouldn't require anything to 
actually get displayed or pop up.
I guess however that maybe in headless mode the UI is in a degraded 
state; would it be possible to trigger loading of the missing bits?  Any 
idea where to look?


Regards,
Colomban

[1] 
https://blog.documentfoundation.org/blog/2021/10/13/tender-to-implement-c-accessibility-tests-202110-01/


Re: Accessing main window menus during C++ test run

2022-06-16 Thread Colomban Wendling

Hello,

Le 26/05/2022 à 10:11, Xisco Fauli a écrit :
The UItest framework [1] uses UNO commands to interact with the UI. 
However, Markus also evaluated the accessibility approach when he 
implemented it. You can read more in 
https://mmohrhard.wordpress.com/2016/09/07/ui-testing-in-libreoffice/. I 
hope it helps.


While as mentioned previously the article didn't really help, I just 
went ahead and tried to exercise the UITest setup for accessing the 
accessibility tree.


And a little unexpectedly, I there could access all UI elements through 
the accessibility interfaces just as I was trying to in C++.  Does 
anybody know why this works there, and not in my CppUnit tests? 
Anything I should set up differently, await, or else?


Attached is a small UITest that shows there is everything, and 
especially all menu items.  Now my goal is to get comparable results in 
CppUnit.


Thanks in advance,
Colomban# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
#
# 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/.
#

from uitest.framework import UITestCase

from com.sun.star.accessibility import AccessibleRole


def getRoleName(role):
''' Map an AccessibleRole value to its name '''
for name in dir(AccessibleRole):
if getattr(AccessibleRole, name) == role:
return name
return None

class TestAccessibleTree(UITestCase):
def testTree(self):
with self.ui_test.create_doc_in_start_center("writer") as component:
w = component.getCurrentController().getFrame().getContainerWindow()
w.toFront()

def rec(o, d=0):
print("% *s%s" % (d * 2, '', getRoleName(o.getAccessibleRole(
for i in range(0, o.getAccessibleChildCount()):
c = o.getAccessibleChild(i)
rec(c.getAccessibleContext(), d + 1)

ctx = w.getAccessibleContext()

rec(ctx)
# check the menu (ctx[0]) has children
self.assertGreaterEqual(ctx.getAccessibleChild(0).getAccessibleContext().getAccessibleChildCount(), 1)

# vim: set shiftwidth=4 softtabstop=4 expandtab:


Re: Review for initial a11y C++ test conversion

2022-06-08 Thread Colomban Wendling

Le 08/06/2022 à 14:54, Caolán McNamara a écrit :

On Thu, 2022-05-19 at 18:26 +0200, Colomban Wendling wrote:

Hello everyone,

I'm looking for someone to review
https://gerrit.libreoffice.org/c/core/+/133844.


merged now


Thanks to everyone giving advice and reviewing, much appreciated.

I also just published an initial version of potentially useful info I 
gathered during the process for this first step at 
https://wiki.documentfoundation.org/Development/Accessibility_Unit_Tests, in 
the hope it would help anyone else interested in porting similar tests 
to CppUnit -- or writing new ones.


This will all be expanded as I go along and work on subsequent a11y test 
areas.


Regards,
Colomban


[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

Re: Accessing main window menus during C++ test run

2022-05-31 Thread Colomban Wendling

Hello Xisco, thanks for your message.

Unfortunately this blog post, while instructive, is not really helpful 
as the accessibility approach is mentioned as having been discarded 
mostly because the accessibility implementation in LO was deemed not 
robust enough, so not a reliable basis for designing a new framework on top.


Unfortunately here I'm actually *trying* to exercise the accessibility 
implementation in the hope it'll help with improving it, so I cannot 
just ignore it :)


Thanks anyway, and any more knowledge would still be highly appreciated!

Regards,
Colomban

Le 26/05/2022 à 10:11, Xisco Fauli a écrit :

Hello Colomban,

The UItest framework [1] uses UNO commands to interact with the UI. 
However, Markus also evaluated the accessibility approach when he 
implemented it. You can read more in 
https://mmohrhard.wordpress.com/2016/09/07/ui-testing-in-libreoffice/. I 
hope it helps.


Cheers

[1] https://wiki.documentfoundation.org/Development/UITests

On 25/5/22 19:16, Colomban Wendling wrote:

Hello everybody,

I'm trying to interact with the UI in a CppUnit test, or more 
specifically with the accessible objects representing it, as part of 
the CppUnit accessibility unit tests project I'm working on.


I have no trouble reaching the top window or document, but most UI 
around the document seem empty, and specifically in the current area 
I'm pursuing right now: the menus.  I can get a hold of the menubar, 
but it has no children whatsoever.  Same goes for e.g. the statusbar.


I even tried hacking around VCL's Menu class to see whether it was the
accessible objects I was lacking, but no, barely any menu items are
constructed for my test runs, whereas a whole lot of them are during a 
normal run, as expected.


What I do to create my test windows don't seem too odd to me: I'm 
calling XDesktop2::loadComponentFromURL(), where the instance comes 
from 
frame::Desktop::create(test::BootstrapFixture::mxComponentContext) -- 
same goes trying to use UnoApiTest::mxDesktop::loadComponentFromURL().

My naive expectation was that I'd get a full-featured window with the
corresponding document, but apparently I only get a mock or subset of 
the actual UI.


So, is there a way to get a full-featured UI in a test, and how? Or to 
load specific parts of the UI on demand, so to have the same behavior 
a normal run would have?


Currently I'm working with Writer, but any component would be fine for 
now, and ideally I'd have a solution for all of them; but any one 
would be a good enough start :)


BTW I know I could perform actions sending UNO commands, but here I'm 
really more interested in the UI elements behavior and accessibility 
than the commands they trigger, so that's not a solution.


I'd be very glad to get any pointers that could help, thanks!

Regards,
Colomban Wendling






Re: ESC meeting minutes: 2022-05-26

2022-05-31 Thread Colomban Wendling

Le 31/05/2022 à 01:57, Michael Weghorn a écrit :

On 30/05/2022 11.08, Caolán McNamara wrote:

For a11y I don't know what is seen as the major problems, is there some
fundamentally missing pieces (like in the past not having direct
windows IAccessible2 support and needing a java access bridge). Or are
the fundamentals ok and its a matter of a general malaise. Is the
general widgetry ok, but particular components have poor document level
a11y. Or is there an endless amount of fairly easy entry level problems
that there isn't enough people to take care of.


It's a bit of both I'd think.

The main issues I can think of from the top of my head are:

* Only on-screen elements of the document are exposed to ATs.  This is 
on purpose probably for performance (not sure if we have any numbers to 
base it on?) so elements are lazy-loaded and destroyed, but it has 
non-trivial impact on various AT features.  There are some things 
supposed to help mitigate the issues (like flows-from and flows-to 
relationships), but they present their own sets of issues (like some 
elements from there not having proper parent/child relationships, etc.).


* Some parts of the document are not accessible through the keyboard, 
like e.g. embedded objects, images and such, which makes it nearly 
impossible to AT users to interact with them.


* Some relations are missing, like for annotations and footnotes.  Also, 
there is a lack of semantics for change tracking leading to messy output 
from ATs.  These could be seen as smaller and simpler issues, as it 
likely only requires plugging in the correct cables.


I don't have a comprehensive overview either, but I think most of those 
have a proper bug for them.


I'm CCing Joanmarie which might have a lot more insight here.


[…]

IIUC, the gtk4 VCL plugin currently doesn't have an a11y implementation 
yet, and there has been a change of how a11y is handled at least within 
the Gtk library itself. [1]


Yeah, for GTK4 there will likely be a need to a whole new a11y VCL 
layer.  This might not be so hard to get started getting inspiration 
from GTK4 itself, but a lot will have to be ironed out.  Currently GTK4 
itself still has a fair bit of rough edges because of this change, even 
if the end goal is to make things easier and more modern.


Accessing main window menus during C++ test run

2022-05-25 Thread Colomban Wendling

Hello everybody,

I'm trying to interact with the UI in a CppUnit test, or more 
specifically with the accessible objects representing it, as part of the 
CppUnit accessibility unit tests project I'm working on.


I have no trouble reaching the top window or document, but most UI 
around the document seem empty, and specifically in the current area I'm 
pursuing right now: the menus.  I can get a hold of the menubar, but it 
has no children whatsoever.  Same goes for e.g. the statusbar.


I even tried hacking around VCL's Menu class to see whether it was the
accessible objects I was lacking, but no, barely any menu items are
constructed for my test runs, whereas a whole lot of them are during a 
normal run, as expected.


What I do to create my test windows don't seem too odd to me: I'm 
calling XDesktop2::loadComponentFromURL(), where the instance comes from 
frame::Desktop::create(test::BootstrapFixture::mxComponentContext) -- 
same goes trying to use UnoApiTest::mxDesktop::loadComponentFromURL().

My naive expectation was that I'd get a full-featured window with the
corresponding document, but apparently I only get a mock or subset of 
the actual UI.


So, is there a way to get a full-featured UI in a test, and how?  Or to 
load specific parts of the UI on demand, so to have the same behavior a 
normal run would have?


Currently I'm working with Writer, but any component would be fine for 
now, and ideally I'd have a solution for all of them; but any one would 
be a good enough start :)


BTW I know I could perform actions sending UNO commands, but here I'm 
really more interested in the UI elements behavior and accessibility 
than the commands they trigger, so that's not a solution.


I'd be very glad to get any pointers that could help, thanks!

Regards,
Colomban Wendling


Review for initial a11y C++ test conversion

2022-05-23 Thread Colomban Wendling
Hello everyone,

I'm looking for someone to review
https://gerrit.libreoffice.org/c/core/+/133844.

I'm working on improving the C++ accessibility tests and the
framework/helpers around them to both ease converting Java tests, and
writing new ones easily, as per the related tender #202110-01 [1].
The first step submitted here merely translates an existing Java test to
C++ to get things started, and get directions right.  There will be
documentation on the process, but I for the moment held back on
publishing it e.g. on the wiki before I know whether I'm roughly on the
right track or not; but I could publish it tentatively as well if requested.

To my knowledge, nobody is yet dedicated to reviewing this work, or work
in this area in general, so I'm looking for somebody willing to jump in
anyhow and give this a look :)

Thanks in advance!
Colomban

[1]
https://blog.documentfoundation.org/blog/2021/10/13/tender-to-implement-c-accessibility-tests-202110-01/


[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(


Re: Building debian package without version in the name

2022-03-08 Thread Colomban Wendling
Hi,

Le 21/02/2022 à 15:29, Marco Marinello a écrit :
> […]
> 
> Since I'd like to provide via private repos a recent version of LO, is
> there a way to build the DEB packages without the version in the name?

Regardless of the answer to your specific question (which I don't know
the answer to), I would rather recommend you to base your builds on
Debian's own packaging (especially as it'd replace current Debian
packages).  It'll be a little bit more work than just running LO's build
system to generate the packages, but it'll give your more "debianish"
packages (installing in usual locations, more correct dependencies, and
overally more polished packages).

Just a thought though.
Colomban


[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 
b/accessibility/inc/exte

Re: Replacing /.vs by *.vs in .gitignore

2018-11-15 Thread Colomban Wendling
Le 15/11/2018 à 07:43, Kévin Dlle a écrit :
> With VS2017 integration, when a module solution in opened (for example
> vcl/vcl.sln), VS2017 creates a folder vcl/.vs
> These folders are not masked by the actuel gitignore.
> We should replace the line /.vs by *.vs

If the directory is a still always named ".vs", the ignore rule should
be ".vs/" rather than "*.vs", which would ignore any ".vs"-suffixed file.
Stripping the "/" from "/.vs" is enough, but maybe adding a "/" suffix
to have ".vs/" and so only match directories would make sense.

Regards,
Colomban
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice


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

2017-03-21 Thread Colomban Wendling
 vcl/unx/gtk/salnativewidgets-gtk.cxx  |6 ++
 vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx |6 ++
 2 files changed, 12 insertions(+)

New commits:
commit 17307a10537fbd1f04c683c2f93bf880173ce3b4
Author: Colomban Wendling <cwendl...@hypra.fr>
Date:   Wed Mar 15 17:12:04 2017 +0100

tdf#105415 Use the system caret width on GTK

Change-Id: I6b7fc9d06a49613cc6fe247b44c56f36935082fa
Reviewed-on: https://gerrit.libreoffice.org/35282
Tested-by: Jenkins <c...@libreoffice.org>
Reviewed-by: Caolán McNamara <caol...@redhat.com>
Tested-by: Caolán McNamara <caol...@redhat.com>

diff --git a/vcl/unx/gtk/salnativewidgets-gtk.cxx 
b/vcl/unx/gtk/salnativewidgets-gtk.cxx
index e8e8cdd81ef7..162b48535dcb 100644
--- a/vcl/unx/gtk/salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk/salnativewidgets-gtk.cxx
@@ -4108,6 +4108,12 @@ void GtkSalGraphics::updateSettings( AllSettings& 
rSettings )
 aStyleSet.SetTitleFont( aFont );
 aStyleSet.SetFloatTitleFont( aFont );
 
+// Cursor width
+gfloat caretAspectRatio = 0.04f;
+gtk_widget_style_get( gWidgetData[m_nXScreen].gEditBoxWidget, 
"cursor-aspect-ratio", , nullptr );
+// Assume 20px tall for the ratio computation, which should give 
reasonable results
+aStyleSet.SetCursorSize( 20 * caretAspectRatio + 1 );
+
 // get cursor blink time
 gboolean blink = false;
 
diff --git a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx 
b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
index 60f2295b5a94..83bd40d9b9d1 100644
--- a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
@@ -2564,6 +2564,12 @@ void GtkSalGraphics::updateSettings( AllSettings& 
rSettings )
 // This baby is the default page/paper color
 aStyleSet.SetWindowColor( aBackFieldColor );
 
+// Cursor width
+gfloat caretAspectRatio = 0.04f;
+gtk_style_context_get_style( pCStyle, "cursor-aspect-ratio", 
, nullptr );
+// Assume 20px tall for the ratio computation, which should give 
reasonable results
+aStyleSet.SetCursorSize( 20 * caretAspectRatio + 1 );
+
 // Dark shadow color
 style_context_set_state(pCStyle, GTK_STATE_FLAG_INSENSITIVE);
 gtk_style_context_get_color(pCStyle, 
gtk_style_context_get_state(pCStyle), );
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


Colomban Wendling license statement

2017-03-17 Thread Colomban Wendling
All of my past & future contributions to LibreOffice may be licensed
under the MPLv2/LGPLv3+ dual license.
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice