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

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Mon Nov 2 23:29:50 UTC 2020


 sc/qa/uitest/range_name/create_range_name.py |   33 +++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

New commits:
commit c1c89b9323f925f2211b94b3d0e78a7b503b7142
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Mon Nov 2 21:54:59 2020 +0100
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Tue Nov 3 00:29:13 2020 +0100

    uitest: test creation of range names from ui
    
    Change-Id: I3897a8a4dc77b5d41b3b64a03146c121fee5c83b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105229
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/sc/qa/uitest/range_name/create_range_name.py b/sc/qa/uitest/range_name/create_range_name.py
index 92f70088ada7..b1b60c1cd83e 100644
--- a/sc/qa/uitest/range_name/create_range_name.py
+++ b/sc/qa/uitest/range_name/create_range_name.py
@@ -10,6 +10,8 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
 from uitest.framework import UITestCase
 from uitest.uihelper.common import type_text, select_pos
 from uitest.uihelper.common import get_state_as_dict
+from libreoffice.calc.document import get_cell_by_position
+from uitest.uihelper.calc import enter_text_to_cell
 
 class CreateRangeNameTest(UITestCase):
 
@@ -35,6 +37,37 @@ class CreateRangeNameTest(UITestCase):
 
         self.ui_test.close_doc()
 
+    def test_create_range_name_from_ui(self):
+
+        self.ui_test.create_doc_in_start_center("calc")
+
+        calcDoc = self.xUITest.getTopFocusWindow()
+        gridwin = calcDoc.getChild("grid_window")
+
+        enter_text_to_cell(gridwin, "A1", "1")
+        enter_text_to_cell(gridwin, "B1", "1")
+        enter_text_to_cell(gridwin, "C1", "1")
+
+        gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C1"}))
+        xPosWindow = calcDoc.getChild('pos_window')
+        self.assertEqual('A1:C1', get_state_as_dict(xPosWindow)['Text'])
+
+        xPosWindow.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+        xPosWindow.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+        xPosWindow.executeAction("TYPE", mkPropertyValues({"TEXT":"RANGE1"}))
+        xPosWindow.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"}))
+
+        self.assertEqual('RANGE1', get_state_as_dict(xPosWindow)['Text'])
+
+        calcDoc = self.xUITest.getTopFocusWindow()
+        gridwin = calcDoc.getChild("grid_window")
+
+        document = self.ui_test.get_component()
+        enter_text_to_cell(gridwin, "A2", "=SUM(RANGE1)")
+        self.assertEqual(3.0, get_cell_by_position(document, 0, 0, 1).getValue())
+
+        self.ui_test.close_doc()
+
     def test_create_local_range_name(self):
 
         self.ui_test.create_doc_in_start_center("calc")


More information about the Libreoffice-commits mailing list