[Libreoffice-commits] core.git: sw/qa

Ahmed ElShreif (via logerrit) logerrit at kemper.freedesktop.org
Tue Jul 14 13:34:48 UTC 2020


 sw/qa/uitest/writer_tests6/findbar.py |   71 ++++++++++++++++++++++++++++++++++
 1 file changed, 71 insertions(+)

New commits:
commit 5b2dcb95710391c6e0d33e5ed4b743c01929d436
Author:     Ahmed ElShreif <aelshreif7 at gmail.com>
AuthorDate: Sun Jul 12 14:24:10 2020 +0200
Commit:     Ahmed ElShreif <aelshreif7 at gmail.com>
CommitDate: Tue Jul 14 15:34:11 2020 +0200

    uitest : Add demo for "bottom find bar" using ToolBox support
    
    Change-Id: Ie586851be1e9131394ac0103837b26f408026dca
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98596
    Tested-by: Jenkins
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/sw/qa/uitest/writer_tests6/findbar.py b/sw/qa/uitest/writer_tests6/findbar.py
new file mode 100644
index 000000000000..df973dc8e162
--- /dev/null
+++ b/sw/qa/uitest/writer_tests6/findbar.py
@@ -0,0 +1,71 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# This file is part of the LibreOffice project.
+#
+# 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
+import time
+from uitest.uihelper.common import get_state_as_dict, type_text
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from uitest.debug import sleep
+
+#test Find Bar
+class FindBar(UITestCase):
+
+    def test_find_bar(self):
+
+        self.ui_test.create_doc_in_start_center("writer")
+        xWriterDoc = self.xUITest.getTopFocusWindow()
+        xWriterEdit = xWriterDoc.getChild("writer_edit")
+
+        # Type some lines to search for words on them
+        xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "LibreOffice"}))
+        xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
+        xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "LibreOffice Writer"}))
+        xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
+        xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "LibreOffice Calc"}))
+        xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
+        xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "The Document Foundation"}))
+
+        # open the Find Bar
+        xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "CTRL+f"}))
+
+        # Type the Word that we want to search for it
+        xfind = xWriterDoc.getChild("find")
+        xfind.executeAction("TYPE", mkPropertyValues({"TEXT": "Libre"}))
+
+        # Select the Find Bar
+        xfind_bar = xWriterDoc.getChild("FindBar")
+        self.assertEqual(get_state_as_dict(xfind_bar)["ItemCount"], "14")
+
+        # Press on FindAll in the Find Bar
+        xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "5"}))  # 5 is FindAll id
+        self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemID"], "5")
+        self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemText"], "Find All")
+        self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemCommand"], ".uno:FindAll")
+        self.assertEqual(get_state_as_dict(xWriterEdit)["SelectedText"], "LibreLibreLibre")
+
+        # Press on Find Next in the Find Bar
+        xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "4"}))  # 4 is Find Next id
+        self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemID"], "4")
+        self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemText"], "Find Next")
+        self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemCommand"], ".uno:DownSearch")
+        self.assertEqual(get_state_as_dict(xWriterEdit)["SelectedText"], "Libre")
+
+        # Press on Find Previous in the Find Bar
+        xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "3"}))  # 3 is Find Previous id
+        self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemID"], "3")
+        self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemText"], "Find Previous")
+        self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemCommand"], ".uno:UpSearch")
+        self.assertEqual(get_state_as_dict(xWriterEdit)["SelectedText"], "Libre")
+
+        # Close the Find Bar
+        xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "1"}))  # 1 is for close
+
+        self.ui_test.close_doc()
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:


More information about the Libreoffice-commits mailing list