27#include <cppunit/TestAssert.h>
29#include <com/sun/star/accessibility/AccessibleEventObject.hpp>
30#include <com/sun/star/accessibility/XAccessible.hpp>
31#include <com/sun/star/accessibility/XAccessibleAction.hpp>
32#include <com/sun/star/accessibility/XAccessibleContext.hpp>
33#include <com/sun/star/accessibility/XAccessibleText.hpp>
40 static const sal_Int32 MAX_CHILDREN = 500;
42 static css::uno::Reference<css::accessibility::XAccessibleContext>
44 const css::uno::Reference<css::accessibility::XAccessibleContext>& xCtx,
46 bool(
const css::uno::Reference<css::accessibility::XAccessibleContext>&)>& cPredicate);
47 static css::uno::Reference<css::accessibility::XAccessibleContext>
49 const css::uno::Reference<css::accessibility::XAccessible>& xAcc,
51 bool(
const css::uno::Reference<css::accessibility::XAccessibleContext>&)>& cPredicate);
53 const css::uno::Reference<css::accessibility::XAccessibleContext>& xCtx, sal_Int16 role);
54 static css::uno::Reference<css::accessibility::XAccessibleContext>
55 getAccessibleObjectForRole(
const css::uno::Reference<css::accessibility::XAccessible>& xacc,
72 static css::uno::Reference<css::accessibility::XAccessibleContext> getAccessibleObjectForName(
73 const css::uno::Reference<css::accessibility::XAccessibleContext>& xCtx,
74 const sal_Int16 role, std::u16string_view name);
75 static inline css::uno::Reference<css::accessibility::XAccessibleContext>
77 const sal_Int16 role, std::u16string_view name)
79 return getAccessibleObjectForName(xAcc->getAccessibleContext(), role,
name);
118 template <
typename... Ts>
120 const css::uno::Reference<css::accessibility::XAccessibleContext>& xCtx,
121 const sal_Int16 role, std::u16string_view name, Ts... args)
123 auto nChildren = xCtx->getAccessibleChildCount();
126 if (xCtx->getAccessibleRole() == role && nameEquals(xCtx,
name))
128 for (
decltype(nChildren)
i = 0;
i < nChildren &&
i < MAX_CHILDREN;
i++)
131 = getAccessibleObjectForName(xCtx->getAccessibleChild(
i),
args...))
137 for (
decltype(nChildren)
i = 0;
i < nChildren &&
i < MAX_CHILDREN;
i++)
140 = getAccessibleObjectForName(xCtx->getAccessibleChild(
i), role,
name,
args...))
147 template <
typename... Ts>
148 static inline css::uno::Reference<css::accessibility::XAccessibleContext>
150 const sal_Int16 role, std::u16string_view name, Ts... args)
152 return getAccessibleObjectForName(xAcc->getAccessibleContext(), role,
name,
args...);
155 static bool equals(
const css::uno::Reference<css::accessibility::XAccessible>& xacc1,
156 const css::uno::Reference<css::accessibility::XAccessible>& xacc2);
157 static bool equals(
const css::uno::Reference<css::accessibility::XAccessibleContext>& xctx1,
158 const css::uno::Reference<css::accessibility::XAccessibleContext>& xctx2);
171 static bool nameEquals(
const css::uno::Reference<css::accessibility::XAccessibleContext>& xCtx,
172 const std::u16string_view name);
173 static bool nameEquals(
const css::uno::Reference<css::accessibility::XAccessible>& xAcc,
174 const std::u16string_view name)
176 return nameEquals(xAcc->getAccessibleContext(),
name);
179 static OUString getRoleName(
const sal_Int16 role);
180 static OUString getEventIdName(
const sal_Int16 event_id);
181 static OUString getRelationTypeName(
const sal_Int16 rel_type);
183 template <
typename T>
static std::string
debugString(
const css::uno::Reference<T>& x)
185 return debugString(
x.get());
198 return debugString(
const_cast<T*
>(
p));
203 CPPUNIT_NS::OStringStream ost;
205 ost <<
"(" <<
static_cast<const void*
>(
p) <<
")";
207 ost <<
" " << debugName(
p);
212 static OUString debugAccessibleStateSet(sal_Int64 p);
239 static bool Await(
const std::function<
bool()>& cUntilCallback, sal_uInt64 nTimeoutMs = 3000);
255 static void Wait(sal_uInt64 nTimeoutMs);
258 static OUString
debugName(css::accessibility::XAccessibleContext* xctx);
259 static OUString
debugName(css::accessibility::XAccessible* xacc);
260 static OUString
debugName(
const css::accessibility::AccessibleEventObject* evobj);
261 static OUString
debugName(css::accessibility::XAccessibleAction* xAct);
262 static OUString
debugName(css::accessibility::XAccessibleText* xTxt);
268#define AT_ASSERTION_TRAITS(T) \
269 template <> struct assertion_traits<css::uno::Reference<T>> \
271 static bool equal(const css::uno::Reference<T>& x, const css::uno::Reference<T>& y) \
273 return AccessibilityTools::equals(x, y); \
276 static std::string toString(const css::uno::Reference<T>& x) \
278 return AccessibilityTools::debugString(x); \
285#undef AT_ASSERTION_TRAITS
#define OOO_DLLPUBLIC_TEST