sw/qa/uitest/findBar/tdf138232.py |    3 +++
 vcl/source/uitest/uiobject.cxx    |    1 +
 2 files changed, 4 insertions(+)

New commits:
commit 5bb06ea6931c0c72df6b0f164bac1c8d00c51bb6
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Fri Jun 4 21:59:21 2021 +0200
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Fri Jun 4 23:04:34 2021 +0200

    Fix UITest
    
    The test had previously raced between the effect of
    vnd.sun.star.findbar:FocusToFindbar, typing, and pressing
    the "Find All" button. If typing happened before focusing,
    then focusing selected the already typed text. If button
    was clicked before focusing, it found the edit unfocused,
    and grabbed the focus, selecting its content.
    
    This adds "HasFocus" property to WindowUIObject::get_state.
    
    Change-Id: Ib277bd70508a3c1e86e1668afb7592d7a1523947
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116697
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/sw/qa/uitest/findBar/tdf138232.py 
b/sw/qa/uitest/findBar/tdf138232.py
index 93f859bc7521..62a79824ea4d 100644
--- a/sw/qa/uitest/findBar/tdf138232.py
+++ b/sw/qa/uitest/findBar/tdf138232.py
@@ -23,6 +23,9 @@ class tdf138232(UITestCase):
         self.xUITest.executeCommand("vnd.sun.star.findbar:FocusToFindbar")
 
         xfind = xWriterDoc.getChild("find")
+        self.ui_test.wait_until_property_is_updated(xfind, 'HasFocus', "true")
+        self.assertEqual("true", get_state_as_dict(xfind)['HasFocus'])
+
         xfind.executeAction("TYPE", mkPropertyValues({"TEXT": "Hello"}))
         self.assertEqual("Hello", get_state_as_dict(xfind)['Text'])
 
diff --git a/vcl/source/uitest/uiobject.cxx b/vcl/source/uitest/uiobject.cxx
index 6c14c2192177..f04e8c54cc95 100644
--- a/vcl/source/uitest/uiobject.cxx
+++ b/vcl/source/uitest/uiobject.cxx
@@ -300,6 +300,7 @@ StringMap WindowUIObject::get_state()
     aMap["Visible"] = OUString::boolean(mxWindow->IsVisible());
     aMap["ReallyVisible"] = OUString::boolean(mxWindow->IsReallyVisible());
     aMap["Enabled"] = OUString::boolean(mxWindow->IsEnabled());
+    aMap["HasFocus"] = OUString::boolean(mxWindow->HasChildPathFocus());
     aMap["WindowType"] = 
OUString::number(static_cast<sal_uInt16>(mxWindow->GetType()), 16);
 
     Point aPos = mxWindow->GetPosPixel();
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to