diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:06:44 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:06:44 +0000 |
commit | ed5640d8b587fbcfed7dd7967f3de04b37a76f26 (patch) | |
tree | 7a5f7c6c9d02226d7471cb3cc8fbbf631b415303 /sc/qa/uitest/calc_tests2 | |
parent | Initial commit. (diff) | |
download | libreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.tar.xz libreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.zip |
Adding upstream version 4:7.4.7.upstream/4%7.4.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sc/qa/uitest/calc_tests2')
-rw-r--r-- | sc/qa/uitest/calc_tests2/consolidate.py | 106 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests2/dataform.py | 24 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests2/standardFilter.py | 604 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests2/tdf104117.py | 39 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests2/tdf114992.py | 24 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests2/tdf117367.py | 49 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests2/tdf120174.py | 30 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests2/tdf127113.py | 58 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests2/tdf46138.py | 31 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests2/xmlSource.py | 62 |
10 files changed, 1027 insertions, 0 deletions
diff --git a/sc/qa/uitest/calc_tests2/consolidate.py b/sc/qa/uitest/calc_tests2/consolidate.py new file mode 100644 index 000000000..19da793c0 --- /dev/null +++ b/sc/qa/uitest/calc_tests2/consolidate.py @@ -0,0 +1,106 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file +from uitest.uihelper.common import select_by_text +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + +class consolidate(UITestCase): + def test_consolidate(self): + with self.ui_test.load_file(get_url_for_data_file("consolidate.ods")) as calc_doc: + with self.ui_test.execute_modeless_dialog_through_command(".uno:DataConsolidate") as xDialog: + xfunc = xDialog.getChild("func") + xlbdataarea = xDialog.getChild("lbdataarea") + xadd = xDialog.getChild("add") + xbyrow = xDialog.getChild("byrow") + xbycol = xDialog.getChild("bycol") + xeddestarea = xDialog.getChild("eddestarea") + + select_by_text(xfunc, "Sum") + + select_by_text(xlbdataarea, "range1") + xadd.executeAction("CLICK", tuple()) + select_by_text(xlbdataarea, "range2") + xadd.executeAction("CLICK", tuple()) + propsC = {"TEXT": "range3"} + actionPropsC = mkPropertyValues(propsC) + xlbdataarea.executeAction("SELECT", actionPropsC) + xadd.executeAction("CLICK", tuple()) + xbyrow.executeAction("CLICK", tuple()) + xbycol.executeAction("CLICK", tuple()) + xeddestarea.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xeddestarea.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xeddestarea.executeAction("TYPE", mkPropertyValues({"TEXT":"$Total.$A$2"})) + + #verify + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 2).getValue(), 300) + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 3).getValue(), 303) + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 4).getValue(), 306) + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 5).getValue(), 309) + + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 2).getValue(), 303) + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 3).getValue(), 306) + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 4).getValue(), 309) + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 5).getValue(), 312) + + self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 2).getValue(), 306) + self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 3).getValue(), 309) + self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 4).getValue(), 312) + self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 5).getValue(), 315) + + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 2).getValue(), 309) + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 3).getValue(), 312) + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 4).getValue(), 315) + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 5).getValue(), 318) + #verify dialog + with self.ui_test.execute_modeless_dialog_through_command(".uno:DataConsolidate") as xDialog: + xfunc = xDialog.getChild("func") + xlbdataarea = xDialog.getChild("lbdataarea") + xdelete = xDialog.getChild("delete") + xbyrow = xDialog.getChild("byrow") + xbycol = xDialog.getChild("bycol") + xeddestarea = xDialog.getChild("eddestarea") + xconsareas = xDialog.getChild("consareas") + self.assertEqual(get_state_as_dict(xfunc)["SelectEntryText"], "Sum") + self.assertEqual(get_state_as_dict(xconsareas)["Children"], "3") + self.assertEqual(get_state_as_dict(xeddestarea)["Text"], "$Total.$A$2") + self.assertEqual(get_state_as_dict(xbyrow)["Selected"], "true") + self.assertEqual(get_state_as_dict(xbycol)["Selected"], "true") + #delete first range + xFirstEntry = xconsareas.getChild("0") + xFirstEntry.executeAction("SELECT", tuple()) + xdelete.executeAction("CLICK", tuple()) + self.assertEqual(get_state_as_dict(xconsareas)["Children"], "2") + + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 2).getValue(), 200) + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 3).getValue(), 202) + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 4).getValue(), 204) + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 5).getValue(), 206) + + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 2).getValue(), 202) + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 3).getValue(), 204) + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 4).getValue(), 206) + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 5).getValue(), 208) + + self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 2).getValue(), 204) + self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 3).getValue(), 206) + self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 4).getValue(), 208) + self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 5).getValue(), 210) + + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 2).getValue(), 206) + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 3).getValue(), 208) + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 4).getValue(), 210) + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 5).getValue(), 212) + + # test cancel button + with self.ui_test.execute_modeless_dialog_through_command(".uno:DataConsolidate", close_button="cancel"): + pass + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests2/dataform.py b/sc/qa/uitest/calc_tests2/dataform.py new file mode 100644 index 000000000..a42d3d342 --- /dev/null +++ b/sc/qa/uitest/calc_tests2/dataform.py @@ -0,0 +1,24 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues + +class dataform(UITestCase): + def test_dataform(self): + with self.ui_test.create_doc_in_start_center("calc"): + + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A10"})) + + with self.ui_test.execute_dialog_through_command(".uno:DataForm", close_button="close"): + pass + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests2/standardFilter.py b/sc/qa/uitest/calc_tests2/standardFilter.py new file mode 100644 index 000000000..76d89a3cd --- /dev/null +++ b/sc/qa/uitest/calc_tests2/standardFilter.py @@ -0,0 +1,604 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file +from uitest.uihelper.common import select_by_text +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 113979 - Paste unformatted text does not ignore empty cells + +class standardFilter(UITestCase): + def test_standard_filter(self): + with self.ui_test.load_file(get_url_for_data_file("standardFilter.ods")): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C8"})) + + with self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xconnect2 = xDialog.getChild("connect2") + xfield2 = xDialog.getChild("field2") + xval2 = xDialog.getChild("val2") + + select_by_text(xfield1, "a") + xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) + select_by_text(xconnect2, "OR") + select_by_text(xfield2, "b") + xval2.executeAction("TYPE", mkPropertyValues({"TEXT":"3"})) + #3x down - should be on row 9 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "8") + #reopen filter and verify + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + with self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xconnect2 = xDialog.getChild("connect2") + xfield2 = xDialog.getChild("field2") + xval2 = xDialog.getChild("val2") + + self.assertEqual(get_state_as_dict(xfield1)["SelectEntryText"], "a") + self.assertEqual(get_state_as_dict(xfield2)["SelectEntryText"], "b") + self.assertEqual(get_state_as_dict(xconnect2)["SelectEntryText"], "OR") + self.assertEqual(get_state_as_dict(xval1)["Text"], "1") + self.assertEqual(get_state_as_dict(xval2)["Text"], "3") + + def test_standard_filter_copy_result(self): + with self.ui_test.load_file(get_url_for_data_file("standardFilter.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C8"})) + + with self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xconnect2 = xDialog.getChild("connect2") + xfield2 = xDialog.getChild("field2") + xval2 = xDialog.getChild("val2") + xcopyresult = xDialog.getChild("copyresult") + xedcopyarea = xDialog.getChild("edcopyarea") + select_by_text(xfield1, "a") + xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) + select_by_text(xconnect2, "OR") + select_by_text(xfield2, "b") + xval2.executeAction("TYPE", mkPropertyValues({"TEXT":"3"})) + xcopyresult.executeAction("CLICK", tuple()) + xedcopyarea.executeAction("TYPE", mkPropertyValues({"TEXT":"F1"})) + #verify + self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 0).getString(), "a") + self.assertEqual(get_cell_by_position(calc_doc, 0, 6, 0).getString(), "b") + self.assertEqual(get_cell_by_position(calc_doc, 0, 7, 0).getString(), "c") + self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 1).getValue(), 1) + self.assertEqual(get_cell_by_position(calc_doc, 0, 6, 1).getValue(), 2) + self.assertEqual(get_cell_by_position(calc_doc, 0, 7, 1).getValue(), 3) + self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 2).getValue(), 2) + self.assertEqual(get_cell_by_position(calc_doc, 0, 6, 2).getValue(), 3) + self.assertEqual(get_cell_by_position(calc_doc, 0, 7, 2).getValue(), 4) + + def test_standard_filter_copy_result_next_sheet(self): + with self.ui_test.load_file(get_url_for_data_file("standardFilter.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C8"})) + + with self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xconnect2 = xDialog.getChild("connect2") + xfield2 = xDialog.getChild("field2") + xval2 = xDialog.getChild("val2") + xcopyresult = xDialog.getChild("copyresult") + xedcopyarea = xDialog.getChild("edcopyarea") + select_by_text(xfield1, "a") + xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) + select_by_text(xconnect2, "OR") + select_by_text(xfield2, "b") + xval2.executeAction("TYPE", mkPropertyValues({"TEXT":"3"})) + xcopyresult.executeAction("CLICK", tuple()) + xedcopyarea.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet2.$F$1"})) + #verify + self.assertEqual(get_cell_by_position(calc_doc, 1, 5, 0).getString(), "a") + self.assertEqual(get_cell_by_position(calc_doc, 1, 6, 0).getString(), "b") + self.assertEqual(get_cell_by_position(calc_doc, 1, 7, 0).getString(), "c") + self.assertEqual(get_cell_by_position(calc_doc, 1, 5, 1).getValue(), 1) + self.assertEqual(get_cell_by_position(calc_doc, 1, 6, 1).getValue(), 2) + self.assertEqual(get_cell_by_position(calc_doc, 1, 7, 1).getValue(), 3) + self.assertEqual(get_cell_by_position(calc_doc, 1, 5, 2).getValue(), 2) + self.assertEqual(get_cell_by_position(calc_doc, 1, 6, 2).getValue(), 3) + self.assertEqual(get_cell_by_position(calc_doc, 1, 7, 2).getValue(), 4) + + def test_standard_filter_case_sensitive(self): + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + enter_text_to_cell(gridwin, "A1", "first") + enter_text_to_cell(gridwin, "B1", "second") + enter_text_to_cell(gridwin, "A2", "a1") + enter_text_to_cell(gridwin, "A3", "A1") + enter_text_to_cell(gridwin, "A4", "A1") + enter_text_to_cell(gridwin, "B2", "4") + enter_text_to_cell(gridwin, "B3", "5") + enter_text_to_cell(gridwin, "B4", "6") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B4"})) + with self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xcase = xDialog.getChild("case") + + select_by_text(xfield1, "first") + xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"a1"})) + xcase.executeAction("CLICK", tuple()) + #2x down - should be on row 5 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "4") + #reopen filter and verify + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + with self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xcase = xDialog.getChild("case") + + self.assertEqual(get_state_as_dict(xfield1)["SelectEntryText"], "first") + self.assertEqual(get_state_as_dict(xval1)["Text"], "a1") + self.assertEqual(get_state_as_dict(xcase)["Selected"], "true") + + def test_standard_filter_regular_expression(self): + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + enter_text_to_cell(gridwin, "A1", "first") + enter_text_to_cell(gridwin, "B1", "second") + enter_text_to_cell(gridwin, "A2", "aa") + enter_text_to_cell(gridwin, "A3", "aaa") + enter_text_to_cell(gridwin, "A4", "abbb") + enter_text_to_cell(gridwin, "A5", "accc") + enter_text_to_cell(gridwin, "A6", "a*") + enter_text_to_cell(gridwin, "B2", "1") + enter_text_to_cell(gridwin, "B3", "2") + enter_text_to_cell(gridwin, "B4", "3") + enter_text_to_cell(gridwin, "B5", "4") + enter_text_to_cell(gridwin, "B6", "5") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B6"})) + with self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xregexp = xDialog.getChild("regexp") + + select_by_text(xfield1, "first") + xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"a*"})) + xregexp.executeAction("CLICK", tuple()) + #3x down - should be on row 7 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "6") + #reopen filter and verify + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + with self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xregexp = xDialog.getChild("regexp") + + self.assertEqual(get_state_as_dict(xfield1)["SelectEntryText"], "first") + self.assertEqual(get_state_as_dict(xval1)["Text"], "a*") + self.assertEqual(get_state_as_dict(xregexp)["Selected"], "true") + + def test_standard_filter_condition_contains(self): + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + enter_text_to_cell(gridwin, "A1", "first") + enter_text_to_cell(gridwin, "B1", "second") + enter_text_to_cell(gridwin, "A2", "aa") + enter_text_to_cell(gridwin, "A3", "aaa") + enter_text_to_cell(gridwin, "A4", "abbb") + enter_text_to_cell(gridwin, "A5", "accc") + enter_text_to_cell(gridwin, "A6", "a*") + enter_text_to_cell(gridwin, "B2", "1") + enter_text_to_cell(gridwin, "B3", "2") + enter_text_to_cell(gridwin, "B4", "3") + enter_text_to_cell(gridwin, "B5", "4") + enter_text_to_cell(gridwin, "B6", "5") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B6"})) + with self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xregexp = xDialog.getChild("regexp") + + select_by_text(xfield1, "first") + xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"a*"})) + xregexp.executeAction("CLICK", tuple()) + #3x down - should be on row 7 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "6") + #reopen filter and verify + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + with self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xregexp = xDialog.getChild("regexp") + + self.assertEqual(get_state_as_dict(xfield1)["SelectEntryText"], "first") + self.assertEqual(get_state_as_dict(xval1)["Text"], "a*") + self.assertEqual(get_state_as_dict(xregexp)["Selected"], "true") + + #from testcasespecification OOo + def test_standard_filter_condition_contains2(self): + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + enter_text_to_cell(gridwin, "A1", "A") + enter_text_to_cell(gridwin, "B1", "B") + enter_text_to_cell(gridwin, "C1", "C") + enter_text_to_cell(gridwin, "D1", "D") + enter_text_to_cell(gridwin, "A2", "economics") + enter_text_to_cell(gridwin, "B2", "34") + enter_text_to_cell(gridwin, "C2", "67") + enter_text_to_cell(gridwin, "D2", "122") + enter_text_to_cell(gridwin, "A3", "socioeconomic") + enter_text_to_cell(gridwin, "B3", "45") + enter_text_to_cell(gridwin, "C3", "77") + enter_text_to_cell(gridwin, "D3", "333") + enter_text_to_cell(gridwin, "A4", "sociology") + enter_text_to_cell(gridwin, "B4", "78") + enter_text_to_cell(gridwin, "C4", "89") + enter_text_to_cell(gridwin, "D4", "56") + enter_text_to_cell(gridwin, "A5", "humanities") + enter_text_to_cell(gridwin, "B5", "45") + enter_text_to_cell(gridwin, "C5", "67") + enter_text_to_cell(gridwin, "D5", "89") + #Select + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:D5"})) + #Choose DATA-FILTER-STANDARDFILTER + #Choose field name "A"/ Choose condition "Contains"/Enter value "cio"/Press OK button + with self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xcond1 = xDialog.getChild("cond1") + + select_by_text(xfield1, "A") + select_by_text(xcond1, "Contains") + xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"cio"})) + + #Verify that row 1,3, 4 are visible (2 and 5 are hidden) + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "2") + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "3") + #reopen filter and verify + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + with self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter", close_button="cancel") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xcond1 = xDialog.getChild("cond1") + self.assertEqual(get_state_as_dict(xfield1)["SelectEntryText"], "A") + self.assertEqual(get_state_as_dict(xval1)["Text"], "cio") + self.assertEqual(get_state_as_dict(xcond1)["SelectEntryText"], "Contains") + + def test_standard_filter_condition_does_not_contains(self): + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + enter_text_to_cell(gridwin, "A1", "A") + enter_text_to_cell(gridwin, "B1", "B") + enter_text_to_cell(gridwin, "C1", "C") + enter_text_to_cell(gridwin, "D1", "D") + enter_text_to_cell(gridwin, "A2", "economics") + enter_text_to_cell(gridwin, "B2", "34") + enter_text_to_cell(gridwin, "C2", "67") + enter_text_to_cell(gridwin, "D2", "122") + enter_text_to_cell(gridwin, "A3", "socioeconomic") + enter_text_to_cell(gridwin, "B3", "45") + enter_text_to_cell(gridwin, "C3", "77") + enter_text_to_cell(gridwin, "D3", "333") + enter_text_to_cell(gridwin, "A4", "sociology") + enter_text_to_cell(gridwin, "B4", "78") + enter_text_to_cell(gridwin, "C4", "89") + enter_text_to_cell(gridwin, "D4", "56") + enter_text_to_cell(gridwin, "A5", "humanities") + enter_text_to_cell(gridwin, "B5", "45") + enter_text_to_cell(gridwin, "C5", "67") + enter_text_to_cell(gridwin, "D5", "89") + #Select + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:D5"})) + #Choose DATA-FILTER-STANDARDFILTER + #Choose field name "A"/ Choose condition "Does not contain"/Enter value "cio"/Press OK button + with self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xcond1 = xDialog.getChild("cond1") + + select_by_text(xfield1, "A") + select_by_text(xcond1, "Does not contain") + xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"cio"})) + + #Verify that row 1,2, 5 are visible (3 and 4 are hidden) + 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"], "4") + #reopen filter and verify + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + with self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter", close_button="cancel") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xcond1 = xDialog.getChild("cond1") + self.assertEqual(get_state_as_dict(xfield1)["SelectEntryText"], "A") + self.assertEqual(get_state_as_dict(xval1)["Text"], "cio") + self.assertEqual(get_state_as_dict(xcond1)["SelectEntryText"], "Does not contain") + + + def test_standard_filter_condition_Begins_with(self): + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + enter_text_to_cell(gridwin, "A1", "A") + enter_text_to_cell(gridwin, "B1", "B") + enter_text_to_cell(gridwin, "C1", "C") + enter_text_to_cell(gridwin, "D1", "D") + enter_text_to_cell(gridwin, "A2", "economics") + enter_text_to_cell(gridwin, "B2", "34") + enter_text_to_cell(gridwin, "C2", "67") + enter_text_to_cell(gridwin, "D2", "122") + enter_text_to_cell(gridwin, "A3", "socioeconomic") + enter_text_to_cell(gridwin, "B3", "45") + enter_text_to_cell(gridwin, "C3", "77") + enter_text_to_cell(gridwin, "D3", "333") + enter_text_to_cell(gridwin, "A4", "sociology") + enter_text_to_cell(gridwin, "B4", "78") + enter_text_to_cell(gridwin, "C4", "89") + enter_text_to_cell(gridwin, "D4", "56") + enter_text_to_cell(gridwin, "A5", "humanities") + enter_text_to_cell(gridwin, "B5", "45") + enter_text_to_cell(gridwin, "C5", "67") + enter_text_to_cell(gridwin, "D5", "89") + #Select + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:D5"})) + #Choose DATA-FILTER-STANDARDFILTER + #Choose field name "A"/ Choose condition "Begins with"/Enter value "si"/Press OK button + with self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xcond1 = xDialog.getChild("cond1") + + select_by_text(xfield1, "A") + select_by_text(xcond1, "Begins with") + xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"so"})) + + #Verify that row 1,3, 4 are visible (2 and 5 are hidden) + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "2") + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "3") + #reopen filter and verify + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + with self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter", close_button="cancel") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xcond1 = xDialog.getChild("cond1") + self.assertEqual(get_state_as_dict(xfield1)["SelectEntryText"], "A") + self.assertEqual(get_state_as_dict(xval1)["Text"], "so") + self.assertEqual(get_state_as_dict(xcond1)["SelectEntryText"], "Begins with") + + + def test_standard_filter_condition_Does_not_begin_with(self): + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + enter_text_to_cell(gridwin, "A1", "A") + enter_text_to_cell(gridwin, "B1", "B") + enter_text_to_cell(gridwin, "C1", "C") + enter_text_to_cell(gridwin, "D1", "D") + enter_text_to_cell(gridwin, "A2", "economics") + enter_text_to_cell(gridwin, "B2", "34") + enter_text_to_cell(gridwin, "C2", "67") + enter_text_to_cell(gridwin, "D2", "122") + enter_text_to_cell(gridwin, "A3", "socioeconomic") + enter_text_to_cell(gridwin, "B3", "45") + enter_text_to_cell(gridwin, "C3", "77") + enter_text_to_cell(gridwin, "D3", "333") + enter_text_to_cell(gridwin, "A4", "sociology") + enter_text_to_cell(gridwin, "B4", "78") + enter_text_to_cell(gridwin, "C4", "89") + enter_text_to_cell(gridwin, "D4", "56") + enter_text_to_cell(gridwin, "A5", "humanities") + enter_text_to_cell(gridwin, "B5", "45") + enter_text_to_cell(gridwin, "C5", "67") + enter_text_to_cell(gridwin, "D5", "89") + #Select + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:D5"})) + #Choose DATA-FILTER-STANDARDFILTER + #Choose field name "A"/ Choose condition "Does not contain"/Enter value "cio"/Press OK button + with self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xcond1 = xDialog.getChild("cond1") + + select_by_text(xfield1, "A") + select_by_text(xcond1, "Does not begin with") + xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"so"})) + + #Verify that row 1,2, 5 are visible (3 and 4 are hidden) + 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"], "4") + #reopen filter and verify + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + with self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter", close_button="cancel") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xcond1 = xDialog.getChild("cond1") + self.assertEqual(get_state_as_dict(xfield1)["SelectEntryText"], "A") + self.assertEqual(get_state_as_dict(xval1)["Text"], "so") + self.assertEqual(get_state_as_dict(xcond1)["SelectEntryText"], "Does not begin with") + + + def test_standard_filter_condition_Ends_with(self): + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + enter_text_to_cell(gridwin, "A1", "A") + enter_text_to_cell(gridwin, "B1", "B") + enter_text_to_cell(gridwin, "C1", "C") + enter_text_to_cell(gridwin, "D1", "D") + enter_text_to_cell(gridwin, "A2", "economics") + enter_text_to_cell(gridwin, "B2", "34") + enter_text_to_cell(gridwin, "C2", "67") + enter_text_to_cell(gridwin, "D2", "122") + enter_text_to_cell(gridwin, "A3", "socioeconomic") + enter_text_to_cell(gridwin, "B3", "45") + enter_text_to_cell(gridwin, "C3", "77") + enter_text_to_cell(gridwin, "D3", "333") + enter_text_to_cell(gridwin, "A4", "sociology") + enter_text_to_cell(gridwin, "B4", "78") + enter_text_to_cell(gridwin, "C4", "89") + enter_text_to_cell(gridwin, "D4", "56") + enter_text_to_cell(gridwin, "A5", "humanities") + enter_text_to_cell(gridwin, "B5", "45") + enter_text_to_cell(gridwin, "C5", "67") + enter_text_to_cell(gridwin, "D5", "89") + #Select + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:D5"})) + #Choose DATA-FILTER-STANDARDFILTER + #Choose field name "A"/ Choose condition "Does not contain"/Enter value "cio"/Press OK button + with self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xcond1 = xDialog.getChild("cond1") + + select_by_text(xfield1, "A") + select_by_text(xcond1, "Ends with") + xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"s"})) + + #Verify that row 1,2, 5 are visible (3 and 4 are hidden) + 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"], "4") + #reopen filter and verify + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + with self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter", close_button="cancel") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xcond1 = xDialog.getChild("cond1") + self.assertEqual(get_state_as_dict(xfield1)["SelectEntryText"], "A") + self.assertEqual(get_state_as_dict(xval1)["Text"], "s") + self.assertEqual(get_state_as_dict(xcond1)["SelectEntryText"], "Ends with") + + + def test_standard_filter_condition_Does_not_end_with(self): + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + enter_text_to_cell(gridwin, "A1", "A") + enter_text_to_cell(gridwin, "B1", "B") + enter_text_to_cell(gridwin, "C1", "C") + enter_text_to_cell(gridwin, "D1", "D") + enter_text_to_cell(gridwin, "A2", "economics") + enter_text_to_cell(gridwin, "B2", "34") + enter_text_to_cell(gridwin, "C2", "67") + enter_text_to_cell(gridwin, "D2", "122") + enter_text_to_cell(gridwin, "A3", "socioeconomic") + enter_text_to_cell(gridwin, "B3", "45") + enter_text_to_cell(gridwin, "C3", "77") + enter_text_to_cell(gridwin, "D3", "333") + enter_text_to_cell(gridwin, "A4", "sociology") + enter_text_to_cell(gridwin, "B4", "78") + enter_text_to_cell(gridwin, "C4", "89") + enter_text_to_cell(gridwin, "D4", "56") + enter_text_to_cell(gridwin, "A5", "humanities") + enter_text_to_cell(gridwin, "B5", "45") + enter_text_to_cell(gridwin, "C5", "67") + enter_text_to_cell(gridwin, "D5", "89") + #Select + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:D5"})) + #Choose DATA-FILTER-STANDARDFILTER + #Choose field name "A"/ Choose condition "Begins with"/Enter value "si"/Press OK button + with self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xcond1 = xDialog.getChild("cond1") + + select_by_text(xfield1, "A") + select_by_text(xcond1, "Does not end with") + xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"s"})) + + #Verify that row 1,3, 4 are visible (2 and 5 are hidden) + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "2") + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "3") + #reopen filter and verify + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + with self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter", close_button="cancel") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xcond1 = xDialog.getChild("cond1") + self.assertEqual(get_state_as_dict(xfield1)["SelectEntryText"], "A") + self.assertEqual(get_state_as_dict(xval1)["Text"], "s") + self.assertEqual(get_state_as_dict(xcond1)["SelectEntryText"], "Does not end with") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests2/tdf104117.py b/sc/qa/uitest/calc_tests2/tdf104117.py new file mode 100644 index 000000000..8287be14e --- /dev/null +++ b/sc/qa/uitest/calc_tests2/tdf104117.py @@ -0,0 +1,39 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import select_by_text +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + +#Bug 104117 - Crash in Calc when selecting "Uniform Integer" with an max value "100000000000000" in "Random Number Generator +class tdf104117(UITestCase): + def test_tdf104117(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"})) + with self.ui_test.execute_modeless_dialog_through_command(".uno:RandomNumberGeneratorDialog") as xDialog: + xcellrangeedit = xDialog.getChild("cell-range-edit") + xdistributioncombo = xDialog.getChild("distribution-combo") + xparameter2spin = xDialog.getChild("parameter2-spin") + + xcellrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$A$2"})) + select_by_text(xdistributioncombo, "Uniform Integer") + xparameter2spin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xparameter2spin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xparameter2spin.executeAction("TYPE", mkPropertyValues({"TEXT":"1000000000000000000000000000000000000000000000"})) + + #Verify + self.assertEqual(bool(get_cell_by_position(document, 0, 0, 0).getString() ), True) + self.assertEqual(bool(get_cell_by_position(document, 0, 0, 1).getString() ), True) + #undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(bool(get_cell_by_position(document, 0, 0, 0).getString() ), False) + self.assertEqual(bool(get_cell_by_position(document, 0, 0, 1).getString() ), False) +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests2/tdf114992.py b/sc/qa/uitest/calc_tests2/tdf114992.py new file mode 100644 index 000000000..6b3a97b0e --- /dev/null +++ b/sc/qa/uitest/calc_tests2/tdf114992.py @@ -0,0 +1,24 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_url_for_data_file + +#Bug: Delete a sheet in a calc document and LO crashes + +class tdf114992(UITestCase): + def test_tdf114992_delete_sheet_crash(self): + with self.ui_test.load_file(get_url_for_data_file("tdf114992.ods")) as calc_doc: + with self.ui_test.execute_dialog_through_command(".uno:Remove", close_button="yes"): + pass + + self.assertEqual(calc_doc.Sheets.getCount(), 1) + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(calc_doc.Sheets.getCount(), 2) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests2/tdf117367.py b/sc/qa/uitest/calc_tests2/tdf117367.py new file mode 100644 index 000000000..382873a3c --- /dev/null +++ b/sc/qa/uitest/calc_tests2/tdf117367.py @@ -0,0 +1,49 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.uno.propertyvalue import mkPropertyValues +#Bug 117367 - FORMATTING Merge cells dialog radio buttons cannot be unselected + +class tdf117367(UITestCase): + def test_tdf117367_merge_cells_radio_buttons(self): + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + enter_text_to_cell(gridwin, "A1", "AAA") + enter_text_to_cell(gridwin, "A2", "BBB") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B4"})) + + #Right-click - Merge cells /Select all three options + with self.ui_test.execute_dialog_through_command(".uno:MergeCells") as xDialog: + xmoveCellsRadio = xDialog.getChild("move-cells-radio") + xemptyCellsRadio = xDialog.getChild("empty-cells-radio") + xkeepContentRadio = xDialog.getChild("keep-content-radio") + xmoveCellsRadio.executeAction("CLICK", tuple()) + xmoveCellsRadio.executeAction("CLICK", tuple()) + #Issue: I think these should be exclusive, not possible to select more than one. It is also impossible to uncheck any of the buttons. + self.assertEqual(get_state_as_dict(xmoveCellsRadio)["Checked"], "true") + self.assertEqual(get_state_as_dict(xemptyCellsRadio)["Checked"], "false") + self.assertEqual(get_state_as_dict(xkeepContentRadio)["Checked"], "false") + + xemptyCellsRadio.executeAction("CLICK", tuple()) + self.assertEqual(get_state_as_dict(xmoveCellsRadio)["Checked"], "false") + self.assertEqual(get_state_as_dict(xemptyCellsRadio)["Checked"], "true") + self.assertEqual(get_state_as_dict(xkeepContentRadio)["Checked"], "false") + + xkeepContentRadio.executeAction("CLICK", tuple()) + self.assertEqual(get_state_as_dict(xmoveCellsRadio)["Checked"], "false") + self.assertEqual(get_state_as_dict(xemptyCellsRadio)["Checked"], "false") + self.assertEqual(get_state_as_dict(xkeepContentRadio)["Checked"], "true") + + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests2/tdf120174.py b/sc/qa/uitest/calc_tests2/tdf120174.py new file mode 100644 index 000000000..31a9f6167 --- /dev/null +++ b/sc/qa/uitest/calc_tests2/tdf120174.py @@ -0,0 +1,30 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.calc import enter_text_to_cell + +class tdf120174(UITestCase): + def test_tdf120174(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + enter_text_to_cell(gridwin, "A1", "121") + enter_text_to_cell(gridwin, "B1", "=A1") + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getValue(), 121) # B1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + # Delete contents of A1 + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DELETE"})) + # Before the fix the result would be still 121. + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getValue(), 0) # B1 + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getValue(), 121) # B1 + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests2/tdf127113.py b/sc/qa/uitest/calc_tests2/tdf127113.py new file mode 100644 index 000000000..daab2f521 --- /dev/null +++ b/sc/qa/uitest/calc_tests2/tdf127113.py @@ -0,0 +1,58 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + +class tdf127113(UITestCase): + + def launch_dialog(self, direction): + with self.ui_test.execute_dialog_through_command(".uno:FillSeries") as xDialog: + xDirection = xDialog.getChild(direction) + xDirection.executeAction("CLICK", tuple()) + + xStart = xDialog.getChild("startValue") + xStart.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) + self.assertEqual("1", get_state_as_dict(xStart)["Text"]) + + xEnd = xDialog.getChild("endValue") + xEnd.executeAction("TYPE", mkPropertyValues({"TEXT":"5"})) + self.assertEqual("5", get_state_as_dict(xEnd)["Text"]) + + # Without the fix in place, this test would have failed because the increment child + # couldn't be empty and a warning dialog would be displayed + xIncrement = xDialog.getChild("increment") + xIncrement.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xIncrement.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + self.assertEqual("", get_state_as_dict(xIncrement)["Text"]) + + def test_tdf127113(self): + with self.ui_test.create_doc_in_start_center("calc") as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A9"})) + + self.launch_dialog("down") + + value = 1.0 + for i in range(9): + self.assertEqual(value, get_cell_by_position(calc_doc, 0, 0, i).getValue()) + value += 0.5 + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "B1:B9"})) + + self.launch_dialog("up") + + for i in range(9): + value -= 0.5 + self.assertEqual(value, get_cell_by_position(calc_doc, 0, 1, i).getValue()) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests2/tdf46138.py b/sc/qa/uitest/calc_tests2/tdf46138.py new file mode 100644 index 000000000..1a07bf916 --- /dev/null +++ b/sc/qa/uitest/calc_tests2/tdf46138.py @@ -0,0 +1,31 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +#Bug 46138 - Calc Frozen after "undo" "Filling Series Number in a Column" + +class tdf46138(UITestCase): + def test_tdf46138(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #Choose a column, + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + self.xUITest.executeCommand(".uno:SelectColumn") + #select 'edit'>'fill'>'series'>Starting Value '1' then "OK", + with self.ui_test.execute_dialog_through_command(".uno:FillSeries") as xDialog: + xStart = xDialog.getChild("startValue") + xStart.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "1") + #then "Ctrl+Z"/ undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests2/xmlSource.py b/sc/qa/uitest/calc_tests2/xmlSource.py new file mode 100644 index 000000000..b2038d233 --- /dev/null +++ b/sc/qa/uitest/calc_tests2/xmlSource.py @@ -0,0 +1,62 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file +from libreoffice.calc.document import get_cell_by_position + +class xmlSource(UITestCase): + + def test_importXml(self): + + with self.ui_test.create_doc_in_start_center("calc") as calc_doc: + + # Create a new tab + with self.ui_test.execute_dialog_through_command(".uno:Insert") as xDialog: + xAfter = xDialog.getChild('after') + xAfter.executeAction("CLICK", tuple()) + + with self.ui_test.execute_modeless_dialog_through_command(".uno:ManageXMLSource") as xDialog: + + xSource = xDialog.getChild("selectsource") + + with self.ui_test.execute_blocking_action(xSource.executeAction, args=('CLICK', ()), close_button="open") as xOpenDialog: + xFileName = xOpenDialog.getChild("file_name") + xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": get_url_for_data_file("xmlSource.xml")})) + + xTree = xDialog.getChild("tree") + self.assertEqual('13', get_state_as_dict(xTree)["Children"]) + + xTree.getChild('0').executeAction("SELECT", tuple()) + xTree.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + xTree.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + + self.assertEqual("entry", get_state_as_dict(xTree)["SelectEntryText"]) + self.assertEqual("11", get_state_as_dict(xTree)["SelectionCount"]) + + xEdit = xDialog.getChild("edit") + xEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "$A$1"})) + + # tdf#126565: Without the fix in place, this test would have failed with + # AssertionError: '' != 'name' + for i in range(8): + self.assertEqual("", get_cell_by_position(calc_doc, 0, i, 0).getString()) + + # Check the headers + self.assertEqual("name", get_cell_by_position(calc_doc, 1, 0, 0).getString()) + self.assertEqual("translated-address", get_cell_by_position(calc_doc, 1, 1, 0).getString()) + self.assertEqual("to", get_cell_by_position(calc_doc, 1, 2, 0).getString()) + self.assertEqual("from", get_cell_by_position(calc_doc, 1, 3, 0).getString()) + self.assertEqual("source", get_cell_by_position(calc_doc, 1, 4, 0).getString()) + self.assertEqual("destination", get_cell_by_position(calc_doc, 1, 5, 0).getString()) + self.assertEqual("service", get_cell_by_position(calc_doc, 1, 6, 0).getString()) + self.assertEqual("disabled", get_cell_by_position(calc_doc, 1, 7, 0).getString()) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: |