Kaydet (Commit) 3a03ee49 authored tarafından Caolán McNamara's avatar Caolán McNamara

afl-eventtesting: there is no focused/active window in headless mode

so close all open frames, not just the active one
and send events to the first discovered visible window and not the focus
window

Change-Id: I7339bc6743cd3106ceddea049136796121819eb3
üst b78d4c65
......@@ -1282,7 +1282,15 @@ unsigned int persist_cnt;
//the application post start-up for ui-testing
void Desktop::CloseFrameAndReopen(Reference<XDesktop2> xDesktop)
{
Reference<css::frame::XFrame> xFrame = xDesktop->getActiveFrame();
css::uno::Reference<css::container::XIndexAccess> xTaskContainer(
xDesktop->getFrames(), css::uno::UNO_QUERY_THROW);
sal_Int32 c = xTaskContainer->getCount();
for (sal_Int32 i = 0; i < c; ++i)
{
css::uno::Reference< css::frame::XFrame > xFrame;
xTaskContainer->getByIndex(i) >>= xFrame;
if (!xFrame.is())
continue;
Reference<css::frame::XDispatchProvider> xProvider(xFrame, css::uno::UNO_QUERY);
css::uno::Reference<css::frame::XController > xController = xFrame->getController();
......@@ -1299,6 +1307,7 @@ void Desktop::CloseFrameAndReopen(Reference<XDesktop2> xDesktop)
css::uno::Reference< css::frame::XDispatch > xDispatch = xProvider->queryDispatch(aCommand, OUString(), 0);
xDispatch->dispatch(aCommand, css::uno::Sequence< css::beans::PropertyValue >());
}
OpenDefault();
}
......
......@@ -347,9 +347,16 @@ namespace
{
bool InjectKeyEvent(SvStream& rStream)
{
VclPtr<vcl::Window> xWin(Application::GetFocusWindow());
if (!xWin)
xWin.reset(Application::GetActiveTopWindow());
if (Application::AnyInput())
return false;
VclPtr<vcl::Window> xWin(Application::GetFirstTopLevelWindow());
while (xWin)
{
if (xWin->IsVisible())
break;
xWin.reset(Application::GetNextTopLevelWindow(xWin));
}
if (!xWin)
return false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment