diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-10-10 12:52:58 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-10-10 12:54:17 +0100 |
commit | 3a03ee49e7cced375decefd336294632180414e4 (patch) | |
tree | ca9dc7ead0a0a24d6be8b291575840a7f7a9cf41 /desktop | |
parent | b78d4c6503ff47177316685aae79cb5eaf55e33a (diff) |
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
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/source/app/app.cxx | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index 79b3c86e9f32..a3b436d92867 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -1282,23 +1282,32 @@ 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(); - Reference<css::frame::XDispatchProvider> xProvider(xFrame, css::uno::UNO_QUERY); + 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(); - css::uno::Reference<css::frame::XModel> xModel = xController->getModel(); - css::uno::Reference< css::util::XModifiable > xModifiable(xModel, css::uno::UNO_QUERY); - xModifiable->setModified(false); + css::uno::Reference<css::frame::XController > xController = xFrame->getController(); + css::uno::Reference<css::frame::XModel> xModel = xController->getModel(); + css::uno::Reference< css::util::XModifiable > xModifiable(xModel, css::uno::UNO_QUERY); + xModifiable->setModified(false); - css::util::URL aCommand; - aCommand.Complete = ".uno:CloseDoc"; + css::util::URL aCommand; + aCommand.Complete = ".uno:CloseDoc"; - css::uno::Reference<css::uno::XComponentContext> xContext = ::comphelper::getProcessComponentContext(); - Reference< css::util::XURLTransformer > xParser = css::util::URLTransformer::create(xContext); - xParser->parseStrict(aCommand); + css::uno::Reference<css::uno::XComponentContext> xContext = ::comphelper::getProcessComponentContext(); + Reference< css::util::XURLTransformer > xParser = css::util::URLTransformer::create(xContext); + xParser->parseStrict(aCommand); - css::uno::Reference< css::frame::XDispatch > xDispatch = xProvider->queryDispatch(aCommand, OUString(), 0); - xDispatch->dispatch(aCommand, css::uno::Sequence< css::beans::PropertyValue >()); + css::uno::Reference< css::frame::XDispatch > xDispatch = xProvider->queryDispatch(aCommand, OUString(), 0); + xDispatch->dispatch(aCommand, css::uno::Sequence< css::beans::PropertyValue >()); + } OpenDefault(); } |