summaryrefslogtreecommitdiffstats
path: root/sc/qa/uitest/range_name/tdf137617.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
commited5640d8b587fbcfed7dd7967f3de04b37a76f26 (patch)
tree7a5f7c6c9d02226d7471cb3cc8fbbf631b415303 /sc/qa/uitest/range_name/tdf137617.py
parentInitial commit. (diff)
downloadlibreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.tar.xz
libreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.zip
Adding upstream version 4:7.4.7.upstream/4%7.4.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sc/qa/uitest/range_name/tdf137617.py')
-rw-r--r--sc/qa/uitest/range_name/tdf137617.py101
1 files changed, 101 insertions, 0 deletions
diff --git a/sc/qa/uitest/range_name/tdf137617.py b/sc/qa/uitest/range_name/tdf137617.py
new file mode 100644
index 000000000..234cc99f8
--- /dev/null
+++ b/sc/qa/uitest/range_name/tdf137617.py
@@ -0,0 +1,101 @@
+# -*- 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
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from uitest.uihelper.common import get_state_as_dict
+from uitest.uihelper.common import select_by_text
+from uitest.uihelper.calc import enter_text_to_cell
+
+class tdf137617(UITestCase):
+
+ def test_tdf137617(self):
+
+ with 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"}))
+
+ with self.ui_test.execute_dialog_through_command(".uno:CreateNames") as xDialog:
+
+
+ # 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'])
+
+
+ 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"
+ with self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") as xDialogOpt:
+
+ xPages = xDialogOpt.getChild("pages")
+ xCalcEntry = xPages.getChild('3')
+ xCalcEntry.executeAction("EXPAND", tuple())
+ xCalcFormulaEntry = xCalcEntry.getChild('4')
+ xCalcFormulaEntry.executeAction("SELECT", tuple())
+
+ xFormulaSyntax = xDialogOpt.getChild('formulasyntax')
+ select_by_text(xFormulaSyntax, "Excel R1C1")
+
+
+ enter_text_to_cell(gridwin, "C1", "Result3")
+ enter_text_to_cell(gridwin, "D1", "Result4")
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "C1:D2"}))
+
+ with self.ui_test.execute_dialog_through_command(".uno:CreateNames") as xDialog:
+
+
+ # 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'])
+
+
+ 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'])
+
+ # Change formula syntax back to "Calc A1"
+ with self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") as xDialogOpt:
+
+ xPages = xDialogOpt.getChild("pages")
+ xCalcEntry = xPages.getChild('3')
+ xCalcEntry.executeAction("EXPAND", tuple())
+ xCalcFormulaEntry = xCalcEntry.getChild('4')
+ xCalcFormulaEntry.executeAction("SELECT", tuple())
+
+ xFormulaSyntax = xDialogOpt.getChild('formulasyntax')
+ select_by_text(xFormulaSyntax, "Calc A1")
+
+
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab: