office-gobmx/vcl/CppunitTest_vcl_gtk3_a11y.mk

69 lines
2.3 KiB
Makefile
Raw Normal View History

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 <m.weghorn@posteo.de>
2023-04-05 08:39:25 -05:00
# -*- 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/.
#
# hack plugging into the CppunitTest machinery yet using a xvfb-wrapper GTK3 run
$(call gb_CppunitTest_get_target,vcl_gtk3_a11y) : gb_TEST_ENV_VARS += SAL_USE_VCLPLUGIN=gtk3
# force running with the X11 Gdk backend also when running on Wayland
$(call gb_CppunitTest_get_target,vcl_gtk3_a11y) : gb_TEST_ENV_VARS += GDK_BACKEND=x11
gtk3 a11y tests: Always use dbus-daemon for the AT-SPI bus at-spi-bus-launcher launches a separate DBus instance for AT-SPI, and prefers dbus-broker over dbus-daemon when the corresponding build option was set and dbus-broker is present. However, trying to launch a bus using dbus-broker fails in the environment created for the gtk3 a11y tests, which are run using `xvfb-run` and use a separate session bus created using `dbus-launch`, (i.e. the dbus-daemon implementation). See [1] (and other messages of that email thread) and [2] for more details. Avoid the problem of mixing different DBus implementations by setting an environment variable that makes at-spi-bus-launcher use dbus-daemon instead of dbus-broker regardless of how it was configured at build time. This depends on at-spi2-core commit [3] for at-spi-bus-launcher to actually evaluate the environment variable: commit e735ed9135517532d37f7dab546786f8b4d39283 Author: Michael Weghorn <m.weghorn@posteo.de> Date: Wed Jul 31 11:27:27 2024 +0200 at-spi-bus-launcher: Introduce env var to select DBus implementation In at-spi-bus-launcher, introduce evaluation of an environment variable `ATSPI_DBUS_IMPLEMENTATION` to allow explicitly overriding the DBus implementation to use. In case of `ATSPI_DBUS_IMPLEMENTATION=dbus-daemon`, don't try to use dbus-broker, and vice versa. This can e.g. be useful for tests in environments where dbus-broker is installed and was configured as the preferred DBus implementation at at-spi2-core build time, but cannot be run in the test environment, e.g. when tests are run via xvfb-run --auto-servernum dbus-run-session [...] Thanks to Colomban Wendling for mentioning that idea in [1]. [1] https://gitlab.gnome.org/GNOME/at-spi2-core/-/issues/49#note_1854645 Related: #49 This makes make CppunitTest_vcl_gtk3_a11y pass on a current Fedora Rawhide when using a self-built at-spi2-core from its git main branch. [1] https://lists.freedesktop.org/archives/libreoffice/2023-August/090853.html [2] https://gitlab.gnome.org/GNOME/at-spi2-core/-/issues/49 [3] https://gitlab.gnome.org/GNOME/at-spi2-core/-/commit/e735ed9135517532d37f7dab546786f8b4d39283 Change-Id: Ifd84ef1f993398423ac0e0f695c1c0323adf02b7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171366 Reviewed-by: Colomban Wendling <cwendling@hypra.fr> Reviewed-by: Michael Weghorn <m.weghorn@posteo.de> Tested-by: Jenkins
2024-08-01 01:38:05 -05:00
# set env var for at-spi-bus-launcher to use dbus-daemon also if dbus-broker is default;
# the latter doesn't work in the session created by xvfb-run and dbus-launch
$(call gb_CppunitTest_get_target,vcl_gtk3_a11y) : gb_TEST_ENV_VARS += ATSPI_DBUS_IMPLEMENTATION=dbus-daemon
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 <m.weghorn@posteo.de>
2023-04-05 08:39:25 -05:00
ifeq (,$(VCL_GTK3_TESTS_NO_XVFB))
$(call gb_CppunitTest_get_target,vcl_gtk3_a11y) : \
gtk3 a11y test: Let xvfb-run auto-determine free server num As the xvfb-run manpage says, it uses a default server number of 99: > -n servernumber, --server-num=servernumber > Use servernumber as the server number (but see the -a, --auto-servernum option above). The default is 99. The gtk3 a11y tests use xvfb-run. Running the test multiple times in parallel (e.g. when doing two separate builds with tests, as happens on CI) would fall like this on Debian testing: $ make CppunitTest_vcl_gtk3_a11y make -j 12 -rs -f /home/michi/development/git/libreoffice/Makefile.gbuild CppunitTest_vcl_gtk3_a11y [CUT] vcl_gtk3_a11y xvfb-run: error: Xvfb failed to start Hint: You are currently not seeing messages from other users and the system. Users in groups 'adm', 'systemd-journal' can see all messages. Pass -q to turn off this notice. No coredumps found. Error: a unit test failed, please do one of: make CppunitTest_vcl_gtk3_a11y CPPUNITTRACE="gdb --args" # for interactive debugging on Linux make CppunitTest_vcl_gtk3_a11y VALGRIND=memcheck # for memory checking make CppunitTest_vcl_gtk3_a11y DEBUGCPPUNIT=TRUE # for exception catching You can limit the execution to just one particular test by: make CPPUNIT_TEST_NAME="testXYZ" ...above mentioned params... However, it behaves differently on Alma Linux 8, where it looks like xvfb-run seems then to reuse the existing Xfvb session, causing the tests to potentially find the LibreOffice instance from another test run, and then inspecting the wrong one, leading to failures like the one in [1]: equality assertion failed - Expected: ecclectic.fodt — LibreOfficeDev Writer - Actual : ecclectic.fodt — LibreOfficeDev Writer 24.2 [9bc2aede99017ed0338e97b21b4735919b705b47] The fact that the second instance of xvfb-run reuses the session of the firs one and finds the LibreOffice there can also be reproduced on Alma Linux 8 by just running these 2 commands in parallel: 1) start LO in xfvb-run session: $ xvfb-run dbus-launch libreoffice 2) run below Python script that lists the running applications: $ xvfb-run dbus-launch python3 /home/vagrant/atspi-list-apps.py --------start-------- [application | soffice] --------end-------- /usr/bin/xvfb-run: line 186: kill: (27078) - No such process This *should not* list the applications from the other xfvb-run. It works as expected when passing `--auto-servernum`: $ xvfb-run --auto-servernum dbus-launch python3 /home/vagrant/atspi-list-apps.py --------start-------- --------end-------- Therefore, pass the `--auto-servernum` arg to xvfb-run, so that it automatically determines a free server number instead. > -a, --auto-servernum > Try to get a free server number, starting at 99, or the argument to --server-num. Python script mentioned above used for testing: $ cat atspi-list-apps.py #!/usr/bin/python3 import pyatspi registry = pyatspi.registry.Registry() apps = list(registry.getDesktop(0)) print('--------start--------') for app in apps: print(f'{app}') print('--------end--------') [1] https://ci.libreoffice.org/job/gerrit_linux_gcc_release/151750/consoleFull#-1985341263d893063f-7f3d-4b7e-b56f-4e0f225817cd Change-Id: I0673212fb8fed5c9698c9f797b7bf49ba51033b0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158021 Tested-by: Jenkins Reviewed-by: Colomban Wendling <cwendling@hypra.fr> Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-10-16 04:03:46 -05:00
ICECREAM_RUN += $(XVFB_RUN) --auto-servernum $(DBUS_LAUNCH) --exit-with-session
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 <m.weghorn@posteo.de>
2023-04-05 08:39:25 -05:00
endif
$(eval $(call gb_CppunitTest_CppunitTest,vcl_gtk3_a11y))
$(eval $(call gb_CppunitTest_add_exception_objects,vcl_gtk3_a11y, \
vcl/qa/cppunit/a11y/atspi2/atspiwrapper \
vcl/qa/cppunit/a11y/atspi2/atspi2 \
vcl/qa/cppunit/a11y/atspi2/atspi2text \
))
$(eval $(call gb_CppunitTest_set_include,vcl_gtk3_a11y,\
$$(INCLUDE) \
$$(ATSPI2_CFLAGS) \
))
$(eval $(call gb_CppunitTest_add_libs,vcl_gtk3_a11y,\
$$(ATSPI2_LIBS) \
))
$(eval $(call gb_CppunitTest_use_libraries,vcl_gtk3_a11y, \
sal \
cppu \
subsequenttest \
test \
i18nlangtag \
unotest \
vcl \
))
$(eval $(call gb_CppunitTest_use_externals,vcl_gtk3_a11y,\
boost_headers \
))
$(eval $(call gb_CppunitTest_use_api,vcl_gtk3_a11y,\
offapi \
udkapi \
))
$(eval $(call gb_CppunitTest_use_sdk_api,vcl_gtk3_a11y))
$(eval $(call gb_CppunitTest_use_rdb,vcl_gtk3_a11y,services))
$(eval $(call gb_CppunitTest_use_ure,vcl_gtk3_a11y))
$(eval $(call gb_CppunitTest_use_vcl,vcl_gtk3_a11y))
$(eval $(call gb_CppunitTest_use_instdir_configuration,vcl_gtk3_a11y))
$(eval $(call gb_CppunitTest_use_common_configuration,vcl_gtk3_a11y))
$(call gb_CppunitTest_get_target,vcl_gtk3_a11y): $(call gb_Library_get_target,vclplug_gtk3)
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 <m.weghorn@posteo.de>
2023-04-05 08:39:25 -05:00
# vim: set noet sw=4 ts=4: