summaryrefslogtreecommitdiffstats
path: root/sc/qa/uitest/calc_tests6
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 05:54:39 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 05:54:39 +0000
commit267c6f2ac71f92999e969232431ba04678e7437e (patch)
tree358c9467650e1d0a1d7227a21dac2e3d08b622b2 /sc/qa/uitest/calc_tests6
parentInitial commit. (diff)
downloadlibreoffice-267c6f2ac71f92999e969232431ba04678e7437e.tar.xz
libreoffice-267c6f2ac71f92999e969232431ba04678e7437e.zip
Adding upstream version 4:24.2.0.upstream/4%24.2.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sc/qa/uitest/calc_tests6')
-rw-r--r--sc/qa/uitest/calc_tests6/autoFormat.py69
-rw-r--r--sc/qa/uitest/calc_tests6/autocorrectOptions.py95
-rw-r--r--sc/qa/uitest/calc_tests6/hideShowSheet.py45
-rw-r--r--sc/qa/uitest/calc_tests6/moveCopySheet.py121
-rw-r--r--sc/qa/uitest/calc_tests6/multipleOperations.py118
-rw-r--r--sc/qa/uitest/calc_tests6/scenarios.py45
-rw-r--r--sc/qa/uitest/calc_tests6/shareSpreadsheet.py27
-rw-r--r--sc/qa/uitest/calc_tests6/tdf104378.py33
-rw-r--r--sc/qa/uitest/calc_tests6/tdf107267.py60
-rw-r--r--sc/qa/uitest/calc_tests6/tdf116996.py41
-rw-r--r--sc/qa/uitest/calc_tests6/tdf118638.py54
-rw-r--r--sc/qa/uitest/calc_tests6/tdf121263.py39
-rw-r--r--sc/qa/uitest/calc_tests6/tdf147830.py52
-rw-r--r--sc/qa/uitest/calc_tests6/tdf91726.py50
14 files changed, 849 insertions, 0 deletions
diff --git a/sc/qa/uitest/calc_tests6/autoFormat.py b/sc/qa/uitest/calc_tests6/autoFormat.py
new file mode 100644
index 0000000000..e5ff72f073
--- /dev/null
+++ b/sc/qa/uitest/calc_tests6/autoFormat.py
@@ -0,0 +1,69 @@
+# -*- 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 libreoffice.uno.propertyvalue import mkPropertyValues
+#uitest sc / AutoFormat Styles
+
+class autoFormat(UITestCase):
+ def test_autoformat_styles(self):
+ with self.ui_test.create_doc_in_start_center("calc"):
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ #select A1:C5
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C5"}))
+ #AutoFormat Styles
+ with self.ui_test.execute_dialog_through_command(".uno:AutoFormat") as xDialog:
+
+ formatlb = xDialog.getChild("formatlb")
+ numformatcb = xDialog.getChild("numformatcb")
+ bordercb = xDialog.getChild("bordercb")
+ fontcb = xDialog.getChild("fontcb")
+ patterncb = xDialog.getChild("patterncb")
+ alignmentcb = xDialog.getChild("alignmentcb")
+ autofitcb = xDialog.getChild("autofitcb")
+
+ entry = formatlb.getChild("7") #Financial
+ entry.executeAction("SELECT", tuple())
+ numformatcb.executeAction("CLICK", tuple())
+ bordercb.executeAction("CLICK", tuple())
+ fontcb.executeAction("CLICK", tuple())
+ patterncb.executeAction("CLICK", tuple())
+ alignmentcb.executeAction("CLICK", tuple())
+ autofitcb.executeAction("CLICK", tuple())
+
+
+ #verify
+ with self.ui_test.execute_dialog_through_command(".uno:AutoFormat") as xDialog:
+
+ formatlb = xDialog.getChild("formatlb")
+ numformatcb = xDialog.getChild("numformatcb")
+ bordercb = xDialog.getChild("bordercb")
+ fontcb = xDialog.getChild("fontcb")
+ patterncb = xDialog.getChild("patterncb")
+ alignmentcb = xDialog.getChild("alignmentcb")
+ autofitcb = xDialog.getChild("autofitcb")
+
+ entry = formatlb.getChild("7") #Financial
+ entry.executeAction("SELECT", tuple())
+ self.assertEqual(get_state_as_dict(numformatcb)["Selected"], "false")
+ self.assertEqual(get_state_as_dict(bordercb)["Selected"], "false")
+ self.assertEqual(get_state_as_dict(fontcb)["Selected"], "false")
+ self.assertEqual(get_state_as_dict(patterncb)["Selected"], "false")
+ self.assertEqual(get_state_as_dict(alignmentcb)["Selected"], "false")
+ self.assertEqual(get_state_as_dict(autofitcb)["Selected"], "false")
+ numformatcb.executeAction("CLICK", tuple())
+ bordercb.executeAction("CLICK", tuple())
+ fontcb.executeAction("CLICK", tuple())
+ patterncb.executeAction("CLICK", tuple())
+ alignmentcb.executeAction("CLICK", tuple())
+ autofitcb.executeAction("CLICK", tuple())
+
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests6/autocorrectOptions.py b/sc/qa/uitest/calc_tests6/autocorrectOptions.py
new file mode 100644
index 0000000000..e626ad93f4
--- /dev/null
+++ b/sc/qa/uitest/calc_tests6/autocorrectOptions.py
@@ -0,0 +1,95 @@
+# -*- 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_pos
+
+class autocorrectOptions(UITestCase):
+
+ def test_autocorrect_options_calc(self):
+ with self.ui_test.create_doc_in_start_center("calc"):
+ with self.ui_test.execute_dialog_through_command(".uno:AutoCorrectDlg", close_button="cancel") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "0") #tab replace
+ origtext = xDialog.getChild("origtext")
+ newtext = xDialog.getChild("newtext")
+ xnew = xDialog.getChild("new")
+ xdelete = xDialog.getChild("delete")
+ xtabview = xDialog.getChild("tabview")
+ nrRows = get_state_as_dict(xtabview)["VisibleCount"]
+
+ self.assertTrue(int(nrRows) > 0)
+
+ #add new rule
+ origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ origtext.executeAction("TYPE", mkPropertyValues({"TEXT":"::::"}))
+ newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ newtext.executeAction("TYPE", mkPropertyValues({"TEXT":"dvojtecky"}))
+ xnew.executeAction("CLICK", tuple())
+ nrRowsNew = get_state_as_dict(xtabview)["VisibleCount"]
+ nrRowsDiff = int(nrRowsNew) - int(nrRows)
+ self.assertEqual(nrRowsDiff, 1) #we have +1 rule
+ #delete rule
+ origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ origtext.executeAction("TYPE", mkPropertyValues({"TEXT":"::::"}))
+ newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ newtext.executeAction("TYPE", mkPropertyValues({"TEXT":"dvojtecky"}))
+ xdelete.executeAction("CLICK", tuple())
+ self.assertEqual(get_state_as_dict(xtabview)["VisibleCount"], nrRows) #we have default nr of rules
+
+ select_pos(xTabs, "1") #tab Exceptions
+ #abbreviations
+ abbrev = xDialog.getChild("abbrev")
+ newabbrev = xDialog.getChild("newabbrev")
+ delabbrev = xDialog.getChild("delabbrev")
+ abbrevlist = xDialog.getChild("abbrevlist")
+
+ nrRowsAbb = get_state_as_dict(abbrevlist)["VisibleCount"]
+
+ self.assertTrue(int(nrRowsAbb) > 0)
+
+ abbrev.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ abbrev.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ abbrev.executeAction("TYPE", mkPropertyValues({"TEXT":"qqqqq"}))
+ newabbrev.executeAction("CLICK", tuple())
+ nrRowsAbbNew = get_state_as_dict(abbrevlist)["VisibleCount"]
+ nrRowsAbbDiff = int(nrRowsAbbNew) - int(nrRowsAbb)
+ self.assertEqual(nrRowsAbbDiff, 1) #we have +1 rule
+ delabbrev.executeAction("CLICK", tuple())
+ self.assertEqual(get_state_as_dict(abbrevlist)["VisibleCount"], nrRowsAbb) #we have default nr of rules
+
+ #words with two initial capitals
+ double = xDialog.getChild("double")
+ newdouble = xDialog.getChild("newdouble")
+ deldouble = xDialog.getChild("deldouble")
+ doublelist = xDialog.getChild("doublelist")
+
+ nrRowsDouble = get_state_as_dict(doublelist)["VisibleCount"]
+
+ self.assertTrue(int(nrRowsDouble) > 0)
+
+ double.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ double.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ double.executeAction("TYPE", mkPropertyValues({"TEXT":"QQqqq"}))
+ newdouble.executeAction("CLICK", tuple())
+ nrRowsDoubleNew = get_state_as_dict(doublelist)["VisibleCount"]
+ nrRowsDoubleDiff = int(nrRowsDoubleNew) - int(nrRowsDouble) #convert string and
+ self.assertEqual(nrRowsDoubleDiff, 1) #we have +1 rule
+ deldouble.executeAction("CLICK", tuple())
+ self.assertEqual(get_state_as_dict(doublelist)["VisibleCount"], nrRowsDouble) #we have default nr of rules
+
+
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests6/hideShowSheet.py b/sc/qa/uitest/calc_tests6/hideShowSheet.py
new file mode 100644
index 0000000000..3f34fca1a1
--- /dev/null
+++ b/sc/qa/uitest/calc_tests6/hideShowSheet.py
@@ -0,0 +1,45 @@
+# -*- 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 libreoffice.uno.propertyvalue import mkPropertyValues
+#uitest sc / Show sheet dialog
+
+class hideShowSheet(UITestCase):
+ def test_hide_show_sheet(self):
+ with self.ui_test.create_doc_in_start_center("calc"):
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ #insert sheet
+ with self.ui_test.execute_dialog_through_command(".uno:Insert"):
+ pass
+ #select sheet
+ gridwin.executeAction("SELECT", mkPropertyValues({"TABLE":"1"}))
+ self.assertEqual(get_state_as_dict(gridwin)["SelectedTable"], "1")
+ #hide sheet
+ self.xUITest.executeCommand(".uno:Hide")
+ #show sheet Dialog
+ with self.ui_test.execute_dialog_through_command(".uno:Show", close_button="cancel") as xDialog:
+ treeview = xDialog.getChild("treeview")
+ self.assertEqual(get_state_as_dict(treeview)["Children"], "1")
+ #insert 2nd sheet
+ with self.ui_test.execute_dialog_through_command(".uno:Insert"):
+ pass
+ #select sheet
+ gridwin.executeAction("SELECT", mkPropertyValues({"TABLE":"2"}))
+ self.assertEqual(get_state_as_dict(gridwin)["SelectedTable"], "1")
+ #hide sheet
+ self.xUITest.executeCommand(".uno:Hide")
+ #show sheet Dialog
+ with self.ui_test.execute_dialog_through_command(".uno:Show", close_button="cancel") as xDialog:
+ treeview = xDialog.getChild("treeview")
+ self.assertEqual(get_state_as_dict(treeview)["Children"], "2")
+
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests6/moveCopySheet.py b/sc/qa/uitest/calc_tests6/moveCopySheet.py
new file mode 100644
index 0000000000..5b21e6e86c
--- /dev/null
+++ b/sc/qa/uitest/calc_tests6/moveCopySheet.py
@@ -0,0 +1,121 @@
+# -*- 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 libreoffice.uno.propertyvalue import mkPropertyValues
+#uitest sc - move/copy sheet dialog
+
+class moveCopySheet(UITestCase):
+ def test_copy_move_sheet(self):
+ with self.ui_test.create_doc_in_start_center("calc") as document:
+ #default - 1 sheet; select the sheet (is selected), dialog move/copy sheet
+ with self.ui_test.execute_dialog_through_command(".uno:Move") as xDialog:
+ #new name = newName
+ newName = xDialog.getChild("newName")
+ newName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ newName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ newName.executeAction("TYPE", mkPropertyValues({"TEXT":"newName"}))
+ #verify, the file has 2 sheets; first one "newName" is selected
+ self.assertEqual(document.Sheets.getCount(), 2)
+ # dialog move/copy sheet ; Copy is selected; Select move and -move to end position - ; New Name = moveName
+ with self.ui_test.execute_dialog_through_command(".uno:Move") as xDialog:
+ xMoveButton = xDialog.getChild("move")
+ xMoveButton.executeAction("CLICK", tuple())
+ insertBefore = xDialog.getChild("insertBefore")
+
+ xTreeEntry = insertBefore.getChild('2')
+ xTreeEntry.executeAction("SELECT", tuple())
+
+ newName = xDialog.getChild("newName")
+ self.assertEqual(get_state_as_dict(newName)["Text"], "newName")
+ newName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ newName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ newName.executeAction("TYPE", mkPropertyValues({"TEXT":"moveName"}))
+ # Verify, the file has 2 sheets; first one is "Sheet1" ; second one is "moveName"
+ self.assertEqual(document.Sheets.getCount(), 2)
+
+ self.assertEqual(document.Sheets[0].Name, "Sheet1")
+ self.assertEqual(document.Sheets[1].Name, "moveName")
+
+ # Verify that the cancel button does not do anything
+ with self.ui_test.execute_dialog_through_command(".uno:Move", close_button="cancel"):
+ pass
+
+ self.assertEqual(document.Sheets.getCount(), 2)
+ self.assertEqual(document.Sheets[0].Name, "Sheet1")
+ self.assertEqual(document.Sheets[1].Name, "moveName")
+
+ #Check copy option
+ with self.ui_test.execute_dialog_through_command(".uno:Move") as xDialog:
+ xCopy = xDialog.getChild("copy")
+ xCopy.executeAction("CLICK", tuple())
+ sheetName = "moveName_2"
+ newName = xDialog.getChild("newName")
+ self.assertEqual(get_state_as_dict(newName)["Text"], sheetName)
+
+
+ self.assertEqual(document.Sheets.getCount(), 3)
+ self.assertEqual(document.Sheets[0].Name, sheetName)
+ self.assertEqual(document.Sheets[1].Name, "Sheet1")
+ self.assertEqual(document.Sheets[2].Name, "moveName")
+
+ # tdf#56973 - copy/paste (single) sheet is checked but not enabled
+ def test_tdf56973_copy_paste_inactive(self):
+ with self.ui_test.create_doc_in_start_center("calc"):
+ with self.ui_test.execute_dialog_through_command(".uno:Move") as xDialog:
+ # A single sheet can only be copied
+ xCopyButton = xDialog.getChild("copy")
+ self.assertEqual(get_state_as_dict(xCopyButton)["Checked"], "true")
+ self.assertEqual(get_state_as_dict(xCopyButton)["Enabled"], "true")
+ # A single sheet can not be moved
+ xMoveButton = xDialog.getChild("move")
+ self.assertEqual(get_state_as_dict(xMoveButton)["Checked"], "false")
+ self.assertEqual(get_state_as_dict(xMoveButton)["Enabled"], "false")
+
+ # tdf#96854 - remember last used option for copy/move sheet
+ def test_tdf96854_remember_copy_move_option(self):
+ with self.ui_test.create_doc_in_start_center("calc"):
+ # Add a second sheet to the calc document
+ with self.ui_test.execute_dialog_through_command(".uno:Move") as xDialog:
+ pass
+
+ # Check if the copy option was remembered
+ with self.ui_test.execute_dialog_through_command(".uno:Move") as xDialog:
+ xCopyButton = xDialog.getChild("copy")
+ self.assertEqual(get_state_as_dict(xCopyButton)["Checked"], "true")
+ xMoveButton = xDialog.getChild("move")
+ self.assertEqual(get_state_as_dict(xMoveButton)["Checked"], "false")
+ # Move selected sheet and check if option was remembered
+ xMoveButton.executeAction("CLICK", tuple())
+
+ # Check if move option was remembered
+ with self.ui_test.execute_dialog_through_command(".uno:Move") as xDialog:
+ xCopyButton = xDialog.getChild("copy")
+ self.assertEqual(get_state_as_dict(xCopyButton)["Checked"], "false")
+ xMoveButton = xDialog.getChild("move")
+ self.assertEqual(get_state_as_dict(xMoveButton)["Checked"], "true")
+
+ #tdf#139464 Set OK button label to selected action: Move or Copy
+ def test_tdf139464_move_sheet(self):
+ with self.ui_test.create_doc_in_start_center("calc"):
+ with self.ui_test.execute_dialog_through_command(".uno:Move") as xDialog:
+ xOkButton = xDialog.getChild("ok")
+ xCopyButton = xDialog.getChild("copy")
+ self.assertEqual(get_state_as_dict(xCopyButton)['Text'], get_state_as_dict(xOkButton)['Text'])
+ with self.ui_test.execute_dialog_through_command(".uno:Move") as xDialog:
+ xOkButton = xDialog.getChild("ok")
+ xCopyButton = xDialog.getChild("copy")
+ xMoveButton = xDialog.getChild("move")
+ self.assertEqual(get_state_as_dict(xCopyButton)['Text'], get_state_as_dict(xOkButton)['Text'])
+ xMoveButton.executeAction("CLICK", tuple())
+ self.assertEqual(get_state_as_dict(xMoveButton)['Text'], get_state_as_dict(xOkButton)['Text'])
+ xCopyButton.executeAction("CLICK", tuple())
+ self.assertEqual(get_state_as_dict(xCopyButton)['Text'], get_state_as_dict(xOkButton)['Text'])
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests6/multipleOperations.py b/sc/qa/uitest/calc_tests6/multipleOperations.py
new file mode 100644
index 0000000000..a796016a83
--- /dev/null
+++ b/sc/qa/uitest/calc_tests6/multipleOperations.py
@@ -0,0 +1,118 @@
+# -*- 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 libreoffice.calc.document import get_cell_by_position
+from uitest.uihelper.calc import enter_text_to_cell
+
+#https://www.linuxtopia.org/online_books/office_guides/openoffice_3_calc_user_guide/openoffice_calc_Multiple_operations_Multiple_operations_in_columns_or_rows.html
+
+class multipleOperations(UITestCase):
+
+ def test_multiple_operations_one_variable(self):
+ with self.ui_test.create_doc_in_start_center("calc") as document:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ xGridWindow = xCalcDoc.getChild("grid_window")
+
+ #enter data
+ enter_text_to_cell(xGridWindow, "B1", "10")
+ enter_text_to_cell(xGridWindow, "B2", "2")
+ enter_text_to_cell(xGridWindow, "B3", "10000")
+ enter_text_to_cell(xGridWindow, "B4", "2000")
+ enter_text_to_cell(xGridWindow, "B5", "=B4*(B1-B2)-B3")
+
+ enter_text_to_cell(xGridWindow, "D2", "500")
+ enter_text_to_cell(xGridWindow, "D3", "1000")
+ enter_text_to_cell(xGridWindow, "D4", "1500")
+ enter_text_to_cell(xGridWindow, "D5", "2000")
+ enter_text_to_cell(xGridWindow, "D6", "2500")
+ enter_text_to_cell(xGridWindow, "D7", "3000")
+ enter_text_to_cell(xGridWindow, "D8", "3500")
+ enter_text_to_cell(xGridWindow, "D9", "4000")
+ enter_text_to_cell(xGridWindow, "D10", "4500")
+ enter_text_to_cell(xGridWindow, "D11", "5000")
+ #Select the range D2:E11
+ xGridWindow.executeAction("SELECT", mkPropertyValues({"RANGE": "D2:E11"}))
+ #Choose Data > Multiple Operations.
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:TableOperationDialog") as xDialog:
+ #Formulas = B5 ; Column input cell = B4
+ formulas = xDialog.getChild("formulas")
+ col = xDialog.getChild("col")
+ formulas.executeAction("TYPE", mkPropertyValues({"TEXT":"$B$5"}))
+ col.executeAction("TYPE", mkPropertyValues({"TEXT":"$B$4"}))
+ #verify
+ self.assertEqual(get_cell_by_position(document, 0, 4, 1).getValue(), -6000)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 2).getValue(), -2000)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 3).getValue(), 2000)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 4).getValue(), 6000)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 5).getValue(), 10000)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 6).getValue(), 14000)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 7).getValue(), 18000)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 8).getValue(), 22000)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 9).getValue(), 26000)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 10).getValue(), 30000)
+
+ def test_multiple_operations_several_formulas(self):
+ with self.ui_test.create_doc_in_start_center("calc") as document:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ xGridWindow = xCalcDoc.getChild("grid_window")
+
+ #enter data
+ enter_text_to_cell(xGridWindow, "B1", "10")
+ enter_text_to_cell(xGridWindow, "B2", "2")
+ enter_text_to_cell(xGridWindow, "B3", "10000")
+ enter_text_to_cell(xGridWindow, "B4", "2000")
+ enter_text_to_cell(xGridWindow, "B5", "=B4*(B1-B2)-B3")
+ enter_text_to_cell(xGridWindow, "C5", "=B5/B4")
+
+ enter_text_to_cell(xGridWindow, "D2", "500")
+ enter_text_to_cell(xGridWindow, "D3", "1000")
+ enter_text_to_cell(xGridWindow, "D4", "1500")
+ enter_text_to_cell(xGridWindow, "D5", "2000")
+ enter_text_to_cell(xGridWindow, "D6", "2500")
+ enter_text_to_cell(xGridWindow, "D7", "3000")
+ enter_text_to_cell(xGridWindow, "D8", "3500")
+ enter_text_to_cell(xGridWindow, "D9", "4000")
+ enter_text_to_cell(xGridWindow, "D10", "4500")
+ enter_text_to_cell(xGridWindow, "D11", "5000")
+ #Select the range D2:F11
+ xGridWindow.executeAction("SELECT", mkPropertyValues({"RANGE": "D2:F11"}))
+ #Choose Data > Multiple Operations.
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:TableOperationDialog") as xDialog:
+ #Formulas = B5 ; Column input cell = B4
+ formulas = xDialog.getChild("formulas")
+ col = xDialog.getChild("col")
+ formulas.executeAction("TYPE", mkPropertyValues({"TEXT":"$B$5:$C$5"}))
+ col.executeAction("TYPE", mkPropertyValues({"TEXT":"$B$4"}))
+ #verify
+ self.assertEqual(get_cell_by_position(document, 0, 4, 1).getValue(), -6000)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 2).getValue(), -2000)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 3).getValue(), 2000)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 4).getValue(), 6000)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 5).getValue(), 10000)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 6).getValue(), 14000)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 7).getValue(), 18000)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 8).getValue(), 22000)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 9).getValue(), 26000)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 10).getValue(), 30000)
+
+ self.assertEqual(get_cell_by_position(document, 0, 5, 1).getValue(), -12)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 2).getValue(), -2)
+ self.assertEqual(round(get_cell_by_position(document, 0, 5, 3).getValue(),2), 1.33)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 4).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 5).getValue(), 4)
+ self.assertEqual(round(get_cell_by_position(document, 0, 5, 6).getValue(),2), 4.67)
+ self.assertEqual(round(get_cell_by_position(document, 0, 5, 7).getValue(),2), 5.14)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 8).getValue(), 5.5)
+ self.assertEqual(round(get_cell_by_position(document, 0, 5, 9).getValue(),2), 5.78)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 10).getValue(), 6)
+
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests6/scenarios.py b/sc/qa/uitest/calc_tests6/scenarios.py
new file mode 100644
index 0000000000..583c0b1ce5
--- /dev/null
+++ b/sc/qa/uitest/calc_tests6/scenarios.py
@@ -0,0 +1,45 @@
+# -*- 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.calc import enter_text_to_cell
+
+# uitest Tools - Scenarios
+
+class scenarios(UITestCase):
+
+ def test_scenarios(self):
+ with self.ui_test.create_doc_in_start_center("calc"):
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ xGridWindow = xCalcDoc.getChild("grid_window")
+
+ #fill B1:B4 with 1, select B1:B4;
+ enter_text_to_cell(xGridWindow, "B1", "1")
+ enter_text_to_cell(xGridWindow, "B2", "1")
+ enter_text_to_cell(xGridWindow, "B3", "1")
+ enter_text_to_cell(xGridWindow, "B4", "1")
+ xGridWindow.executeAction("SELECT", mkPropertyValues({"RANGE": "B1:B4"}))
+ #scenarios - scenario A1
+ with self.ui_test.execute_dialog_through_command(".uno:ScenarioManager") as xDialog:
+
+ name = xDialog.getChild("name")
+ name.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ name.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ name.executeAction("TYPE", mkPropertyValues({"TEXT":"A1"}))
+
+ #next scenarios - scenario B1
+ with self.ui_test.execute_dialog_through_command(".uno:ScenarioManager") as xDialog:
+
+ name = xDialog.getChild("name")
+ name.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ name.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ name.executeAction("TYPE", mkPropertyValues({"TEXT":"B1"}))
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests6/shareSpreadsheet.py b/sc/qa/uitest/calc_tests6/shareSpreadsheet.py
new file mode 100644
index 0000000000..265d4a2d14
--- /dev/null
+++ b/sc/qa/uitest/calc_tests6/shareSpreadsheet.py
@@ -0,0 +1,27 @@
+# -*- 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
+
+#just open dialog, select Share, check name and cancel [save not allowed in uitest]
+
+class shareSpreadsheet(UITestCase):
+
+ def test_share_spreadsheet(self):
+ with self.ui_test.create_doc_in_start_center("calc"):
+ #dialog shareSpreadsheet
+ with self.ui_test.execute_dialog_through_command(".uno:ShareDocument", close_button="cancel") as xDialog:
+
+ share = xDialog.getChild("share")
+ share.executeAction("CLICK", tuple())
+ users = xDialog.getChild("users")
+ self.assertEqual(get_state_as_dict(users)["Children"], "1")
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests6/tdf104378.py b/sc/qa/uitest/calc_tests6/tdf104378.py
new file mode 100644
index 0000000000..3f1eaa8190
--- /dev/null
+++ b/sc/qa/uitest/calc_tests6/tdf104378.py
@@ -0,0 +1,33 @@
+# -*- 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 libreoffice.calc.document import get_cell_by_position
+
+class tdf104378(UITestCase):
+
+ def test_tdf104378(self):
+ with self.ui_test.create_doc_in_start_center("calc") as document:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+
+ enter_text_to_cell(gridwin, "A1", "遠程MySQL連接遠程MySQL連接遠程MySQL連接")
+
+ with self.ui_test.execute_dialog_through_command(".uno:ChineseConversion"):
+ pass
+
+
+ # Without the fix in place, this test would have failed with
+ # - 远程MySQL連接遠程MySQL連接遠程MySQL連接
+ # + 远程MySQL连接远程MySQL连接远程MySQL连接
+ self.assertEqual(get_cell_by_position(
+ document, 0, 0, 0).getString(), "远程MySQL连接远程MySQL连接远程MySQL连接")
+
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests6/tdf107267.py b/sc/qa/uitest/calc_tests6/tdf107267.py
new file mode 100644
index 0000000000..8ff9a19baa
--- /dev/null
+++ b/sc/qa/uitest/calc_tests6/tdf107267.py
@@ -0,0 +1,60 @@
+# -*- 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 libreoffice.calc.document import get_cell_by_position
+from uitest.uihelper.common import select_pos
+from uitest.uihelper.common import get_url_for_data_file, get_state_as_dict
+
+#Bug 107267 - During a sub-total calculation or sum, the data set is not computed well.
+class Subtotals(UITestCase):
+
+
+ def test_tdf107267(self):
+ with self.ui_test.load_file(get_url_for_data_file("tdf107267.ods")) as calc_doc:
+ XcalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = XcalcDoc.getChild("grid_window")
+ # 1. Open the test file
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:F123"}))
+ # 2. Data->Subtotals
+ with self.ui_test.execute_dialog_through_command(".uno:DataSubTotals") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+
+ select_pos(xTabs, "0")
+ xGroupBy1 = xDialog.getChild("group_by1")
+ self.assertEqual("Person Number", get_state_as_dict(xGroupBy1)["SelectEntryText"])
+
+ xColumns1 = xDialog.getChild("columns1")
+ self.assertEqual("shipping time", get_state_as_dict(xColumns1)["SelectEntryText"])
+
+ select_pos(xTabs, "1")
+ xGroupBy2 = xDialog.getChild("group_by2")
+ self.assertEqual("Person Number", get_state_as_dict(xGroupBy2)["SelectEntryText"])
+
+ xColumns2 = xDialog.getChild("columns2")
+ self.assertEqual("shipping time", get_state_as_dict(xColumns2)["SelectEntryText"])
+
+ select_pos(xTabs, "2")
+ xGroupBy3 = xDialog.getChild("group_by3")
+ self.assertEqual("Person Number", get_state_as_dict(xGroupBy3)["SelectEntryText"])
+
+ xColumns3 = xDialog.getChild("columns3")
+ self.assertEqual("shipping time", get_state_as_dict(xColumns3)["SelectEntryText"])
+
+ #verify
+ self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 141).getString(), "Grand Average")
+ self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 142).getString(), "Grand Min")
+ self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 143).getString(), "Grand Max")
+
+ self.assertEqual(round(get_cell_by_position(calc_doc, 0, 5, 141).getValue(), 13), 3.3852459016393)
+ self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 142).getValue(), 0)
+ self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 143).getValue(), 26)
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests6/tdf116996.py b/sc/qa/uitest/calc_tests6/tdf116996.py
new file mode 100644
index 0000000000..d6b21115c5
--- /dev/null
+++ b/sc/qa/uitest/calc_tests6/tdf116996.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 uitest.uihelper.common import get_state_as_dict
+
+#Bug 116996 - Crash recover on selecting Tools -> Options -> Advanced: Enable experimental features
+
+class tdf116996(UITestCase):
+
+ def change_experimental_features(self, enabled):
+ with self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog", close_button="") as xDialogOpt:
+ xPages = xDialogOpt.getChild("pages")
+ xLOEntry = xPages.getChild('0') # Libreoffice
+ xLOEntry.executeAction("EXPAND", tuple())
+ xAdvancedEntry = xLOEntry.getChild('10')
+ xAdvancedEntry.executeAction("SELECT", tuple()) #Libreoffice / Advanced
+ xexperimental = xDialogOpt.getChild("experimental")
+ if get_state_as_dict(xexperimental)['Selected'] != enabled:
+ xexperimental.executeAction("CLICK", tuple()) #enable experimental features
+
+ self.assertEqual(get_state_as_dict(xexperimental)["Selected"], enabled)
+
+ xOKBtn = xDialogOpt.getChild("ok")
+
+ with self.ui_test.execute_blocking_action(xOKBtn.executeAction, args=('CLICK', ()), close_button="no"):
+ pass
+
+ def test_tdf116996_enable_experimental_feature(self):
+ with self.ui_test.create_doc_in_start_center("calc"):
+ try:
+ self.change_experimental_features("true")
+ finally:
+ self.change_experimental_features("false")
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests6/tdf118638.py b/sc/qa/uitest/calc_tests6/tdf118638.py
new file mode 100644
index 0000000000..c928aa3884
--- /dev/null
+++ b/sc/qa/uitest/calc_tests6/tdf118638.py
@@ -0,0 +1,54 @@
+# -*- 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 libreoffice.calc.document import get_cell_by_position
+from uitest.uihelper.common import select_pos
+from uitest.uihelper.common import select_by_text
+from uitest.uihelper.common import get_url_for_data_file
+#Bug 118638 - subtotal option loses doesn't contain existing format for column
+class Subtotals(UITestCase):
+
+
+ def test_tdf118638_subtotal_format(self):
+ with self.ui_test.load_file(get_url_for_data_file("tdf118638.ods")) as calc_doc:
+ XcalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = XcalcDoc.getChild("grid_window")
+ # Open the test file
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B15"}))
+ #Data->Subtotals
+ with self.ui_test.execute_dialog_through_command(".uno:DataSubTotals") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "0")
+ xGroupBy = xDialog.getChild("group_by1")
+ select_by_text(xGroupBy, "Store Name")
+ xCheckListMenu = xDialog.getChild("grid1")
+ xTreeList = xCheckListMenu.getChild("columns1")
+ xEntry = xTreeList.getChild("1")
+ xEntry.executeAction("CLICK", tuple())
+
+ #use the SUM function
+ # xfunctions = xDialog.getChild("functions")
+ # propsF = {"TEXT": "Sum"}
+ # actionPropsF = mkPropertyValues(propsF)
+ # xfunctions.executeAction("SELECT", actionPropsF)
+
+
+ #verify
+ self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 15).getString(), "5408 Sum")
+ self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 16).getString(), "Grand Sum")
+
+ self.assertEqual(round(get_cell_by_position(calc_doc, 0, 1, 15).getValue(),12), 238.89)
+ self.assertEqual(round(get_cell_by_position(calc_doc, 0, 1, 16).getValue(),12), 238.89)
+
+ self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 15).getString(), "$238.89")
+ self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 16).getString(), "$238.89")
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests6/tdf121263.py b/sc/qa/uitest/calc_tests6/tdf121263.py
new file mode 100644
index 0000000000..3b663c4ddf
--- /dev/null
+++ b/sc/qa/uitest/calc_tests6/tdf121263.py
@@ -0,0 +1,39 @@
+# -*- 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 get_state_as_dict
+
+class tdf121263(UITestCase):
+
+ def test_tdf121263_hide_more_sheets(self):
+ with self.ui_test.create_doc_in_start_center("calc"):
+ xTopWindow = self.xUITest.getTopFocusWindow()
+ gridwin = xTopWindow.getChild("grid_window")
+
+ with self.ui_test.execute_dialog_through_command(".uno:Insert"):
+ pass
+ with self.ui_test.execute_dialog_through_command(".uno:Insert"):
+ pass
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"TABLE": "2"}))
+ #select previous sheet
+ self.xUITest.executeCommand(".uno:JumpToPrevTableSel")
+
+ #hide sheet
+ self.xUITest.executeCommand(".uno:Hide")
+
+ #show sheet Dialog
+ with self.ui_test.execute_dialog_through_command(".uno:Show", close_button="cancel") as xDialog:
+ treeview = xDialog.getChild("treeview")
+ self.assertEqual(get_state_as_dict(treeview)["Children"], "2")
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests6/tdf147830.py b/sc/qa/uitest/calc_tests6/tdf147830.py
new file mode 100644
index 0000000000..521cca6595
--- /dev/null
+++ b/sc/qa/uitest/calc_tests6/tdf147830.py
@@ -0,0 +1,52 @@
+# -*- 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_url_for_data_file, get_state_as_dict, select_by_text
+from libreoffice.calc.document import is_row_hidden
+
+class tdf147830(UITestCase):
+
+ def test_tdf147830(self):
+
+ with self.ui_test.load_file(get_url_for_data_file("tdf147830.ods")) as calc_doc:
+
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterSpecialFilter") as xDialog:
+ xFilterArea = xDialog.getChild("lbfilterarea")
+ self.assertEqual("- undefined -", get_state_as_dict(xFilterArea)["SelectEntryText"])
+ self.assertEqual("5", get_state_as_dict(xFilterArea)["EntryCount"])
+
+ select_by_text(xFilterArea, "Irgendwo")
+
+ xEditFilterArea = xDialog.getChild("edfilterarea")
+ self.assertEqual("$Filterkriterien.$A$40:$AMF$60", get_state_as_dict(xEditFilterArea)["Text"])
+
+ # Without the fix in place, this test would have crashed here
+
+ self.assertFalse(is_row_hidden(calc_doc, 0))
+ for i in range(1, 17):
+ self.assertTrue(is_row_hidden(calc_doc, i))
+
+ self.assertFalse(is_row_hidden(calc_doc, 17))
+ self.assertTrue(is_row_hidden(calc_doc, 18))
+ self.assertTrue(is_row_hidden(calc_doc, 19))
+ self.assertTrue(is_row_hidden(calc_doc, 20))
+
+ for i in range(21, 26):
+ self.assertFalse(is_row_hidden(calc_doc, i))
+
+ self.assertTrue(is_row_hidden(calc_doc, 27))
+ self.assertFalse(is_row_hidden(calc_doc, 28))
+ self.assertFalse(is_row_hidden(calc_doc, 29))
+
+ self.xUITest.executeCommand(".uno:Undo")
+
+ for i in range(30):
+ self.assertFalse(is_row_hidden(calc_doc, i))
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests6/tdf91726.py b/sc/qa/uitest/calc_tests6/tdf91726.py
new file mode 100644
index 0000000000..4c6ff5b0f0
--- /dev/null
+++ b/sc/qa/uitest/calc_tests6/tdf91726.py
@@ -0,0 +1,50 @@
+# -*- 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 libreoffice.uno.propertyvalue import mkPropertyValues
+#Bug 91726 - AutoFormat: Crash when using an existing name for a new preset
+
+class tdf91726(UITestCase):
+ def test_tdf91726_new_style(self):
+ with self.ui_test.create_doc_in_start_center("calc"):
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ #select A1:E9
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:E9"}))
+ #AutoFormat Styles
+ with self.ui_test.execute_dialog_through_command(".uno:AutoFormat", close_button="") as xDialog:
+ #add new style "Default"
+ xadd = xDialog.getChild("add")
+
+ # Use empty close_button to open consecutive dialogs
+ with self.ui_test.execute_blocking_action(
+ xadd.executeAction, args=('CLICK', ()), close_button="") as dialog:
+ nameEntry = dialog.getChild("name_entry")
+ nameEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"Default"}))
+ xOKBtn = dialog.getChild("ok")
+
+ with self.ui_test.execute_blocking_action(
+ xOKBtn.executeAction, args=('CLICK', ()), close_button="") as dialog2:
+ #Error message: You have entered an invalid name.
+ #AutoFormat could not be created.
+ #Try again using a different name.
+ xOKBtn2 = dialog2.getChild("ok")
+
+ with self.ui_test.execute_blocking_action(
+ xOKBtn2.executeAction, args=('CLICK', ()), close_button="cancel") as dialog3:
+ nameEntry = dialog3.getChild("name_entry")
+ #back to name dialog, LO should not crash
+ self.assertEqual(get_state_as_dict(nameEntry)["Text"], "Default")
+
+ xCanceltn = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCanceltn)
+
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab: