diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2017-03-21 19:40:34 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2017-03-21 21:31:00 +0000 |
commit | d0740605fcd6f2f65f78f1ac8a05bd641edc6a76 (patch) | |
tree | 67a967597de4dde41385bbe391640ee13fd7022e /vcl | |
parent | caf208166c01519f090ee88b1ddff809ed199007 (diff) |
uitest: also accept child windows having focus for logging
Change-Id: I6c09900aa95a01330b5bedf12f3e4a7a03e5a620
Reviewed-on: https://gerrit.libreoffice.org/35517
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/uitest/logger.cxx | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/vcl/source/uitest/logger.cxx b/vcl/source/uitest/logger.cxx index 3fa60deb70a8..4ccd07fd9566 100644 --- a/vcl/source/uitest/logger.cxx +++ b/vcl/source/uitest/logger.cxx @@ -42,6 +42,24 @@ void UITestLogger::logCommand(const OUString& rAction) maStream.WriteLine(OUStringToOString(rAction, RTL_TEXTENCODING_UTF8)); } +namespace { + +// most likely this should be recursive +bool child_windows_have_focus(VclPtr<Control>& xUIElement) +{ + sal_Int32 nCount = xUIElement->GetChildCount(); + for (sal_Int32 i = 0; i < nCount; ++i) + { + if (xUIElement->GetChild(i)->HasFocus()) + { + return true; + } + } + return false; +} + +} + void UITestLogger::logAction(VclPtr<Control>& xUIElement, VclEventId nEvent) { if (!mbValid) @@ -50,11 +68,13 @@ void UITestLogger::logAction(VclPtr<Control>& xUIElement, VclEventId nEvent) if (xUIElement->get_id().isEmpty()) return; - if (!xUIElement->HasFocus()) - return; - std::unique_ptr<UIObject> pUIObject = xUIElement->GetUITestFactory()(xUIElement.get()); OUString aAction = pUIObject->get_action(nEvent); + if (!xUIElement->HasFocus() && !child_windows_have_focus(xUIElement)) + { + return; + } + if (!aAction.isEmpty()) maStream.WriteLine(OUStringToOString(aAction, RTL_TEXTENCODING_UTF8)); } |