summaryrefslogtreecommitdiff
path: root/vcl/source/uitest/logger.cxx
diff options
context:
space:
mode:
authorAhmed ElShreif <aelshreif7@gmail.com>2019-08-09 23:23:11 -0500
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2019-08-19 22:56:39 +0800
commite72ae01b906455524a1d4a615ab1a0efb94a6f11 (patch)
treef9dc6e523d1cfd133cd445424a891c8645dbebd1 /vcl/source/uitest/logger.cxx
parent99bedce928c33e8cb607f1d3f3c09feebaeb3c6b (diff)
uitest: solve problem with un-named parents
1) Add recursively query for the parent until find an parent with a name. 2) Remove the parent part "from xxxxxx" from the log statment if there is un-named parent 3) Update the compiler to use the most top parent if there is command with no un-named parent Change-Id: Id7dd5092bc995312494b5536720141908e73af9a
Diffstat (limited to 'vcl/source/uitest/logger.cxx')
-rw-r--r--vcl/source/uitest/logger.cxx67
1 files changed, 65 insertions, 2 deletions
diff --git a/vcl/source/uitest/logger.cxx b/vcl/source/uitest/logger.cxx
index 36a6c7340add..0ecd673f9879 100644
--- a/vcl/source/uitest/logger.cxx
+++ b/vcl/source/uitest/logger.cxx
@@ -20,6 +20,49 @@
#include <com/sun/star/beans/PropertyValue.hpp>
#include <memory>
+namespace{
+
+bool isDialogWindow(vcl::Window const * pWindow)
+{
+ WindowType nType = pWindow->GetType();
+ // DIALOG to MODALDIALOG
+ if (nType >= WindowType::DIALOG && nType <= WindowType::MODALDIALOG)
+ return true;
+
+ // MESSBOX, INFOBOX, WARNINGBOX, ERRORBOX, QUERYBOX
+ if (nType >= WindowType::MESSBOX && nType <= WindowType::QUERYBOX)
+ return true;
+
+ if (nType == WindowType::TABDIALOG)
+ return true;
+
+ return false;
+}
+
+bool isTopWindow(vcl::Window const * pWindow)
+{
+ WindowType eType = pWindow->GetType();
+ if (eType == WindowType::FLOATINGWINDOW)
+ {
+ return pWindow->GetStyle() & WB_SYSTEMFLOATWIN;
+ }
+ return false;
+}
+
+vcl::Window* get_top_parent(vcl::Window* pWindow)
+{
+ if (isDialogWindow(pWindow) || isTopWindow(pWindow))
+ return pWindow;
+
+ vcl::Window* pParent = pWindow->GetParent();
+ if (!pParent)
+ return pWindow;
+
+ return get_top_parent(pParent);
+}
+
+
+}
UITestLogger::UITestLogger():
maStream(),
mbValid(false)
@@ -216,7 +259,17 @@ void UITestLogger::logKeyInput(VclPtr<vcl::Window> const & xUIElement, const Key
OUString aContent;
if(pUIObject->get_type()=="EditUIObject"){
- aContent = "Type on '" + rID + "' " + aKeyCode + " from " + aParentID ;
+ if(aParentID=="")
+ {
+ VclPtr <vcl::Window> pParent_top = get_top_parent(xUIElement);
+ aParentID= pParent_top->get_id();
+ }
+ if(aParentID==""){
+ aContent = aContent+"Type on '" + rID + "' " + aKeyCode;
+ }
+ else{
+ aContent = aContent+"Type on '" + rID + "' " + aKeyCode + " from " + aParentID ;
+ }
}
else if(pUIObject->get_type()=="SwEditWinUIObject" && rID=="writer_edit"){
aContent = "Type on writer " + aKeyCode ;
@@ -234,7 +287,17 @@ void UITestLogger::logKeyInput(VclPtr<vcl::Window> const & xUIElement, const Key
aContent = "Type on draw " + aKeyCode ;
}
else{
- aContent = "Type on '" + rID + "' " + aKeyCode + " from " + aParentID ;
+ if(aParentID=="")
+ {
+ VclPtr <vcl::Window> pParent_top = get_top_parent(xUIElement);
+ aParentID= pParent_top->get_id();
+ }
+ if(aParentID==""){
+ aContent = "Type on '" + rID + "' " + aKeyCode ;
+ }
+ else{
+ aContent = "Type on '" + rID + "' " + aKeyCode + " from " + aParentID ;
+ }
}
maStream.WriteLine(OUStringToOString(aContent, RTL_TEXTENCODING_UTF8));
}