summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorColomban Wendling <cwendling@hypra.fr>2022-11-03 15:17:46 +0100
committerMichael Weghorn <m.weghorn@posteo.de>2023-03-03 10:56:31 +0000
commit1791b26d75bd50971fe58627c6554f1711890817 (patch)
tree01df579580b6021b9504a2ea796e60bf4b2183cf /test
parent27b8c67bb154d2e09c2377a5f73621b72167a226 (diff)
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 <m.weghorn@posteo.de>
Diffstat (limited to 'test')
-rw-r--r--test/source/a11y/AccessibilityTools.cxx53
1 files changed, 53 insertions, 0 deletions
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 <com/sun/star/accessibility/AccessibleRole.hpp>
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleAction.hpp>
#include <com/sun/star/accessibility/XAccessibleContext.hpp>
+#include <com/sun/star/awt/KeyModifier.hpp>
+#include <rtl/ustrbuf.hxx>
#include <sal/log.hxx>
#include <toolkit/awt/vclxaccessiblecomponent.hxx>
#include <vcl/scheduler.hxx>
@@ -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("<Mod1>");
+ if (keyStroke.Modifiers & awt::KeyModifier::MOD2)
+ r.append("<Mod2>");
+ if (keyStroke.Modifiers & awt::KeyModifier::MOD3)
+ r.append("<Mod3>");
+ if (keyStroke.Modifiers & awt::KeyModifier::SHIFT)
+ r.append("<Shift>");
+ 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)