summaryrefslogtreecommitdiffstats
path: root/sc/qa/uitest/range_name
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
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')
-rw-r--r--sc/qa/uitest/range_name/create_range_name.py162
-rw-r--r--sc/qa/uitest/range_name/tdf119954.py72
-rw-r--r--sc/qa/uitest/range_name/tdf137617.py101
-rw-r--r--sc/qa/uitest/range_name/tdf138822.py55
-rw-r--r--sc/qa/uitest/range_name/tdf145077.py41
-rw-r--r--sc/qa/uitest/range_name/tdf86214.py58
6 files changed, 489 insertions, 0 deletions
diff --git a/sc/qa/uitest/range_name/create_range_name.py b/sc/qa/uitest/range_name/create_range_name.py
new file mode 100644
index 000000000..f3351326f
--- /dev/null
+++ b/sc/qa/uitest/range_name/create_range_name.py
@@ -0,0 +1,162 @@
+# -*- 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 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):
+
+ def test_create_range_name(self):
+
+ with self.ui_test.create_doc_in_start_center("calc"):
+
+ calcDoc = self.xUITest.getTopFocusWindow()
+ xPosWindow = calcDoc.getChild('pos_window')
+ self.assertEqual('A1', get_state_as_dict(xPosWindow)['Text'])
+
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:AddName", close_button="add") as xAddNameDlg:
+
+
+ xEdit = xAddNameDlg.getChild("edit")
+ type_text(xEdit, "globalRangeName")
+
+
+ self.assertEqual('globalRangeName', get_state_as_dict(xPosWindow)['Text'])
+
+
+ def test_create_range_name_from_ui(self):
+
+ with self.ui_test.create_doc_in_start_center("calc") as document:
+
+ 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")
+
+ enter_text_to_cell(gridwin, "A2", "=SUM(RANGE1)")
+ self.assertEqual(3.0, get_cell_by_position(document, 0, 0, 1).getValue())
+
+ # Change the name
+ with self.ui_test.execute_dialog_through_command(".uno:DefineName") as xDialog:
+ xNamesList = xDialog.getChild('names')
+ self.assertEqual(1, len(xNamesList.getChildren()))
+
+ xName = xDialog.getChild('name')
+ self.assertEqual( 'RANGE1', get_state_as_dict(xName)["Text"])
+
+ xName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xName.executeAction("TYPE", mkPropertyValues({"TEXT":"RANGE2"}))
+
+
+ # tdf#87474 check the formula is updated after changing the name
+ self.assertEqual("=SUM(RANGE2)", get_cell_by_position(document, 0, 0, 1).getFormula())
+
+ self.xUITest.executeCommand(".uno:Undo")
+
+ self.assertEqual("=SUM(RANGE1)", get_cell_by_position(document, 0, 0, 1).getFormula())
+
+
+ def test_create_local_range_name(self):
+
+ with self.ui_test.create_doc_in_start_center("calc") as document:
+
+ calcDoc = self.xUITest.getTopFocusWindow()
+ xPosWindow = calcDoc.getChild('pos_window')
+ self.assertEqual('A1', get_state_as_dict(xPosWindow)['Text'])
+
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:AddName", close_button="add") as xAddNameDlg:
+
+
+ xEdit = xAddNameDlg.getChild("edit")
+ type_text(xEdit, "localRangeName")
+
+ xScope = xAddNameDlg.getChild("scope")
+ select_pos(xScope, "1")
+
+
+ # tdf#67007: Without the fix in place, this test would have failed with
+ # AssertionError: 'localRangeName' != 'A1'
+ # Additionally, newly check a sheet-local scoped name has " (sheetname)" appended.
+ self.assertEqual('localRangeName (Sheet1)', get_state_as_dict(xPosWindow)['Text'])
+
+ gridwin = calcDoc.getChild("grid_window")
+ enter_text_to_cell(gridwin, "A1", "1")
+
+ # Use the name range in the current sheet
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B1"}))
+
+ with self.ui_test.execute_dialog_through_command(".uno:InsertName", close_button="paste") as xDialog:
+
+ xCtrl = xDialog.getChild('ctrl')
+ self.assertEqual(1, len(xCtrl.getChildren()))
+ self.assertEqual("localRangeName\t$Sheet1.$A$1\tSheet1", get_state_as_dict(xCtrl.getChild('0'))['Text'])
+ xCtrl.getChild('0').executeAction("SELECT", tuple())
+
+ # use return key to paste the name range
+ gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
+
+ self.assertEqual("1", get_cell_by_position(document, 0, 1, 0).getString())
+ self.assertEqual("=localRangeName", get_cell_by_position(document, 0, 1, 0).getFormula())
+
+ # Insert a new sheet
+ with self.ui_test.execute_dialog_through_command(".uno:Insert"):
+ pass
+
+ # Use the name range in the new sheet
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B1"}))
+
+ with self.ui_test.execute_dialog_through_command(".uno:InsertName", close_button="paste") as xDialog:
+
+ xCtrl = xDialog.getChild('ctrl')
+ self.assertEqual(1, len(xCtrl.getChildren()))
+ self.assertEqual("localRangeName\t$Sheet1.$A$1\tSheet1", get_state_as_dict(xCtrl.getChild('0'))['Text'])
+ xCtrl.getChild('0').executeAction("SELECT", tuple())
+
+ # use return key to paste the name range
+ gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
+
+ # tdf#137896: Without the fix in place, this test would have failed with
+ # AssertionError: '1' != '#NAME?'
+ self.assertEqual("1", get_cell_by_position(document, 0, 1, 0).getString())
+
+ # and AssertionError: '=Sheet1.localRangeName' != '=localrangename'
+ self.assertEqual("=Sheet1.localRangeName", get_cell_by_position(document, 0, 1, 0).getFormula())
+
+ with self.ui_test.execute_dialog_through_command(".uno:DefineName") as xDialog:
+
+ # tdf#138851: Without the fix in place, this test would have failed with
+ # AssertionError: 'Sheet1' != 'Document (Global)'
+ xScope = xDialog.getChild("scope")
+ self.assertEqual("Sheet1", get_state_as_dict(xScope)['SelectEntryText'])
+
+
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/range_name/tdf119954.py b/sc/qa/uitest/range_name/tdf119954.py
new file mode 100644
index 000000000..8bea8d6c3
--- /dev/null
+++ b/sc/qa/uitest/range_name/tdf119954.py
@@ -0,0 +1,72 @@
+# -*- 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 uitest.uihelper.calc import enter_text_to_cell
+from uitest.uihelper.common import get_url_for_data_file, type_text
+from uitest.uihelper.keyboard import select_all
+
+from libreoffice.calc.document import get_cell_by_position
+from libreoffice.uno.propertyvalue import mkPropertyValues
+
+
+# Bug 119954 - Using a second defined database range in formula expression switches to first range.
+class tdf119954(UITestCase):
+ def test_tdf119954_second_db_range(self):
+ with self.ui_test.load_file(get_url_for_data_file("tdf119954.ods")) as calc_doc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ #* new document
+ #* in A1 enter 1
+ #* in C3 enter 2
+ #* on A1 define a database range 'aaa' with $Sheet1.$A$1
+ #* on C3 define a database range 'bbb' with $Sheet2.$C$3
+ #* in any cell enter formula =bbb
+ # => result is 1 instead of 2
+ #* place cell cursor on that formula cell again
+ # => see that the formula is =aaa instead of =bbb
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:DefineDBName") as xDefineNameDlg:
+ xEntryBox = xDefineNameDlg.getChild("entry")
+ type_text(xEntryBox, "aaa")
+ add = xDefineNameDlg.getChild("add")
+ assign = xDefineNameDlg.getChild("assign")
+ add.executeAction("CLICK", tuple())
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:DefineDBName") as xDefineNameDlg:
+ xEntryBox = xDefineNameDlg.getChild("entry")
+ add = xDefineNameDlg.getChild("add")
+ assign = xDefineNameDlg.getChild("assign")
+ select_all(xEntryBox)
+ type_text(xEntryBox, "bbb")
+ select_all(assign)
+ type_text(assign, "$Sheet2.$C$3")
+ add.executeAction("CLICK", tuple())
+
+ enter_text_to_cell(gridwin, "B2", "=bbb")
+ gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
+ self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 1).getValue(), 2)
+
+ enter_text_to_cell(gridwin, "C2", "=aaa")
+ gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
+ self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 1).getValue(), 1)
+
+ self.xUITest.executeCommand(".uno:Undo")
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 1).getValue(), 0)
+ self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 1).getValue(), 0)
+ self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 2).getFormula(), "")
+ self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 1).getFormula(), "")
+
+ # check cancel button
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:DefineDBName", close_button="cancel"):
+ pass
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
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:
diff --git a/sc/qa/uitest/range_name/tdf138822.py b/sc/qa/uitest/range_name/tdf138822.py
new file mode 100644
index 000000000..d8d72d313
--- /dev/null
+++ b/sc/qa/uitest/range_name/tdf138822.py
@@ -0,0 +1,55 @@
+# -*- 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 uitest.uihelper.common import get_state_as_dict
+from uitest.uihelper.common import type_text
+
+class tdf138822(UITestCase):
+
+ def test_tdf138822(self):
+ with self.ui_test.create_doc_in_start_center("calc"):
+
+ calcDoc = self.xUITest.getTopFocusWindow()
+ xPosWindow = calcDoc.getChild('pos_window')
+ self.assertEqual('A1', get_state_as_dict(xPosWindow)['Text'])
+
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:DefineName", close_button="add"):
+ pass
+
+ xDefineNamesDialog = self.xUITest.getTopFocusWindow()
+
+ xAddBtn = xDefineNamesDialog.getChild("add")
+ self.assertEqual("false", get_state_as_dict(xAddBtn)['Enabled'])
+
+ xEdit = xDefineNamesDialog.getChild("edit")
+ type_text(xEdit, "rangeName")
+
+ self.assertEqual("true", get_state_as_dict(xAddBtn)['Enabled'])
+
+ self.ui_test.close_dialog_through_button(xAddBtn)
+
+ xManageNamesDialog = self.xUITest.getTopFocusWindow()
+
+ xNamesList = xManageNamesDialog.getChild('names')
+ self.assertEqual(1, len(xNamesList.getChildren()))
+ self.assertEqual(get_state_as_dict(xNamesList.getChild('0'))["Text"], "rangeName\t$Sheet1.$A$1\tDocument (Global)")
+
+ xCancelBtn = xManageNamesDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCancelBtn)
+
+ # Open the dialog again
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:DefineName") as xManageNamesDialog:
+
+ xNamesList = xManageNamesDialog.getChild('names')
+
+ # Without the fix in place, this test would have failed with
+ # AssertionError: 0 != 1
+ self.assertEqual(0, len(xNamesList.getChildren()))
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/range_name/tdf145077.py b/sc/qa/uitest/range_name/tdf145077.py
new file mode 100644
index 000000000..38c23c62a
--- /dev/null
+++ b/sc/qa/uitest/range_name/tdf145077.py
@@ -0,0 +1,41 @@
+# -*- 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, get_url_for_data_file
+from uitest.uihelper.common import select_by_text
+
+class tdf145077(UITestCase):
+
+ def test_tdf145077(self):
+
+ with self.ui_test.load_file(get_url_for_data_file("tdf145077.ods")):
+
+ calcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = calcDoc.getChild("grid_window")
+
+ xPosWindow = calcDoc.getChild('pos_window')
+
+ rangeList = ["Players (Team1)", "Points (Team1)", "Winners (Team1)"]
+ expectedSelection = ["Team1.D1:Team1.R1", "Team1.D10:Team1.R10", "Team1.B2:Team1.B9"]
+
+ # Without the fix in place, this test would have failed with
+ # AssertionError: 'Team1.D10:Team1.R10' != 'Team1.D1:Team1.R1'
+ for index, rangeName in enumerate(rangeList):
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B10"}))
+
+ self.assertEqual("Team1.B10:Team1.B10", get_state_as_dict(gridwin)["MarkedArea"])
+
+ select_by_text(xPosWindow, rangeName)
+
+ # Check selection
+ self.assertEqual(expectedSelection[index], get_state_as_dict(gridwin)["MarkedArea"])
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/range_name/tdf86214.py b/sc/qa/uitest/range_name/tdf86214.py
new file mode 100644
index 000000000..8cbed2f00
--- /dev/null
+++ b/sc/qa/uitest/range_name/tdf86214.py
@@ -0,0 +1,58 @@
+# -*- 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 uitest.uihelper.common import type_text, get_state_as_dict
+from uitest.uihelper.keyboard import select_all
+
+
+class InvalidNames(UITestCase):
+
+ def test_invalid_names(self):
+
+ with self.ui_test.create_doc_in_start_center("calc"):
+
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:AddName", close_button="add") as xAddNameDlg:
+
+
+ invalid_names = ["A1", "12", "1.2", "A1:B2", "test.a", \
+ "test+", "test-", "test*", "test!abc", "test#", \
+ "test^", "test°", "test$", "test§", "test%", \
+ "test&", "test/", "test(", "test)", "test[", "test]", \
+ "test\\", "test`", "test´", "test'", "test~", "test<", \
+ "tst>", "test|", "test:t", "test;z"]
+
+ xLabel = xAddNameDlg.getChild("label")
+ xAddBtn = xAddNameDlg.getChild("add")
+ xEdit = xAddNameDlg.getChild("edit")
+
+ success_text = get_state_as_dict(xLabel)["Text"]
+
+ for name in invalid_names:
+ with self.subTest(name = name):
+ select_all(xEdit)
+ type_text(xEdit, name)
+
+ # tdf#132869 - Without the fix in place, this test would have failed with
+ # - Expected: "Invalid name. Start with a letter, use only letters, numbers and underscore."
+ # - Actual : ""
+ self.assertNotEqual(success_text, get_state_as_dict(xEdit)["QuickHelpText"])
+ self.assertEqual(get_state_as_dict(xAddBtn)["Enabled"], "false")
+
+
+ select_all(xEdit)
+ type_text(xEdit, "valid_name")
+
+ self.assertEqual(success_text, get_state_as_dict(xLabel)["Text"])
+ self.assertEqual(success_text, get_state_as_dict(xEdit)["QuickHelpText"])
+ self.assertEqual(get_state_as_dict(xAddBtn)["Enabled"], "true")
+
+
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab: