vcl/source/uitest/uiobject.cxx |   21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

New commits:
commit 013e5bacc65710f9412de2287749a84e469056a0
Author: Markus Mohrhard <markus.mohrh...@googlemail.com>
Date:   Sun Mar 26 01:20:10 2017 +0100

    uitest: handle float windows better in the hierarchy dump
    
    Change-Id: Ic49ac5774116bf9d8af980ecc0d99b0056fc8bed
    Reviewed-on: https://gerrit.libreoffice.org/35695
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Markus Mohrhard <markus.mohrh...@googlemail.com>

diff --git a/vcl/source/uitest/uiobject.cxx b/vcl/source/uitest/uiobject.cxx
index 3dabf7a0e56f..24fac7a4dd31 100644
--- a/vcl/source/uitest/uiobject.cxx
+++ b/vcl/source/uitest/uiobject.cxx
@@ -93,16 +93,25 @@ bool isDialogWindow(vcl::Window* pWindow)
     return false;
 }
 
-vcl::Window* get_dialog_parent(vcl::Window* pWindow)
+bool isTopWindow(vcl::Window* pWindow)
 {
-    if (isDialogWindow(pWindow))
+    WindowType eType = pWindow->GetType();
+    if (eType == WindowType::FLOATINGWINDOW)
+        return true;
+
+    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_dialog_parent(pParent);
+    return get_top_parent(pParent);
 }
 
 std::vector<KeyEvent> generate_key_events_from_text(const OUString& rStr)
@@ -409,7 +418,7 @@ void addChildren(vcl::Window* pParent, std::set<OUString>& 
rChildren)
 
 std::unique_ptr<UIObject> WindowUIObject::get_child(const OUString& rID)
 {
-    vcl::Window* pDialogParent = get_dialog_parent(mxWindow.get());
+    vcl::Window* pDialogParent = get_top_parent(mxWindow.get());
     vcl::Window* pWindow = findChild(pDialogParent, rID);
 
     if (!pWindow)
@@ -421,7 +430,7 @@ std::unique_ptr<UIObject> WindowUIObject::get_child(const 
OUString& rID)
 
 std::set<OUString> WindowUIObject::get_children() const
 {
-    vcl::Window* pDialogParent = get_dialog_parent(mxWindow.get());
+    vcl::Window* pDialogParent = get_top_parent(mxWindow.get());
     std::set<OUString> aChildren;
     aChildren.insert(pDialogParent->get_id());
     addChildren(pDialogParent, aChildren);
@@ -473,7 +482,7 @@ OUString WindowUIObject::dumpState() const
 
 OUString WindowUIObject::dumpHierarchy() const
 {
-    vcl::Window* pDialogParent = get_dialog_parent(mxWindow.get());
+    vcl::Window* pDialogParent = get_top_parent(mxWindow.get());
     std::unique_ptr<UIObject> pParentWrapper =
         pDialogParent->GetUITestFactory()(pDialogParent);
     return pParentWrapper->dumpState();
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to