17#include <com/sun/star/accessibility/AccessibleRole.hpp>
18#include <com/sun/star/accessibility/XAccessible.hpp>
19#include <com/sun/star/accessibility/XAccessibleAction.hpp>
20#include <com/sun/star/accessibility/XAccessibleContext.hpp>
21#include <com/sun/star/awt/XDialog2.hpp>
22#include <com/sun/star/awt/XWindow.hpp>
23#include <com/sun/star/frame/Desktop.hpp>
24#include <com/sun/star/lang/XComponent.hpp>
25#include <com/sun/star/uno/Reference.hxx>
30#include <rtl/ustring.hxx>
41 css::uno::Reference<css::frame::XDesktop2>
mxDesktop;
43 css::uno::Reference<css::awt::XWindow>
mxWindow;
45 static bool isDocumentRole(
const sal_Int16 role);
47 virtual void load(
const rtl::OUString& sURL);
48 virtual void loadFromSrc(
const rtl::OUString& sSrcPath);
50 css::uno::Reference<css::accessibility::XAccessibleContext> getWindowAccessibleContext();
51 virtual css::uno::Reference<css::accessibility::XAccessibleContext>
52 getDocumentAccessibleContext();
56 vcl::ITiledRenderable* pTiledRenderable
57 =
dynamic_cast<vcl::ITiledRenderable*
>(mxDocument.get());
58 CPPUNIT_ASSERT(pTiledRenderable);
59 pTiledRenderable->postKeyEvent(
nType, nCharCode, nKeyCode);
62 static css::uno::Reference<css::accessibility::XAccessibleContext> getFirstRelationTargetOfType(
63 const css::uno::Reference<css::accessibility::XAccessibleContext>& xContext,
64 sal_Int16 relationType);
79 virtual std::deque<css::uno::Reference<css::accessibility::XAccessibleContext>>
80 getAllChildren(
const css::uno::Reference<css::accessibility::XAccessibleContext>& xContext);
82 void dumpA11YTree(
const css::uno::Reference<css::accessibility::XAccessibleContext>& xContext,
85 css::uno::Reference<css::accessibility::XAccessibleContext>
86 getItemFromName(
const css::uno::Reference<css::accessibility::XAccessibleContext>& xMenuCtx,
87 std::u16string_view name);
89 activateMenuItem(
const css::uno::Reference<css::accessibility::XAccessibleAction>& xAction);
91 bool activateMenuItem(
const css::uno::Reference<css::accessibility::XAccessibleContext>& xCtx)
93 return activateMenuItem(css::uno::Reference<css::accessibility::XAccessibleAction>(
94 xCtx, css::uno::UNO_QUERY_THROW));
102 template <
typename... Ts>
103 css::uno::Reference<css::accessibility::XAccessibleContext>
104 getItemFromName(
const css::uno::Reference<css::accessibility::XAccessibleContext>& xMenuCtx,
105 std::u16string_view name, Ts... names)
107 auto item = getItemFromName(xMenuCtx,
name);
108 CPPUNIT_ASSERT(item.is());
109 activateMenuItem(item);
110 return getItemFromName(item, names...);
115 template <
typename... Ts>
117 activateMenuItem(
const css::uno::Reference<css::accessibility::XAccessibleContext>& xMenuCtx,
120 auto item = getItemFromName(xMenuCtx, names...);
121 CPPUNIT_ASSERT(item.is());
122 return activateMenuItem(item);
130 getWindowAccessibleContext(), css::accessibility::AccessibleRole::MENU_BAR);
131 CPPUNIT_ASSERT(menuBar.is());
132 return activateMenuItem(menuBar, names...);
146 static css::uno::Reference<css::accessibility::XAccessibleContext>
149 static inline css::uno::Reference<css::accessibility::XAccessibleContext>
152 return getFocusedObject(xAcc->getAccessibleContext());
175 static css::uno::Reference<css::accessibility::XAccessibleContext>
176 tabTo(
const css::uno::Reference<css::accessibility::XAccessible>& xRoot,
const sal_Int16 role,
177 const std::u16string_view name,
180 static bool tabTo(
const css::uno::Reference<css::accessibility::XAccessible>& xRoot,
181 const css::uno::Reference<css::accessibility::XAccessibleContext>& xChild,
194 Dialog(css::uno::Reference<css::awt::XDialog2>& xDialog2,
bool bAutoClose =
true);
204 void close(sal_Int32 result = VclResponseType::RET_CANCEL);
206 css::uno::Reference<css::accessibility::XAccessibleContext>
207 tabTo(
const sal_Int16 role,
const std::u16string_view name)
212 bool tabTo(
const css::uno::Reference<css::accessibility::XAccessibleContext>& xChild)
287 static std::shared_ptr<DialogWaiter> awaitDialog(
const std::u16string_view name,
288 std::function<
void(
Dialog&)> callback,
289 bool bAutoClose =
true);
293 virtual void setUp()
override;
294 virtual void tearDown()
override;
Accessibility-specialized helper to send events to a window.
virtual bool waitEndDialog(sal_uInt64 nTimeoutMs=3000)=0
Waits for the associated dialog to close.
void setAutoClose(bool bAutoClose)
css::uno::Reference< css::accessibility::XAccessibleContext > tabTo(const sal_Int16 role, const std::u16string_view name)
css::uno::Reference< css::accessibility::XAccessible > mxAccessible
css::uno::Reference< css::awt::XDialog2 > mxDialog2
css::uno::Reference< css::accessibility::XAccessible > getAccessible() const
bool tabTo(const css::uno::Reference< css::accessibility::XAccessibleContext > &xChild)
bool activateMenuItem(const css::uno::Reference< css::accessibility::XAccessibleContext > &xMenuCtx, Ts... names)
bool activateMenuItem(Ts... names)
static css::uno::Reference< css::accessibility::XAccessibleContext > getFocusedObject(const css::uno::Reference< css::accessibility::XAccessibleContext > &xCtx)
Gets the focused accessible object at xAcc level or below.
css::uno::Reference< css::lang::XComponent > mxDocument
bool activateMenuItem(const css::uno::Reference< css::accessibility::XAccessibleContext > &xCtx)
bool activateMenuItem(const css::uno::Reference< css::accessibility::XAccessibleAction > &xAction)
static css::uno::Reference< css::accessibility::XAccessibleContext > getFocusedObject(const css::uno::Reference< css::accessibility::XAccessible > &xAcc)
css::uno::Reference< css::frame::XDesktop2 > mxDesktop
void documentPostKeyEvent(int nType, int nCharCode, int nKeyCode)
static bool tabTo(const css::uno::Reference< css::accessibility::XAccessible > &xRoot, const css::uno::Reference< css::accessibility::XAccessibleContext > &xChild, const EventPosterHelperBase *pEventPosterHelper=nullptr)
static css::uno::Reference< css::accessibility::XAccessibleContext > tabTo(const css::uno::Reference< css::accessibility::XAccessible > &xRoot, const sal_Int16 role, const std::u16string_view name, const EventPosterHelperBase *pEventPosterHelper=nullptr)
Navigates through focusable elements using the Tab keyboard shortcut.
css::uno::Reference< css::awt::XWindow > mxWindow
css::uno::Reference< css::accessibility::XAccessibleContext > getItemFromName(const css::uno::Reference< css::accessibility::XAccessibleContext > &xMenuCtx, std::u16string_view name, Ts... names)
css::uno::Reference< css::accessibility::XAccessibleContext > getItemFromName(const css::uno::Reference< css::accessibility::XAccessibleContext > &xMenuCtx, std::u16string_view name)
Base helper class to send events to a window.
#define OOO_DLLPUBLIC_TEST