[Libreoffice-commits] core.git: vcl/source
Markus Mohrhard
markus.mohrhard at googlemail.com
Tue Mar 21 21:31:27 UTC 2017
vcl/source/uitest/logger.cxx | 26 +++++++++++++++++++++++---
1 file changed, 23 insertions(+), 3 deletions(-)
New commits:
commit d0740605fcd6f2f65f78f1ac8a05bd641edc6a76
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Tue Mar 21 19:40:34 2017 +0100
uitest: also accept child windows having focus for logging
Change-Id: I6c09900aa95a01330b5bedf12f3e4a7a03e5a620
Reviewed-on: https://gerrit.libreoffice.org/35517
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
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));
}
More information about the Libreoffice-commits
mailing list