summaryrefslogtreecommitdiffstats
path: root/sc/qa/uitest/calc_tests4
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_tests4
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 'sc/qa/uitest/calc_tests4')
-rw-r--r--sc/qa/uitest/calc_tests4/tdf118207.py60
-rw-r--r--sc/qa/uitest/calc_tests4/tdf131170.py58
-rw-r--r--sc/qa/uitest/calc_tests4/tdf85403.py43
-rw-r--r--sc/qa/uitest/calc_tests4/tdf85979.py58
-rw-r--r--sc/qa/uitest/calc_tests4/tdf86253.py67
-rw-r--r--sc/qa/uitest/calc_tests4/tdf88999.py53
-rw-r--r--sc/qa/uitest/calc_tests4/tdf89907.py64
-rw-r--r--sc/qa/uitest/calc_tests4/tdf89958.py71
-rw-r--r--sc/qa/uitest/calc_tests4/tdf91305.py140
-rw-r--r--sc/qa/uitest/calc_tests4/tdf92423.py75
-rw-r--r--sc/qa/uitest/calc_tests4/tdf94208.py52
-rw-r--r--sc/qa/uitest/calc_tests4/tdf95192.py52
-rw-r--r--sc/qa/uitest/calc_tests4/tdf99208.py68
-rw-r--r--sc/qa/uitest/calc_tests4/tdf99386.py39
-rw-r--r--sc/qa/uitest/calc_tests4/tdf99627.py52
-rw-r--r--sc/qa/uitest/calc_tests4/tdf99773.py52
-rw-r--r--sc/qa/uitest/calc_tests4/textToColumns.py526
-rw-r--r--sc/qa/uitest/calc_tests4/trackedChanges.py298
18 files changed, 1828 insertions, 0 deletions
diff --git a/sc/qa/uitest/calc_tests4/tdf118207.py b/sc/qa/uitest/calc_tests4/tdf118207.py
new file mode 100644
index 000000000..1f07672fa
--- /dev/null
+++ b/sc/qa/uitest/calc_tests4/tdf118207.py
@@ -0,0 +1,60 @@
+# -*- 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
+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 118207 - CRASH: Cutting and pasting a conditional format column and undoing
+
+class tdf118207(UITestCase):
+ def test_tdf118207(self):
+ calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf118189.xlsx"))
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+ #Make sure that tools-options-LibreOffice Calc-General-Input settings-Show overwrite warning when pasting data is NOT tagged.
+ self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog
+ xDialogOpt = self.xUITest.getTopFocusWindow()
+
+ xPages = xDialogOpt.getChild("pages")
+ xCalcEntry = xPages.getChild('3') # Calc
+ xCalcEntry.executeAction("EXPAND", tuple())
+ xCalcGeneralEntry = xCalcEntry.getChild('0')
+ xCalcGeneralEntry.executeAction("SELECT", tuple()) #General / replwarncb
+ xreplwarncb = xDialogOpt.getChild("replwarncb")
+ if (get_state_as_dict(xreplwarncb)["Selected"]) == "true":
+ xreplwarncb.executeAction("CLICK", tuple())
+ xOKBtn = xDialogOpt.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+ #Select Column A
+ #Cut it
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
+ self.xUITest.executeCommand(".uno:SelectColumn")
+ self.xUITest.executeCommand(".uno:Cut")
+ #Paste it in Column B , Paste it in Column B again
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B1"}))
+ self.xUITest.executeCommand(".uno:Paste")
+ self.xUITest.executeCommand(".uno:Paste")
+ #Undo 3 times
+ self.xUITest.executeCommand(".uno:Undo")
+ self.xUITest.executeCommand(".uno:Undo")
+ self.xUITest.executeCommand(".uno:Undo")
+ #-> CRASH
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString() , "On Back Order")
+ #verify
+
+ self.ui_test.close_doc()
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab: \ No newline at end of file
diff --git a/sc/qa/uitest/calc_tests4/tdf131170.py b/sc/qa/uitest/calc_tests4/tdf131170.py
new file mode 100644
index 000000000..726796936
--- /dev/null
+++ b/sc/qa/uitest/calc_tests4/tdf131170.py
@@ -0,0 +1,58 @@
+# -*- 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.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 tdf131170(UITestCase):
+ def test_DefineLabelRange(self):
+ calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf131170.ods"))
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+
+ self.ui_test.execute_dialog_through_command(".uno:DefineLabelRange")
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ xRange = xDialog.getChild("range")
+ self.assertEqual(4, len(xRange.getChildren()))
+ self.assertEqual(get_state_as_dict(xRange.getChild('0'))["Text"].strip(), "--- Column ---")
+ self.assertEqual(get_state_as_dict(xRange.getChild('1'))["Text"].strip(), "$Sheet1.$I$6:$K$6 [AA, BB, CC]")
+ self.assertEqual(get_state_as_dict(xRange.getChild('2'))["Text"].strip(), "--- Row ---")
+ self.assertEqual(get_state_as_dict(xRange.getChild('3'))["Text"].strip(), "$Sheet1.$H$7:$H$9 [X, Y, Z]")
+
+ def handle_confirmation_dlg(dialog2):
+ xOKBtn2 = dialog2.getChild("yes")
+ self.ui_test.close_dialog_through_button(xOKBtn2)
+
+ xDeleteBtn = xDialog.getChild("delete")
+
+ xRange.getChild('1').executeAction("SELECT", tuple())
+ self.ui_test.execute_blocking_action(xDeleteBtn.executeAction, args=('CLICK', ()),
+ dialog_handler=handle_confirmation_dlg)
+
+ self.assertEqual(3, len(xRange.getChildren()))
+ self.assertEqual(get_state_as_dict(xRange.getChild('0'))["Text"].strip(), "--- Column ---")
+ self.assertEqual(get_state_as_dict(xRange.getChild('1'))["Text"].strip(), "--- Row ---")
+ self.assertEqual(get_state_as_dict(xRange.getChild('2'))["Text"].strip(), "$Sheet1.$H$7:$H$9 [X, Y, Z]")
+
+ xRange.getChild('2').executeAction("SELECT", tuple())
+ self.ui_test.execute_blocking_action(xDeleteBtn.executeAction, args=('CLICK', ()),
+ dialog_handler=handle_confirmation_dlg)
+
+ self.assertEqual(2, len(xRange.getChildren()))
+ self.assertEqual(get_state_as_dict(xRange.getChild('0'))["Text"].strip(), "--- Column ---")
+ self.assertEqual(get_state_as_dict(xRange.getChild('1'))["Text"].strip(), "--- Row ---")
+
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ self.ui_test.close_doc()
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests4/tdf85403.py b/sc/qa/uitest/calc_tests4/tdf85403.py
new file mode 100644
index 000000000..e82835fc3
--- /dev/null
+++ b/sc/qa/uitest/calc_tests4/tdf85403.py
@@ -0,0 +1,43 @@
+# -*- 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
+import org.libreoffice.unotest
+import pathlib
+from uitest.path import get_srcdir_url
+#Bug 85403 - no broadcast after text to columns to convert text to numbers
+def get_url_for_data_file(file_name):
+ return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri()
+
+class tdf85403(UITestCase):
+ def test_tdf85403_text_to_columns(self):
+ calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf85403.ods"))
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+
+ #'123 in A1, SUM(A1) in B1, result is 0 as expected,
+ #now select A1 and use data->text to columns->ok and B1 is not updated,
+ #putting a new SUM(A1) in C1 will show 123
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
+ # Data - Text to Columns
+ self.ui_test.execute_dialog_through_command(".uno:TextToColumns")
+ xDialog = self.xUITest.getTopFocusWindow()
+ # Click Ok
+ xOK = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOK)
+
+ #Verify
+ self.assertEqual(get_cell_by_position(document, 0, 1, 0).getValue(), 123)
+
+ self.ui_test.close_doc()
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab: \ No newline at end of file
diff --git a/sc/qa/uitest/calc_tests4/tdf85979.py b/sc/qa/uitest/calc_tests4/tdf85979.py
new file mode 100644
index 000000000..359a0f35c
--- /dev/null
+++ b/sc/qa/uitest/calc_tests4/tdf85979.py
@@ -0,0 +1,58 @@
+# -*- 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
+import org.libreoffice.unotest
+import pathlib
+#Bug 85979 - Crash: data text to columns
+def get_url_for_data_file(file_name):
+ return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri()
+
+class tdf85979(UITestCase):
+ def test_td85979_text_to_columns(self):
+ calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf85979.ods"))
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+
+ #(I selected C1 to C5, then Text to Columns, unselected "Tab" and selected "Space")
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "C1:C5"}))
+ # Data - Text to Columns
+ self.ui_test.execute_dialog_through_command(".uno:TextToColumns")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xspace = xDialog.getChild("space")
+ if (get_state_as_dict(xspace)["Selected"]) == "false":
+ xspace.executeAction("CLICK", tuple())
+ # Click Ok
+ xOK = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOK)
+
+ #Verify
+ self.assertEqual(get_cell_by_position(document, 0, 2, 0).getValue(), 99)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 1).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 2).getValue(), 9)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 3).getValue(), 9)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 0).getValue(), 260)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 1).getValue(), 10)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 2).getValue(), 23)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 3).getValue(), 23)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 0).getValue(), 149)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 1).getValue(), 6)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 2).getValue(), 14)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 3).getValue(), 14)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 0).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 1).getValue(), 16)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 2).getValue(), 35)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 3).getValue(), 35)
+
+ self.ui_test.close_doc()
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab: \ No newline at end of file
diff --git a/sc/qa/uitest/calc_tests4/tdf86253.py b/sc/qa/uitest/calc_tests4/tdf86253.py
new file mode 100644
index 000000000..9e801f851
--- /dev/null
+++ b/sc/qa/uitest/calc_tests4/tdf86253.py
@@ -0,0 +1,67 @@
+# -*- 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
+import org.libreoffice.unotest
+import os
+import pathlib
+from uitest.uihelper.common import get_state_as_dict
+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.uno.propertyvalue import mkPropertyValues
+
+def get_url_for_data_file(file_name):
+ return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri()
+
+class tdf86253(UITestCase):
+
+ def test_tdf86253(self):
+ calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf86253.ods"))
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+
+ #* Copy A1, then paste special only "formatting" to C1:C17;
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
+ self.xUITest.executeCommand(".uno:Copy")
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "C1:C17"}))
+ self.ui_test.execute_dialog_through_command(".uno:PasteSpecial")
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ xtext = xDialog.getChild("text")
+ xnumbers = xDialog.getChild("numbers")
+ xdatetime = xDialog.getChild("datetime")
+ xformats = xDialog.getChild("formats")
+
+ xtext.executeAction("CLICK", tuple())
+ xnumbers.executeAction("CLICK", tuple())
+ xdatetime.executeAction("CLICK", tuple())
+ xformats.executeAction("CLICK", tuple())
+
+ xOkBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOkBtn)
+
+ #--> Cell formatting for C1:C17 is changed. But, if you go to "Format - Conditional Formatting - Manage",
+ #you will see that a new formatting condition is created with the range "C1:C6", rather than "C1:C17". This is wrong behavior.
+ self.ui_test.execute_dialog_through_command(".uno:ConditionalFormatManagerDialog")
+
+ xCondFormatMgr = self.xUITest.getTopFocusWindow()
+
+ # check that we have exactly 1 conditional format and range is C1:C17
+ xList = xCondFormatMgr.getChild("CONTAINER")
+ list_state = get_state_as_dict(xList)
+ self.assertEqual(list_state['Children'], '1')
+
+ xTreeEntry = xList.getChild('0')
+ self.assertEqual(get_state_as_dict(xTreeEntry)["Text"], "A1:A6,C1:C17\tCell value >= 0")
+
+ xCancelBtn = xCondFormatMgr.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCancelBtn)
+
+ self.ui_test.close_doc()
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests4/tdf88999.py b/sc/qa/uitest/calc_tests4/tdf88999.py
new file mode 100644
index 000000000..ddbfaa427
--- /dev/null
+++ b/sc/qa/uitest/calc_tests4/tdf88999.py
@@ -0,0 +1,53 @@
+# -*- 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
+#Bug 88999 - UI: Scientific format: unable to modify number of decimal places through Sidebar or Format > Cells
+
+class tdf88999(UITestCase):
+ def test_tdf88999_scientific_format_decimal_value(self):
+ #numberingformatpage.ui
+ 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", "1e-2")
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B1"}))
+ #select cell A1
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
+ #format - cell
+ self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "0") #tab Numbers
+ xliststore1 = xDialog.getChild("categorylb") #1st list / Category
+ xliststore2 = xDialog.getChild("formatlb") #2nd list / Format
+ xdecimalsed = xDialog.getChild("decimalsed")
+ xleadzerosed = xDialog.getChild("leadzerosed")
+ xnegnumred = xDialog.getChild("negnumred")
+ xthousands = xDialog.getChild("thousands")
+ xlanguagelb = xDialog.getChild("languagelb")
+ xformatted = xDialog.getChild("formatted")
+
+ self.assertEqual(get_state_as_dict(xliststore1)["SelectEntryText"], "Scientific")
+ self.assertEqual(get_state_as_dict(xdecimalsed)["Text"], "2")
+ self.assertEqual(get_state_as_dict(xdecimalsed)["Enabled"], "true")
+ self.assertEqual(get_state_as_dict(xleadzerosed)["Text"], "1")
+ self.assertEqual(get_state_as_dict(xformatted)["Text"], "0.00E+00")
+ xOk = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOk)
+
+ self.ui_test.close_doc()
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab: \ No newline at end of file
diff --git a/sc/qa/uitest/calc_tests4/tdf89907.py b/sc/qa/uitest/calc_tests4/tdf89907.py
new file mode 100644
index 000000000..13a960145
--- /dev/null
+++ b/sc/qa/uitest/calc_tests4/tdf89907.py
@@ -0,0 +1,64 @@
+# -*- 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 89907 - Text to columns only affects first line when width is auto set
+
+class tdf89907(UITestCase):
+ def test_tdf89907_text_to_columns(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()
+
+ #Add data
+ enter_text_to_cell(gridwin, "A1", "afasdfs.fdfasd.fsadf.fasd")
+ enter_text_to_cell(gridwin, "A2", "3242.43242.3242.2342")
+ enter_text_to_cell(gridwin, "A3", "fdsfa.afsdfa.adfdas.fsad")
+ enter_text_to_cell(gridwin, "A4", "21312.1111.1111.111")
+ #select column A
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
+ self.xUITest.executeCommand(".uno:SelectColumn")
+ #Optimal Width
+ self.xUITest.executeCommand(".uno:SetOptimalColumnWidthDirect")
+ # Data - Text to Columns
+ self.ui_test.execute_dialog_through_command(".uno:TextToColumns")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xother = xDialog.getChild("other")
+ xinputother = xDialog.getChild("inputother")
+ if (get_state_as_dict(xother)["Selected"]) == "false":
+ xother.executeAction("CLICK", tuple())
+ xinputother.executeAction("TYPE", mkPropertyValues({"TEXT":"."}))
+ # Click Ok
+ xOK = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOK)
+
+ #Verify
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "afasdfs")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 3242)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "fdsfa")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 3).getValue(), 21312)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "fdfasd")
+ self.assertEqual(get_cell_by_position(document, 0, 1, 1).getValue(), 43242)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 2).getString(), "afsdfa")
+ self.assertEqual(get_cell_by_position(document, 0, 1, 3).getValue(), 1111)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 0).getString(), "fsadf")
+ self.assertEqual(get_cell_by_position(document, 0, 2, 1).getValue(), 3242)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 2).getString(), "adfdas")
+ self.assertEqual(get_cell_by_position(document, 0, 2, 3).getValue(), 1111)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 0).getString(), "fasd")
+ self.assertEqual(get_cell_by_position(document, 0, 3, 1).getValue(), 2342)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 2).getString(), "fsad")
+ self.assertEqual(get_cell_by_position(document, 0, 3, 3).getValue(), 111)
+
+ self.ui_test.close_doc()
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab: \ No newline at end of file
diff --git a/sc/qa/uitest/calc_tests4/tdf89958.py b/sc/qa/uitest/calc_tests4/tdf89958.py
new file mode 100644
index 000000000..d08148fbd
--- /dev/null
+++ b/sc/qa/uitest/calc_tests4/tdf89958.py
@@ -0,0 +1,71 @@
+# -*- 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
+import org.libreoffice.unotest
+import pathlib
+#Bug 89958 - Data->Filter->Standard Filter, condition "does not end with" does filter too much
+def get_url_for_data_file(file_name):
+ return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri()
+
+class tdf89958(UITestCase):
+ def test_td89958_standard_filter(self):
+ calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf89958.ods"))
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+ #select A1-> Column .uno:SelectColumn
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
+ self.xUITest.executeCommand(".uno:SelectColumn")
+
+ #Menu: Data->Filter->Standard Filter ...
+ #Field Name "Column A", Condition "Does not end with", Value: "CTORS"
+ self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xfield1 = xDialog.getChild("field1")
+ xval1 = xDialog.getChild("val1")
+ xcond1 = xDialog.getChild("cond1")
+
+ props = {"TEXT": "Column A"}
+ actionProps = mkPropertyValues(props)
+ xfield1.executeAction("SELECT", actionProps)
+ props2 = {"TEXT": "Does not end with"}
+ actionProps2 = mkPropertyValues(props2)
+ xcond1.executeAction("SELECT", actionProps2)
+ xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"CTORS"}))
+ xOKBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ #Expected behaviours: A2 is not filtered as it does not end with "CTORS".
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
+ gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"}))
+ gridWinState = get_state_as_dict(gridwin)
+ self.assertEqual(gridWinState["CurrentRow"], "1")
+ gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"}))
+ gridWinState = get_state_as_dict(gridwin)
+ self.assertEqual(gridWinState["CurrentRow"], "3")
+# #reopen filter and verify - doesn't works
+# gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"}))
+# gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"}))
+# self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter")
+# xDialog = self.xUITest.getTopFocusWindow()
+# xfield1 = xDialog.getChild("field1")
+# xval1 = xDialog.getChild("val1")
+# xcond1 = xDialog.getChild("cond1")
+# self.assertEqual(get_state_as_dict(xfield1)["SelectEntryText"], "Column A")
+# self.assertEqual(get_state_as_dict(xval1)["Text"], "CTORS")
+# self.assertEqual(get_state_as_dict(xcond1)["SelectEntryText"], "Does not end with")
+# xCancelBtn = xDialog.getChild("cancel")
+# self.ui_test.close_dialog_through_button(xCancelBtn)
+
+ self.ui_test.close_doc()
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab: \ No newline at end of file
diff --git a/sc/qa/uitest/calc_tests4/tdf91305.py b/sc/qa/uitest/calc_tests4/tdf91305.py
new file mode 100644
index 000000000..eae7e8c45
--- /dev/null
+++ b/sc/qa/uitest/calc_tests4/tdf91305.py
@@ -0,0 +1,140 @@
+# -*- 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
+#Bug 91305 - Sort button does not sort first cell if it has text format
+
+class tdf91305(UITestCase):
+
+ def test_tdf91305_sort_text_cells_rows(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()
+ #In column A enter texts
+ enter_text_to_cell(gridwin, "A1", "cc")
+ enter_text_to_cell(gridwin, "A2", "ff")
+ enter_text_to_cell(gridwin, "A3", "aa")
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A3"}))
+ #Press toolbarbutton for ascending sorting .uno:SortAsc
+ self.xUITest.executeCommand(".uno:SortAscending")
+ #verify
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "aa")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "cc")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "ff")
+ #Press toolbarbutton for descending sorting .uno:SortDescending
+ self.xUITest.executeCommand(".uno:SortDescending")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "ff")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "cc")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "aa")
+
+ def test_tdf91305_sort_text_cells_columns(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()
+ #In column A enter texts
+ enter_text_to_cell(gridwin, "A1", "cc")
+ enter_text_to_cell(gridwin, "B1", "ff")
+ enter_text_to_cell(gridwin, "C1", "aa")
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C1"}))
+ #Open sort dialog by DATA - SORT
+ self.ui_test.execute_dialog_through_command(".uno:DataSort")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ xleftright = xDialog.getChild("leftright")
+ select_pos(xTabs, "1")
+ xleftright.executeAction("CLICK", tuple())
+ xOK = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOK)
+ #verify
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "aa")
+ self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "cc")
+ self.assertEqual(get_cell_by_position(document, 0, 2, 0).getString(), "ff")
+ #Open sort dialog by DATA - SORT
+ self.ui_test.execute_dialog_through_command(".uno:DataSort")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ xleftright = xDialog.getChild("leftright")
+ xdown = xDialog.getChild("down")
+ select_pos(xTabs, "1")
+ xleftright.executeAction("CLICK", tuple())
+ select_pos(xTabs, "0")
+ xdown.executeAction("CLICK", tuple())
+ xOK = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOK)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "ff")
+ self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "cc")
+ self.assertEqual(get_cell_by_position(document, 0, 2, 0).getString(), "aa")
+ self.ui_test.close_doc()
+
+ #comment 6 - Additional sub-bugs:
+ def test_tdf91305_sort_text_cells_rows(self):
+ #Selecting some empty cells and pressing SORT causes empty cells to move below.
+ #No matter if you sort from A to Z or from Z to A.
+ 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()
+ #In column A enter text
+ enter_text_to_cell(gridwin, "A5", "ff")
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"}))
+ #sorting
+ self.xUITest.executeCommand(".uno:SortAscending")
+ self.xUITest.executeCommand(".uno:SortDescending")
+ #verify
+ self.assertEqual(get_cell_by_position(document, 0, 0, 4).getString(), "ff")
+ # Assert that the correct range has been selected
+ gridWinState = get_state_as_dict(gridwin)
+ self.assertEqual(gridWinState["MarkedArea"], "Sheet1.A1:Sheet1.A4")
+
+ self.ui_test.close_doc()
+
+ #2) Placing digit to the header position and running set of sorts will make digit to be on 2nd or last position.
+ def test_tdf91305_sort_text_cells_1st_row_digit(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()
+ #In column A enter texts
+ enter_text_to_cell(gridwin, "A1", "1")
+ enter_text_to_cell(gridwin, "A2", "ff")
+ enter_text_to_cell(gridwin, "A3", "aa")
+ enter_text_to_cell(gridwin, "A4", "cc")
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"}))
+ #Press toolbarbutton for ascending sorting .uno:SortAsc
+ self.xUITest.executeCommand(".uno:SortAscending")
+ #verify
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "1")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "aa")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "cc")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "ff")
+ #Press toolbarbutton for descending sorting .uno:SortDescending
+ self.xUITest.executeCommand(".uno:SortDescending")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "ff")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "cc")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "aa")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "1")
+ #Undo
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "1")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "aa")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "cc")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "ff")
+
+ self.ui_test.close_doc()
+# vim: set shiftwidth=4 softtabstop=4 expandtab: \ No newline at end of file
diff --git a/sc/qa/uitest/calc_tests4/tdf92423.py b/sc/qa/uitest/calc_tests4/tdf92423.py
new file mode 100644
index 000000000..52920ae17
--- /dev/null
+++ b/sc/qa/uitest/calc_tests4/tdf92423.py
@@ -0,0 +1,75 @@
+# -*- 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
+from uitest.debug import sleep
+#Bug 92423 - EDITING Text to columns... does not respect currently selected cells
+
+class tdf92423(UITestCase):
+ def test_tdf92423_text_to_columns(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()
+
+ #Make sure that tools-options-StarOffice Calc-General-Input settings-Show overwrite warning when pasting data is tagged.
+ self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog
+ xDialogOpt = self.xUITest.getTopFocusWindow()
+
+ xPages = xDialogOpt.getChild("pages")
+ xWriterEntry = xPages.getChild('3') # Calc
+ xWriterEntry.executeAction("EXPAND", tuple())
+ xWriterGeneralEntry = xWriterEntry.getChild('0')
+ xWriterGeneralEntry.executeAction("SELECT", tuple()) #General / replwarncb
+ xreplwarncb = xDialogOpt.getChild("replwarncb")
+ if (get_state_as_dict(xreplwarncb)["Selected"]) == "false":
+ xreplwarncb.executeAction("CLICK", tuple())
+ xOKBtn = xDialogOpt.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+ #enter data
+ enter_text_to_cell(gridwin, "A1", "1;2")
+ enter_text_to_cell(gridwin, "A2", "2;3")
+ enter_text_to_cell(gridwin, "A3", "3;4")
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A3"}))
+ #copy data
+ self.xUITest.executeCommand(".uno:Copy")
+ #move down
+ self.xUITest.executeCommand(".uno:GoDown")
+ self.xUITest.executeCommand(".uno:GoDown")
+ self.xUITest.executeCommand(".uno:GoDown")
+ self.xUITest.executeCommand(".uno:GoDown")
+ self.xUITest.executeCommand(".uno:GoDown")
+ self.xUITest.executeCommand(".uno:GoDown")
+ #paste data, should be selected
+ self.xUITest.executeCommand(".uno:Paste") #A7:A9
+ gridWinState = get_state_as_dict(gridwin)
+ self.assertEqual(gridWinState["MarkedArea"], "Sheet1.A7:Sheet1.A9")
+ # Data - Text to Columns
+ self.ui_test.execute_dialog_through_command(".uno:TextToColumns")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xSemicolon = xDialog.getChild("semicolon") #check semicolon checkbox
+ if (get_state_as_dict(xSemicolon)["Selected"]) == "false":
+ xSemicolon.executeAction("CLICK", tuple())
+ # Click Ok
+ xOK = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOK)
+
+ #Verify
+ self.assertEqual(get_cell_by_position(document, 0, 0, 6).getValue(), 1)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 7).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 8).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 6).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 7).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 8).getValue(), 4)
+
+ self.ui_test.close_doc()
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab: \ No newline at end of file
diff --git a/sc/qa/uitest/calc_tests4/tdf94208.py b/sc/qa/uitest/calc_tests4/tdf94208.py
new file mode 100644
index 000000000..346b60c61
--- /dev/null
+++ b/sc/qa/uitest/calc_tests4/tdf94208.py
@@ -0,0 +1,52 @@
+# -*- 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
+#Bug 94208 - Undo after Control-D Fill doesn't broadcast deleted (undo-inserted) cells for calculation
+
+class tdf94208(UITestCase):
+
+ def test_tdf94208_Undo_fill_down_rows_selected(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()
+
+ #1 - Fill data
+ enter_text_to_cell(gridwin, "A3", "Range")
+ enter_text_to_cell(gridwin, "A4", "Range")
+ enter_text_to_cell(gridwin, "A5", "Range")
+ enter_text_to_cell(gridwin, "A6", "Range")
+ enter_text_to_cell(gridwin, "A7", "Range")
+ enter_text_to_cell(gridwin, "A8", "Range")
+ enter_text_to_cell(gridwin, "B6", "test")
+ #2 - Select rows three though eight.
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A3:A8"}))
+ self.xUITest.executeCommand(".uno:SelectRow")
+ #3 - type Control-D/Fill Down
+ self.xUITest.executeCommand(".uno:FillDown")
+ #4 - undo.
+ self.xUITest.executeCommand(".uno:Undo")
+ #5 - Ouch! The data isn't right.
+ self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "Range")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "Range")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 4).getString(), "Range")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 5).getString(), "Range")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 6).getString(), "Range")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 6).getString(), "Range")
+ self.assertEqual(get_cell_by_position(document, 0, 1, 5).getString(), "test")
+
+ self.ui_test.close_doc()
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests4/tdf95192.py b/sc/qa/uitest/calc_tests4/tdf95192.py
new file mode 100644
index 000000000..5e1292d9d
--- /dev/null
+++ b/sc/qa/uitest/calc_tests4/tdf95192.py
@@ -0,0 +1,52 @@
+# -*- 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
+import org.libreoffice.unotest
+import pathlib
+#Bug 95192 - SORTING Natural sorting not working with non-letter,non-number content
+
+def get_url_for_data_file(file_name):
+ return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri()
+
+class tdf95192(UITestCase):
+ def test_td99627_natural_sort(self):
+ calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf95192.ods"))
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
+
+ #Open sort dialog by DATA - SORT
+ self.ui_test.execute_dialog_through_command(".uno:DataSort")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "1")
+ xNatural = xDialog.getChild("naturalsort")
+ xNatural.executeAction("CLICK", tuple())
+ xOk = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOk)
+ #Verify
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Sal. Capra 1/17")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "Sal. Capra 1/20")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "Sal. Oregina 1/2")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 41).getString(), "Vico Chiuso Cinque Santi 18/10")
+ #UNDO
+ self.xUITest.executeCommand(".uno:Undo")
+ #Verify
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Sal. Oregina 1/2")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "Via A. Centurione 11/7")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 41).getString(), "Vico Chiuso Cinque Santi 18/10")
+
+ self.ui_test.close_doc()
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab: \ No newline at end of file
diff --git a/sc/qa/uitest/calc_tests4/tdf99208.py b/sc/qa/uitest/calc_tests4/tdf99208.py
new file mode 100644
index 000000000..94fed01c3
--- /dev/null
+++ b/sc/qa/uitest/calc_tests4/tdf99208.py
@@ -0,0 +1,68 @@
+# -*- 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
+import org.libreoffice.unotest
+import pathlib
+#Bug 99208 - Spreadsheet sort hangs
+def get_url_for_data_file(file_name):
+ return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri()
+
+class tdf99208(UITestCase):
+ def test_td99627_natural_sort(self):
+ calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf99208.ods"))
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+ #select A3:C245
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C245"}))
+
+ #Menu 'Data -> Sort
+ #Column A - Ascending' <ok>
+ self.ui_test.execute_dialog_through_command(".uno:DataSort")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "1")
+ xNatural = xDialog.getChild("naturalsort")
+ xtopdown = xDialog.getChild("topdown")
+ xHeader = xDialog.getChild("header")
+ xFormats = xDialog.getChild("formats")
+ if (get_state_as_dict(xNatural)["Selected"]) == "false":
+ xNatural.executeAction("CLICK", tuple())
+ if (get_state_as_dict(xHeader)["Selected"]) == "false":
+ xHeader.executeAction("CLICK", tuple())
+ if (get_state_as_dict(xFormats)["Selected"]) == "false":
+ xFormats.executeAction("CLICK", tuple())
+ xtopdown.executeAction("CLICK", tuple())
+ select_pos(xTabs, "0")
+ xSortKey1 = xDialog.getChild("sortlb")
+ xAsc = xDialog.getChild("up")
+ props = {"TEXT": "FODMAP"}
+ actionProps = mkPropertyValues(props)
+ xSortKey1.executeAction("SELECT", actionProps)
+ xAsc.executeAction("CLICK", tuple())
+ xOk = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOk)
+ #Verify Expected: Values column B sorted ascending, column "control" unsorted
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "FODMAP")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "agave")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "almond milk")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 244).getString(), "zucchini")
+ # UNDO
+ self.xUITest.executeCommand(".uno:Undo")
+ # Verify
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "FODMAP")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "beef (grass fed, no breadcrumbs)")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 244).getString(), "salsa")
+
+ self.ui_test.close_doc()
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab: \ No newline at end of file
diff --git a/sc/qa/uitest/calc_tests4/tdf99386.py b/sc/qa/uitest/calc_tests4/tdf99386.py
new file mode 100644
index 000000000..ff9286b61
--- /dev/null
+++ b/sc/qa/uitest/calc_tests4/tdf99386.py
@@ -0,0 +1,39 @@
+# -*- 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 libreoffice.uno.propertyvalue import mkPropertyValues
+from uitest.debug import sleep
+from uitest.uihelper.calc import enter_text_to_cell
+from libreoffice.calc.document import get_cell_by_position
+import org.libreoffice.unotest
+import pathlib
+import time
+
+def get_url_for_data_file(file_name):
+ return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri()
+
+class tdf99386(UITestCase):
+
+ def test_td99386_undo_merged_cell_needs_hard_recalculate(self):
+
+ calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf99386.ods"))
+
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ xGridWindow = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+
+ xGridWindow.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B1"})) #select cells
+ self.xUITest.executeCommand(".uno:ToggleMergeCells") # merge cells
+ self.xUITest.executeCommand(".uno:Undo")
+
+ self.assertEqual(get_cell_by_position(document, 0, 1, 1).getString(), "This")
+
+ self.ui_test.close_doc()
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests4/tdf99627.py b/sc/qa/uitest/calc_tests4/tdf99627.py
new file mode 100644
index 000000000..4f95a9e96
--- /dev/null
+++ b/sc/qa/uitest/calc_tests4/tdf99627.py
@@ -0,0 +1,52 @@
+# -*- 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
+import org.libreoffice.unotest
+import pathlib
+#Bug 99627 - Calc freezes when applying natural sorting on text columns
+
+def get_url_for_data_file(file_name):
+ return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri()
+
+class tdf99627(UITestCase):
+ def test_td99627_natural_sort(self):
+ calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf99627.ods"))
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
+
+ #Open sort dialog by DATA - SORT
+ self.ui_test.execute_dialog_through_command(".uno:DataSort")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "1")
+ xNatural = xDialog.getChild("naturalsort")
+ xdown = xDialog.getChild("down")
+ xNatural.executeAction("CLICK", tuple())
+ select_pos(xTabs, "0")
+ xdown.executeAction("CLICK", tuple())
+ xOk = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOk)
+ #Verify
+ self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "2998")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 2998).getString(), "1")
+ #UNDO
+ self.xUITest.executeCommand(".uno:Undo")
+ #Verify
+ self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "1")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 2998).getString(), "2998")
+
+ self.ui_test.close_doc()
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab: \ No newline at end of file
diff --git a/sc/qa/uitest/calc_tests4/tdf99773.py b/sc/qa/uitest/calc_tests4/tdf99773.py
new file mode 100644
index 000000000..099788fa1
--- /dev/null
+++ b/sc/qa/uitest/calc_tests4/tdf99773.py
@@ -0,0 +1,52 @@
+# -*- 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
+#Bug 99773 - EDITING: calc freezes if sorting in natural mode
+
+class tdf99773(UITestCase):
+ def test_tdf99773_natural_sorting_space(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 data
+ enter_text_to_cell(gridwin, "A1", "A 11")
+ enter_text_to_cell(gridwin, "A2", "A 2")
+ enter_text_to_cell(gridwin, "A3", "B 2")
+ enter_text_to_cell(gridwin, "A4", "A 5")
+ enter_text_to_cell(gridwin, "A5", "A 50")
+ enter_text_to_cell(gridwin, "A6", "B 20")
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A6"}))
+ #Open sort dialog by DATA - SORT
+ self.ui_test.execute_dialog_through_command(".uno:DataSort")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "1")
+ xNatural = xDialog.getChild("naturalsort")
+ if (get_state_as_dict(xNatural)["Selected"]) == "false":
+ xNatural.executeAction("CLICK", tuple())
+ xOk = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOk)
+ #Verify
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "A 2")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "A 5")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "A 11")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "A 50")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 4).getString(), "B 2")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 5).getString(), "B 20")
+
+ self.ui_test.close_doc()
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/calc_tests4/textToColumns.py b/sc/qa/uitest/calc_tests4/textToColumns.py
new file mode 100644
index 000000000..6e2aad2c2
--- /dev/null
+++ b/sc/qa/uitest/calc_tests4/textToColumns.py
@@ -0,0 +1,526 @@
+# -*- 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
+#text to column testcase
+
+def get_url_for_data_file(file_name):
+ return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri()
+
+
+class CalcTextToColumns(UITestCase):
+
+ def test_text_to_columns_dot(self):
+ #_Dot_as_Separator
+ calc_doc = self.ui_test.load_file(get_url_for_data_file("text_to_columns_dot.ods"))
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+ #Make sure that tools-options-StarOffice Calc-General-Input settings-Show overwrite warning when pasting data is tagged.
+ self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog
+ xDialogOpt = self.xUITest.getTopFocusWindow()
+
+ xPages = xDialogOpt.getChild("pages")
+ xWriterEntry = xPages.getChild('3') # Calc
+ xWriterEntry.executeAction("EXPAND", tuple())
+ xWriterGeneralEntry = xWriterEntry.getChild('0')
+ xWriterGeneralEntry.executeAction("SELECT", tuple()) #General / replwarncb
+ xreplwarncb = xDialogOpt.getChild("replwarncb")
+ print(get_state_as_dict(xreplwarncb)["Selected"])
+ if (get_state_as_dict(xreplwarncb)["Selected"]) == "false":
+ xreplwarncb.executeAction("CLICK", tuple())
+ print(get_state_as_dict(xreplwarncb)["Selected"])
+ xOKBtn = xDialogOpt.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ #Select A1:A5 on Sheet 'Dot_as_Separator'
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A5"}))
+ #Data - Text to Columns
+ self.ui_test.execute_dialog_through_command(".uno:TextToColumns")
+ xDialog = self.xUITest.getTopFocusWindow()
+ #Untag Tab as separator and tag other. Put a dot into the input field next to the other checkbox
+ xtab = xDialog.getChild("tab")
+ xcomma = xDialog.getChild("comma")
+ xsemicolon = xDialog.getChild("semicolon")
+ xspace = xDialog.getChild("space")
+ xother = xDialog.getChild("other")
+ xinputother = xDialog.getChild("inputother")
+
+ if (get_state_as_dict(xother)["Selected"]) == "false":
+ xother.executeAction("CLICK", tuple())
+ xinputother.executeAction("TYPE", mkPropertyValues({"TEXT":"."}))
+ #Click Ok
+ #Does an overwrite warning come up? If not file an Issue.
+ #Tag the 'Do not show warning again' checkbox and press Ok.
+ xOK = xDialog.getChild("ok")
+ def handle_warn_dlg(dialog):
+ xyesBtn = dialog.getChild("yes")
+ xask = dialog.getChild("ask")
+ xask.executeAction("CLICK", tuple())
+ self.ui_test.close_dialog_through_button(xyesBtn)
+
+ self.ui_test.execute_blocking_action(xOK.executeAction, args=('CLICK', ()),
+ dialog_handler=handle_warn_dlg)
+ #Verify
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getValue(), 1)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 2).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 3).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 4).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 0).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 1).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 2).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 3).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 4).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 0).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 1).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 2).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 3).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 4).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 0).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 1).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 2).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 3).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 4).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 0).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 1).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 2).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 3).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 4).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 0).getValue(), 6)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 1).getValue(), 6)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 2).getValue(), 6)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 3).getValue(), 6)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 4).getValue(), 6)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 0).getString(), "random content")
+ self.assertEqual(get_cell_by_position(document, 0, 6, 1).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 2).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 3).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 4).getString(), "random content")
+ #verify setting in options
+ self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog
+ xDialogOpt = self.xUITest.getTopFocusWindow()
+
+ xPages = xDialogOpt.getChild("pages")
+ xWriterEntry = xPages.getChild('3') # Calc
+ xWriterEntry.executeAction("EXPAND", tuple())
+ xWriterGeneralEntry = xWriterEntry.getChild('0')
+ xWriterGeneralEntry.executeAction("SELECT", tuple()) #General / replwarncb
+ xreplwarncb = xDialogOpt.getChild("replwarncb")
+ self.assertEqual(get_state_as_dict(xreplwarncb)["Selected"], "false")
+ xOKBtn = xDialogOpt.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ self.ui_test.close_doc()
+
+ def test_text_to_columns_comma(self):
+ #Comma as Separator
+ calc_doc = self.ui_test.load_file(get_url_for_data_file("text_to_columns_comma.ods"))
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+ #Make sure that tools-options-StarOffice Calc-General-Input settings-Show overwrite warning when pasting data is tagged.
+ self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog
+ xDialogOpt = self.xUITest.getTopFocusWindow()
+
+ xPages = xDialogOpt.getChild("pages")
+ xWriterEntry = xPages.getChild('3') # Calc
+ xWriterEntry.executeAction("EXPAND", tuple())
+ xWriterGeneralEntry = xWriterEntry.getChild('0')
+ xWriterGeneralEntry.executeAction("SELECT", tuple()) #General / replwarncb
+ xreplwarncb = xDialogOpt.getChild("replwarncb")
+ print(get_state_as_dict(xreplwarncb)["Selected"])
+ if (get_state_as_dict(xreplwarncb)["Selected"]) == "false":
+ xreplwarncb.executeAction("CLICK", tuple())
+ print(get_state_as_dict(xreplwarncb)["Selected"])
+ xOKBtn = xDialogOpt.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ # Select A1:A5
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A5"}))
+ # Data - Text to Columns
+ self.ui_test.execute_dialog_through_command(".uno:TextToColumns")
+ xDialog = self.xUITest.getTopFocusWindow()
+ # Untag Tab as separator and tag comma.
+ xComma = xDialog.getChild("comma")
+ if (get_state_as_dict(xComma)["Selected"]) == "false":
+ xComma.executeAction("CLICK", tuple())
+ # Click Ok
+ xOK = xDialog.getChild("ok")
+ def handle_warn_dlg(dialog):
+ xyesBtn = dialog.getChild("yes")
+ self.ui_test.close_dialog_through_button(xyesBtn)
+
+ self.ui_test.execute_blocking_action(xOK.executeAction, args=('CLICK', ()),
+ dialog_handler=handle_warn_dlg)
+ #Verify
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getValue(), 1)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 2).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 3).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 4).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 0).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 1).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 2).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 3).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 4).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 0).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 1).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 2).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 3).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 4).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 0).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 1).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 2).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 3).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 4).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 0).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 1).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 2).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 3).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 4).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 0).getValue(), 6)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 1).getValue(), 6)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 2).getValue(), 6)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 3).getValue(), 6)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 4).getValue(), 6)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 0).getString(), "random content")
+ self.assertEqual(get_cell_by_position(document, 0, 6, 1).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 2).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 3).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 4).getString(), "random content")
+
+ self.ui_test.close_doc()
+ def test_text_to_columns_semicolon(self):
+ #Semicolon as Separator
+ calc_doc = self.ui_test.load_file(get_url_for_data_file("text_to_columns_semicolon.ods"))
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+ #Make sure that tools-options-StarOffice Calc-General-Input settings-Show overwrite warning when pasting data is tagged.
+ self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog
+ xDialogOpt = self.xUITest.getTopFocusWindow()
+
+ xPages = xDialogOpt.getChild("pages")
+ xWriterEntry = xPages.getChild('3') # Calc
+ xWriterEntry.executeAction("EXPAND", tuple())
+ xWriterGeneralEntry = xWriterEntry.getChild('0')
+ xWriterGeneralEntry.executeAction("SELECT", tuple()) #General / replwarncb
+ xreplwarncb = xDialogOpt.getChild("replwarncb")
+ if (get_state_as_dict(xreplwarncb)["Selected"]) == "false":
+ xreplwarncb.executeAction("CLICK", tuple())
+ xOKBtn = xDialogOpt.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ # Select A1:A5 on Sheet
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A5"}))
+ # Data - Text to Columns
+ self.ui_test.execute_dialog_through_command(".uno:TextToColumns")
+ xDialog = self.xUITest.getTopFocusWindow()
+ # Untag comma as separator and tag Semicolon
+ xSemicolon = xDialog.getChild("semicolon")
+ if (get_state_as_dict(xSemicolon)["Selected"]) == "false":
+ xSemicolon.executeAction("CLICK", tuple())
+ # Click Ok
+ xOK = xDialog.getChild("ok")
+ def handle_warn_dlg(dialog):
+ xyesBtn = dialog.getChild("yes")
+ self.ui_test.close_dialog_through_button(xyesBtn)
+
+ self.ui_test.execute_blocking_action(xOK.executeAction, args=('CLICK', ()),
+ dialog_handler=handle_warn_dlg)
+ #Verify
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getValue(), 1)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 2).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 3).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 4).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 0).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 1).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 2).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 3).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 4).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 0).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 1).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 2).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 3).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 4).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 0).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 1).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 2).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 3).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 4).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 0).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 1).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 2).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 3).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 4).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 0).getValue(), 6)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 1).getValue(), 6)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 2).getValue(), 6)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 3).getValue(), 6)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 4).getValue(), 6)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 0).getString(), "random content")
+ self.assertEqual(get_cell_by_position(document, 0, 6, 1).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 2).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 3).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 4).getString(), "random content")
+ self.ui_test.close_doc()
+
+ def test_text_to_columns_space(self):
+ #Space as Separator
+ calc_doc = self.ui_test.load_file(get_url_for_data_file("text_to_columns_space.ods"))
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+ #Make sure that tools-options-StarOffice Calc-General-Input settings-Show overwrite warning when pasting data is tagged.
+ self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog
+ xDialogOpt = self.xUITest.getTopFocusWindow()
+
+ xPages = xDialogOpt.getChild("pages")
+ xWriterEntry = xPages.getChild('3') # Calc
+ xWriterEntry.executeAction("EXPAND", tuple())
+ xWriterGeneralEntry = xWriterEntry.getChild('0')
+ xWriterGeneralEntry.executeAction("SELECT", tuple()) #General / replwarncb
+ xreplwarncb = xDialogOpt.getChild("replwarncb")
+ if (get_state_as_dict(xreplwarncb)["Selected"]) == "false":
+ xreplwarncb.executeAction("CLICK", tuple())
+ xOKBtn = xDialogOpt.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ # Select A1:A5 on Sheet
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A5"}))
+ # Data - Text to Columns
+ self.ui_test.execute_dialog_through_command(".uno:TextToColumns")
+ xDialog = self.xUITest.getTopFocusWindow()
+ # Untag comma as separator and tag Semicolon
+ xSpace = xDialog.getChild("space")
+ if (get_state_as_dict(xSpace)["Selected"]) == "false":
+ xSpace.executeAction("CLICK", tuple())
+ # xspace.executeAction("CLICK", tuple())
+ # Click Ok
+ xOK = xDialog.getChild("ok")
+ def handle_warn_dlg(dialog):
+ xyesBtn = dialog.getChild("yes")
+ self.ui_test.close_dialog_through_button(xyesBtn)
+
+ self.ui_test.execute_blocking_action(xOK.executeAction, args=('CLICK', ()),
+ dialog_handler=handle_warn_dlg)
+ #Verify
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getValue(), 1)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 2).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 3).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 4).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 0).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 1).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 2).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 3).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 4).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 0).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 1).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 2).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 3).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 4).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 0).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 1).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 2).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 3).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 4).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 0).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 1).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 2).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 3).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 4).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 0).getValue(), 6)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 1).getValue(), 6)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 2).getValue(), 6)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 3).getValue(), 6)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 4).getValue(), 6)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 0).getString(), "random content")
+ self.assertEqual(get_cell_by_position(document, 0, 6, 1).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 2).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 3).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 4).getString(), "random content")
+ self.ui_test.close_doc()
+
+ def test_text_to_columns_pipe(self):
+ #Space as Separator
+ calc_doc = self.ui_test.load_file(get_url_for_data_file("text_to_columns_pipe.ods"))
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+ #Make sure that tools-options-StarOffice Calc-General-Input settings-Show overwrite warning when pasting data is tagged.
+ self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog
+ xDialogOpt = self.xUITest.getTopFocusWindow()
+
+ xPages = xDialogOpt.getChild("pages")
+ xWriterEntry = xPages.getChild('3') # Calc
+ xWriterEntry.executeAction("EXPAND", tuple())
+ xWriterGeneralEntry = xWriterEntry.getChild('0')
+ xWriterGeneralEntry.executeAction("SELECT", tuple()) #General / replwarncb
+ xreplwarncb = xDialogOpt.getChild("replwarncb")
+ if (get_state_as_dict(xreplwarncb)["Selected"]) == "false":
+ xreplwarncb.executeAction("CLICK", tuple())
+ xOKBtn = xDialogOpt.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ # Select A1:A5 on Sheet
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A5"}))
+ # Data - Text to Columns
+ self.ui_test.execute_dialog_through_command(".uno:TextToColumns")
+ xDialog = self.xUITest.getTopFocusWindow()
+ # Untag comma as separator and tag Semicolon
+ xtab = xDialog.getChild("tab")
+ xcomma = xDialog.getChild("comma")
+ xsemicolon = xDialog.getChild("semicolon")
+ xspace = xDialog.getChild("space")
+ xother = xDialog.getChild("other")
+ xinputother = xDialog.getChild("inputother")
+ xSpace = xDialog.getChild("space")
+ if (get_state_as_dict(xother)["Selected"]) == "false":
+ xother.executeAction("CLICK", tuple())
+ xinputother.executeAction("TYPE", mkPropertyValues({"TEXT":"|"}))
+ # Click Ok
+ xOK = xDialog.getChild("ok")
+ def handle_warn_dlg(dialog):
+ xyesBtn = dialog.getChild("yes")
+ self.ui_test.close_dialog_through_button(xyesBtn)
+
+ self.ui_test.execute_blocking_action(xOK.executeAction, args=('CLICK', ()),
+ dialog_handler=handle_warn_dlg)
+ #Verify
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getValue(), 1)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 2).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 3).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 4).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 0).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 1).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 2).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 3).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 4).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 0).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 1).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 2).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 3).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 4).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 0).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 1).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 2).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 3).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 4).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 0).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 1).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 2).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 3).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 4).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 0).getValue(), 6)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 1).getValue(), 6)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 2).getValue(), 6)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 3).getValue(), 6)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 4).getValue(), 6)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 0).getString(), "random content")
+ self.assertEqual(get_cell_by_position(document, 0, 6, 1).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 2).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 3).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 4).getString(), "random content")
+ self.ui_test.close_doc()
+
+ def test_text_to_columns_pipespace(self):
+ #Space as Separator
+ calc_doc = self.ui_test.load_file(get_url_for_data_file("text_to_columns_pipe_space.ods"))
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+ #Make sure that tools-options-StarOffice Calc-General-Input settings-Show overwrite warning when pasting data is tagged.
+ self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog
+ xDialogOpt = self.xUITest.getTopFocusWindow()
+
+ xPages = xDialogOpt.getChild("pages")
+ xWriterEntry = xPages.getChild('3') # Calc
+ xWriterEntry.executeAction("EXPAND", tuple())
+ xWriterGeneralEntry = xWriterEntry.getChild('0')
+ xWriterGeneralEntry.executeAction("SELECT", tuple()) #General / replwarncb
+ xreplwarncb = xDialogOpt.getChild("replwarncb")
+ if (get_state_as_dict(xreplwarncb)["Selected"]) == "false":
+ xreplwarncb.executeAction("CLICK", tuple())
+ xOKBtn = xDialogOpt.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOKBtn)
+
+ # Select A1:A5 on Sheet
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A5"}))
+ # Data - Text to Columns
+ self.ui_test.execute_dialog_through_command(".uno:TextToColumns")
+ xDialog = self.xUITest.getTopFocusWindow()
+ #
+ xtab = xDialog.getChild("tab")
+ xcomma = xDialog.getChild("comma")
+ xsemicolon = xDialog.getChild("semicolon")
+ xspace = xDialog.getChild("space")
+ xother = xDialog.getChild("other")
+ xinputother = xDialog.getChild("inputother")
+ if (get_state_as_dict(xspace)["Selected"]) == "false":
+ xspace.executeAction("CLICK", tuple())
+ if (get_state_as_dict(xother)["Selected"]) == "false":
+ xother.executeAction("CLICK", tuple())
+ xinputother.executeAction("TYPE", mkPropertyValues({"TEXT":"|"}))
+ # Click Ok
+ xOK = xDialog.getChild("ok")
+ def handle_warn_dlg(dialog):
+ xyesBtn = dialog.getChild("yes")
+ self.ui_test.close_dialog_through_button(xyesBtn)
+
+ self.ui_test.execute_blocking_action(xOK.executeAction, args=('CLICK', ()),
+ dialog_handler=handle_warn_dlg)
+ #Verify
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getValue(), 1)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 2).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 3).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 0, 4).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 0).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 1).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 2).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 3).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 1, 4).getValue(), 2)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 0).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 1).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 2).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 3).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 2, 4).getValue(), 3)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 0).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 1).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 2).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 3).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 3, 4).getValue(), 4)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 0).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 1).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 2).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 3).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 4, 4).getValue(), 5)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 0).getValue(), 6)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 1).getValue(), 6)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 2).getValue(), 6)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 3).getValue(), 6)
+ self.assertEqual(get_cell_by_position(document, 0, 5, 4).getValue(), 6)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 0).getString(), "random content")
+ self.assertEqual(get_cell_by_position(document, 0, 6, 1).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 2).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 3).getValue(), 0)
+ self.assertEqual(get_cell_by_position(document, 0, 6, 4).getString(), "random content")
+ self.ui_test.close_doc()
+# vim: set shiftwidth=4 softtabstop=4 expandtab: \ No newline at end of file
diff --git a/sc/qa/uitest/calc_tests4/trackedChanges.py b/sc/qa/uitest/calc_tests4/trackedChanges.py
new file mode 100644
index 000000000..abd26385a
--- /dev/null
+++ b/sc/qa/uitest/calc_tests4/trackedChanges.py
@@ -0,0 +1,298 @@
+# -*- 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/.
+# tests for tracked changes ; tdf912270
+
+from uitest.framework import UITestCase
+from uitest.debug import sleep
+from libreoffice.calc.document import get_cell_by_position
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from uitest.uihelper.calc import enter_text_to_cell
+from uitest.uihelper.common import get_state_as_dict
+from uitest.path import get_srcdir_url
+import datetime
+
+
+def get_url_for_data_file(file_name):
+ return get_srcdir_url() + "/sc/qa/uitest/calc_tests/data/" + file_name
+
+class CalcTrackedChanges(UITestCase):
+
+ def test_tdf131907(self):
+ calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf131907.odt"))
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptChanges")
+ xTrackDlg = self.xUITest.getTopFocusWindow()
+
+ xChangesList = xTrackDlg.getChild("calcchanges")
+ self.assertEqual(1, len(xChangesList.getChildren()))
+
+ textStart = "Row inserted \tSheet1.1:1\t \t"
+ textEnd = "(Row 1:1 inserted)"
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('0'))["Text"].startswith(textStart))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('0'))["Text"].endswith(textEnd))
+
+ #it would crash here
+ xRejBtn = xTrackDlg.getChild("reject")
+ xRejBtn.executeAction("CLICK", tuple())
+
+ self.assertEqual(2, len(xChangesList.getChildren()))
+ self.assertEqual(get_state_as_dict(xChangesList.getChild('0'))["Text"], "Accepted")
+ self.assertEqual(get_state_as_dict(xChangesList.getChild('1'))["Text"], "Rejected")
+
+ xCancBtn = xTrackDlg.getChild("close")
+ xCancBtn.executeAction("CLICK", tuple())
+
+ self.ui_test.close_doc()
+
+ def test_tdf66263_Protect_Records(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()
+ self.xUITest.executeCommand(".uno:TraceChangeMode")
+ #protect dialog
+ self.ui_test.execute_dialog_through_command(".uno:ProtectTraceChangeMode")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xpass = xDialog.getChild("pass1ed")
+ xpass.executeAction("TYPE", mkPropertyValues({"TEXT":"a"}))
+ xconfirm = xDialog.getChild("confirm1ed")
+ xconfirm.executeAction("TYPE", mkPropertyValues({"TEXT":"a"}))
+ xOkBtn = xDialog.getChild("ok")
+ xOkBtn.executeAction("CLICK", tuple())
+ #verify password
+ self.ui_test.execute_dialog_through_command(".uno:ProtectTraceChangeMode")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xpass = xDialog.getChild("pass1ed")
+ xpass.executeAction("TYPE", mkPropertyValues({"TEXT":"a"}))
+ xOkBtn = xDialog.getChild("ok")
+ xOkBtn.executeAction("CLICK", tuple())
+
+ self.ui_test.close_doc()
+
+ def test_tracked_changes_accept(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()
+ #track changes; enter text to cell
+ self.xUITest.executeCommand(".uno:TraceChangeMode")
+ enter_text_to_cell(gridwin, "A1", "Test LibreOffice")
+ enter_text_to_cell(gridwin, "A2", "Test LibreOffice")
+ #accept tracked changes
+ self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptChanges")
+ xTrackDlg = self.xUITest.getTopFocusWindow()
+
+ xChangesList = xTrackDlg.getChild("calcchanges")
+ self.assertEqual(2, len(xChangesList.getChildren()))
+
+ textStart = "Changed contents\tSheet1.A1\t \t" + datetime.datetime.now().strftime("%m/%d/%Y")
+ textEnd = "(Cell A1 changed from '<empty>' to 'Test LibreOffice')"
+ textStart2 = "Changed contents\tSheet1.A2\t \t" + datetime.datetime.now().strftime("%m/%d/%Y")
+ textEnd2 = "(Cell A2 changed from '<empty>' to 'Test LibreOffice')"
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('0'))["Text"].startswith(textStart))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('0'))["Text"].endswith(textEnd))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('1'))["Text"].startswith(textStart2))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('1'))["Text"].endswith(textEnd2))
+
+ xAccBtn = xTrackDlg.getChild("accept")
+ xAccBtn.executeAction("CLICK", tuple())
+
+ self.assertEqual(2, len(xChangesList.getChildren()))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('0'))["Text"].startswith(textStart2))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('0'))["Text"].endswith(textEnd2))
+ self.assertEqual(get_state_as_dict(xChangesList.getChild('1'))["Text"], "Accepted")
+
+ xAccBtn = xTrackDlg.getChild("accept")
+ xAccBtn.executeAction("CLICK", tuple())
+
+ self.assertEqual(1, len(xChangesList.getChildren()))
+ self.assertEqual(get_state_as_dict(xChangesList.getChild('0'))["Text"], "Accepted")
+ xChangesList.getChild('0').executeAction("EXPAND", tuple())
+
+ self.assertEqual(2, len(xChangesList.getChild('0').getChildren()))
+
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('0').getChild('0'))["Text"].startswith(textStart))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('0').getChild('0'))["Text"].endswith(textEnd))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('0').getChild('1'))["Text"].startswith(textStart2))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('0').getChild('1'))["Text"].endswith(textEnd2))
+
+ xCancBtn = xTrackDlg.getChild("close")
+ xCancBtn.executeAction("CLICK", tuple())
+
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Test LibreOffice")
+ self.ui_test.close_doc()
+
+ def test_tracked_changes_acceptall(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()
+ #track changes; enter text to cell
+ self.xUITest.executeCommand(".uno:TraceChangeMode")
+ enter_text_to_cell(gridwin, "A1", "Test LibreOffice")
+ enter_text_to_cell(gridwin, "A2", "Test LibreOffice")
+ #accept All tracked changes
+ self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptChanges")
+ xTrackDlg = self.xUITest.getTopFocusWindow()
+
+ xChangesList = xTrackDlg.getChild("calcchanges")
+ self.assertEqual(2, len(xChangesList.getChildren()))
+
+ textStart = "Changed contents\tSheet1.A1\t \t" + datetime.datetime.now().strftime("%m/%d/%Y")
+ textEnd = "(Cell A1 changed from '<empty>' to 'Test LibreOffice')"
+ textStart2 = "Changed contents\tSheet1.A2\t \t" + datetime.datetime.now().strftime("%m/%d/%Y")
+ textEnd2 = "(Cell A2 changed from '<empty>' to 'Test LibreOffice')"
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('0'))["Text"].startswith(textStart))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('0'))["Text"].endswith(textEnd))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('1'))["Text"].startswith(textStart2))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('1'))["Text"].endswith(textEnd2))
+
+ xAccBtn = xTrackDlg.getChild("acceptall")
+ xAccBtn.executeAction("CLICK", tuple())
+
+ self.assertEqual(1, len(xChangesList.getChildren()))
+ self.assertEqual(get_state_as_dict(xChangesList.getChild('0'))["Text"], "Accepted")
+ xChangesList.getChild('0').executeAction("EXPAND", tuple())
+
+ self.assertEqual(2, len(xChangesList.getChild('0').getChildren()))
+
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('0').getChild('0'))["Text"].startswith(textStart))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('0').getChild('0'))["Text"].endswith(textEnd))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('0').getChild('1'))["Text"].startswith(textStart2))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('0').getChild('1'))["Text"].endswith(textEnd2))
+
+ xCancBtn = xTrackDlg.getChild("close")
+ xCancBtn.executeAction("CLICK", tuple())
+
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Test LibreOffice")
+ self.ui_test.close_doc()
+
+ def test_tracked_changes_reject(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()
+ #track changes; enter text to cell
+ self.xUITest.executeCommand(".uno:TraceChangeMode")
+ enter_text_to_cell(gridwin, "A1", "Test LibreOffice")
+ enter_text_to_cell(gridwin, "A2", "Test LibreOffice")
+ #accept tracked changes
+ self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptChanges")
+ xTrackDlg = self.xUITest.getTopFocusWindow()
+
+ xChangesList = xTrackDlg.getChild("calcchanges")
+ self.assertEqual(2, len(xChangesList.getChildren()))
+
+ textStart = "Changed contents\tSheet1.A1\t \t" + datetime.datetime.now().strftime("%m/%d/%Y")
+ textEnd = "(Cell A1 changed from '<empty>' to 'Test LibreOffice')"
+ textStart2 = "Changed contents\tSheet1.A2\t \t" + datetime.datetime.now().strftime("%m/%d/%Y")
+ textEnd2 = "(Cell A2 changed from '<empty>' to 'Test LibreOffice')"
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('0'))["Text"].startswith(textStart))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('0'))["Text"].endswith(textEnd))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('1'))["Text"].startswith(textStart2))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('1'))["Text"].endswith(textEnd2))
+
+ xRejBtn = xTrackDlg.getChild("reject")
+ xRejBtn.executeAction("CLICK", tuple())
+
+ self.assertEqual(3, len(xChangesList.getChildren()))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('0'))["Text"].startswith(textStart2))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('0'))["Text"].endswith(textEnd2))
+ self.assertEqual(get_state_as_dict(xChangesList.getChild('1'))["Text"], "Accepted")
+ self.assertEqual(get_state_as_dict(xChangesList.getChild('2'))["Text"], "Rejected")
+
+ xAccBtn = xTrackDlg.getChild("reject")
+ xAccBtn.executeAction("CLICK", tuple())
+
+ self.assertEqual(2, len(xChangesList.getChildren()))
+ self.assertEqual(get_state_as_dict(xChangesList.getChild('0'))["Text"], "Accepted")
+ self.assertEqual(get_state_as_dict(xChangesList.getChild('1'))["Text"], "Rejected")
+
+ xChangesList.getChild('0').executeAction("EXPAND", tuple())
+ self.assertEqual(2, len(xChangesList.getChild('0').getChildren()))
+
+ textEnd3 = "(Cell A1 changed from 'Test LibreOffice' to '<empty>')"
+ textEnd4 = "(Cell A2 changed from 'Test LibreOffice' to '<empty>')"
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('0').getChild('0'))["Text"].startswith(textStart))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('0').getChild('0'))["Text"].endswith(textEnd3))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('0').getChild('1'))["Text"].startswith(textStart2))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('0').getChild('1'))["Text"].endswith(textEnd4))
+
+ xChangesList.getChild('1').executeAction("EXPAND", tuple())
+ self.assertEqual(2, len(xChangesList.getChild('1').getChildren()))
+
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('1').getChild('0'))["Text"].startswith(textStart))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('1').getChild('0'))["Text"].endswith(textEnd))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('1').getChild('1'))["Text"].startswith(textStart2))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('1').getChild('1'))["Text"].endswith(textEnd2))
+
+ xCancBtn = xTrackDlg.getChild("close")
+ xCancBtn.executeAction("CLICK", tuple())
+
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "")
+ self.ui_test.close_doc()
+
+ def test_tracked_changes_rejectall(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()
+ #track changes; enter text to cell
+ self.xUITest.executeCommand(".uno:TraceChangeMode")
+ enter_text_to_cell(gridwin, "A1", "Test LibreOffice")
+ enter_text_to_cell(gridwin, "A2", "Test LibreOffice")
+ #accept tracked changes
+ self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptChanges")
+ xTrackDlg = self.xUITest.getTopFocusWindow()
+
+ xChangesList = xTrackDlg.getChild("calcchanges")
+ self.assertEqual(2, len(xChangesList.getChildren()))
+
+ textStart = "Changed contents\tSheet1.A1\t \t" + datetime.datetime.now().strftime("%m/%d/%Y")
+ textEnd = "(Cell A1 changed from '<empty>' to 'Test LibreOffice')"
+ textStart2 = "Changed contents\tSheet1.A2\t \t" + datetime.datetime.now().strftime("%m/%d/%Y")
+ textEnd2 = "(Cell A2 changed from '<empty>' to 'Test LibreOffice')"
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('0'))["Text"].startswith(textStart))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('0'))["Text"].endswith(textEnd))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('1'))["Text"].startswith(textStart2))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('1'))["Text"].endswith(textEnd2))
+
+ xAccBtn = xTrackDlg.getChild("rejectall")
+ xAccBtn.executeAction("CLICK", tuple())
+
+ self.assertEqual(2, len(xChangesList.getChildren()))
+ self.assertEqual(get_state_as_dict(xChangesList.getChild('0'))["Text"], "Accepted")
+ self.assertEqual(get_state_as_dict(xChangesList.getChild('1'))["Text"], "Rejected")
+
+ xChangesList.getChild('0').executeAction("EXPAND", tuple())
+ self.assertEqual(2, len(xChangesList.getChild('0').getChildren()))
+
+ textEnd3 = "(Cell A1 changed from 'Test LibreOffice' to '<empty>')"
+ textEnd4 = "(Cell A2 changed from 'Test LibreOffice' to '<empty>')"
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('0').getChild('0'))["Text"].startswith(textStart2))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('0').getChild('0'))["Text"].endswith(textEnd4))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('0').getChild('1'))["Text"].startswith(textStart))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('0').getChild('1'))["Text"].endswith(textEnd3))
+
+ xChangesList.getChild('1').executeAction("EXPAND", tuple())
+ self.assertEqual(2, len(xChangesList.getChild('1').getChildren()))
+
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('1').getChild('0'))["Text"].startswith(textStart))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('1').getChild('0'))["Text"].endswith(textEnd))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('1').getChild('1'))["Text"].startswith(textStart2))
+ self.assertTrue(get_state_as_dict(xChangesList.getChild('1').getChild('1'))["Text"].endswith(textEnd2))
+
+ xCancBtn = xTrackDlg.getChild("close")
+ xCancBtn.executeAction("CLICK", tuple())
+
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "")
+ self.ui_test.close_doc()
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab: