[Libreoffice-commits] core.git: uitest/writer_tests vcl/source

Muhammet Kara muhammet.kara at pardus.org.tr
Wed Jun 20 10:52:41 UTC 2018


 uitest/writer_tests/customizeDialog.py |   56 +++++++++++++++++++++++++++++++++
 vcl/source/uitest/uiobject.cxx         |    6 +++
 2 files changed, 62 insertions(+)

New commits:
commit 89a3f789de928a08650de03681c45cbf544889ad
Author: Muhammet Kara <muhammet.kara at pardus.org.tr>
Date:   Wed Apr 18 12:27:15 2018 +0300

    Add UI test for the Customize dialog
    
    Change-Id: I00109ef54ec7cfc1f4976794daa92ded3cd6ce4b
    Reviewed-on: https://gerrit.libreoffice.org/53119
    Tested-by: Jenkins
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/uitest/writer_tests/customizeDialog.py b/uitest/writer_tests/customizeDialog.py
new file mode 100644
index 000000000000..e6fef69cb50e
--- /dev/null
+++ b/uitest/writer_tests/customizeDialog.py
@@ -0,0 +1,56 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+from uitest.framework import UITestCase
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from uitest.uihelper.common import get_state_as_dict
+import time
+from uitest.debug import sleep
+
+class ConfigureDialog(UITestCase):
+
+    def test_open_ConfigureDialog_writer(self):
+
+        self.ui_test.create_doc_in_start_center("writer")
+        self.ui_test.execute_dialog_through_command(".uno:ConfigureDialog")
+        xDialog = self.xUITest.getTopFocusWindow()
+
+        xcancBtn = xDialog.getChild("cancel")
+        xcancBtn.executeAction("CLICK", tuple())
+
+        self.ui_test.close_doc()
+
+    def test_search_filter(self):
+        self.ui_test.create_doc_in_start_center("writer")
+        self.ui_test.execute_dialog_through_command(".uno:ConfigureDialog")
+        xDialog = self.xUITest.getTopFocusWindow()
+
+        xfunc = xDialog.getChild("functions")
+        xSearch = xDialog.getChild("searchEntry")
+
+        initialEntryCount = get_state_as_dict(xfunc)["Children"]
+        self.assertTrue(initialEntryCount is not 0)
+
+        xSearch.executeAction("SET", mkPropertyValues({"TEXT":"format"}))
+
+        # Wait for the search/filter op to be completed
+        time.sleep(1)
+
+        filteredEntryCount = get_state_as_dict(xfunc)["Children"]
+        self.assertTrue(filteredEntryCount < initialEntryCount)
+
+        xSearch.executeAction("CLEAR", tuple())
+
+        finalEntryCount = get_state_as_dict(xfunc)["Children"]
+        self.assertEqual(initialEntryCount, finalEntryCount)
+
+
+        xcancBtn = xDialog.getChild("cancel")  #button Cancel
+        xcancBtn.executeAction("CLICK", tuple())  #click the button
+
+        self.ui_test.close_doc()
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/vcl/source/uitest/uiobject.cxx b/vcl/source/uitest/uiobject.cxx
index adf26cbb2ac8..e5ac0895dea8 100644
--- a/vcl/source/uitest/uiobject.cxx
+++ b/vcl/source/uitest/uiobject.cxx
@@ -659,6 +659,12 @@ void EditUIObject::execute(const OUString& rAction,
             mxEdit->SetSelection(aSelection);
         }
     }
+    else if (rAction == "CLEAR")
+    {
+        mxEdit->SetText("");
+        mxEdit->UpdateData();
+        bHandled = true;
+    }
     else
     {
         bHandled = false;


More information about the Libreoffice-commits mailing list