sc/qa/uitest/calc_dialogs/openDialogs.py |    3 
 sc/qa/uitest/range_name/tdf137617.py     |   98 +++++++++++++++++++++++++++++++
 2 files changed, 100 insertions(+), 1 deletion(-)

New commits:
commit 1b0eb76eb1787d9d9fbd7a7a73ee8ae47b62dc33
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Tue Nov 3 11:33:10 2020 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Tue Nov 3 13:39:54 2020 +0100

    tdf#137617: sc: Add UItest
    
    Change-Id: I544a221e7b3c76bb046235768d3fdcb700805579
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105239
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sc/qa/uitest/calc_dialogs/openDialogs.py 
b/sc/qa/uitest/calc_dialogs/openDialogs.py
index 4a76fae293e0..f616c67f7c6c 100644
--- a/sc/qa/uitest/calc_dialogs/openDialogs.py
+++ b/sc/qa/uitest/calc_dialogs/openDialogs.py
@@ -79,7 +79,8 @@ dialogs = [
         # tested in sc/qa/uitest/calc_tests9/tdf130371.py
     # {"command": ".uno:SheetInsertName", "closeButton": "close"},
         # dialog does not open
-    {"command": ".uno:CreateNames", "closeButton": "cancel", "skipTestOK": 
True},
+    #{"command": ".uno:CreateNames", "closeButton": "cancel", "skipTestOK": 
True},
+        # tested in sc/qa/uitest/range_name/tdf137617.py
         # OK button triggers a new dialog
     #{"command": ".uno:DefineLabelRange", "closeButton": "cancel"},
         # tested in sc/qa/uitest/calc_tests4/tdf131170.py
diff --git a/sc/qa/uitest/range_name/tdf137617.py 
b/sc/qa/uitest/range_name/tdf137617.py
new file mode 100644
index 000000000000..78039ff81369
--- /dev/null
+++ b/sc/qa/uitest/range_name/tdf137617.py
@@ -0,0 +1,98 @@
+# -*- 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
+from uitest.uihelper.calc import enter_text_to_cell
+
+class tdf137617(UITestCase):
+
+    def test_tdf137617(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", "Result1")
+        enter_text_to_cell(gridwin, "A2", "Result2")
+
+        gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B2"}))
+
+        self.ui_test.execute_dialog_through_command(".uno:CreateNames")
+
+        xDialog = self.xUITest.getTopFocusWindow()
+
+        # Only left is selected
+        self.assertEqual('true', 
get_state_as_dict(xDialog.getChild('left'))['Selected'])
+        self.assertEqual('false', 
get_state_as_dict(xDialog.getChild('right'))['Selected'])
+        self.assertEqual('false', 
get_state_as_dict(xDialog.getChild('bottom'))['Selected'])
+        self.assertEqual('false', 
get_state_as_dict(xDialog.getChild('top'))['Selected'])
+
+        xOkBtn = xDialog.getChild("ok")
+        self.ui_test.close_dialog_through_button(xOkBtn)
+
+        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B1"}))
+
+        xPosWindow = calcDoc.getChild('pos_window')
+        self.assertEqual('Result1', get_state_as_dict(xPosWindow)['Text'])
+
+        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B2"}))
+
+        self.assertEqual('Result2', get_state_as_dict(xPosWindow)['Text'])
+
+        # Change formula syntax to "Excel R1C1"
+        self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog")
+        xDialogOpt = self.xUITest.getTopFocusWindow()
+
+        xPages = xDialogOpt.getChild("pages")
+        xCalcEntry = xPages.getChild('3')
+        xCalcEntry.executeAction("EXPAND", tuple())
+        xCalcFormulaEntry = xCalcEntry.getChild('4')
+        xCalcFormulaEntry.executeAction("SELECT", tuple())
+
+        xFormulaSyntax = xDialogOpt.getChild('formulasyntax')
+
+        props = {"TEXT": "Excel R1C1"}
+        actionProps = mkPropertyValues(props)
+        xFormulaSyntax.executeAction("SELECT", actionProps)
+
+        xOKBtn = xDialogOpt.getChild("ok")
+        self.ui_test.close_dialog_through_button(xOKBtn)
+
+        enter_text_to_cell(gridwin, "C1", "Result3")
+        enter_text_to_cell(gridwin, "D1", "Result4")
+
+        gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "C1:D2"}))
+
+        self.ui_test.execute_dialog_through_command(".uno:CreateNames")
+
+        xDialog = self.xUITest.getTopFocusWindow()
+
+        # Only top is selected
+        self.assertEqual('false', 
get_state_as_dict(xDialog.getChild('left'))['Selected'])
+        self.assertEqual('false', 
get_state_as_dict(xDialog.getChild('right'))['Selected'])
+        self.assertEqual('false', 
get_state_as_dict(xDialog.getChild('bottom'))['Selected'])
+        self.assertEqual('true', 
get_state_as_dict(xDialog.getChild('top'))['Selected'])
+
+        xOkBtn = xDialog.getChild("ok")
+        self.ui_test.close_dialog_through_button(xOkBtn)
+
+        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C2"}))
+
+        # Without the fix in place, this test would have failed with
+        # AssertionError: 'Result3' != 'R2C3'
+        self.assertEqual('Result3', get_state_as_dict(xPosWindow)['Text'])
+
+        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D2"}))
+
+        self.assertEqual('Result4', get_state_as_dict(xPosWindow)['Text'])
+
+        self.ui_test.close_doc()
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to