[API CHANGE] uitest: Add API to get XUIObject for specific XWindow
Add a XUITest::getWindow method that allows to get the XUIObject for a given XWindow. The XUITest interface is internal/unpublished API used for UI tests. The newly introduced method will be used in an upcoming commit in sw/qa/uitest/table/tdf146145.py to port that test away from depending on a11y implementation details that are about to change. Change-Id: I6fcbee3ce894ad82ec42fa034b85544b50408779 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185773 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
This commit is contained in:
@@ -21,6 +21,12 @@ interface XUITest
|
||||
XUIObject getTopFocusWindow();
|
||||
|
||||
XUIObject getFloatWindow();
|
||||
|
||||
/** Get the XUIObject for the given window.
|
||||
|
||||
@since LibreOffice 25.8
|
||||
*/
|
||||
XUIObject getWindow([in] ::com::sun::star::awt::XWindow xWindow);
|
||||
};
|
||||
|
||||
}; }; }; }; };
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
#include <vcl/uitest/uitest.hxx>
|
||||
#include <vcl/svapp.hxx>
|
||||
#include <vcl/toolkit/unowrap.hxx>
|
||||
#include <vcl/window.hxx>
|
||||
|
||||
#include "uiobject_uno.hxx"
|
||||
@@ -44,6 +45,9 @@ public:
|
||||
|
||||
css::uno::Reference<css::ui::test::XUIObject> SAL_CALL getFloatWindow() override;
|
||||
|
||||
css::uno::Reference<css::ui::test::XUIObject>
|
||||
SAL_CALL getWindow(const css::uno::Reference<css::awt::XWindow>& xWindow) override;
|
||||
|
||||
OUString SAL_CALL getImplementationName() override;
|
||||
|
||||
sal_Bool SAL_CALL supportsService(OUString const & ServiceName) override;
|
||||
@@ -94,6 +98,20 @@ css::uno::Reference<css::ui::test::XUIObject> SAL_CALL UITestUnoObj::getFloatWin
|
||||
return new UIObjectUnoObj(std::move(pObj));
|
||||
}
|
||||
|
||||
css::uno::Reference<css::ui::test::XUIObject>
|
||||
SAL_CALL UITestUnoObj::getWindow(const css::uno::Reference<::css::awt::XWindow>& xWindow)
|
||||
{
|
||||
if (!xWindow.is())
|
||||
return {};
|
||||
|
||||
UnoWrapperBase* pWrapper = UnoWrapperBase::GetUnoWrapper();
|
||||
assert(pWrapper);
|
||||
VclPtr<vcl::Window> pWindow = pWrapper->GetWindow(xWindow);
|
||||
assert(pWindow);
|
||||
|
||||
return new UIObjectUnoObj(pWindow->GetUITestFactory()(pWindow));
|
||||
}
|
||||
|
||||
OUString SAL_CALL UITestUnoObj::getImplementationName()
|
||||
{
|
||||
return u"org.libreoffice.uitest.UITest"_ustr;
|
||||
|
||||
Reference in New Issue
Block a user