summaryrefslogtreecommitdiffstats
path: root/sc/qa/uitest/calc_tests8
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 16:51:28 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 16:51:28 +0000
commit940b4d1848e8c70ab7642901a68594e8016caffc (patch)
treeeb72f344ee6c3d9b80a7ecc079ea79e9fba8676d /sc/qa/uitest/calc_tests8
parentInitial commit. (diff)
downloadlibreoffice-940b4d1848e8c70ab7642901a68594e8016caffc.tar.xz
libreoffice-940b4d1848e8c70ab7642901a68594e8016caffc.zip
Adding upstream version 1:7.0.4.upstream/1%7.0.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--sc/qa/uitest/calc_tests8/navigator.py117
-rw-r--r--sc/qa/uitest/calc_tests8/tdf119343.py42
-rw-r--r--sc/qa/uitest/calc_tests8/tdf124829.py41
-rw-r--r--sc/qa/uitest/calc_tests8/tdf125051.py50
4 files changed, 250 insertions, 0 deletions
diff --git a/sc/qa/uitest/calc_tests8/navigator.py b/sc/qa/uitest/calc_tests8/navigator.py
new file mode 100644
index 000000000..4026ca665
--- /dev/null
+++ b/sc/qa/uitest/calc_tests8/navigator.py
@@ -0,0 +1,117 @@
+#
+# 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.path import get_srcdir_url
+
+def get_url_for_data_file(file_name):
+ return get_srcdir_url() + "/sc/qa/uitest/calc_tests/data/" + file_name
+
+class navigator(UITestCase):
+
+ def test_rename_sheet(self):
+ self.ui_test.load_file(get_url_for_data_file("navigator.ods"))
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ xGridWin = xCalcDoc.getChild("grid_window")
+
+ self.xUITest.executeCommand(".uno:Sidebar")
+ xGridWin.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "ScNavigatorPanel"}))
+
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ xNavigatorPanel = xCalcDoc.getChild("NavigatorPanelParent")
+ xContentBox = xNavigatorPanel.getChild('contentbox')
+ xSheets = xContentBox.getChild("0")
+ self.assertEqual(get_state_as_dict(xSheets)['Text'], 'Sheets')
+ self.assertEqual(len(xSheets.getChildren()), 2)
+ self.assertEqual(get_state_as_dict(xSheets.getChild('0'))['Text'], 'Sheet1')
+ self.assertEqual(get_state_as_dict(xSheets.getChild('1'))['Text'], 'S2')
+ xRangeNames = xContentBox.getChild("1")
+ self.assertEqual(get_state_as_dict(xRangeNames)['Text'], 'Range names')
+ self.assertEqual(len(xRangeNames.getChildren()), 2)
+ self.assertEqual(get_state_as_dict(xRangeNames.getChild('0'))['Text'], 'first (Sheet1)')
+ self.assertEqual(get_state_as_dict(xRangeNames.getChild('1'))['Text'], 'second (Sheet1)')
+
+ #The document has one comment too
+ xComments = xContentBox.getChild("6")
+ self.assertEqual(get_state_as_dict(xComments)['Text'], 'Comments')
+ self.assertEqual(len(xComments.getChildren()), 1)
+ self.assertEqual(get_state_as_dict(xComments.getChild('0'))['Text'], 'Test Comment')
+
+ self.ui_test.execute_dialog_through_command(".uno:RenameTable")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xname_entry = xDialog.getChild("name_entry")
+ xname_entry.executeAction("TYPE", mkPropertyValues({"TEXT": "S1"}))
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ xNavigatorPanel = xCalcDoc.getChild("NavigatorPanelParent")
+ xContentBox = xNavigatorPanel.getChild('contentbox')
+ xSheets = xContentBox.getChild("0")
+ self.assertEqual(get_state_as_dict(xSheets)['Text'], 'Sheets')
+ self.assertEqual(len(xSheets.getChildren()), 2)
+ self.assertEqual(get_state_as_dict(xSheets.getChild('0'))['Text'], 'S1')
+ self.assertEqual(get_state_as_dict(xSheets.getChild('1'))['Text'], 'S2')
+ xRangeNames = xContentBox.getChild("1")
+ self.assertEqual(get_state_as_dict(xRangeNames)['Text'], 'Range names')
+ self.assertEqual(len(xRangeNames.getChildren()), 2)
+ self.assertEqual(get_state_as_dict(xRangeNames.getChild('0'))['Text'], 'first (S1)')
+ self.assertEqual(get_state_as_dict(xRangeNames.getChild('1'))['Text'], 'second (S1)')
+
+ self.xUITest.executeCommand(".uno:Undo")
+
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ xNavigatorPanel = xCalcDoc.getChild("NavigatorPanelParent")
+ xContentBox = xNavigatorPanel.getChild('contentbox')
+ xSheets = xContentBox.getChild("0")
+ self.assertEqual(get_state_as_dict(xSheets)['Text'], 'Sheets')
+ self.assertEqual(len(xSheets.getChildren()), 2)
+ self.assertEqual(get_state_as_dict(xSheets.getChild('0'))['Text'], 'Sheet1')
+ self.assertEqual(get_state_as_dict(xSheets.getChild('1'))['Text'], 'S2')
+ xRangeNames = xContentBox.getChild("1")
+ self.assertEqual(get_state_as_dict(xRangeNames)['Text'], 'Range names')
+ self.assertEqual(len(xRangeNames.getChildren()), 2)
+ #FIXME: tdf#133082
+ #self.assertEqual(get_state_as_dict(xRangeNames.getChild('0'))['Text'], 'first (Sheet1)')
+ #self.assertEqual(get_state_as_dict(xRangeNames.getChild('1'))['Text'], 'second (Sheet1)')
+
+ self.xUITest.executeCommand(".uno:Sidebar")
+ self.ui_test.close_doc()
+
+ def test_tdf98493(self):
+
+ self.ui_test.load_file(get_url_for_data_file("tdf98493.ods"))
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ xGridWin = xCalcDoc.getChild("grid_window")
+
+ self.assertEqual(get_state_as_dict(xGridWin)["SelectedTable"], "2")
+
+ self.xUITest.executeCommand(".uno:Sidebar")
+ xGridWin.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "ScNavigatorPanel"}))
+
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ xNavigatorPanel = xCalcDoc.getChild("NavigatorPanelParent")
+ xNavigatorPanel.executeAction("ROOT", tuple())
+ xContentBox = xNavigatorPanel.getChild('contentbox')
+
+ # tdf#133079, without the fix in place, it would be 8
+ self.assertEqual(len(xContentBox.getChildren()), 1)
+
+ xSheets = xContentBox.getChild('0')
+ self.assertEqual(len(xSheets.getChildren()), 12)
+
+ #key=item position, value=sheet ( there are hidden sheets )
+ results = { '1': '0', '5': '4', '6': '4', '11': '10'}
+
+ for k, v in results.items():
+ xChild = xSheets.getChild(k)
+ xChild.executeAction("DOUBLECLICK", tuple())
+
+ self.assertEqual(get_state_as_dict(xGridWin)["SelectedTable"], v)
+
+ self.xUITest.executeCommand(".uno:Sidebar")
+ self.ui_test.close_doc()
diff --git a/sc/qa/uitest/calc_tests8/tdf119343.py b/sc/qa/uitest/calc_tests8/tdf119343.py
new file mode 100644
index 000000000..82c0e11b4
--- /dev/null
+++ b/sc/qa/uitest/calc_tests8/tdf119343.py
@@ -0,0 +1,42 @@
+# -*- 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 uitest.uihelper.common import get_state_as_dict
+from uitest.uihelper.common import select_pos
+from uitest.uihelper.calc import enter_text_to_cell
+from libreoffice.calc.document import get_sheet_from_doc
+from libreoffice.calc.conditional_format import get_conditional_format_from_sheet
+from uitest.debug import sleep
+from libreoffice.calc.document import get_cell_by_position
+from libreoffice.uno.propertyvalue import mkPropertyValues
+import org.libreoffice.unotest
+import pathlib
+from uitest.path import get_srcdir_url
+def get_url_for_data_file(file_name):
+ return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri()
+
+#Bug 119343 - EDITING: copied and pasted cells containing formulas are not recalculated (2)
+
+class tdf119343(UITestCase):
+ def test_tdf119343_copy_paste_formula(self):
+ #numberingformatpage.ui
+ calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf119343.ods"))
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "M295"}))
+ self.xUITest.executeCommand(".uno:Copy")
+ gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"}))
+ self.xUITest.executeCommand(".uno:Paste")
+ #verify
+ self.assertEqual(get_cell_by_position(document, 0, 12, 295).getString(), "Q11005355")
+ self.assertEqual(get_cell_by_position(document, 0, 12, 294).getString(), "Q1099565")
+ self.assertEqual(get_cell_by_position(document, 0, 12, 293).getString(), "Q108420")
+
+ self.ui_test.close_doc()
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests8/tdf124829.py b/sc/qa/uitest/calc_tests8/tdf124829.py
new file mode 100644
index 000000000..97a43f641
--- /dev/null
+++ b/sc/qa/uitest/calc_tests8/tdf124829.py
@@ -0,0 +1,41 @@
+# -*- 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 uitest.uihelper.common import get_state_as_dict
+from uitest.uihelper.common import select_pos
+from uitest.uihelper.calc import enter_text_to_cell
+from libreoffice.calc.document import get_sheet_from_doc
+from libreoffice.calc.conditional_format import get_conditional_format_from_sheet
+from uitest.debug import sleep
+from libreoffice.calc.document import get_cell_by_position
+from libreoffice.uno.propertyvalue import mkPropertyValues
+import org.libreoffice.unotest
+import pathlib
+
+def get_url_for_data_file(file_name):
+ return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri()
+
+#Bug 124829 - CRASH: cutting and undoing a sheet with external links
+
+class tdf124829(UITestCase):
+ def test_tdf124829_Crash_cutting_undo_sheet_external_links(self):
+ #numberingformatpage.ui
+ calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf124829.ods"))
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+
+ self.xUITest.executeCommand(".uno:SelectAll")
+ self.xUITest.executeCommand(".uno:Cut")
+ for i in range(40):
+ self.xUITest.executeCommand(".uno:Undo")
+
+ #verify; no crashes
+ self.assertEqual(document.Sheets.getCount(), 6)
+
+ self.ui_test.close_doc()
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests8/tdf125051.py b/sc/qa/uitest/calc_tests8/tdf125051.py
new file mode 100644
index 000000000..d993aacdf
--- /dev/null
+++ b/sc/qa/uitest/calc_tests8/tdf125051.py
@@ -0,0 +1,50 @@
+# -*- 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 uitest.uihelper.common import get_state_as_dict
+from uitest.uihelper.common import select_pos
+from uitest.uihelper.calc import enter_text_to_cell
+from libreoffice.calc.document import get_cell_by_position
+from libreoffice.uno.propertyvalue import mkPropertyValues
+
+#Bug 125051 - EDITING: CRASH when start SpellCheck
+
+class tdf125051(UITestCase):
+ def test_tdf125051_crash_spelling_dialog(self):
+ calc_doc = self.ui_test.create_doc_in_start_center("calc")
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+ enter_text_to_cell(gridwin, "A1", "text")
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
+ self.ui_test.execute_dialog_through_command(".uno:SpellDialog")
+ xDialog = self.xUITest.getTopFocusWindow() #Spelling dialog
+
+ xDialog2 = self.xUITest.getTopFocusWindow() # info dialog "The spellcheck of this sheet has been completed.-> OK"
+ okBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(okBtn)
+
+ xDialog = self.xUITest.getTopFocusWindow() #Spelling dialog
+ #open options
+ optionsBtn = xDialog.getChild("options")
+ def handle_options_dlg(dialog):
+ #print(dialog.getChildren())
+ xCancelBtn = dialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCancelBtn)
+
+ self.ui_test.execute_blocking_action(optionsBtn.executeAction, args=('CLICK', ()),
+ dialog_handler=handle_options_dlg)
+
+ closeBtn = xDialog.getChild("close") #close Spelling dialog
+ self.ui_test.close_dialog_through_button(closeBtn)
+
+ #verify, we didn't crash
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "text")
+
+ self.ui_test.close_doc()
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab: