diff options
Diffstat (limited to '')
299 files changed, 19037 insertions, 0 deletions
diff --git a/sc/qa/uitest/__init__.py b/sc/qa/uitest/__init__.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/sc/qa/uitest/__init__.py diff --git a/sc/qa/uitest/autofilter/autofilter.py b/sc/qa/uitest/autofilter/autofilter.py new file mode 100644 index 000000000..e1aea9c1e --- /dev/null +++ b/sc/qa/uitest/autofilter/autofilter.py @@ -0,0 +1,101 @@ +# -*- 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.path import get_srcdir_url + +from uitest.uihelper.common import get_state_as_dict +from libreoffice.uno.propertyvalue import mkPropertyValues +from libreoffice.calc.document import get_row + +import time + +def get_url_for_data_file(file_name): + return get_srcdir_url() + "/sc/qa/uitest/autofilter/data/" + file_name + +def is_row_hidden(doc, index): + row = get_row(doc, index) + val = row.getPropertyValue("IsVisible") + return not val + +class AutofilterTest(UITestCase): + + def test_tdf106214(self): + doc = self.ui_test.load_file(get_url_for_data_file("autofilter.ods")) + + xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") + xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + + xFloatWindow = self.xUITest.getFloatWindow() + xCheckListMenu = xFloatWindow.getChild("check_list_menu") + + xTreeList = xCheckListMenu.getChild("check_list_box") + xFirstEntry = xTreeList.getChild("0") + + xFirstEntry.executeAction("CLICK", tuple()) + + xOkBtn = xFloatWindow.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) + + self.assertFalse(is_row_hidden(doc, 0)) + self.assertFalse(is_row_hidden(doc, 1)) + self.assertFalse(is_row_hidden(doc, 2)) + self.assertTrue(is_row_hidden(doc, 3)) + self.assertFalse(is_row_hidden(doc, 4)) + + self.ui_test.close_doc() + + def test_filter_multiple_rows(self): + doc = self.ui_test.load_file(get_url_for_data_file("autofilter.ods")) + + xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") + xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "2", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xCheckListMenu = xFloatWindow.getChild("check_list_menu") + + xTreeList = xCheckListMenu.getChild("check_list_box") + xFirstEntry = xTreeList.getChild("1") + + xFirstEntry.executeAction("CLICK", tuple()) + + xOkBtn = xFloatWindow.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) + + self.assertFalse(is_row_hidden(doc, 0)) + self.assertFalse(is_row_hidden(doc, 1)) + self.assertTrue(is_row_hidden(doc, 2)) + self.assertTrue(is_row_hidden(doc, 3)) + self.assertFalse(is_row_hidden(doc, 4)) + + def test_tdf134351(self): + doc = self.ui_test.load_file(get_url_for_data_file("autofilter.ods")) + + xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") + xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + + xFloatWindow = self.xUITest.getFloatWindow() + xCheckListMenu = xFloatWindow.getChild("check_list_menu") + + xTreeList = xCheckListMenu.getChild("check_list_box") + + self.assertEqual(2, len(xTreeList.getChildren())) + self.assertTrue(get_state_as_dict(xTreeList.getChild('0'))['IsSelected']) + self.assertTrue(get_state_as_dict(xTreeList.getChild('1'))['IsSelected']) + + xOkBtn = xFloatWindow.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) + + self.assertFalse(is_row_hidden(doc, 0)) + # Without the fix in place, this test would have failed here + self.assertFalse(is_row_hidden(doc, 1)) + self.assertFalse(is_row_hidden(doc, 2)) + self.assertFalse(is_row_hidden(doc, 3)) + self.assertFalse(is_row_hidden(doc, 4)) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/autofilter/autofilterBugs.py b/sc/qa/uitest/autofilter/autofilterBugs.py new file mode 100644 index 000000000..e216d7994 --- /dev/null +++ b/sc/qa/uitest/autofilter/autofilterBugs.py @@ -0,0 +1,249 @@ +# -*- 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 libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict +import time +from uitest.debug import sleep +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 + +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() + +class autofilter(UITestCase): + + def test_tdf115046(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf115046.ods")) + document = self.ui_test.get_component() + #autofilter exist + self.assertEqual(document.getPropertyValue("UnnamedDatabaseRanges").getByTable(0).AutoFilter, True) + + self.ui_test.execute_dialog_through_command(".uno:DataSort") + xDialog = self.xUITest.getTopFocusWindow() + + xcancBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xcancBtn) + #autofilter still exist + self.assertEqual(document.getPropertyValue("UnnamedDatabaseRanges").getByTable(0).AutoFilter, True) + + self.ui_test.close_doc() + + def test_tdf94055(self): + self.ui_test.create_doc_in_start_center("calc") + document = self.ui_test.get_component() + calcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = calcDoc.getChild("grid_window") + enter_text_to_cell(xGridWindow, "A1", "X") + enter_text_to_cell(xGridWindow, "B1", "Y") + enter_text_to_cell(xGridWindow, "A2", "a") + enter_text_to_cell(xGridWindow, "B2", "b") + enter_text_to_cell(xGridWindow, "A3", "c") + enter_text_to_cell(xGridWindow, "B3", "d") + xGridWindow.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B1"})) + + self.ui_test.execute_dialog_through_command(".uno:DataFilterAutoFilter") + xDialog = self.xUITest.getTopFocusWindow() + xYesBtn = xDialog.getChild("yes") + self.ui_test.close_dialog_through_button(xYesBtn) + + xGridWindow.executeAction("SELECT", mkPropertyValues({"RANGE": "A2:A3"})) + self.xUITest.executeCommand(".uno:SelectRow") #select two rows + + self.ui_test.execute_dialog_through_command(".uno:DataSort") + xDialog = self.xUITest.getTopFocusWindow() + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #autofilter still exist + self.assertEqual(document.getPropertyValue("UnnamedDatabaseRanges").getByTable(0).AutoFilter, True) + + self.ui_test.close_doc() + + #tdf77479.ods + def test_tdf77479(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf77479.ods")) + document = self.ui_test.get_component() + calcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = calcDoc.getChild("grid_window") + #autofilter exist + self.assertEqual(document.getPropertyValue("UnnamedDatabaseRanges").getByTable(0).AutoFilter, True) + + xGridWindow.executeAction("SELECT", mkPropertyValues({"RANGE": "A2:E6"})) + + self.ui_test.execute_dialog_through_command(".uno:DataSort") + xDialog = self.xUITest.getTopFocusWindow() + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #autofilter still exist + self.assertEqual(document.getPropertyValue("UnnamedDatabaseRanges").getByTable(0).AutoFilter, True) + + self.ui_test.close_doc() + + #112656 + def test_tdf112656(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf112656.ods")) + document = self.ui_test.get_component() + calcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = calcDoc.getChild("grid_window") + + xGridWindow.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "2", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xTreeList = xFloatWindow.getChild("check_list_box") + xFirstEntry = xTreeList.getChild("0") + xSecondEntry = xTreeList.getChild("1") + self.assertEqual(get_state_as_dict(xFirstEntry)["Text"], "Fruit") + self.assertEqual(get_state_as_dict(xSecondEntry)["Text"], "Vegetables") + + self.ui_test.close_doc() + + #tdf81124 + def test_tdf81124(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf81124.ods")) + document = self.ui_test.get_component() + calcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = calcDoc.getChild("grid_window") + + xGridWindow.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + + xUnselect = xFloatWindow.getChild("unselect_current") + xUnselect.executeAction("CLICK", tuple()) + xokBtn = xFloatWindow.getChild("ok") + self.assertEqual(get_state_as_dict(xokBtn)["Enabled"], "false") + + xSelect = xFloatWindow.getChild("select_current") + xSelect.executeAction("CLICK", tuple()) + xokBtn = xFloatWindow.getChild("ok") + self.assertEqual(get_state_as_dict(xokBtn)["Enabled"], "true") + + xCancel = xFloatWindow.getChild("cancel") + xCancel.executeAction("CLICK", tuple()) + + self.ui_test.close_doc() + +#tdf73565 + def test_tdf73565(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf73565.ods")) + document = self.ui_test.get_component() + calcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = calcDoc.getChild("grid_window") + + xGridWindow.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xTreeList = xFloatWindow.getChild("check_list_box") + xFirstEntry = xTreeList.getChild("0") + self.assertEqual(get_state_as_dict(xFirstEntry)["Text"], "2014") + + xCancel = xFloatWindow.getChild("cancel") + xCancel.executeAction("CLICK", tuple()) + + self.ui_test.close_doc() + + #tdf65505 + def test_tdf65505(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf81124.ods")) + document = self.ui_test.get_component() + calcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = calcDoc.getChild("grid_window") + + xGridWindow.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xTreeList = xFloatWindow.getChild("check_list_box") + xFirstEntry = xTreeList.getChild("0") + self.assertEqual(get_state_as_dict(xFirstEntry)["Text"], "(empty)") + + xCancel = xFloatWindow.getChild("cancel") + xCancel.executeAction("CLICK", tuple()) + + self.ui_test.close_doc() + +#tdf74857 + def test_tdf74857(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf74857.ods")) + document = self.ui_test.get_component() + calcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = calcDoc.getChild("grid_window") + + xGridWindow.executeAction("TYPE", mkPropertyValues({"KEYCODE":"SHIFT+CTRL+DOWN"})) + # Assert that the correct range has been selected + gridWinState = get_state_as_dict(xGridWindow) + self.assertEqual(gridWinState["MarkedArea"], "Sheet1.A1:Sheet1.A25") + + self.ui_test.close_doc() + + #tdf35294 + def test_tdf35294(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf35294.ods")) + document = self.ui_test.get_component() + calcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = calcDoc.getChild("grid_window") + + xGridWindow.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xTreeList = xFloatWindow.getChild("check_list_box") + x1Entry = xTreeList.getChild("0") + x2Entry = xTreeList.getChild("1") + x3Entry = xTreeList.getChild("2") + x4Entry = xTreeList.getChild("3") + x5Entry = xTreeList.getChild("4") + x6Entry = xTreeList.getChild("5") + x7Entry = xTreeList.getChild("6") + + self.assertEqual(get_state_as_dict(x1Entry)["Text"], "a") + self.assertEqual(get_state_as_dict(x2Entry)["Text"], "á") + self.assertEqual(get_state_as_dict(x3Entry)["Text"], "b") + self.assertEqual(get_state_as_dict(x4Entry)["Text"], "č") + self.assertEqual(get_state_as_dict(x5Entry)["Text"], "é") + self.assertEqual(get_state_as_dict(x6Entry)["Text"], "ř") + self.assertEqual(get_state_as_dict(x7Entry)["Text"], "ž") + + xCancel = xFloatWindow.getChild("cancel") + xCancel.executeAction("CLICK", tuple()) + + self.ui_test.close_doc() + + #tdf55712 + def test_tdf55712(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf55712.ods")) + document = self.ui_test.get_component() + calcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = calcDoc.getChild("grid_window") + + xGridWindow.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xTreeList = xFloatWindow.getChild("check_list_box") + x1Entry = xTreeList.getChild("0") + x2Entry = xTreeList.getChild("1") + x3Entry = xTreeList.getChild("2") + x4Entry = xTreeList.getChild("3") + x5Entry = xTreeList.getChild("4") + x6Entry = xTreeList.getChild("5") + x7Entry = xTreeList.getChild("6") + x8Entry = xTreeList.getChild("7") + x9Entry = xTreeList.getChild("8") + + self.assertEqual(get_state_as_dict(x1Entry)["Text"], "0") + self.assertEqual(get_state_as_dict(x2Entry)["Text"], "0.1") + self.assertEqual(get_state_as_dict(x3Entry)["Text"], "0.2") + self.assertEqual(get_state_as_dict(x4Entry)["Text"], "0.3") + self.assertEqual(get_state_as_dict(x5Entry)["Text"], "0.5") + self.assertEqual(get_state_as_dict(x6Entry)["Text"], "0.8") + self.assertEqual(get_state_as_dict(x7Entry)["Text"], "0.9") + self.assertEqual(get_state_as_dict(x8Entry)["Text"], "1") + self.assertEqual(get_state_as_dict(x9Entry)["Text"], "(empty)") + self.assertEqual(get_state_as_dict(xTreeList)["Children"], "9") + + xCancel = xFloatWindow.getChild("cancel") + xCancel.executeAction("CLICK", tuple()) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/autofilter/data/autofilter.ods b/sc/qa/uitest/autofilter/data/autofilter.ods Binary files differnew file mode 100644 index 000000000..49285933c --- /dev/null +++ b/sc/qa/uitest/autofilter/data/autofilter.ods diff --git a/sc/qa/uitest/autofilter/data/tdf101165.ods b/sc/qa/uitest/autofilter/data/tdf101165.ods Binary files differnew file mode 100644 index 000000000..9c459bbc5 --- /dev/null +++ b/sc/qa/uitest/autofilter/data/tdf101165.ods diff --git a/sc/qa/uitest/autofilter/data/tdf112656.ods b/sc/qa/uitest/autofilter/data/tdf112656.ods Binary files differnew file mode 100644 index 000000000..c6859f238 --- /dev/null +++ b/sc/qa/uitest/autofilter/data/tdf112656.ods diff --git a/sc/qa/uitest/autofilter/data/tdf115046.ods b/sc/qa/uitest/autofilter/data/tdf115046.ods Binary files differnew file mode 100644 index 000000000..edd544373 --- /dev/null +++ b/sc/qa/uitest/autofilter/data/tdf115046.ods diff --git a/sc/qa/uitest/autofilter/data/tdf117276.ods b/sc/qa/uitest/autofilter/data/tdf117276.ods Binary files differnew file mode 100644 index 000000000..d1310526e --- /dev/null +++ b/sc/qa/uitest/autofilter/data/tdf117276.ods diff --git a/sc/qa/uitest/autofilter/data/tdf122260.ods b/sc/qa/uitest/autofilter/data/tdf122260.ods Binary files differnew file mode 100644 index 000000000..00c86d00a --- /dev/null +++ b/sc/qa/uitest/autofilter/data/tdf122260.ods diff --git a/sc/qa/uitest/autofilter/data/tdf130770.ods b/sc/qa/uitest/autofilter/data/tdf130770.ods Binary files differnew file mode 100644 index 000000000..952cf3866 --- /dev/null +++ b/sc/qa/uitest/autofilter/data/tdf130770.ods diff --git a/sc/qa/uitest/autofilter/data/tdf35294.ods b/sc/qa/uitest/autofilter/data/tdf35294.ods Binary files differnew file mode 100644 index 000000000..0261275de --- /dev/null +++ b/sc/qa/uitest/autofilter/data/tdf35294.ods diff --git a/sc/qa/uitest/autofilter/data/tdf55712.ods b/sc/qa/uitest/autofilter/data/tdf55712.ods Binary files differnew file mode 100644 index 000000000..ebcd6d39a --- /dev/null +++ b/sc/qa/uitest/autofilter/data/tdf55712.ods diff --git a/sc/qa/uitest/autofilter/data/tdf73565.ods b/sc/qa/uitest/autofilter/data/tdf73565.ods Binary files differnew file mode 100644 index 000000000..11c6cda83 --- /dev/null +++ b/sc/qa/uitest/autofilter/data/tdf73565.ods diff --git a/sc/qa/uitest/autofilter/data/tdf74857.ods b/sc/qa/uitest/autofilter/data/tdf74857.ods Binary files differnew file mode 100644 index 000000000..f4fe4fe0a --- /dev/null +++ b/sc/qa/uitest/autofilter/data/tdf74857.ods diff --git a/sc/qa/uitest/autofilter/data/tdf77479.ods b/sc/qa/uitest/autofilter/data/tdf77479.ods Binary files differnew file mode 100644 index 000000000..100df9ae2 --- /dev/null +++ b/sc/qa/uitest/autofilter/data/tdf77479.ods diff --git a/sc/qa/uitest/autofilter/data/tdf81124.ods b/sc/qa/uitest/autofilter/data/tdf81124.ods Binary files differnew file mode 100644 index 000000000..6d3d97b41 --- /dev/null +++ b/sc/qa/uitest/autofilter/data/tdf81124.ods diff --git a/sc/qa/uitest/autofilter/tdf101165.py b/sc/qa/uitest/autofilter/tdf101165.py new file mode 100644 index 000000000..32ffb7c27 --- /dev/null +++ b/sc/qa/uitest/autofilter/tdf101165.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 uitest.uihelper.common import select_pos +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.document import get_sheet_from_doc +from libreoffice.calc.conditional_format import get_conditional_format_from_sheet +from uitest.debug import sleep +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +import org.libreoffice.unotest +import pathlib + +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +#Bug 101165 - Crashing on a filter selection, every time + +class tdf101165(UITestCase): + def test_tdf101165_autofilter(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf101165.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xAll = xFloatWindow.getChild("toggle_all") + xAll.executeAction("CLICK", tuple()) + + self.assertEqual(get_cell_by_position(document, 1, 0, 1).getValue(), 6494) + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab:
\ No newline at end of file diff --git a/sc/qa/uitest/autofilter/tdf117276.py b/sc/qa/uitest/autofilter/tdf117276.py new file mode 100644 index 000000000..acd7d1189 --- /dev/null +++ b/sc/qa/uitest/autofilter/tdf117276.py @@ -0,0 +1,115 @@ +# -*- 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 +from libreoffice.calc.document import get_row +# import org.libreoffice.unotest +# import pathlib +from uitest.path import get_srcdir_url + +def get_url_for_data_file(file_name): +# return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + return get_srcdir_url() + "/sc/qa/uitest/autofilter/data/" + file_name + +def is_row_hidden(doc, index): + row = get_row(doc, index) + val = row.getPropertyValue("IsVisible") + return not val + +#Bug 117276 - Autofilter settings being reset in some cases + +class tdf117276(UITestCase): + def test_tdf117276_autofilter(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf117276.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + # 1. open attached file + # 2. open filter of column B (Fabrikat) and deselect (Citroen, Fiat, Ford, Opel, Peugeot, Renault, Tesla) + gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xCheckListMenu = xFloatWindow.getChild("check_list_menu") + xTreeList = xCheckListMenu.getChild("check_list_box") + + xCitroenEntry = xTreeList.getChild("2") + xCitroenEntry.executeAction("CLICK", tuple()) #Citroen + xFiatEntry = xTreeList.getChild("3") + xFiatEntry.executeAction("CLICK", tuple()) #Fiat + xFordEntry = xTreeList.getChild("4") + xFordEntry.executeAction("CLICK", tuple()) #Ford + xOpelEntry = xTreeList.getChild("6") + xOpelEntry.executeAction("CLICK", tuple()) #Opel + xPeugeotEntry = xTreeList.getChild("7") + xPeugeotEntry.executeAction("CLICK", tuple()) #Peugeot + xRenaultEntry = xTreeList.getChild("9") + xRenaultEntry.executeAction("CLICK", tuple()) #Renault + xTeslaEntry = xTreeList.getChild("10") + xTeslaEntry.executeAction("CLICK", tuple()) #Tesla + + xOkBtn = xFloatWindow.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) + + self.assertFalse(is_row_hidden(calc_doc, 0)) + self.assertFalse(is_row_hidden(calc_doc, 1)) + self.assertTrue(is_row_hidden(calc_doc, 3)) + + # 3. open filter of column I (Wert) and deselect 8000 (Values 7000 and 9000 are not shown) + gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "8", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xCheckListMenu = xFloatWindow.getChild("check_list_menu") + xTreeList = xCheckListMenu.getChild("check_list_box") + + xCitroenEntry = xTreeList.getChild("0") + xCitroenEntry.executeAction("CLICK", tuple()) + + xOkBtn = xFloatWindow.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) + + self.assertFalse(is_row_hidden(calc_doc, 0)) + self.assertFalse(is_row_hidden(calc_doc, 1)) + self.assertTrue(is_row_hidden(calc_doc, 9)) + + # 4. open filter of column B and select Tesla + gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xCheckListMenu = xFloatWindow.getChild("check_list_menu") + xTreeList = xCheckListMenu.getChild("check_list_box") + xTeslaEntry = xTreeList.getChild("4") + xTeslaEntry.executeAction("CLICK", tuple()) #Tesla + + xOkBtn = xFloatWindow.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) + self.assertFalse(is_row_hidden(calc_doc, 0)) + self.assertFalse(is_row_hidden(calc_doc, 1)) + self.assertFalse(is_row_hidden(calc_doc, 21)) + + # 5. open filter of column I and select 7000 --> 8000 because:new strategy of the filter is implemented + #(which strings to show and which to hide, when multiple filters are in used). + gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "8", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xCheckListMenu = xFloatWindow.getChild("check_list_menu") + xTreeList = xCheckListMenu.getChild("check_list_box") + + x8000Entry = xTreeList.getChild("1") # check "8000" + x8000Entry.executeAction("CLICK", tuple()) + + xOkBtn = xFloatWindow.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) + + self.assertFalse(is_row_hidden(calc_doc, 0)) + self.assertFalse(is_row_hidden(calc_doc, 1)) + self.assertFalse(is_row_hidden(calc_doc, 7)) + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/autofilter/tdf117276_autofilter_reset.py b/sc/qa/uitest/autofilter/tdf117276_autofilter_reset.py new file mode 100644 index 000000000..c4924ab37 --- /dev/null +++ b/sc/qa/uitest/autofilter/tdf117276_autofilter_reset.py @@ -0,0 +1,191 @@ +# -*- 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.calc import enter_text_to_cell +from libreoffice.calc.document import get_sheet_from_doc +from uitest.debug import sleep +from libreoffice.uno.propertyvalue import mkPropertyValues +from libreoffice.calc.document import get_row +from uitest.path import get_srcdir_url + + +def get_url_for_data_file(file_name): + return get_srcdir_url() + "/sc/qa/uitest/autofilter/data/" + file_name + +def is_row_hidden(doc, index): + row = get_row(doc, index) + val = row.getPropertyValue("IsVisible") + return not val + +#Bug 117276 - Autofilter settings being reset in some cases + +class tdf117276_autofilter_reset(UITestCase): + def get_values_count_in_AutoFilter(self, xGridWindow, columnIndex, buttonName = "cancel"): + # open filter pop-up window + self.assertIsNotNone(xGridWindow) + xGridWindow.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": columnIndex, "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + self.assertIsNotNone(xFloatWindow) + + # get check list + xCheckListMenu = xFloatWindow.getChild("check_list_menu") + self.assertIsNotNone(xCheckListMenu) + + xTreeList = xCheckListMenu.getChild("check_list_box") + self.assertIsNotNone(xTreeList) + + valuesCount = len(xTreeList.getChildren()) + + # close pop-up window + xButton = xFloatWindow.getChild(buttonName) + self.assertIsNotNone(xButton) + xButton.executeAction("CLICK", tuple()) + + return valuesCount + + def openAutoFilterAndCloseIt(self, xGridWindow, columnIndex, buttonName): + self.get_values_count_in_AutoFilter(xGridWindow, columnIndex, buttonName) + + def check_state(self, document, xGridWindow): + self.assertFalse(is_row_hidden(document, 0)) # column headers + self.assertTrue(is_row_hidden(document, 1)) + self.assertTrue(is_row_hidden(document, 2)) + self.assertTrue(is_row_hidden(document, 3)) + self.assertTrue(is_row_hidden(document, 4)) + self.assertFalse(is_row_hidden(document, 5)) + + self.assertEqual(1, self.get_values_count_in_AutoFilter(xGridWindow, "0")) + self.assertEqual(2, self.get_values_count_in_AutoFilter(xGridWindow, "1")) + + def test_run(self): + self.ui_test.create_doc_in_start_center("calc") + document = self.ui_test.get_component() + calcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = calcDoc.getChild("grid_window") + +# self.ui_test.execute_dialog_through_command(".uno:Insert") # insert sheet +# xDialog = self.xUITest.getTopFocusWindow() +# xOKButton = xDialog.getChild("ok") +# xOKButton.executeAction("CLICK", tuple()) + + # 1. prepare document + # | A | B | + # ----------------------------------------- + # 1 | HEADER-A | HEADER-B | + # ----------------------------------------- + # 2 | Unique a2 | common value for B2:B4 | + # 3 | Unique a3 | common value for B2:B4 | + # 4 | Unique a4 | common value for B2:B4 | + # 5 | Unique a5 | Unique b5 | + # 6 | Unique a6 | Unique b6 | + # + # row-1 + enter_text_to_cell(xGridWindow, "A1", "HEADER-A") + enter_text_to_cell(xGridWindow, "B1", "HEADER-B") + + # row-1 + enter_text_to_cell(xGridWindow, "A2", "Unique a2") + enter_text_to_cell(xGridWindow, "B2", "common value for B2:B4") + + # row-2 + enter_text_to_cell(xGridWindow, "A3", "Unique a3") + enter_text_to_cell(xGridWindow, "B3", "common value for B2:B4") + + # row-3 + enter_text_to_cell(xGridWindow, "A4", "Unique a4") + enter_text_to_cell(xGridWindow, "B4", "common value for B2:B4") + + # row-4 + enter_text_to_cell(xGridWindow, "A5", "Unique a5") + enter_text_to_cell(xGridWindow, "B5", "Unique b5") + + # row-5 + enter_text_to_cell(xGridWindow, "A6", "Unique a6") + enter_text_to_cell(xGridWindow, "B6", "Unique b6") + + xGridWindow.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B6"})) + + # 2. switch on auto-filter + self.ui_test.execute_dialog_through_command(".uno:DataFilterAutoFilter") + xDialog = self.xUITest.getTopFocusWindow() + xYesBtn = xDialog.getChild("yes") + self.ui_test.close_dialog_through_button(xYesBtn) + + # autofilter still exist + self.assertEqual(document.getPropertyValue("UnnamedDatabaseRanges").getByTable(0).AutoFilter, True) + + # 3. open filter of column A and deselect first 3 entries (Unique a2, Unique a3, Unique a4) + xGridWindow.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xCheckListMenu = xFloatWindow.getChild("check_list_menu") + xTreeList = xCheckListMenu.getChild("check_list_box") + + xEntry1 = xTreeList.getChild("0") + xEntry1.executeAction("CLICK", tuple()) # Unique a2 + xEntry2 = xTreeList.getChild("1") + xEntry2.executeAction("CLICK", tuple()) # Unique a3 + xEntry3 = xTreeList.getChild("2") + xEntry3.executeAction("CLICK", tuple()) # Unique a4 + + xOkButton = xFloatWindow.getChild("ok") + xOkButton.executeAction("CLICK", tuple()) + + # check filtering + # | A | B | + # ----------------------------------------- + # 1 | HEADER-A | HEADER-B | + # ----------------------------------------- + # 5 | Unique a5 | Unique b5 | + # 6 | Unique a6 | Unique b6 | + self.assertFalse(is_row_hidden(document, 0)) # column headers + self.assertTrue(is_row_hidden(document, 1)) + self.assertTrue(is_row_hidden(document, 2)) + self.assertTrue(is_row_hidden(document, 3)) + self.assertFalse(is_row_hidden(document, 4)) + self.assertFalse(is_row_hidden(document, 5)) + + self.assertEqual(5, self.get_values_count_in_AutoFilter(xGridWindow, "0")) + self.assertEqual(2, self.get_values_count_in_AutoFilter(xGridWindow, "1")) + + # 4. open filter of column B and deselect "Unique b5" + xGridWindow.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xCheckListMenu = xFloatWindow.getChild("check_list_menu") + xTreeList = xCheckListMenu.getChild("check_list_box") + + xEntry = xTreeList.getChild("0") + xEntry.executeAction("CLICK", tuple()) # Unique b5 + + xOkButton = xFloatWindow.getChild("ok") + xOkButton.executeAction("CLICK", tuple()) + + # check filtering + # | A | B | + # ----------------------------------------- + # 1 | HEADER-A | HEADER-B | + # ----------------------------------------- + # 6 | Unique a6 | Unique b6 | + self.check_state(document, xGridWindow) + + # 4. open filters of column A, B and close it using different buttons + self.openAutoFilterAndCloseIt(xGridWindow, "1", "ok") + self.check_state(document, xGridWindow) + + self.openAutoFilterAndCloseIt(xGridWindow, "1", "cancel") + self.check_state(document, xGridWindow) + + self.openAutoFilterAndCloseIt(xGridWindow, "0", "cancel") + self.check_state(document, xGridWindow) + + self.openAutoFilterAndCloseIt(xGridWindow, "0", "ok") + self.check_state(document, xGridWindow) + + # finish + self.ui_test.close_doc() + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/autofilter/tdf122260.py b/sc/qa/uitest/autofilter/tdf122260.py new file mode 100644 index 000000000..7d9df8564 --- /dev/null +++ b/sc/qa/uitest/autofilter/tdf122260.py @@ -0,0 +1,102 @@ +# -*- 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 libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +from libreoffice.calc.document import get_row + + +from uitest.path import get_srcdir_url +def get_url_for_data_file(file_name): + return get_srcdir_url() + "/sc/qa/uitest/autofilter/data/" + file_name + +def is_row_hidden(doc, index): + row = get_row(doc, index) + val = row.getPropertyValue("IsVisible") + return not val + +#Bug 122260 - EDITING Autofilters not properly cleared +class tdf122260(UITestCase): + def check_value_in_AutoFilter(self, gridwin, columnIndex, valueIndex): + # open filter pop-up window + self.assertIsNotNone(gridwin) + gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": columnIndex, "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + self.assertIsNotNone(xFloatWindow) + + # get check list + xCheckListMenu = xFloatWindow.getChild("check_list_menu") + self.assertIsNotNone(xCheckListMenu) + + xTreeList = xCheckListMenu.getChild("check_list_box") + self.assertIsNotNone(xTreeList) + + # on/off required checkbox + xEntry = xTreeList.getChild(valueIndex) + self.assertIsNotNone(xEntry) + xEntry.executeAction("CLICK", tuple()) + + # close pop-up window + xOkBtn = xFloatWindow.getChild("ok") + self.assertIsNotNone(xOkBtn) + xOkBtn.executeAction("CLICK", tuple()) + + def get_values_count_in_AutoFilter(self, gridwin, columnIndex): + # open filter pop-up window + self.assertIsNotNone(gridwin) + gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": columnIndex, "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + self.assertIsNotNone(xFloatWindow) + + # get check list + xCheckListMenu = xFloatWindow.getChild("check_list_menu") + self.assertIsNotNone(xCheckListMenu) + + xTreeList = xCheckListMenu.getChild("check_list_box") + self.assertIsNotNone(xTreeList) + + valuesCount = len(xTreeList.getChildren()) + + # close pop-up window + xOkBtn = xFloatWindow.getChild("ok") + self.assertIsNotNone(xOkBtn) + xOkBtn.executeAction("CLICK", tuple()) + + return valuesCount + + def test_tdf122260_autofilter(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf122260.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + self.assertIsNotNone(gridwin) + + # filter out b1 + self.check_value_in_AutoFilter(gridwin, "1", "0") + # filter out a2 (as a1 is filtered out a2 is the first item) + self.check_value_in_AutoFilter(gridwin, "0", "0") + # return back a2 (as a1 is filtered out a2 is the first item) + self.check_value_in_AutoFilter(gridwin, "0", "0") + + # check rows visibility + # row-0 is row with headers + self.assertTrue(is_row_hidden(calc_doc, 1)) + self.assertFalse(is_row_hidden(calc_doc, 2)) + self.assertFalse(is_row_hidden(calc_doc, 3)) + self.assertFalse(is_row_hidden(calc_doc, 4)) + + # check if "b1" is accessible in filter of the column-b + # (so all values of the column B are available) + self.assertEqual(4, self.get_values_count_in_AutoFilter(gridwin, "1")) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/autofilter/tdf126306.py b/sc/qa/uitest/autofilter/tdf126306.py new file mode 100644 index 000000000..5446d3337 --- /dev/null +++ b/sc/qa/uitest/autofilter/tdf126306.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.calc import enter_text_to_cell +from libreoffice.uno.propertyvalue import mkPropertyValues +from libreoffice.calc.document import get_cell_by_position +from libreoffice.calc.document import get_row + +class tdf126306(UITestCase): + def check_values(self, document, results): + for i, value in enumerate(results, start=1): + self.assertEqual(get_cell_by_position(document, 0, 0, i).getValue(), value) + + def check_row_hidden(self, document, results = [True] * 14): + for i, value in enumerate(results, start=1): + row = get_row(document, i) + bVisible = row.getPropertyValue("IsVisible") + self.assertEqual(bVisible, value) + + def test_run(self): + self.ui_test.create_doc_in_start_center("calc") + document = self.ui_test.get_component() + calcDoc = self.xUITest.getTopFocusWindow() + xGridWin = calcDoc.getChild("grid_window") + + default_values = [25, 1023, 17, 9, 19, 0, 107, 89, 8, 453, 33, 3, 25, 204] + document = self.ui_test.get_component() + + for i, value in enumerate(default_values, start=2): + enter_text_to_cell(xGridWin, "A" + str(i), str(value)) + + xGridWin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A15"})) + + self.ui_test.execute_dialog_through_command(".uno:DataFilterAutoFilter") + xDialog = self.xUITest.getTopFocusWindow() + xYesBtn = xDialog.getChild("yes") + self.ui_test.close_dialog_through_button(xYesBtn) + + self.assertEqual(document.getPropertyValue("UnnamedDatabaseRanges").getByTable(0).AutoFilter, True) + + self.check_values(document, default_values) + self.check_row_hidden(document) + + # Sort ascending button + xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xFloatWindow.executeAction("TYPE", mkPropertyValues({"KEYCODE":"SHIFT+TAB"})) + xFloatWindow.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) + + sort_asc_values = [0, 3, 8, 9, 17, 19, 25, 25, 33, 89, 107, 204, 453, 1023] + self.check_values(document, sort_asc_values) + self.check_row_hidden(document) + + #Undo + self.xUITest.executeCommand(".uno:Undo") + self.check_values(document, default_values) + self.check_row_hidden(document) + + # Sort descending button + xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xFloatWindow.executeAction("TYPE", mkPropertyValues({"KEYCODE":"SHIFT+TAB"})) + xFloatWindow.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xFloatWindow.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) + + sort_des_values = [1023, 453, 204, 107, 89, 33, 25, 25, 19, 17, 9, 8, 3, 0] + self.check_values(document, sort_des_values) + self.check_row_hidden(document) + + #Undo + self.xUITest.executeCommand(".uno:Undo") + self.check_values(document, default_values) + self.check_row_hidden(document) + + # Top 10 button + xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xFloatWindow.executeAction("TYPE", mkPropertyValues({"KEYCODE":"SHIFT+TAB"})) + xFloatWindow.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xFloatWindow.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xFloatWindow.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) + + top10_hidden_values = [True, True, True, False, True, False, True, + True, False, True, True, False, True, True] + + #Values are the same + self.check_values(document, default_values) + self.check_row_hidden(document, top10_hidden_values) + + #Undo + self.xUITest.executeCommand(".uno:Undo") + self.check_values(document, default_values) + self.check_row_hidden(document) + + # Empty button + xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xFloatWindow.executeAction("TYPE", mkPropertyValues({"KEYCODE":"SHIFT+TAB"})) + xFloatWindow.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xFloatWindow.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xFloatWindow.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xFloatWindow.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) + + empty_values = [False] * 14 + #Values are the same + self.check_values(document, default_values) + self.check_row_hidden(document, empty_values) + + #Undo + self.xUITest.executeCommand(".uno:Undo") + self.check_values(document, default_values) + self.check_row_hidden(document) + + # Not Empty button + xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xFloatWindow.executeAction("TYPE", mkPropertyValues({"KEYCODE":"SHIFT+TAB"})) + xFloatWindow.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xFloatWindow.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xFloatWindow.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xFloatWindow.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xFloatWindow.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) + + #Nothing should change + self.check_values(document, default_values) + self.check_row_hidden(document) + + #Undo + self.xUITest.executeCommand(".uno:Undo") + self.check_values(document, default_values) + self.check_row_hidden(document) + + # finish + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/autofilter/tdf130070.py b/sc/qa/uitest/autofilter/tdf130070.py new file mode 100644 index 000000000..77c554849 --- /dev/null +++ b/sc/qa/uitest/autofilter/tdf130070.py @@ -0,0 +1,73 @@ +# -*- 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 +from libreoffice.calc.document import get_row +# import org.libreoffice.unotest +# import pathlib +from uitest.path import get_srcdir_url + +def get_url_for_data_file(file_name): +# return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + return get_srcdir_url() + "/sc/qa/uitest/autofilter/data/" + file_name + +def is_row_hidden(doc, index): + row = get_row(doc, index) + val = row.getPropertyValue("IsVisible") + return not val + +#Bug 130770 - Autofilter not updated on data change (automatically or manually) + +class tdf130770(UITestCase): + def test_tdf130770_autofilter(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf130770.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + # 1. open attached file and check initial state + self.assertFalse(is_row_hidden(calc_doc, 0)) + self.assertFalse(is_row_hidden(calc_doc, 1)) + self.assertTrue(is_row_hidden(calc_doc, 2)) + self.assertFalse(is_row_hidden(calc_doc, 3)) + self.assertFalse(is_row_hidden(calc_doc, 4)) + + # 2. open filter of column A and cancel + gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + + xOkBtn = xFloatWindow.getChild("cancel") + xOkBtn.executeAction("CLICK", tuple()) + + self.assertFalse(is_row_hidden(calc_doc, 0)) + self.assertFalse(is_row_hidden(calc_doc, 1)) + self.assertTrue(is_row_hidden(calc_doc, 2)) + self.assertFalse(is_row_hidden(calc_doc, 3)) + self.assertFalse(is_row_hidden(calc_doc, 4)) + + # 3. open filter of column A and just click OK + gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + + xOkBtn = xFloatWindow.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) + + self.assertFalse(is_row_hidden(calc_doc, 0)) + self.assertFalse(is_row_hidden(calc_doc, 1)) + self.assertTrue(is_row_hidden(calc_doc, 2)) + self.assertFalse(is_row_hidden(calc_doc, 3)) + self.assertTrue(is_row_hidden(calc_doc, 4)) # filtered out + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/autofilter/tdf97340.py b/sc/qa/uitest/autofilter/tdf97340.py new file mode 100644 index 000000000..237ed7117 --- /dev/null +++ b/sc/qa/uitest/autofilter/tdf97340.py @@ -0,0 +1,38 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import select_pos +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.document import get_sheet_from_doc +from libreoffice.calc.conditional_format import get_conditional_format_from_sheet +from uitest.debug import sleep +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +import org.libreoffice.unotest +import pathlib + +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +#Bug 97340 - Calc crashes on filtering with select checkbox with space bar + +class tdf97340(UITestCase): + def test_tdf97340_autofilter(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("autofilter.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xsearchEdit = xFloatWindow.getChild("search_edit") + xsearchEdit.executeAction("TYPE", mkPropertyValues({"TEXT":" "})) + xsearchEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"})) + + 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_dialogs/openDialogs.py b/sc/qa/uitest/calc_dialogs/openDialogs.py new file mode 100644 index 000000000..a3bb7fb24 --- /dev/null +++ b/sc/qa/uitest/calc_dialogs/openDialogs.py @@ -0,0 +1,184 @@ +# -*- 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 unittest +from uitest.uihelper.testDialog import testDialog + +dialogs = [ + {"command": ".uno:OpenRemote", "closeButton": "cancel"}, + {"command": ".uno:SaveAsTemplate", "closeButton": "cancel"}, + {"command": ".uno:SaveAsRemote", "closeButton": "cancel"}, + {"command": ".uno:ExportToPDF", "closeButton": "cancel", "skipTestOK": True}, + # export needs filesystem + {"command": ".uno:Print", "closeButton": "cancel", "skipTestOK": True}, + # no printer in CI + {"command": ".uno:PrinterSetup", "closeButton": "cancel"}, + # {"command": ".uno:SetDocumentProperties", "closeButton": "cancel"}, + # tested in sc/qa/uitest/calc_tests/documentProperties.py + # {"command": ".uno:PasteSpecial", "closeButton": "cancel"}, + # would need to copy first something into the clipboard + # {"command": ".uno:SearchDialog", "closeButton": "close"}, + # tested in sc/qa/uitest/search_replace/* + # {"command": ".uno:InsertObjectChart", "closeButton": "cancel"}, + # tested in uitest/calc_tests/create_chart.py + {"command": ".uno:DataDataPilotRun", "closeButton": "cancel", "skipTestOK": True}, + # OK button triggers a new dialog + # {"command": ".uno:FunctionDialog", "closeButton": "cancel"}, + # Cancel button tested in uitest/calc_tests/function_wizard.py + # OK button tested in sc/qa/uitest/calc_tests7/tdf123479.py + {"command": ".uno:InsertName", "closeButton": "close"}, + {"command": ".uno:InsertObjectFloatingFrame", "closeButton": "cancel"}, + {"command": ".uno:FontworkGalleryFloater", "closeButton": "cancel"}, + # {"command": ".uno:HyperlinkDialog", "closeButton": "ok"}, + # dialog opens but is not recognised by execute_dialog_through_command + #{"command": ".uno:InsertSymbol", "closeButton": "cancel"}, + # Tested in uitest/demo_ui/char_dialog.py + {"command": ".uno:EditHeaderAndFooter", "closeButton": "cancel"}, + # {"command": ".uno:InsertSignatureLine", "closeButton": "cancel"}, + # tested in sc/qa/uitest/signatureLine/insertSignatureLine.py + # {"command": ".uno:FormatCellDialog", "closeButton": "cancel"}, + # tested in sc/qa/uitest/calc_tests/formatCells.py + # {"command": ".uno:RowHeight", "closeButton": "cancel"}, + # tested in sc/qa/uitest/calc_tests/rows.py + {"command": ".uno:SetOptimalRowHeight", "closeButton": "cancel"}, + # {"command": ".uno:ColumnWidth", "closeButton": "cancel"}, + # tested in sc/qa/uitest/calc_tests/columns.py + {"command": ".uno:SetOptimalColumnWidth", "closeButton": "cancel"}, + # {"command": ".uno:PageFormatDialog", "closeButton": "cancel"}, + # tested in sc/qa/uitest/pageFormat/tdf123508.py + {"command": ".uno:EditPrintArea", "closeButton": "cancel", "skipTestOK": True}, + # tested in sc/qa/uitest/calc_tests/printRange.py + # {"command": ".uno:ConditionalFormatMenu", "closeButton": "cancel"}, + # dialog does not open + # {"command": ".uno:AutoFormat", "closeButton": "cancel"}, + # dialog does not open + # {"command": ".uno:ChooseDesign", "closeButton": "cancel"}, + # dialog opens but is not recognised by execute_dialog_through_command + {"command": ".uno:StyleNewByExample", "closeButton": "cancel"}, + {"command": ".uno:InsertCell", "closeButton": "cancel"}, + {"command": ".uno:DeleteCell", "closeButton": "cancel"}, + {"command": ".uno:Insert", "closeButton": "cancel", "skipTestOK": True}, + # OK button tested in uitest/calc_tests/gridwin.py + {"command": ".uno:Add", "closeButton": "cancel"}, + # {"command": ".uno:InsertExternalDataSource", "closeButton": "cancel"}, + # dialog opens and closes, but is not recognized as closed by close_dialog_through_button + # {"command": ".uno:Delete", "closeButton": "cancel"}, + # tested in sc/qa/uitest/calc_tests3/clearCells.py + # {"command": ".uno:RandomNumberGeneratorDialog", "closeButton": "close"}, + # tested in sc/qa/uitest/calc_tests/fillRandomNumber.py + # {"command": ".uno:AddName", "closeButton": "cancel"}, + # Cancel button tested in uitest/demo_ui/edit.py + # "add" button tested in uitest/calc_tests/create_range_name.py + #{"command": ".uno:DefineName", "closeButton": "cancel"}, + # tested in sc/qa/uitest/calc_tests9/tdf130371.py + # {"command": ".uno:SheetInsertName", "closeButton": "close"}, + # dialog does not open + {"command": ".uno:CreateNames", "closeButton": "cancel", "skipTestOK": True}, + # OK button triggers a new dialog + #{"command": ".uno:DefineLabelRange", "closeButton": "cancel"}, + # tested in sc/qa/uitest/calc_tests4/tdf131170.py + # {"command": ".uno:RenameTable", "closeButton": "cancel"}, + # tested in sc/qa/uitest/calc_tests/sheetRename.py + # {"command": ".uno:Move", "closeButton": "cancel"}, + # tested in sc/qa/uitest/calc_tests6/moveCopySheet.py + {"command": ".uno:SetTabBgColor", "closeButton": "cancel"}, + {"command": ".uno:TableEvents", "closeButton": "cancel"}, + # {"command": ".uno:DataSort", "closeButton": "cancel"}, + # cancel button tested in sc/qa/uitest/calc_tests/sorting.py + # OK button tested in sc/qa/uitest/calc_tests/naturalSort.py + # {"command": ".uno:DataFilterAutoFilter", "closeButton": "ok", "skipTestOK": True}, + # tested in sc/qa/uitest/autofilter/autofilterBugs.py + # {"command": ".uno:DataFilterStandardFilter", "closeButton": "cancel"}, + # tested in sc/qa/uitest/calc_tests2/standardFilter.py + {"command": ".uno:DataFilterSpecialFilter", "closeButton": "cancel", "skipTestOK": True}, + # OK button triggers a new dialog + # {"command": ".uno:DefineDBName", "closeButton": "cancel"}, + # tested in sc/qa/uitest/range_name/tdf119954.py + {"command": ".uno:SelectDB", "closeButton": "cancel"}, + # {"command": ".uno:InsertPivotTable", "closeButton": "cancel"}, + # dialog does not open + # {"command": ".uno:Validation", "closeButton": "cancel"}, + # tested in sc/qa/uitest/validity/validity.py + # {"command": ".uno:DataSubTotals", "closeButton": "cancel"}, + # tested in sc/qa/uitest/calc_tests2/subtotals.py + # {"command": ".uno:DataForm", "closeButton": "close"}, + # tested in sc/qa/uitest/calc_tests2/dataform.py + # {"command": ".uno:DataConsolidate", "closeButton": "cancel"}, + # tested in sc/qa/uitest/calc_tests2/consolidate.py + {"command": ".uno:Group", "closeButton": "cancel"}, + # {"command": ".uno:SamplingDialog", "closeButton": "cancel"}, + # tested in sc/qa/uitest/statistics/sampling.py + # {"command": ".uno:DescriptiveStatisticsDialog", "closeButton": "cancel"}, + # tested in sc/qa/uitest/statistics/descriptiveStatistics.py + # {"command": ".uno:AnalysisOfVarianceDialog", "closeButton": "cancel"}, + # tested in sc/qa/uitest/statistics/anova.py + # {"command": ".uno:CorrelationDialog", "closeButton": "cancel"}, + # tested in sc/qa/uitest/statistics/correlation.py + # {"command": ".uno:CovarianceDialog", "closeButton": "cancel"}, + # tested in sc/qa/uitest/statistics/covariance.py + # {"command": ".uno:ExponentialSmoothingDialog", "closeButton": "cancel"}, + # tested in sc/qa/uitest/statistics/exponentialSmoothing.py + # {"command": ".uno:MovingAverageDialog", "closeButton": "cancel"}, + # tested in sc/qa/uitest/statistics/movingAverage.py + # {"command": ".uno:RegressionDialog", "closeButton": "cancel"}, + # tested in sc/qa/uitest/statistics/regression.py + # {"command": ".uno:TTestDialog", "closeButton": "cancel"}, + # tested in sc/qa/uitest/statistics/tTest.py + # {"command": ".uno:FTestDialog", "closeButton": "cancel"}, + # tested in sc/qa/uitest/statistics/fTest.py + # {"command": ".uno:ZTestDialog", "closeButton": "cancel"}, + # tested in sc/qa/uitest/statistics/zTest.py + # {"command": ".uno:ChiSquareTestDialog", "closeButton": "cancel"}, + # tested in sc/qa/uitest/statistics/chiSquare.py:53 + {"command": ".uno:FourierAnalysisDialog", "closeButton": "cancel"}, + # {"command": ".uno:SpellDialog", "closeButton": "close"}, + # an extra dialog appears + {"command": ".uno:Hyphenate", "closeButton": "cancel"}, + {"command": ".uno:ChineseConversion", "closeButton": "cancel"}, + # {"command": ".uno:AutoCorrectDlg", "closeButton": "cancel"}, + # tested in sc/qa/uitest/calc_tests6/autocorrectOptions.py + {"command": ".uno:GoalSeekDialog", "closeButton": "cancel", "skipTestOK": True}, + # OK button triggers a new dialog + {"command": ".uno:SolverDialog", "closeButton": "close", "skipTestOK": True}, + # OK button triggers a new dialog + # {"command": ".uno:ShareDocument", "closeButton": "cancel"}, + # tested in sc/qa/uitest/calc_tests6/shareSpreadsheet.py + # {"command": ".uno:Protect", "closeButton": "cancel"}, + # tested in sc/qa/uitest/protect/protectSheet.py + # {"command": ".uno:ToolProtectionDocument", "closeButton": "cancel"}, + # tested in sc/qa/uitest/protect/protectSpreadsheet.py + {"command": ".uno:RunMacro", "closeButton": "cancel"}, + {"command": ".uno:ScriptOrganizer", "closeButton": "close"}, + {"command": ".uno:ShowLicense", "closeButton": "close"}, + # {"command": ".uno:About", "closeButton": "close"}, + # tested in sc/qa/uitest/calc_tests7/tdf106667.py +] + + +def load_tests(loader, tests, pattern): + return unittest.TestSuite(openDialogs(dialog) + for dialog in dialogs) + +# Test to open all listed dialogs one by one, close it with the given close button +# and if there is an "OK" button open the dialog again and close it by using the OK button +# the test only checks if calc crashes by opening the dialog, see e.g. tdf#120227, tdf#125985, tdf#125982 +class openDialogs(UITestCase): + def check(self, dialog): + testDialog(self, "calc", dialog) + +dialogCount = 0 +for dialog in dialogs: + dialogCount = dialogCount + 1 + + + def ch(dialog): + return lambda self: self.check(dialog) + + + setattr(openDialogs, "test_%02d_%s" % (dialogCount, dialog["command"]), ch(dialog)) +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests/CalcPasteOnly.py b/sc/qa/uitest/calc_tests/CalcPasteOnly.py new file mode 100644 index 000000000..7253043a7 --- /dev/null +++ b/sc/qa/uitest/calc_tests/CalcPasteOnly.py @@ -0,0 +1,46 @@ +# -*- 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 libreoffice.uno.propertyvalue import mkPropertyValues + +from uitest.framework import UITestCase +from libreoffice.calc.document import get_column +from uitest.path import get_srcdir_url +from libreoffice.calc.document import get_cell_by_position +from uitest.uihelper.calc import enter_text_to_cell +import time +from uitest.debug import sleep + +class CalcPasteOnly(UITestCase): + + def test_paste_only(self): + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xTopWindow = self.xUITest.getTopFocusWindow() + document = self.ui_test.get_component() + gridwin = xTopWindow.getChild("grid_window") + + enter_text_to_cell(gridwin, "A1", "=SUM(A2:A3)") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + self.xUITest.executeCommand(".uno:Copy") + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1"})) + self.xUITest.executeCommand(".uno:PasteOnlyText") + self.assertEqual(get_cell_by_position(document, 0, 2, 0).getString(), "") + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D1"})) + self.xUITest.executeCommand(".uno:PasteOnlyValue") + self.assertEqual(get_cell_by_position(document, 0, 3, 0).getString(), "0") + self.assertEqual(get_cell_by_position(document, 0, 3, 0).getValue(), 0) + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "E1"})) + self.xUITest.executeCommand(".uno:PasteOnlyFormula") + self.assertEqual(get_cell_by_position(document, 0, 4, 0).getString(), "0") + self.assertEqual(get_cell_by_position(document, 0, 4, 0).getValue(), 0) + self.assertEqual(get_cell_by_position(document, 0, 4, 0).getFormula(), "=SUM(E2:E3)") + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests/autofill.py b/sc/qa/uitest/calc_tests/autofill.py new file mode 100644 index 000000000..09b37d6a6 --- /dev/null +++ b/sc/qa/uitest/calc_tests/autofill.py @@ -0,0 +1,153 @@ +# -*- 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 uitest.debug import sleep +from libreoffice.calc.document import get_cell_by_position +import org.libreoffice.unotest +import pathlib +from libreoffice.uno.propertyvalue import mkPropertyValues +#Test for the AutoFill feature - auto-fill can't increment last octet of ip addresses + +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +class CalcAutofill(UITestCase): + + def test_autofill(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("autofill.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #Select cell A12 and drag the fill handle in the bottom right corner of the cell down to A18 + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A12:A18"})) + self.ui_test.execute_dialog_through_command(".uno:FillSeries") + xDialog = self.xUITest.getTopFocusWindow() + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + #Compare with the content in the right next column + self.assertEqual(get_cell_by_position(document, 0, 0, 11).getValue(), 18.34) + self.assertEqual(get_cell_by_position(document, 0, 0, 12).getValue(), 19.34) + self.assertEqual(get_cell_by_position(document, 0, 0, 13).getValue(), 20.34) + self.assertEqual(get_cell_by_position(document, 0, 0, 14).getValue(), 21.34) + self.assertEqual(get_cell_by_position(document, 0, 0, 15).getValue(), 22.34) + self.assertEqual(get_cell_by_position(document, 0, 0, 16).getValue(), 23.34) + self.assertEqual(get_cell_by_position(document, 0, 0, 17).getValue(), 24.34) + #Select cell A12 and drag the fill handle in the bottom right corner of the cell up to A6 + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A6:A12"})) + self.ui_test.execute_dialog_through_command(".uno:FillSeries") + xDialog = self.xUITest.getTopFocusWindow() + xup = xDialog.getChild("up") + xincrement = xDialog.getChild("increment") + xup.executeAction("CLICK", tuple()) + xincrement.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xincrement.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xincrement.executeAction("TYPE", mkPropertyValues({"TEXT":"-1"})) + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + #Compare with the content in the right next column + self.assertEqual(get_cell_by_position(document, 0, 0, 5).getValue(), 12.34) + self.assertEqual(get_cell_by_position(document, 0, 0, 6).getValue(), 13.34) + self.assertEqual(get_cell_by_position(document, 0, 0, 7).getValue(), 14.34) + self.assertEqual(get_cell_by_position(document, 0, 0, 8).getValue(), 15.34) + self.assertEqual(get_cell_by_position(document, 0, 0, 9).getValue(), 16.34) + self.assertEqual(get_cell_by_position(document, 0, 0, 10).getValue(), 17.34) + self.assertEqual(get_cell_by_position(document, 0, 0, 11).getValue(), 18.34) + + #Continue with the next cells with grey background + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "M12:M18"})) + self.ui_test.execute_dialog_through_command(".uno:FillSeries") + xDialog = self.xUITest.getTopFocusWindow() + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + #Compare with the content in the right next column + self.assertEqual(get_cell_by_position(document, 0, 12, 11).getString(), "12abc40") + self.assertEqual(get_cell_by_position(document, 0, 12, 12).getString(), "12abc41") + self.assertEqual(get_cell_by_position(document, 0, 12, 13).getString(), "12abc42") + self.assertEqual(get_cell_by_position(document, 0, 12, 14).getString(), "12abc43") + self.assertEqual(get_cell_by_position(document, 0, 12, 15).getString(), "12abc44") + self.assertEqual(get_cell_by_position(document, 0, 12, 16).getString(), "12abc45") + self.assertEqual(get_cell_by_position(document, 0, 12, 17).getString(), "12abc46") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "M6:M12"})) + self.ui_test.execute_dialog_through_command(".uno:FillSeries") + xDialog = self.xUITest.getTopFocusWindow() + xup = xDialog.getChild("up") + xincrement = xDialog.getChild("increment") + xup.executeAction("CLICK", tuple()) + xincrement.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xincrement.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xincrement.executeAction("TYPE", mkPropertyValues({"TEXT":"-1"})) + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + #Compare with the content in the right next column + self.assertEqual(get_cell_by_position(document, 0, 12, 5).getString(), "12abc34") + self.assertEqual(get_cell_by_position(document, 0, 12, 6).getString(), "12abc35") + self.assertEqual(get_cell_by_position(document, 0, 12, 7).getString(), "12abc36") + self.assertEqual(get_cell_by_position(document, 0, 12, 8).getString(), "12abc37") + self.assertEqual(get_cell_by_position(document, 0, 12, 9).getString(), "12abc38") + self.assertEqual(get_cell_by_position(document, 0, 12, 10).getString(), "12abc39") + self.assertEqual(get_cell_by_position(document, 0, 12, 11).getString(), "12abc40") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "P12:P18"})) + self.ui_test.execute_dialog_through_command(".uno:FillSeries") + xDialog = self.xUITest.getTopFocusWindow() + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + #Compare with the content in the right next column + self.assertEqual(get_cell_by_position(document, 0, 15, 11).getString(), "10.64.127.7") + self.assertEqual(get_cell_by_position(document, 0, 15, 12).getString(), "10.64.127.8") + self.assertEqual(get_cell_by_position(document, 0, 15, 13).getString(), "10.64.127.9") + self.assertEqual(get_cell_by_position(document, 0, 15, 14).getString(), "10.64.127.10") + self.assertEqual(get_cell_by_position(document, 0, 15, 15).getString(), "10.64.127.11") + self.assertEqual(get_cell_by_position(document, 0, 15, 16).getString(), "10.64.127.12") + self.assertEqual(get_cell_by_position(document, 0, 15, 17).getString(), "10.64.127.13") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "P6:P12"})) + self.ui_test.execute_dialog_through_command(".uno:FillSeries") + xDialog = self.xUITest.getTopFocusWindow() + xup = xDialog.getChild("up") + xincrement = xDialog.getChild("increment") + xup.executeAction("CLICK", tuple()) + xincrement.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xincrement.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xincrement.executeAction("TYPE", mkPropertyValues({"TEXT":"-1"})) + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + #Compare with the content in the right next column + self.assertEqual(get_cell_by_position(document, 0, 15, 5).getString(), "10.64.127.1") + self.assertEqual(get_cell_by_position(document, 0, 15, 6).getString(), "10.64.127.2") + self.assertEqual(get_cell_by_position(document, 0, 15, 7).getString(), "10.64.127.3") + self.assertEqual(get_cell_by_position(document, 0, 15, 8).getString(), "10.64.127.4") + self.assertEqual(get_cell_by_position(document, 0, 15, 9).getString(), "10.64.127.5") + self.assertEqual(get_cell_by_position(document, 0, 15, 10).getString(), "10.64.127.6") + self.assertEqual(get_cell_by_position(document, 0, 15, 11).getString(), "10.64.127.7") + + self.ui_test.close_doc() + + def test_autofill_with_suffix(self): + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + enter_text_to_cell(gridwin, "A1", "1st") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B2"})) + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A3"})) + self.ui_test.execute_dialog_through_command(".uno:FillSeries") + xDialog = self.xUITest.getTopFocusWindow() + xautofill = xDialog.getChild("autofill") + xautofill.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(), "1st") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "2nd") + self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "3rd") + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests/autosum.py b/sc/qa/uitest/calc_tests/autosum.py new file mode 100644 index 000000000..2bb4cff76 --- /dev/null +++ b/sc/qa/uitest/calc_tests/autosum.py @@ -0,0 +1,290 @@ +# -*- 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.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +#AutoSum feature test +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +class calcAutosum(UITestCase): + + def test_autosum_test1(self): + #Sum on range and Sum on Sum's + calc_doc = self.ui_test.load_file(get_url_for_data_file("autosum.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #Place the cell cursor on the gray cells located under Point 1. + #(Multiselection is not possible at this place) and press the Sum Icon in the formula bar. + #Now hit the enter key and the result should be shown. Do so for each gray cell in this part of the document. + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B10"})) + self.xUITest.executeCommand(".uno:AutoSum") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B13"})) + self.xUITest.executeCommand(".uno:AutoSum") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B14"})) + self.xUITest.executeCommand(".uno:AutoSum") + self.assertEqual(get_cell_by_position(document, 0, 1, 9).getValue(), 2) + self.assertEqual(get_cell_by_position(document, 0, 1, 9).getFormula(), "=SUM(B8:B9)") + self.assertEqual(get_cell_by_position(document, 0, 1, 12).getValue(), 2) + self.assertEqual(get_cell_by_position(document, 0, 1, 12).getFormula(), "=SUM(B11:B12)") + self.assertEqual(get_cell_by_position(document, 0, 1, 13).getValue(), 4) + self.assertEqual(get_cell_by_position(document, 0, 1, 13).getFormula(), "=SUM(B13:B13;B10:B10)") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "F8:F14"})) + self.xUITest.executeCommand(".uno:AutoSum") + self.assertEqual(get_cell_by_position(document, 0, 5, 13).getValue(), 4) + self.assertEqual(get_cell_by_position(document, 0, 5, 13).getFormula(), "=SUM(F13:F13;F10:F10)") + + self.ui_test.close_doc() + + def test_autosum_test2(self): + #Sum on Row and Column + calc_doc = self.ui_test.load_file(get_url_for_data_file("autosum.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "E25"})) + self.xUITest.executeCommand(".uno:AutoSum") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "E26"})) + self.xUITest.executeCommand(".uno:AutoSum") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "E27"})) + self.xUITest.executeCommand(".uno:AutoSum") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "E28"})) + self.xUITest.executeCommand(".uno:AutoSum") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "E29"})) + self.xUITest.executeCommand(".uno:AutoSum") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "E30"})) + self.xUITest.executeCommand(".uno:AutoSum") + + self.assertEqual(get_cell_by_position(document, 0, 4, 24).getValue(), 3) + self.assertEqual(get_cell_by_position(document, 0, 4, 24).getFormula(), "=SUM(E22:E24)") + self.assertEqual(get_cell_by_position(document, 0, 4, 25).getValue(), 3) + self.assertEqual(get_cell_by_position(document, 0, 4, 25).getFormula(), "=SUM(B26:D26)") + self.assertEqual(get_cell_by_position(document, 0, 4, 26).getValue(), 3) + self.assertEqual(get_cell_by_position(document, 0, 4, 26).getFormula(), "=SUM(B27:D27)") + self.assertEqual(get_cell_by_position(document, 0, 4, 27).getValue(), 3) + self.assertEqual(get_cell_by_position(document, 0, 4, 27).getFormula(), "=SUM(B28:D28)") + self.assertEqual(get_cell_by_position(document, 0, 4, 28).getValue(), 9) + self.assertEqual(get_cell_by_position(document, 0, 4, 28).getFormula(), "=SUM(E26:E28)") + self.assertEqual(get_cell_by_position(document, 0, 4, 29).getValue(), 12) + self.assertEqual(get_cell_by_position(document, 0, 4, 29).getFormula(), "=SUM(E29:E29;E25:E25)") + + self.ui_test.close_doc() + + def test_autosum_test3(self): + #Subtotals on Autosum + calc_doc = self.ui_test.load_file(get_url_for_data_file("autosum.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C49"})) + self.xUITest.executeCommand(".uno:AutoSum") + + self.assertEqual(get_cell_by_position(document, 0, 2, 48).getValue(), 20) + self.assertEqual(get_cell_by_position(document, 0, 2, 48).getFormula(), "=SUBTOTAL(9;C38:C48)") + + self.ui_test.close_doc() + + def test_autosum_test4(self): + #Autosum on column with selected empty cell for result + calc_doc = self.ui_test.load_file(get_url_for_data_file("autosum.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "B59:B64"})) + self.xUITest.executeCommand(".uno:AutoSum") + + self.assertEqual(get_cell_by_position(document, 0, 1, 63).getValue(), 150) + self.assertEqual(get_cell_by_position(document, 0, 1, 63).getFormula(), "=SUM(B59:B63)") + + self.ui_test.close_doc() + + def test_autosum_test5(self): + #5.Autosum on rows with selected empty cell for result + calc_doc = self.ui_test.load_file(get_url_for_data_file("autosum.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "B76:E80"})) + self.xUITest.executeCommand(".uno:AutoSum") + + self.assertEqual(get_cell_by_position(document, 0, 4, 75).getValue(), 30) + self.assertEqual(get_cell_by_position(document, 0, 4, 75).getFormula(), "=SUM(B76:D76)") + self.assertEqual(get_cell_by_position(document, 0, 4, 76).getValue(), 60) + self.assertEqual(get_cell_by_position(document, 0, 4, 76).getFormula(), "=SUM(B77:D77)") + self.assertEqual(get_cell_by_position(document, 0, 4, 77).getValue(), 90) + self.assertEqual(get_cell_by_position(document, 0, 4, 77).getFormula(), "=SUM(B78:D78)") + self.assertEqual(get_cell_by_position(document, 0, 4, 78).getValue(), 120) + self.assertEqual(get_cell_by_position(document, 0, 4, 78).getFormula(), "=SUM(B79:D79)") + self.assertEqual(get_cell_by_position(document, 0, 4, 79).getValue(), 150) + self.assertEqual(get_cell_by_position(document, 0, 4, 79).getFormula(), "=SUM(B80:D80)") + + self.ui_test.close_doc() + + def test_autosum_test6(self): + #6.Subtotal on column with selected empty cell for result + calc_doc = self.ui_test.load_file(get_url_for_data_file("autosum.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "C92:C101"})) + self.xUITest.executeCommand(".uno:AutoSum") + + self.assertEqual(get_cell_by_position(document, 0, 2, 100).getValue(), 19) + self.assertEqual(get_cell_by_position(document, 0, 2, 100).getFormula(), "=SUBTOTAL(9;C92:C100)") + + self.ui_test.close_doc() + + def test_autosum_test7(self): + #7.Autosum on column without selected empty cell for result + calc_doc = self.ui_test.load_file(get_url_for_data_file("autosum.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "B109:B113"})) + self.xUITest.executeCommand(".uno:AutoSum") + + self.assertEqual(get_cell_by_position(document, 0, 1, 113).getValue(), 150) + self.assertEqual(get_cell_by_position(document, 0, 1, 113).getFormula(), "=SUM(B109:B113)") + + self.ui_test.close_doc() + + def test_autosum_test8(self): + #8.Autosum on rows without selected empty cell for result + calc_doc = self.ui_test.load_file(get_url_for_data_file("autosum.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "B126:D126"})) + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "B128:D128", "EXTEND":"1"})) + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "B130:D130", "EXTEND":"1"})) + self.xUITest.executeCommand(".uno:AutoSum") + + self.assertEqual(get_cell_by_position(document, 0, 4, 125).getValue(), 30) + self.assertEqual(get_cell_by_position(document, 0, 4, 125).getFormula(), "=SUM(B126:D126)") + self.assertEqual(get_cell_by_position(document, 0, 4, 127).getValue(), 90) + self.assertEqual(get_cell_by_position(document, 0, 4, 127).getFormula(), "=SUM(B128:D128)") + self.assertEqual(get_cell_by_position(document, 0, 4, 129).getValue(), 150) + self.assertEqual(get_cell_by_position(document, 0, 4, 129).getFormula(), "=SUM(B130:D130)") + + self.ui_test.close_doc() + + def test_autosum_test9(self): + #9.Subtotal on column without selected empty cell for result + calc_doc = self.ui_test.load_file(get_url_for_data_file("autosum.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "C142:C149"})) + self.xUITest.executeCommand(".uno:AutoSum") + + self.assertEqual(get_cell_by_position(document, 0, 2, 150).getValue(), 19) + self.assertEqual(get_cell_by_position(document, 0, 2, 150).getFormula(), "=SUBTOTAL(9;C142:C149)") + + self.ui_test.close_doc() + + def test_autosum_test10(self): + #10.Autosum on multiselected columns without selected empty cell for result + calc_doc = self.ui_test.load_file(get_url_for_data_file("autosum.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "B160:D164"})) + self.xUITest.executeCommand(".uno:AutoSum") + + self.assertEqual(get_cell_by_position(document, 0, 1, 164).getValue(), 150) + self.assertEqual(get_cell_by_position(document, 0, 1, 164).getFormula(), "=SUM(B160:B164)") + self.assertEqual(get_cell_by_position(document, 0, 2, 164).getValue(), 150) + self.assertEqual(get_cell_by_position(document, 0, 2, 164).getFormula(), "=SUM(C160:C164)") + self.assertEqual(get_cell_by_position(document, 0, 3, 164).getValue(), 150) + self.assertEqual(get_cell_by_position(document, 0, 3, 164).getFormula(), "=SUM(D160:D164)") + self.ui_test.close_doc() + + def test_autosum_test11(self): + #11.Autosum on columns with formula results without selected empty cell for result + calc_doc = self.ui_test.load_file(get_url_for_data_file("autosum.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "B173:D177"})) + self.xUITest.executeCommand(".uno:AutoSum") + + self.assertEqual(round(get_cell_by_position(document, 0, 1, 177).getValue(),2), 2.55) + self.assertEqual(get_cell_by_position(document, 0, 1, 177).getFormula(), "=SUM(B173:B177)") + self.assertEqual(round(get_cell_by_position(document, 0, 2, 177).getValue(),2), -4.91) + self.assertEqual(get_cell_by_position(document, 0, 2, 177).getFormula(), "=SUM(C173:C177)") + self.assertEqual(get_cell_by_position(document, 0, 3, 177).getValue(), 5500) + self.assertEqual(get_cell_by_position(document, 0, 3, 177).getFormula(), "=SUM(D173:D177)") + self.ui_test.close_doc() + + def test_autosum_test12(self): + #12.Autosum on column with filled cell under selected area + calc_doc = self.ui_test.load_file(get_url_for_data_file("autosum.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "B186:D190"})) + self.xUITest.executeCommand(".uno:AutoSum") + + self.assertEqual(get_cell_by_position(document, 0, 1, 191).getValue(), 150) + self.assertEqual(get_cell_by_position(document, 0, 1, 191).getFormula(), "=SUM(B186:B190)") + self.assertEqual(get_cell_by_position(document, 0, 2, 191).getValue(), 150) + self.assertEqual(get_cell_by_position(document, 0, 2, 191).getFormula(), "=SUM(C186:C190)") + self.assertEqual(get_cell_by_position(document, 0, 3, 191).getValue(), 150) + self.assertEqual(get_cell_by_position(document, 0, 3, 191).getFormula(), "=SUM(D186:D190)") + self.ui_test.close_doc() + + def test_autosum_test13(self): + #13.Autosum on column and rows with empty cells selected for row and column + calc_doc = self.ui_test.load_file(get_url_for_data_file("autosum.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "B203:E208"})) + self.xUITest.executeCommand(".uno:AutoSum") + + self.assertEqual(get_cell_by_position(document, 0, 1, 207).getValue(), 150) + self.assertEqual(get_cell_by_position(document, 0, 1, 207).getFormula(), "=SUM(B203:B207)") + self.assertEqual(get_cell_by_position(document, 0, 2, 207).getValue(), 150) + self.assertEqual(get_cell_by_position(document, 0, 2, 207).getFormula(), "=SUM(C203:C207)") + self.assertEqual(get_cell_by_position(document, 0, 3, 207).getValue(), 150) + self.assertEqual(get_cell_by_position(document, 0, 3, 207).getFormula(), "=SUM(D203:D207)") + self.assertEqual(get_cell_by_position(document, 0, 4, 207).getValue(), 450) + self.assertEqual(get_cell_by_position(document, 0, 4, 207).getFormula(), "=SUM(B208:D208)") + self.assertEqual(get_cell_by_position(document, 0, 4, 202).getValue(), 30) + self.assertEqual(get_cell_by_position(document, 0, 4, 202).getFormula(), "=SUM(B203:D203)") + self.assertEqual(get_cell_by_position(document, 0, 4, 203).getValue(), 60) + self.assertEqual(get_cell_by_position(document, 0, 4, 203).getFormula(), "=SUM(B204:D204)") + self.assertEqual(get_cell_by_position(document, 0, 4, 204).getValue(), 90) + self.assertEqual(get_cell_by_position(document, 0, 4, 204).getFormula(), "=SUM(B205:D205)") + self.assertEqual(get_cell_by_position(document, 0, 4, 205).getValue(), 120) + self.assertEqual(get_cell_by_position(document, 0, 4, 205).getFormula(), "=SUM(B206:D206)") + self.assertEqual(get_cell_by_position(document, 0, 4, 206).getValue(), 150) + self.assertEqual(get_cell_by_position(document, 0, 4, 206).getFormula(), "=SUM(B207:D207)") + 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_tests/calcSheetDelete.py b/sc/qa/uitest/calc_tests/calcSheetDelete.py new file mode 100644 index 000000000..93de48292 --- /dev/null +++ b/sc/qa/uitest/calc_tests/calcSheetDelete.py @@ -0,0 +1,152 @@ +# -*- 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 +import time + +class calcSheetDelete(UITestCase): + + def test_tdf114228_insert_and_delete_sheet(self): + + self.ui_test.create_doc_in_start_center("calc") + + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + xGridWindow.executeAction("SELECT", mkPropertyValues({"CELL": "L12"})) + nrSheets = document.Sheets.getCount() #default number + + self.ui_test.execute_dialog_through_command(".uno:Insert") #insert sheet + xDialog = self.xUITest.getTopFocusWindow() + xOKButton = xDialog.getChild("ok") + xOKButton.executeAction("CLICK", tuple()) + + self.assertEqual(document.Sheets.getCount(), nrSheets + 1) + + self.ui_test.execute_dialog_through_command(".uno:Remove") #delete sheet + xDialog = self.xUITest.getTopFocusWindow() + xOKButton = xDialog.getChild("yes") + xOKButton.executeAction("CLICK", tuple()) + + self.assertEqual(document.Sheets.getCount(), nrSheets) + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(document.Sheets.getCount(), nrSheets + 1) + self.xUITest.executeCommand(".uno:Redo") + self.assertEqual(document.Sheets.getCount(), nrSheets) + + self.ui_test.close_doc() + + def test_tdf43078_insert_and_delete_sheet_insert_text(self): + + self.ui_test.create_doc_in_start_center("calc") + document = self.ui_test.get_component() + + nrSheets = document.Sheets.getCount() #default number of sheets + + self.ui_test.execute_dialog_through_command(".uno:Insert") #insert sheet + xDialog = self.xUITest.getTopFocusWindow() + xOKButton = xDialog.getChild("ok") + xOKButton.executeAction("CLICK", tuple()) + + self.ui_test.execute_dialog_through_command(".uno:Insert") #insert sheet + xDialog = self.xUITest.getTopFocusWindow() + xOKButton = xDialog.getChild("ok") + xOKButton.executeAction("CLICK", tuple()) + + self.assertEqual(document.Sheets.getCount(), nrSheets + 2) + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = xCalcDoc.getChild("grid_window") + enter_text_to_cell(xGridWindow, "B2", "abcd") + + self.ui_test.execute_dialog_through_command(".uno:Remove") #delete sheet + xDialog = self.xUITest.getTopFocusWindow() + xOKButton = xDialog.getChild("yes") + xOKButton.executeAction("CLICK", tuple()) + + self.assertEqual(document.Sheets.getCount(), nrSheets + 1) + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(document.Sheets.getCount(), nrSheets + 2) + self.xUITest.executeCommand(".uno:Redo") + self.assertEqual(document.Sheets.getCount(), nrSheets + 1) + + self.ui_test.close_doc() + + def test_delete_more_sheets_at_once(self): + + self.ui_test.create_doc_in_start_center("calc") + + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + nrSheets = document.Sheets.getCount() #default number + i = 0 + while i < 6: + self.ui_test.execute_dialog_through_command(".uno:Insert") #insert sheet + xDialog = self.xUITest.getTopFocusWindow() + xOKButton = xDialog.getChild("ok") + xOKButton.executeAction("CLICK", tuple()) + i = i + 1 + self.assertEqual(document.Sheets.getCount(), nrSheets + 6) + + i = 0 + while i < 5: + self.xUITest.executeCommand(".uno:JumpToNextTableSel") #select next sheet + i = i + 1 + + self.ui_test.execute_dialog_through_command(".uno:Remove") #delete selected sheets + xDialog = self.xUITest.getTopFocusWindow() + xOKButton = xDialog.getChild("yes") + xOKButton.executeAction("CLICK", tuple()) + + self.assertEqual(document.Sheets.getCount(), nrSheets) + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(document.Sheets.getCount(), nrSheets + 6) + self.xUITest.executeCommand(".uno:Redo") + self.assertEqual(document.Sheets.getCount(), nrSheets) + + self.ui_test.close_doc() + + def test_tdf105105_delete_lots_of_sheets_at_once(self): + + self.ui_test.create_doc_in_start_center("calc") + + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + nrSheets = document.Sheets.getCount() #default number + i = 0 + while i < 100: + self.ui_test.execute_dialog_through_command(".uno:Insert") #insert sheet + xDialog = self.xUITest.getTopFocusWindow() + xOKButton = xDialog.getChild("ok") + xOKButton.executeAction("CLICK", tuple()) + i = i + 1 + self.assertEqual(document.Sheets.getCount(), nrSheets + 100) + + i = 0 + while i < 99: + self.xUITest.executeCommand(".uno:JumpToNextTableSel") #select next sheet + i = i + 1 + + self.ui_test.execute_dialog_through_command(".uno:Remove") #delete selected sheets + xDialog = self.xUITest.getTopFocusWindow() + xOKButton = xDialog.getChild("yes") + xOKButton.executeAction("CLICK", tuple()) + + self.assertEqual(document.Sheets.getCount(), nrSheets) + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(document.Sheets.getCount(), nrSheets + 100) + self.xUITest.executeCommand(".uno:Redo") + self.assertEqual(document.Sheets.getCount(), nrSheets) + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests/columns.py b/sc/qa/uitest/calc_tests/columns.py new file mode 100644 index 000000000..09d699068 --- /dev/null +++ b/sc/qa/uitest/calc_tests/columns.py @@ -0,0 +1,341 @@ +# -*- 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 + +class CalcColumns(UITestCase): + def test_column_width(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 + 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 /cm + xunitlb = xDialogOpt.getChild("unitlb") + props = {"TEXT": "Centimeter"} + actionProps = mkPropertyValues(props) + xunitlb.executeAction("SELECT", actionProps) + xOKBtn = xDialogOpt.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #select A1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #column width + self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") + xDialog = self.xUITest.getTopFocusWindow() + xvalue = xDialog.getChild("value") + xdefault = xDialog.getChild("default") + self.assertEqual(get_state_as_dict(xdefault)["Selected"], "true") #default selected + heightStrOrig = get_state_as_dict(xvalue)["Text"] + heightVal = heightStrOrig[:4] #default 2.26 cm + xvalue.executeAction("UP", tuple()) #2.36 cm + heightStr = get_state_as_dict(xvalue)["Text"] + heightValNew = heightStr[:4] + self.assertEqual(get_state_as_dict(xdefault)["Selected"], "false") #default not selected + self.assertEqual(heightValNew > heightVal, True) #new value is bigger + xdefault.executeAction("CLICK", tuple()) #click default + self.assertEqual(get_state_as_dict(xvalue)["Text"] == heightStrOrig, True) #default value set + #write your own value + xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xvalue.executeAction("TYPE", mkPropertyValues({"TEXT":"1 cm"})) + # Click Ok + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + #verify + self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") + xDialog = self.xUITest.getTopFocusWindow() + xvalue = xDialog.getChild("value") + self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.00 cm") + xCancel = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancel) + + self.ui_test.close_doc() + + def test_column_width_two_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 + 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 /cm + xunitlb = xDialogOpt.getChild("unitlb") + props = {"TEXT": "Centimeter"} + actionProps = mkPropertyValues(props) + xunitlb.executeAction("SELECT", actionProps) + xOKBtn = xDialogOpt.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1", "EXTEND":"1"})) + + self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") + xDialog = self.xUITest.getTopFocusWindow() + xvalue = xDialog.getChild("value") + xdefault = xDialog.getChild("default") + #write your own value + xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xvalue.executeAction("TYPE", mkPropertyValues({"TEXT":"1 cm"})) + # Click Ok + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + #verify + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") + xDialog = self.xUITest.getTopFocusWindow() + xvalue = xDialog.getChild("value") + self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.00 cm") + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1"})) + self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") + xDialog = self.xUITest.getTopFocusWindow() + xvalue = xDialog.getChild("value") + self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.00 cm") + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + + self.ui_test.close_doc() + + def test_column_width_copy(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 + 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 /cm + xunitlb = xDialogOpt.getChild("unitlb") + props = {"TEXT": "Centimeter"} + actionProps = mkPropertyValues(props) + xunitlb.executeAction("SELECT", actionProps) + xOKBtn = xDialogOpt.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #select A1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #column width + self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") + xDialog = self.xUITest.getTopFocusWindow() + xvalue = xDialog.getChild("value") + xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xvalue.executeAction("TYPE", mkPropertyValues({"TEXT":"1 cm"})) + # Click Ok + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + #select column 1 + self.xUITest.executeCommand(".uno:SelectColumn") + #copy + self.xUITest.executeCommand(".uno:Copy") + #select C1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1"})) + #paste + self.xUITest.executeCommand(".uno:Paste") + #verify + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1"})) + self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") + xDialog = self.xUITest.getTopFocusWindow() + xvalue = xDialog.getChild("value") + self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.00 cm") + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + + self.ui_test.close_doc() + + def test_column_hide_show(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() + #select A3 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1"})) + self.xUITest.executeCommand(".uno:HideColumn") #uno command moves focus one cell down + #verify D1 + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentColumn"], "3") + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"LEFT"})) + #verify B (column C is hidden) + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentColumn"], "1") + #Show hidden column: select B1:D1 + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "B1:D1"})) + self.xUITest.executeCommand(".uno:ShowColumn") + #verify + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D1"})) + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentColumn"], "3") + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"LEFT"})) + #verify C1 (COlumn C is not hidden) + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentColumn"], "2") + + self.ui_test.close_doc() + + def test_column_test_move(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() + #select C1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1"})) + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentColumn"], "2") + #right + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RIGHT"})) + #verify D1 + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentColumn"], "3") + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"LEFT"})) + #verify C1 + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentColumn"], "2") + + self.ui_test.close_doc() + + def test_tdf117522_column_width_insert_left(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 + 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 /cm + xunitlb = xDialogOpt.getChild("unitlb") + props = {"TEXT": "Centimeter"} + actionProps = mkPropertyValues(props) + xunitlb.executeAction("SELECT", actionProps) + xOKBtn = xDialogOpt.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #select C1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1"})) + #column width + self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") + xDialog = self.xUITest.getTopFocusWindow() + xvalue = xDialog.getChild("value") + xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xvalue.executeAction("TYPE", mkPropertyValues({"TEXT":"1 cm"})) + # Click Ok + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + #select D1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D1"})) + #column width + self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") + xDialog = self.xUITest.getTopFocusWindow() + xvalue = xDialog.getChild("value") + xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xvalue.executeAction("TYPE", mkPropertyValues({"TEXT":"2 cm"})) + # Click Ok + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + #select E1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "E1"})) + #column width + self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") + xDialog = self.xUITest.getTopFocusWindow() + xvalue = xDialog.getChild("value") + xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xvalue.executeAction("TYPE", mkPropertyValues({"TEXT":"3 cm"})) + # Click Ok + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + #select columns C-E + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "C1:E1"})) + self.xUITest.executeCommand(".uno:SelectColumn") + #Insert Columns Left + self.xUITest.executeCommand(".uno:InsertColumnsBefore") + #verify + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1"})) + self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") + xDialog = self.xUITest.getTopFocusWindow() + xvalue = xDialog.getChild("value") + self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.00 cm") + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D1"})) + self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") + xDialog = self.xUITest.getTopFocusWindow() + xvalue = xDialog.getChild("value") + self.assertEqual(get_state_as_dict(xvalue)["Text"], "2.00 cm") + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "E1"})) + self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") + xDialog = self.xUITest.getTopFocusWindow() + xvalue = xDialog.getChild("value") + self.assertEqual(get_state_as_dict(xvalue)["Text"], "3.00 cm") + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "F1"})) + self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") + xDialog = self.xUITest.getTopFocusWindow() + xvalue = xDialog.getChild("value") + self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.00 cm") + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "G1"})) + self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") + xDialog = self.xUITest.getTopFocusWindow() + xvalue = xDialog.getChild("value") + self.assertEqual(get_state_as_dict(xvalue)["Text"], "2.00 cm") + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "H1"})) + self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") + xDialog = self.xUITest.getTopFocusWindow() + xvalue = xDialog.getChild("value") + self.assertEqual(get_state_as_dict(xvalue)["Text"], "3.00 cm") + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests/data/autofill.ods b/sc/qa/uitest/calc_tests/data/autofill.ods Binary files differnew file mode 100644 index 000000000..4456e3333 --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/autofill.ods diff --git a/sc/qa/uitest/calc_tests/data/autosum.ods b/sc/qa/uitest/calc_tests/data/autosum.ods Binary files differnew file mode 100644 index 000000000..05fa934b7 --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/autosum.ods diff --git a/sc/qa/uitest/calc_tests/data/chartArea.ods b/sc/qa/uitest/calc_tests/data/chartArea.ods Binary files differnew file mode 100644 index 000000000..c7cead1a5 --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/chartArea.ods diff --git a/sc/qa/uitest/calc_tests/data/comments.ods b/sc/qa/uitest/calc_tests/data/comments.ods Binary files differnew file mode 100644 index 000000000..9f1e13e35 --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/comments.ods diff --git a/sc/qa/uitest/calc_tests/data/consolidate.ods b/sc/qa/uitest/calc_tests/data/consolidate.ods Binary files differnew file mode 100644 index 000000000..8e17d7478 --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/consolidate.ods diff --git a/sc/qa/uitest/calc_tests/data/dataLabels.ods b/sc/qa/uitest/calc_tests/data/dataLabels.ods Binary files differnew file mode 100644 index 000000000..89c8485fc --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/dataLabels.ods diff --git a/sc/qa/uitest/calc_tests/data/emptyFile.ods b/sc/qa/uitest/calc_tests/data/emptyFile.ods Binary files differnew file mode 100644 index 000000000..cd2454dba --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/emptyFile.ods diff --git a/sc/qa/uitest/calc_tests/data/goalSeek.ods b/sc/qa/uitest/calc_tests/data/goalSeek.ods Binary files differnew file mode 100644 index 000000000..fd78ec019 --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/goalSeek.ods diff --git a/sc/qa/uitest/calc_tests/data/navigator.ods b/sc/qa/uitest/calc_tests/data/navigator.ods Binary files differnew file mode 100644 index 000000000..c487b1d6b --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/navigator.ods diff --git a/sc/qa/uitest/calc_tests/data/solver.ods b/sc/qa/uitest/calc_tests/data/solver.ods Binary files differnew file mode 100644 index 000000000..a6739664a --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/solver.ods diff --git a/sc/qa/uitest/calc_tests/data/stableSorting.ods b/sc/qa/uitest/calc_tests/data/stableSorting.ods Binary files differnew file mode 100644 index 000000000..90d0575c7 --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/stableSorting.ods diff --git a/sc/qa/uitest/calc_tests/data/standardFilter.ods b/sc/qa/uitest/calc_tests/data/standardFilter.ods Binary files differnew file mode 100644 index 000000000..eee728b46 --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/standardFilter.ods diff --git a/sc/qa/uitest/calc_tests/data/tdf100793.ods b/sc/qa/uitest/calc_tests/data/tdf100793.ods Binary files differnew file mode 100644 index 000000000..e68efdb92 --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf100793.ods diff --git a/sc/qa/uitest/calc_tests/data/tdf102525.ods b/sc/qa/uitest/calc_tests/data/tdf102525.ods Binary files differnew file mode 100644 index 000000000..533d2d2ba --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf102525.ods diff --git a/sc/qa/uitest/calc_tests/data/tdf105412.ods b/sc/qa/uitest/calc_tests/data/tdf105412.ods Binary files differnew file mode 100644 index 000000000..d633ed38d --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf105412.ods diff --git a/sc/qa/uitest/calc_tests/data/tdf105544.ods b/sc/qa/uitest/calc_tests/data/tdf105544.ods Binary files differnew file mode 100644 index 000000000..52a1a618c --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf105544.ods diff --git a/sc/qa/uitest/calc_tests/data/tdf107267.ods b/sc/qa/uitest/calc_tests/data/tdf107267.ods Binary files differnew file mode 100644 index 000000000..c0eb39fd1 --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf107267.ods diff --git a/sc/qa/uitest/calc_tests/data/tdf108654.ods b/sc/qa/uitest/calc_tests/data/tdf108654.ods Binary files differnew file mode 100644 index 000000000..e7feec567 --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf108654.ods diff --git a/sc/qa/uitest/calc_tests/data/tdf114992.ods b/sc/qa/uitest/calc_tests/data/tdf114992.ods Binary files differnew file mode 100644 index 000000000..b22a43ae2 --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf114992.ods diff --git a/sc/qa/uitest/calc_tests/data/tdf118189.xlsx b/sc/qa/uitest/calc_tests/data/tdf118189.xlsx Binary files differnew file mode 100644 index 000000000..5208b9de9 --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf118189.xlsx diff --git a/sc/qa/uitest/calc_tests/data/tdf118206.xlsx b/sc/qa/uitest/calc_tests/data/tdf118206.xlsx Binary files differnew file mode 100644 index 000000000..5208b9de9 --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf118206.xlsx diff --git a/sc/qa/uitest/calc_tests/data/tdf118638.ods b/sc/qa/uitest/calc_tests/data/tdf118638.ods Binary files differnew file mode 100644 index 000000000..251d6c7c4 --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf118638.ods diff --git a/sc/qa/uitest/calc_tests/data/tdf119155.xlsx b/sc/qa/uitest/calc_tests/data/tdf119155.xlsx Binary files differnew file mode 100644 index 000000000..8deb480f7 --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf119155.xlsx diff --git a/sc/qa/uitest/calc_tests/data/tdf119162.xls b/sc/qa/uitest/calc_tests/data/tdf119162.xls Binary files differnew file mode 100644 index 000000000..42765fbe9 --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf119162.xls diff --git a/sc/qa/uitest/calc_tests/data/tdf119343.ods b/sc/qa/uitest/calc_tests/data/tdf119343.ods Binary files differnew file mode 100644 index 000000000..489d5c5fe --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf119343.ods diff --git a/sc/qa/uitest/calc_tests/data/tdf119954.ods b/sc/qa/uitest/calc_tests/data/tdf119954.ods Binary files differnew file mode 100644 index 000000000..12a112351 --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf119954.ods diff --git a/sc/qa/uitest/calc_tests/data/tdf120161.ods b/sc/qa/uitest/calc_tests/data/tdf120161.ods Binary files differnew file mode 100644 index 000000000..4b2c6e3ce --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf120161.ods diff --git a/sc/qa/uitest/calc_tests/data/tdf120660.ods b/sc/qa/uitest/calc_tests/data/tdf120660.ods Binary files differnew file mode 100644 index 000000000..fd9c3defd --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf120660.ods diff --git a/sc/qa/uitest/calc_tests/data/tdf122398.ods b/sc/qa/uitest/calc_tests/data/tdf122398.ods Binary files differnew file mode 100644 index 000000000..48e24de0f --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf122398.ods diff --git a/sc/qa/uitest/calc_tests/data/tdf122509.ods b/sc/qa/uitest/calc_tests/data/tdf122509.ods Binary files differnew file mode 100644 index 000000000..cca0c5beb --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf122509.ods diff --git a/sc/qa/uitest/calc_tests/data/tdf123013.ods b/sc/qa/uitest/calc_tests/data/tdf123013.ods Binary files differnew file mode 100644 index 000000000..1b433b2cb --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf123013.ods diff --git a/sc/qa/uitest/calc_tests/data/tdf123052.ods b/sc/qa/uitest/calc_tests/data/tdf123052.ods Binary files differnew file mode 100644 index 000000000..b87c73d88 --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf123052.ods diff --git a/sc/qa/uitest/calc_tests/data/tdf123479.ods b/sc/qa/uitest/calc_tests/data/tdf123479.ods Binary files differnew file mode 100644 index 000000000..90cf7efd8 --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf123479.ods diff --git a/sc/qa/uitest/calc_tests/data/tdf123508.ods b/sc/qa/uitest/calc_tests/data/tdf123508.ods Binary files differnew file mode 100644 index 000000000..a91951b08 --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf123508.ods diff --git a/sc/qa/uitest/calc_tests/data/tdf123520.ods b/sc/qa/uitest/calc_tests/data/tdf123520.ods Binary files differnew file mode 100644 index 000000000..48e24de0f --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf123520.ods diff --git a/sc/qa/uitest/calc_tests/data/tdf124111.ods b/sc/qa/uitest/calc_tests/data/tdf124111.ods Binary files differnew file mode 100644 index 000000000..82265c4ce --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf124111.ods diff --git a/sc/qa/uitest/calc_tests/data/tdf124818.xls b/sc/qa/uitest/calc_tests/data/tdf124818.xls Binary files differnew file mode 100644 index 000000000..2e5656978 --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf124818.xls diff --git a/sc/qa/uitest/calc_tests/data/tdf124822.xls b/sc/qa/uitest/calc_tests/data/tdf124822.xls Binary files differnew file mode 100644 index 000000000..2e5656978 --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf124822.xls diff --git a/sc/qa/uitest/calc_tests/data/tdf124829.ods b/sc/qa/uitest/calc_tests/data/tdf124829.ods Binary files differnew file mode 100644 index 000000000..280d349cf --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf124829.ods diff --git a/sc/qa/uitest/calc_tests/data/tdf124896.ods b/sc/qa/uitest/calc_tests/data/tdf124896.ods Binary files differnew file mode 100644 index 000000000..2eef3473c --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf124896.ods diff --git a/sc/qa/uitest/calc_tests/data/tdf126673.ods b/sc/qa/uitest/calc_tests/data/tdf126673.ods Binary files differnew file mode 100644 index 000000000..9c75b69ca --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf126673.ods diff --git a/sc/qa/uitest/calc_tests/data/tdf130371.ods b/sc/qa/uitest/calc_tests/data/tdf130371.ods Binary files differnew file mode 100644 index 000000000..41099bda3 --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf130371.ods diff --git a/sc/qa/uitest/calc_tests/data/tdf131170.ods b/sc/qa/uitest/calc_tests/data/tdf131170.ods Binary files differnew file mode 100644 index 000000000..09d74a4a2 --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf131170.ods diff --git a/sc/qa/uitest/calc_tests/data/tdf131291.ods b/sc/qa/uitest/calc_tests/data/tdf131291.ods Binary files differnew file mode 100644 index 000000000..76a87c2c2 --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf131291.ods diff --git a/sc/qa/uitest/calc_tests/data/tdf131907.odt b/sc/qa/uitest/calc_tests/data/tdf131907.odt Binary files differnew file mode 100644 index 000000000..2a08fa54b --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf131907.odt diff --git a/sc/qa/uitest/calc_tests/data/tdf132783.ods b/sc/qa/uitest/calc_tests/data/tdf132783.ods Binary files differnew file mode 100644 index 000000000..fd06c83e5 --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf132783.ods diff --git a/sc/qa/uitest/calc_tests/data/tdf31805.ods b/sc/qa/uitest/calc_tests/data/tdf31805.ods Binary files differnew file mode 100644 index 000000000..4660363ef --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf31805.ods diff --git a/sc/qa/uitest/calc_tests/data/tdf37341.ods b/sc/qa/uitest/calc_tests/data/tdf37341.ods Binary files differnew file mode 100644 index 000000000..d0f5024fb --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf37341.ods diff --git a/sc/qa/uitest/calc_tests/data/tdf37623.ods b/sc/qa/uitest/calc_tests/data/tdf37623.ods Binary files differnew file mode 100644 index 000000000..68100bbee --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf37623.ods diff --git a/sc/qa/uitest/calc_tests/data/tdf43693.ods b/sc/qa/uitest/calc_tests/data/tdf43693.ods Binary files differnew file mode 100644 index 000000000..501a07765 --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf43693.ods diff --git a/sc/qa/uitest/calc_tests/data/tdf49531.ods b/sc/qa/uitest/calc_tests/data/tdf49531.ods Binary files differnew file mode 100644 index 000000000..26fe76d3c --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf49531.ods diff --git a/sc/qa/uitest/calc_tests/data/tdf51368.ods b/sc/qa/uitest/calc_tests/data/tdf51368.ods Binary files differnew file mode 100644 index 000000000..a899fcd6e --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf51368.ods diff --git a/sc/qa/uitest/calc_tests/data/tdf53482.ods b/sc/qa/uitest/calc_tests/data/tdf53482.ods Binary files differnew file mode 100644 index 000000000..cfd682d6a --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf53482.ods diff --git a/sc/qa/uitest/calc_tests/data/tdf54018.ods b/sc/qa/uitest/calc_tests/data/tdf54018.ods Binary files differnew file mode 100644 index 000000000..dab482fb4 --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf54018.ods diff --git a/sc/qa/uitest/calc_tests/data/tdf55734.ods b/sc/qa/uitest/calc_tests/data/tdf55734.ods Binary files differnew file mode 100644 index 000000000..d3ccc258f --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf55734.ods diff --git a/sc/qa/uitest/calc_tests/data/tdf56958.ods b/sc/qa/uitest/calc_tests/data/tdf56958.ods Binary files differnew file mode 100644 index 000000000..e2c65a218 --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf56958.ods diff --git a/sc/qa/uitest/calc_tests/data/tdf57274.ods b/sc/qa/uitest/calc_tests/data/tdf57274.ods Binary files differnew file mode 100644 index 000000000..306f3c7a2 --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf57274.ods diff --git a/sc/qa/uitest/calc_tests/data/tdf62267.ods b/sc/qa/uitest/calc_tests/data/tdf62267.ods Binary files differnew file mode 100644 index 000000000..51ed9aecf --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf62267.ods diff --git a/sc/qa/uitest/calc_tests/data/tdf62349.ods b/sc/qa/uitest/calc_tests/data/tdf62349.ods Binary files differnew file mode 100644 index 000000000..71bc5274c --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf62349.ods diff --git a/sc/qa/uitest/calc_tests/data/tdf63805.ods b/sc/qa/uitest/calc_tests/data/tdf63805.ods Binary files differnew file mode 100644 index 000000000..fd2affb4e --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf63805.ods diff --git a/sc/qa/uitest/calc_tests/data/tdf65856.ods b/sc/qa/uitest/calc_tests/data/tdf65856.ods Binary files differnew file mode 100644 index 000000000..c3c27c710 --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf65856.ods diff --git a/sc/qa/uitest/calc_tests/data/tdf65856_2.ods b/sc/qa/uitest/calc_tests/data/tdf65856_2.ods Binary files differnew file mode 100644 index 000000000..4a0fe0ff4 --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf65856_2.ods diff --git a/sc/qa/uitest/calc_tests/data/tdf68290.ods b/sc/qa/uitest/calc_tests/data/tdf68290.ods Binary files differnew file mode 100644 index 000000000..e8047a372 --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf68290.ods diff --git a/sc/qa/uitest/calc_tests/data/tdf69981.ods b/sc/qa/uitest/calc_tests/data/tdf69981.ods Binary files differnew file mode 100644 index 000000000..4647d1a2c --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf69981.ods diff --git a/sc/qa/uitest/calc_tests/data/tdf77509.xls b/sc/qa/uitest/calc_tests/data/tdf77509.xls Binary files differnew file mode 100644 index 000000000..d8d690c8b --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf77509.xls diff --git a/sc/qa/uitest/calc_tests/data/tdf81351.ods b/sc/qa/uitest/calc_tests/data/tdf81351.ods Binary files differnew file mode 100644 index 000000000..7888ce008 --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf81351.ods diff --git a/sc/qa/uitest/calc_tests/data/tdf81696.ods b/sc/qa/uitest/calc_tests/data/tdf81696.ods Binary files differnew file mode 100644 index 000000000..593c8072c --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf81696.ods diff --git a/sc/qa/uitest/calc_tests/data/tdf85403.ods b/sc/qa/uitest/calc_tests/data/tdf85403.ods Binary files differnew file mode 100644 index 000000000..c809d2579 --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf85403.ods diff --git a/sc/qa/uitest/calc_tests/data/tdf85979.ods b/sc/qa/uitest/calc_tests/data/tdf85979.ods Binary files differnew file mode 100644 index 000000000..2b8584a20 --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf85979.ods diff --git a/sc/qa/uitest/calc_tests/data/tdf86253.ods b/sc/qa/uitest/calc_tests/data/tdf86253.ods Binary files differnew file mode 100644 index 000000000..d4042df43 --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf86253.ods diff --git a/sc/qa/uitest/calc_tests/data/tdf88735.ods b/sc/qa/uitest/calc_tests/data/tdf88735.ods Binary files differnew file mode 100644 index 000000000..59abf6050 --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf88735.ods diff --git a/sc/qa/uitest/calc_tests/data/tdf88792.ods b/sc/qa/uitest/calc_tests/data/tdf88792.ods Binary files differnew file mode 100644 index 000000000..ecd9e6040 --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf88792.ods diff --git a/sc/qa/uitest/calc_tests/data/tdf89958.ods b/sc/qa/uitest/calc_tests/data/tdf89958.ods Binary files differnew file mode 100644 index 000000000..5a48917db --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf89958.ods diff --git a/sc/qa/uitest/calc_tests/data/tdf91217.ods b/sc/qa/uitest/calc_tests/data/tdf91217.ods Binary files differnew file mode 100644 index 000000000..c1bb9da85 --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf91217.ods diff --git a/sc/qa/uitest/calc_tests/data/tdf91425.ods b/sc/qa/uitest/calc_tests/data/tdf91425.ods Binary files differnew file mode 100644 index 000000000..5a72f162d --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf91425.ods diff --git a/sc/qa/uitest/calc_tests/data/tdf93506.ods b/sc/qa/uitest/calc_tests/data/tdf93506.ods Binary files differnew file mode 100644 index 000000000..3995e563e --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf93506.ods diff --git a/sc/qa/uitest/calc_tests/data/tdf95192.ods b/sc/qa/uitest/calc_tests/data/tdf95192.ods Binary files differnew file mode 100644 index 000000000..8cee74288 --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf95192.ods diff --git a/sc/qa/uitest/calc_tests/data/tdf96432.ods b/sc/qa/uitest/calc_tests/data/tdf96432.ods Binary files differnew file mode 100644 index 000000000..68aa06fb3 --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf96432.ods diff --git a/sc/qa/uitest/calc_tests/data/tdf98390.ods b/sc/qa/uitest/calc_tests/data/tdf98390.ods Binary files differnew file mode 100644 index 000000000..19baf412b --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf98390.ods diff --git a/sc/qa/uitest/calc_tests/data/tdf98493.ods b/sc/qa/uitest/calc_tests/data/tdf98493.ods Binary files differnew file mode 100644 index 000000000..1cc0d8b11 --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf98493.ods diff --git a/sc/qa/uitest/calc_tests/data/tdf99069.ods b/sc/qa/uitest/calc_tests/data/tdf99069.ods Binary files differnew file mode 100644 index 000000000..9c4fbda4a --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf99069.ods diff --git a/sc/qa/uitest/calc_tests/data/tdf99208.ods b/sc/qa/uitest/calc_tests/data/tdf99208.ods Binary files differnew file mode 100644 index 000000000..2767e7731 --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf99208.ods diff --git a/sc/qa/uitest/calc_tests/data/tdf99386.ods b/sc/qa/uitest/calc_tests/data/tdf99386.ods Binary files differnew file mode 100644 index 000000000..767d0ead4 --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf99386.ods diff --git a/sc/qa/uitest/calc_tests/data/tdf99627.ods b/sc/qa/uitest/calc_tests/data/tdf99627.ods Binary files differnew file mode 100644 index 000000000..84c4e5134 --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf99627.ods diff --git a/sc/qa/uitest/calc_tests/data/text_to_columns_comma.ods b/sc/qa/uitest/calc_tests/data/text_to_columns_comma.ods Binary files differnew file mode 100644 index 000000000..3d5b7d583 --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/text_to_columns_comma.ods diff --git a/sc/qa/uitest/calc_tests/data/text_to_columns_dot.ods b/sc/qa/uitest/calc_tests/data/text_to_columns_dot.ods Binary files differnew file mode 100644 index 000000000..29136ae45 --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/text_to_columns_dot.ods diff --git a/sc/qa/uitest/calc_tests/data/text_to_columns_pipe.ods b/sc/qa/uitest/calc_tests/data/text_to_columns_pipe.ods Binary files differnew file mode 100644 index 000000000..16652ceed --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/text_to_columns_pipe.ods diff --git a/sc/qa/uitest/calc_tests/data/text_to_columns_pipe_space.ods b/sc/qa/uitest/calc_tests/data/text_to_columns_pipe_space.ods Binary files differnew file mode 100644 index 000000000..0895d3497 --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/text_to_columns_pipe_space.ods diff --git a/sc/qa/uitest/calc_tests/data/text_to_columns_semicolon.ods b/sc/qa/uitest/calc_tests/data/text_to_columns_semicolon.ods Binary files differnew file mode 100644 index 000000000..53eb7c615 --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/text_to_columns_semicolon.ods diff --git a/sc/qa/uitest/calc_tests/data/text_to_columns_space.ods b/sc/qa/uitest/calc_tests/data/text_to_columns_space.ods Binary files differnew file mode 100644 index 000000000..4ae3f176c --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/text_to_columns_space.ods diff --git a/sc/qa/uitest/calc_tests/documentProperties.py b/sc/qa/uitest/calc_tests/documentProperties.py new file mode 100644 index 000000000..71030b595 --- /dev/null +++ b/sc/qa/uitest/calc_tests/documentProperties.py @@ -0,0 +1,109 @@ +# -*- 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 libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict +import time +from uitest.debug import sleep +from uitest.uihelper.common import select_pos + + +class CalcDocumentProperties(UITestCase): + + def test_open_document_properties_calc(self): + self.ui_test.create_doc_in_start_center("calc") + self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties") + xDialog = self.xUITest.getTopFocusWindow() + xResetBtn = xDialog.getChild("reset") + xResetBtn.executeAction("CLICK", tuple()) + xTabs = xDialog.getChild("tabcontrol") + + select_pos(xTabs, "0") #first tab + xUserDataCheckbox = xDialog.getChild("userdatacb") # apply user data + xUserDataCheckbox.executeAction("CLICK", tuple()) + xThumbSaveCheckbox = xDialog.getChild("thumbnailsavecb") # save preview image with document + xThumbSaveCheckbox.executeAction("CLICK", tuple()) + +#digital signature + xDigSignBtn = xDialog.getChild("signature") + def handle_sign_dlg(dialog): + xNoBtn = dialog.getChild("no") + self.ui_test.close_dialog_through_button(xNoBtn) + self.ui_test.execute_blocking_action(xDigSignBtn.executeAction, args=('CLICK', ()), + dialog_handler=handle_sign_dlg) + + select_pos(xTabs, "1") #tab Description + + xTitleText = xDialog.getChild("title") + xTitleText.executeAction("TYPE", mkPropertyValues({"TEXT":"Title text"})) + xSubjectText = xDialog.getChild("subject") + xSubjectText.executeAction("TYPE", mkPropertyValues({"TEXT":"Subject text"})) + xKeywordsText = xDialog.getChild("keywords") + xKeywordsText.executeAction("TYPE", mkPropertyValues({"TEXT":"Keywords text"})) + xCommentsText = xDialog.getChild("comments") + xCommentsText.executeAction("TYPE", mkPropertyValues({"TEXT":"Comments text"})) + +#Font tab + select_pos(xTabs, "4") #tab Fonts + xFontEmbedCheckbox = xDialog.getChild("embedFonts") + xFontEmbedCheckbox.executeAction("CLICK", tuple()) + +#Security tab + select_pos(xTabs, "3") #tab Security + xReadOnlyCheckbox = xDialog.getChild("readonly") + xReadOnlyCheckbox.executeAction("CLICK", tuple()) + xRecordChangesCheckbox = xDialog.getChild("recordchanges") + xRecordChangesCheckbox.executeAction("CLICK", tuple()) + xProtectBtn = xDialog.getChild("protect") + def handle_protect_dlg(dialog): + xOkBtn = dialog.getChild("ok") + xPasswordText = dialog.getChild("pass1ed") + xPasswordText.executeAction("TYPE", mkPropertyValues({"TEXT":"password"})) + xConfirmText = dialog.getChild("confirm1ed") + xConfirmText.executeAction("TYPE", mkPropertyValues({"TEXT":"password"})) + self.ui_test.close_dialog_through_button(xOkBtn) + self.ui_test.execute_blocking_action(xProtectBtn.executeAction, args=('CLICK', ()), + dialog_handler=handle_protect_dlg) + + select_pos(xTabs, "2") #tab Custom properties +#add custom properties ------>>>>>>>>>>> not supported + xAddBtn = xDialog.getChild("add") + xAddBtn.executeAction("CLICK", tuple()) + + select_pos(xTabs, "5") #tab Statistics + + xOkBtn = xDialog.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) +#now open the dialog again and read the properties + self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties") + xDialog = self.xUITest.getTopFocusWindow() + xTitleText = xDialog.getChild("title") + xSubjectText = xDialog.getChild("subject") + xKeywordsText = xDialog.getChild("keywords") + xCommentsText = xDialog.getChild("comments") + xReadOnlyCheckbox = xDialog.getChild("readonly") + xRecordChangesCheckbox = xDialog.getChild("recordchanges") + xFontEmbedCheckbox = xDialog.getChild("embedFonts") + xUserDataCheckbox = xDialog.getChild("userdatacb") + xThumbSaveCheckbox = xDialog.getChild("thumbnailsavecb") + self.assertEqual(get_state_as_dict(xTitleText)["Text"], "Title text") + self.assertEqual(get_state_as_dict(xSubjectText)["Text"], "Subject text") + self.assertEqual(get_state_as_dict(xKeywordsText)["Text"], "Keywords text") + self.assertEqual(get_state_as_dict(xReadOnlyCheckbox)["Selected"], "true") + self.assertEqual(get_state_as_dict(xRecordChangesCheckbox)["Selected"], "true") + self.assertEqual(get_state_as_dict(xReadOnlyCheckbox)["Selected"], "true") + self.assertEqual(get_state_as_dict(xFontEmbedCheckbox)["Selected"], "true") + self.assertEqual(get_state_as_dict(xUserDataCheckbox)["Selected"], "false") + self.assertEqual(get_state_as_dict(xThumbSaveCheckbox)["Selected"], "false") + self.assertEqual(get_state_as_dict(xCommentsText)["Text"], "Comments text") + xResetBtn = xDialog.getChild("reset") + xResetBtn.executeAction("CLICK", tuple()) + xCancBtn = xDialog.getChild("cancel") + xCancBtn.executeAction("CLICK", tuple()) + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests/fillRandomNumber.py b/sc/qa/uitest/calc_tests/fillRandomNumber.py new file mode 100644 index 000000000..2f9635184 --- /dev/null +++ b/sc/qa/uitest/calc_tests/fillRandomNumber.py @@ -0,0 +1,65 @@ +# -*- 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 + +#randomnumbergenerator.ui +class fillRandomNumber(UITestCase): + def test_fill_random_number(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() + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"})) + self.ui_test.execute_modeless_dialog_through_command(".uno:RandomNumberGeneratorDialog") + xDialog = self.xUITest.getTopFocusWindow() + xcellrangeedit = xDialog.getChild("cell-range-edit") + xdistributioncombo = xDialog.getChild("distribution-combo") + xparameter1spin = xDialog.getChild("parameter1-spin") + xparameter2spin = xDialog.getChild("parameter2-spin") + xenableseedcheck = xDialog.getChild("enable-seed-check") + xseedspin = xDialog.getChild("seed-spin") + xenableroundingcheck = xDialog.getChild("enable-rounding-check") + xdecimalplacesspin = xDialog.getChild("decimal-places-spin") + + xcellrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$A$2"})) + props = {"TEXT": "Uniform Integer"} + actionProps = mkPropertyValues(props) + xdistributioncombo.executeAction("SELECT", actionProps) + + xparameter1spin.executeAction("UP", tuple()) + xparameter2spin.executeAction("UP", tuple()) + xenableseedcheck.executeAction("CLICK", tuple()) + xseedspin.executeAction("UP", tuple()) + xenableroundingcheck.executeAction("CLICK", tuple()) + xdecimalplacesspin.executeAction("UP", tuple()) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #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) + #close dialog without doing anything + self.ui_test.execute_modeless_dialog_through_command(".uno:RandomNumberGeneratorDialog") + xDialog = self.xUITest.getTopFocusWindow() + xCloseBtn = xDialog.getChild("close") + self.ui_test.close_dialog_through_button(xCloseBtn) + 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) + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests/formatCells.py b/sc/qa/uitest/calc_tests/formatCells.py new file mode 100644 index 000000000..5d350cf25 --- /dev/null +++ b/sc/qa/uitest/calc_tests/formatCells.py @@ -0,0 +1,442 @@ +# -*- 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 + +class formatCell(UITestCase): + def test_format_cell_numbers_tab(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() + #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") + #language + props3 = {"TEXT": "English (USA)"} + actionProps3 = mkPropertyValues(props3) + xlanguagelb.executeAction("SELECT", actionProps3) + #set Number + props = {"TEXT": "Number"} + actionProps = mkPropertyValues(props) + xliststore1.executeAction("SELECT", actionProps) + #set Standard + props2 = {"TEXT": "Standard"} + actionProps2 = mkPropertyValues(props2) + xliststore2.executeAction("SELECT", actionProps2) + #other properties + xdecimalsed.executeAction("UP", tuple()) + xleadzerosed.executeAction("UP", tuple()) + xnegnumred.executeAction("CLICK", tuple()) + xthousands.executeAction("CLICK", tuple()) + #format #,#00.0;[RED]-#,#00.0 + self.assertEqual(get_state_as_dict(xformatted)["Text"], "#,#00.0;[RED]-#,#00.0") + #save + xOk = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOk) + #verify + 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"], "Number") + self.assertEqual(get_state_as_dict(xlanguagelb)["SelectEntryText"], "English (USA)") + self.assertEqual(get_state_as_dict(xdecimalsed)["Text"], "1") + self.assertEqual(get_state_as_dict(xleadzerosed)["Text"], "2") + self.assertEqual(get_state_as_dict(xnegnumred)["Selected"], "true") + self.assertEqual(get_state_as_dict(xthousands)["Selected"], "true") + self.assertEqual(get_state_as_dict(xformatted)["Text"], "#,#00.0;[RED]-#,#00.0") + xOk = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOk) + + self.ui_test.close_doc() + + def test_format_cell_font_tab(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() + #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, "1") #tab Font + xSizeFont = xDialog.getChild("westsizelb-cjk") + xSizeFontEast = xDialog.getChild("eastsizelb") + xSizeFontCTL = xDialog.getChild("ctlsizelb") + xLangFont = xDialog.getChild("westlanglb-cjk") + xLangFontEast = xDialog.getChild("eastlanglb") + xLangFontCTL = xDialog.getChild("ctllanglb") + + xSizeFont.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xSizeFont.executeAction("TYPE", mkPropertyValues({"TEXT":"18"})) #set font size 18 + xSizeFontEast.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xSizeFontEast.executeAction("TYPE", mkPropertyValues({"TEXT":"18"})) #set font size 18 + xSizeFontCTL.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xSizeFontCTL.executeAction("TYPE", mkPropertyValues({"TEXT":"18"})) #set font size 18 + select_pos(xLangFont, "0") + select_pos(xLangFontEast, "0") + select_pos(xLangFontCTL, "0") + xOK = xDialog.getChild("ok") + xOK.executeAction("CLICK", tuple()) + + #Verify - 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, "1") #tab Font + xSizeFont = xDialog.getChild("westsizelb-cjk") + xSizeFontEast = xDialog.getChild("eastsizelb") + xSizeFontCTL = xDialog.getChild("ctlsizelb") + xLangFont = xDialog.getChild("westlanglb-cjk") + xLangFontEast = xDialog.getChild("eastlanglb") + xLangFontCTL = xDialog.getChild("ctllanglb") + + self.assertEqual(get_state_as_dict(xSizeFont)["Text"], "18 pt") + self.assertEqual(get_state_as_dict(xSizeFontEast)["Text"], "18 pt") + self.assertEqual(get_state_as_dict(xSizeFontCTL)["Text"], "18 pt") #check font size + self.assertEqual(get_state_as_dict(xLangFont)["Text"], "[None]") + self.assertEqual(get_state_as_dict(xLangFontEast)["SelectEntryText"], "[None]") + self.assertEqual(get_state_as_dict(xLangFontCTL)["SelectEntryText"], "[None]") + + xCanc = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCanc) + + self.ui_test.close_doc() + + def test_format_cell_font_effects_tab(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() + #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, "2") #tab Font Effects + xRelief = xDialog.getChild("relieflb") + xOverline = xDialog.getChild("overlinelb") + xStrikeout = xDialog.getChild("strikeoutlb") + xUnderline = xDialog.getChild("underlinelb") + xEmphasis = xDialog.getChild("emphasislb") + xPosition = xDialog.getChild("positionlb") + + select_pos(xRelief, "1") + select_pos(xOverline, "1") + select_pos(xStrikeout, "1") + select_pos(xUnderline, "1") + select_pos(xEmphasis, "1") + select_pos(xPosition, "1") + + xOK = xDialog.getChild("ok") + xOK.executeAction("CLICK", tuple()) + #Verify- 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, "2") + + xRelief = xDialog.getChild("relieflb") + xOverline = xDialog.getChild("overlinelb") + xStrikeout = xDialog.getChild("strikeoutlb") + xUnderline = xDialog.getChild("underlinelb") + xEmphasis = xDialog.getChild("emphasislb") + xPosition = xDialog.getChild("positionlb") + + self.assertEqual(get_state_as_dict(xRelief)["SelectEntryText"], "Embossed") + self.assertEqual(get_state_as_dict(xOverline)["SelectEntryText"], "Single") + self.assertEqual(get_state_as_dict(xStrikeout)["SelectEntryText"], "Single") + self.assertEqual(get_state_as_dict(xUnderline)["SelectEntryText"], "Single") + self.assertEqual(get_state_as_dict(xEmphasis)["SelectEntryText"], "Dot") + self.assertEqual(get_state_as_dict(xPosition)["SelectEntryText"], "Below text") + + xCanc = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCanc) + + self.ui_test.close_doc() + + def test_format_cell_alignment_tab(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() + #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, "3") #tab Alignment + comboboxHorzAlign = xDialog.getChild("comboboxHorzAlign") + xspinIndentFrom = xDialog.getChild("spinIndentFrom") + xcomboboxVertAlign = xDialog.getChild("comboboxVertAlign") + xcheckVertStack = xDialog.getChild("checkVertStack") + xcheckWrapTextAuto = xDialog.getChild("checkWrapTextAuto") + xcheckHyphActive = xDialog.getChild("checkHyphActive") + xcomboTextDirBox = xDialog.getChild("comboTextDirBox") + + props = {"TEXT": "Left"} + actionProps = mkPropertyValues(props) + comboboxHorzAlign.executeAction("SELECT", actionProps) + xspinIndentFrom.executeAction("UP", tuple()) + indentVal = get_state_as_dict(xspinIndentFrom)["Text"] + props2 = {"TEXT": "Top"} + actionProps2 = mkPropertyValues(props2) + xcomboboxVertAlign.executeAction("SELECT", actionProps2) + xcheckVertStack.executeAction("CLICK", tuple()) + xcheckWrapTextAuto.executeAction("CLICK", tuple()) + xcheckHyphActive.executeAction("CLICK", tuple()) + props3 = {"TEXT": "Left-to-right (LTR)"} + actionProps3 = mkPropertyValues(props3) + xcomboTextDirBox.executeAction("SELECT", actionProps3) + xOK = xDialog.getChild("ok") + xOK.executeAction("CLICK", tuple()) + #Verify- 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, "3") + comboboxHorzAlign = xDialog.getChild("comboboxHorzAlign") + xspinIndentFrom = xDialog.getChild("spinIndentFrom") + xcomboboxVertAlign = xDialog.getChild("comboboxVertAlign") + xcheckVertStack = xDialog.getChild("checkVertStack") + xcheckWrapTextAuto = xDialog.getChild("checkWrapTextAuto") + xcheckHyphActive = xDialog.getChild("checkHyphActive") + xcomboTextDirBox = xDialog.getChild("comboTextDirBox") + + self.assertEqual(get_state_as_dict(comboboxHorzAlign)["SelectEntryText"], "Left") + self.assertEqual(get_state_as_dict(xspinIndentFrom)["Text"] == indentVal, True) + self.assertEqual(get_state_as_dict(xcomboboxVertAlign)["SelectEntryText"], "Top") + self.assertEqual(get_state_as_dict(xcheckVertStack)["Selected"], "true") + self.assertEqual(get_state_as_dict(xcheckWrapTextAuto)["Selected"], "true") + self.assertEqual(get_state_as_dict(xcheckHyphActive)["Selected"], "true") + self.assertEqual(get_state_as_dict(xcomboTextDirBox)["SelectEntryText"], "Left-to-right (LTR)") + xOK = xDialog.getChild("ok") + xOK.executeAction("CLICK", tuple()) + + self.ui_test.close_doc() + + def test_format_cell_asian_typography_tab(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() + #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, "4") #tab Asian typography + xcheckForbidList = xDialog.getChild("checkForbidList") + xcheckForbidList.executeAction("CLICK", tuple()) + xOK = xDialog.getChild("ok") + xOK.executeAction("CLICK", tuple()) + #Verify- 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, "4") + xcheckForbidList = xDialog.getChild("checkForbidList") + self.assertEqual(get_state_as_dict(xcheckForbidList)["Selected"], "true") + xOK = xDialog.getChild("ok") + xOK.executeAction("CLICK", tuple()) + + self.ui_test.close_doc() + + def test_format_cell_borders_tab(self): + #borderpage.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() + #set points pt measurement + #Make sure that tools-options-LibreOffice Calc-General-Point + 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 /point + xunitlb = xDialogOpt.getChild("unitlb") + props = {"TEXT": "Point"} + actionProps = mkPropertyValues(props) + xunitlb.executeAction("SELECT", actionProps) + xOKBtn = xDialogOpt.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #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, "5") #tab Borders + xsync = xDialog.getChild("sync") + xleftmf = xDialog.getChild("leftmf") + xrightmf = xDialog.getChild("rightmf") + xtopmf = xDialog.getChild("topmf") + xbottommf = xDialog.getChild("bottommf") + + xsync.executeAction("CLICK", tuple()) #uncheck Synchronize + xleftmf.executeAction("UP", tuple()) + xrightmf.executeAction("UP", tuple()) + xrightmf.executeAction("UP", tuple()) + xtopmf.executeAction("UP", tuple()) + xtopmf.executeAction("UP", tuple()) + xtopmf.executeAction("UP", tuple()) + xbottommf.executeAction("UP", tuple()) + xbottommf.executeAction("UP", tuple()) + xbottommf.executeAction("UP", tuple()) + xbottommf.executeAction("UP", tuple()) + + leftVal = get_state_as_dict(xleftmf)["Text"] + rightVal = get_state_as_dict(xrightmf)["Text"] + topVal = get_state_as_dict(xtopmf)["Text"] + bottomVal = get_state_as_dict(xbottommf)["Text"] + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + # Verify 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, "5") #tab Borders + xsync = xDialog.getChild("sync") + xleftmf = xDialog.getChild("leftmf") + xrightmf = xDialog.getChild("rightmf") + xtopmf = xDialog.getChild("topmf") + xbottommf = xDialog.getChild("bottommf") + + self.assertEqual(get_state_as_dict(xsync)["Selected"], "false") + self.assertEqual(get_state_as_dict(xleftmf)["Text"] == leftVal, True) + self.assertEqual(get_state_as_dict(xrightmf)["Text"] == rightVal, True) + self.assertEqual(get_state_as_dict(xtopmf)["Text"] == topVal, True) + self.assertEqual(get_state_as_dict(xbottommf)["Text"] == bottomVal, True) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.ui_test.close_doc() + + def test_format_cell_cell_protection_tab(self): + #cellprotectionpage.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() + #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, "6") #tab Cell protection + xcheckHideFormula = xDialog.getChild("checkHideFormula") + xcheckHideAll = xDialog.getChild("checkHideAll") + xcheckHidePrinting = xDialog.getChild("checkHidePrinting") + + xcheckHideFormula.executeAction("CLICK", tuple()) + xcheckHideAll.executeAction("CLICK", tuple()) + xcheckHidePrinting.executeAction("CLICK", tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + # Verify 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, "6") #tab Borders + xcheckHideFormula = xDialog.getChild("checkHideFormula") + xcheckHideAll = xDialog.getChild("checkHideAll") + xcheckHidePrinting = xDialog.getChild("checkHidePrinting") + + self.assertEqual(get_state_as_dict(xcheckHideFormula)["Selected"], "false") + self.assertEqual(get_state_as_dict(xcheckHideAll)["Selected"], "false") + self.assertEqual(get_state_as_dict(xcheckHidePrinting)["Selected"], "false") + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.ui_test.close_doc() + + def test_tdf130762(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() + #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, "3") #tab Alignment + xspinDegrees = xDialog.getChild("spinDegrees") + self.assertEqual(get_state_as_dict(xspinDegrees)["Text"].replace('°', ''), "0") + xspinDegrees.executeAction("DOWN", tuple()) + self.assertEqual(get_state_as_dict(xspinDegrees)["Text"].replace('°', ''), "355") + xspinDegrees.executeAction("UP", tuple()) + self.assertEqual(get_state_as_dict(xspinDegrees)["Text"].replace('°', ''), "0") + + 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_tests/mergedRowsColumns.py b/sc/qa/uitest/calc_tests/mergedRowsColumns.py new file mode 100644 index 000000000..1302c7b64 --- /dev/null +++ b/sc/qa/uitest/calc_tests/mergedRowsColumns.py @@ -0,0 +1,214 @@ +# -*- 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 libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.framework import UITestCase +from libreoffice.calc.document import get_column +import org.libreoffice.unotest +import pathlib +import time +from uitest.debug import sleep +from libreoffice.calc.document import get_cell_by_position +from uitest.uihelper.common import get_state_as_dict + +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +class mergedRowsColumns(UITestCase): + + def test_merged_row_delete_tdf105412(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf105412.ods")) + xTopWindow = self.xUITest.getTopFocusWindow() + gridwin = xTopWindow.getChild("grid_window") + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A20"})) + self.xUITest.executeCommand(".uno:SelectRow") + self.xUITest.executeCommand(".uno:DeleteRows") + self.xUITest.executeCommand(".uno:Undo") + self.xUITest.executeCommand(".uno:Redo") + + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 18).getString(), "L6") + + self.ui_test.close_doc() + + def test_merged_columns_delete(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf105412.ods")) + xTopWindow = self.xUITest.getTopFocusWindow() + gridwin = xTopWindow.getChild("grid_window") + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D1"})) + self.xUITest.executeCommand(".uno:SelectColumn") + self.xUITest.executeCommand(".uno:DeleteColumns") + self.xUITest.executeCommand(".uno:Undo") + self.xUITest.executeCommand(".uno:Redo") + + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 18).getString(), "L6") + + self.ui_test.close_doc() + + def test_undo_not_available_merged_cells_tdf37901(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf105412.ods")) + xTopWindow = self.xUITest.getTopFocusWindow() + gridwin = xTopWindow.getChild("grid_window") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "B1:B2"})) + self.xUITest.executeCommand(".uno:MergeCells") + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 1).getString(), "Key#") + self.xUITest.executeCommand(".uno:ToggleMergeCells") + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 1).getString(), "Key#") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A2:B2"})) + self.xUITest.executeCommand(".uno:MergeCells") + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 1).getString(), "Key#") + self.xUITest.executeCommand(".uno:ToggleMergeCells") + self.xUITest.executeCommand(".uno:Undo") + + self.ui_test.close_doc() + + def test_calculations_in_merged_cells_tdf51368(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf51368.ods")) + xTopWindow = self.xUITest.getTopFocusWindow() + gridwin = xTopWindow.getChild("grid_window") + + #move the content of the hidden cells into the first cell + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A11:A12"})) + self.ui_test.execute_dialog_through_command(".uno:ToggleMergeCells") + xDialog = self.xUITest.getTopFocusWindow() + + xMoveCells = xDialog.getChild("move-cells-radio") + xMoveCells.executeAction("CLICK", tuple()) + self.ui_test.close_dialog_through_button(xDialog.getChild("ok")) + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 10).getString(), "2 3") + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 11).getString(), "0") + + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 10).getString(), "2") + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 11).getString(), "3") + + #keep the contents of the hidden cells + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A11:A12"})) + self.ui_test.execute_dialog_through_command(".uno:ToggleMergeCells") + xDialog = self.xUITest.getTopFocusWindow() + + xMoveCells = xDialog.getChild("keep-content-radio") + xMoveCells.executeAction("CLICK", tuple()) + self.ui_test.close_dialog_through_button(xDialog.getChild("ok")) + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 10).getString(), "2") + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 11).getString(), "3") + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 11).getString(), "3") + + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 10).getString(), "2") + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 11).getString(), "3") + + #Empty the contents of the hidden cells + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A11:A12"})) + self.ui_test.execute_dialog_through_command(".uno:ToggleMergeCells") + xDialog = self.xUITest.getTopFocusWindow() + + xMoveCells = xDialog.getChild("move-cells-radio") + xMoveCells.executeAction("CLICK", tuple()) + self.ui_test.close_dialog_through_button(xDialog.getChild("ok")) + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 10).getString(), "2 3") + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 11).getString(), "") + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 11).getString(), "0") + + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 10).getString(), "2") + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 11).getString(), "3") + + #A21-A22 + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A21:A22"})) + self.ui_test.execute_dialog_through_command(".uno:ToggleMergeCells") + xDialog = self.xUITest.getTopFocusWindow() + + xMoveCells = xDialog.getChild("keep-content-radio") + xMoveCells.executeAction("CLICK", tuple()) + self.ui_test.close_dialog_through_button(xDialog.getChild("ok")) + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 20).getString(), "2") + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 21).getString(), "3") + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 21).getString(), "2") + + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 20).getString(), "2") + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 21).getString(), "2") + + #A30-A32 + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A30:A32"})) + self.ui_test.execute_dialog_through_command(".uno:ToggleMergeCells") + xDialog = self.xUITest.getTopFocusWindow() + + xMoveCells = xDialog.getChild("keep-content-radio") + xMoveCells.executeAction("CLICK", tuple()) + self.ui_test.close_dialog_through_button(xDialog.getChild("ok")) + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 31).getString(), "thisisbad") + + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 30).getString(), "is") + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 31).getString(), "thisisbad") + + #J12-K12 + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "J12:K12"})) + self.ui_test.execute_dialog_through_command(".uno:ToggleMergeCells") + xDialog = self.xUITest.getTopFocusWindow() + + xMoveCells = xDialog.getChild("keep-content-radio") + xMoveCells.executeAction("CLICK", tuple()) + self.ui_test.close_dialog_through_button(xDialog.getChild("ok")) + self.assertEqual(get_cell_by_position(calc_doc, 0, 9, 11).getString(), "2") + self.assertEqual(get_cell_by_position(calc_doc, 0, 11, 11).getString(), "3") + + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(calc_doc, 0, 9, 11).getString(), "2") + self.assertEqual(get_cell_by_position(calc_doc, 0, 11, 11).getString(), "3") + + #J22-K22 + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "J22:K22"})) + self.ui_test.execute_dialog_through_command(".uno:ToggleMergeCells") + xDialog = self.xUITest.getTopFocusWindow() + + xMoveCells = xDialog.getChild("keep-content-radio") + xMoveCells.executeAction("CLICK", tuple()) + self.ui_test.close_dialog_through_button(xDialog.getChild("ok")) + self.assertEqual(get_cell_by_position(calc_doc, 0, 9, 21).getString(), "2") + self.assertEqual(get_cell_by_position(calc_doc, 0, 11, 21).getString(), "2") + + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(calc_doc, 0, 9, 21).getString(), "2") + self.assertEqual(get_cell_by_position(calc_doc, 0, 11, 21).getString(), "2") + self.ui_test.close_doc() + + def test_merge_merged_cells_tdf63766(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf105412.ods")) + xTopWindow = self.xUITest.getTopFocusWindow() + gridwin = xTopWindow.getChild("grid_window") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "C19:F22"})) + self.xUITest.executeCommand(".uno:ToggleMergeCells") + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 18).getString(), "L6") + self.xUITest.executeCommand(".uno:Undo") + + self.ui_test.close_doc() + + def test_move_merged_cells(self): + self.ui_test.create_doc_in_start_center("calc") + xTopWindow = self.xUITest.getTopFocusWindow() + gridwin = xTopWindow.getChild("grid_window") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "B1:C1"})) + self.xUITest.executeCommand(".uno:ToggleMergeCells") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D1"})) + self.xUITest.executeCommand(".uno:GoLeft") + self.xUITest.executeCommand(".uno:GoLeft") + self.assertEqual(get_state_as_dict(gridwin)["CurrentColumn"], "0") + self.assertEqual(get_state_as_dict(gridwin)["CurrentRow"], "0") #position A1 + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: + diff --git a/sc/qa/uitest/calc_tests/naturalSort.py b/sc/qa/uitest/calc_tests/naturalSort.py new file mode 100644 index 000000000..bd583a3c9 --- /dev/null +++ b/sc/qa/uitest/calc_tests/naturalSort.py @@ -0,0 +1,113 @@ +# -*- 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 +#Testcases Sorting TCS_Sorting + +class CalcNaturalSorting(UITestCase): + + def test_natural_sorting_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() + #enter data + enter_text_to_cell(gridwin, "A1", "MW100SSMOU456.996JIL4") + enter_text_to_cell(gridwin, "A2", "MW180SSMOU456.996JIL4") + enter_text_to_cell(gridwin, "A3", "MW110SSMOU456.993JIL4") + enter_text_to_cell(gridwin, "A4", "MW180SSMOU456.994JIL4") + enter_text_to_cell(gridwin, "A5", "MW101SSMOU456.996JIL4") + #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, "0") + 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(), "MW100SSMOU456.996JIL4") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "MW101SSMOU456.996JIL4") + self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "MW110SSMOU456.993JIL4") + self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "MW180SSMOU456.994JIL4") + self.assertEqual(get_cell_by_position(document, 0, 0, 4).getString(), "MW180SSMOU456.996JIL4") + #UNDO + self.xUITest.executeCommand(".uno:Undo") + #Verify + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "MW100SSMOU456.996JIL4") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "MW180SSMOU456.996JIL4") + self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "MW110SSMOU456.993JIL4") + self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "MW180SSMOU456.994JIL4") + self.assertEqual(get_cell_by_position(document, 0, 0, 4).getString(), "MW101SSMOU456.996JIL4") + #enter data + enter_text_to_cell(gridwin, "D1", "MW-2") + enter_text_to_cell(gridwin, "D2", "MW-20") + enter_text_to_cell(gridwin, "D3", "MW-1") + enter_text_to_cell(gridwin, "D4", "MW-18") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "D1:D4"})) + + #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) + + self.assertEqual(get_cell_by_position(document, 0, 3, 0).getString(), "MW-1") + self.assertEqual(get_cell_by_position(document, 0, 3, 1).getString(), "MW-2") + self.assertEqual(get_cell_by_position(document, 0, 3, 2).getString(), "MW-18") + self.assertEqual(get_cell_by_position(document, 0, 3, 3).getString(), "MW-20") + + self.ui_test.close_doc() + + def test_natural_sorting_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() + #enter data + enter_text_to_cell(gridwin, "A1", "MW-2") + enter_text_to_cell(gridwin, "B1", "MW-20") + enter_text_to_cell(gridwin, "C1", "MW-1") + enter_text_to_cell(gridwin, "D1", "MW-18") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:D1"})) + + #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") + xNatural = xDialog.getChild("naturalsort") + xleftright.executeAction("CLICK", tuple()) + 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(), "MW-1") + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "MW-2") + self.assertEqual(get_cell_by_position(document, 0, 2, 0).getString(), "MW-18") + self.assertEqual(get_cell_by_position(document, 0, 3, 0).getString(), "MW-20") + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests/printRange.py b/sc/qa/uitest/calc_tests/printRange.py new file mode 100644 index 000000000..2a5f26410 --- /dev/null +++ b/sc/qa/uitest/calc_tests/printRange.py @@ -0,0 +1,118 @@ +# -*- 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 + +class printRange(UITestCase): + def test_printRange(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() + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:F20"})) + #Set print range + self.xUITest.executeCommand(".uno:DefinePrintArea") + # Print Range dialog + self.ui_test.execute_modeless_dialog_through_command(".uno:EditPrintArea") + xDialog = self.xUITest.getTopFocusWindow() + xlbprintarea = xDialog.getChild("lbprintarea") + xedprintarea = xDialog.getChild("edprintarea") + #verify range + self.assertEqual(get_state_as_dict(xlbprintarea)["SelectEntryText"], "- selection -") + self.assertEqual(get_state_as_dict(xedprintarea)["Text"], "$A$1:$F$20") + #set Row + xedrepeatrow = xDialog.getChild("edrepeatrow") + xedrepeatrow.executeAction("TYPE", mkPropertyValues({"TEXT":"$1"})) + #set Column + xedrepeatcol = xDialog.getChild("edrepeatcol") + xedrepeatcol.executeAction("TYPE", mkPropertyValues({"TEXT":"$A"})) + # Click Ok + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + + #Verify Print Range dialog + self.ui_test.execute_modeless_dialog_through_command(".uno:EditPrintArea") + xDialog = self.xUITest.getTopFocusWindow() + xedprintarea = xDialog.getChild("edprintarea") + xedrepeatrow = xDialog.getChild("edrepeatrow") + xedrepeatcol = xDialog.getChild("edrepeatcol") + self.assertEqual(get_state_as_dict(xedprintarea)["Text"], "$A$1:$F$20") + self.assertEqual(get_state_as_dict(xedrepeatrow)["Text"], "$1") + self.assertEqual(get_state_as_dict(xedrepeatcol)["Text"], "$A") + xCancel = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancel) + + #delete print ranges + self.xUITest.executeCommand(".uno:DeletePrintArea") + #Verify Print Range dialog + self.ui_test.execute_modeless_dialog_through_command(".uno:EditPrintArea") + xDialog = self.xUITest.getTopFocusWindow() + xedprintarea = xDialog.getChild("edprintarea") + xlbprintarea = xDialog.getChild("lbprintarea") + xedrepeatrow = xDialog.getChild("edrepeatrow") + xedrepeatcol = xDialog.getChild("edrepeatcol") + self.assertEqual(get_state_as_dict(xedprintarea)["Text"], "") + self.assertEqual(get_state_as_dict(xlbprintarea)["SelectEntryText"], "- entire sheet -") + self.assertEqual(get_state_as_dict(xedrepeatrow)["Text"], "$1") + self.assertEqual(get_state_as_dict(xedrepeatcol)["Text"], "$A") + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + self.ui_test.close_doc() + + def test_tdf33341_copy_sheet_with_print_range(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() + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:F20"})) + #Set print range + self.xUITest.executeCommand(".uno:DefinePrintArea") + # Print Range dialog + self.ui_test.execute_modeless_dialog_through_command(".uno:EditPrintArea") + xDialog = self.xUITest.getTopFocusWindow() + xlbprintarea = xDialog.getChild("lbprintarea") + xedprintarea = xDialog.getChild("edprintarea") + #verify range + self.assertEqual(get_state_as_dict(xlbprintarea)["SelectEntryText"], "- selection -") + self.assertEqual(get_state_as_dict(xedprintarea)["Text"], "$A$1:$F$20") + #set Row + xedrepeatrow = xDialog.getChild("edrepeatrow") + xedrepeatrow.executeAction("TYPE", mkPropertyValues({"TEXT":"$1"})) + #set Column + xedrepeatcol = xDialog.getChild("edrepeatcol") + xedrepeatcol.executeAction("TYPE", mkPropertyValues({"TEXT":"$A"})) + # Click Ok + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + + #Copy sheet + self.ui_test.execute_dialog_through_command(".uno:Move") + xDialog = self.xUITest.getTopFocusWindow() + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + #Verify Print Range dialog on new sheet + self.ui_test.execute_modeless_dialog_through_command(".uno:EditPrintArea") + xDialog = self.xUITest.getTopFocusWindow() + xedprintarea = xDialog.getChild("edprintarea") + xedrepeatrow = xDialog.getChild("edrepeatrow") + xedrepeatcol = xDialog.getChild("edrepeatcol") + self.assertEqual(get_state_as_dict(xedprintarea)["Text"], "$A$1:$F$20") + self.assertEqual(get_state_as_dict(xedrepeatrow)["Text"], "$1") + self.assertEqual(get_state_as_dict(xedrepeatcol)["Text"], "$A") + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests/rows.py b/sc/qa/uitest/calc_tests/rows.py new file mode 100644 index 000000000..96cffaf5f --- /dev/null +++ b/sc/qa/uitest/calc_tests/rows.py @@ -0,0 +1,286 @@ +# -*- 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 + +class CalcRows(UITestCase): + def test_row_height(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 + 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 /cm + xunitlb = xDialogOpt.getChild("unitlb") + props = {"TEXT": "Centimeter"} + actionProps = mkPropertyValues(props) + xunitlb.executeAction("SELECT", actionProps) + xOKBtn = xDialogOpt.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #select A1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #row height + self.ui_test.execute_dialog_through_command(".uno:RowHeight") + xDialog = self.xUITest.getTopFocusWindow() + xvalue = xDialog.getChild("value") + xdefault = xDialog.getChild("default") + self.assertEqual(get_state_as_dict(xdefault)["Selected"], "true") #default selected + heightStrOrig = get_state_as_dict(xvalue)["Text"] + heightVal = heightStrOrig[:4] #default 0.45 cm + xvalue.executeAction("UP", tuple()) #0.50 cm + heightStr = get_state_as_dict(xvalue)["Text"] + heightValNew = heightStr[:4] + self.assertEqual(get_state_as_dict(xdefault)["Selected"], "false") #default not selected + self.assertEqual(heightValNew > heightVal, True) #new value is bigger + xdefault.executeAction("CLICK", tuple()) #click default + self.assertEqual(get_state_as_dict(xvalue)["Text"] == heightStrOrig, True) #default value set + #write your own value + xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xvalue.executeAction("TYPE", mkPropertyValues({"TEXT":"1 cm"})) + # Click Ok + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + #verify + self.ui_test.execute_dialog_through_command(".uno:RowHeight") + xDialog = self.xUITest.getTopFocusWindow() + xvalue = xDialog.getChild("value") + self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.00 cm") + xCancel = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancel) + + self.ui_test.close_doc() + + def test_row_height_two_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() + + #Make sure that tools-options-StarOffice Calc-General + 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 /cm + xunitlb = xDialogOpt.getChild("unitlb") + props = {"TEXT": "Centimeter"} + actionProps = mkPropertyValues(props) + xunitlb.executeAction("SELECT", actionProps) + xOKBtn = xDialogOpt.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3", "EXTEND":"1"})) + + self.ui_test.execute_dialog_through_command(".uno:RowHeight") + xDialog = self.xUITest.getTopFocusWindow() + xvalue = xDialog.getChild("value") + xdefault = xDialog.getChild("default") + #write your own value + xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xvalue.executeAction("TYPE", mkPropertyValues({"TEXT":"1 cm"})) + # Click Ok + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + #verify + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + self.ui_test.execute_dialog_through_command(".uno:RowHeight") + xDialog = self.xUITest.getTopFocusWindow() + xvalue = xDialog.getChild("value") + self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.00 cm") + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) + self.ui_test.execute_dialog_through_command(".uno:RowHeight") + xDialog = self.xUITest.getTopFocusWindow() + xvalue = xDialog.getChild("value") + self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.00 cm") + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + + self.ui_test.close_doc() + + def test_tdf89140_row_height_copy(self): + #Bug 89140 - Calc row paste doesn't keep row height + 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 + 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 /cm + xunitlb = xDialogOpt.getChild("unitlb") + props = {"TEXT": "Centimeter"} + actionProps = mkPropertyValues(props) + xunitlb.executeAction("SELECT", actionProps) + xOKBtn = xDialogOpt.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #select A1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #row height + self.ui_test.execute_dialog_through_command(".uno:RowHeight") + xDialog = self.xUITest.getTopFocusWindow() + xvalue = xDialog.getChild("value") + xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xvalue.executeAction("TYPE", mkPropertyValues({"TEXT":"1 cm"})) + # Click Ok + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + #select row 1 + self.xUITest.executeCommand(".uno:SelectRow") + #copy + self.xUITest.executeCommand(".uno:Copy") + #select A3 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) + #paste + self.xUITest.executeCommand(".uno:Paste") + #verify + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) + self.ui_test.execute_dialog_through_command(".uno:RowHeight") + xDialog = self.xUITest.getTopFocusWindow() + xvalue = xDialog.getChild("value") + self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.00 cm") + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + + self.ui_test.close_doc() + + def test_row_hide_show(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() + #select A3 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) + self.xUITest.executeCommand(".uno:HideRow") #uno command moves focus one cell down + #verify A4 + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "3") + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"UP"})) + #verify A2 (row 3 is hidden) + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "1") + #Show hidden row: select A2:A4 + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A2:A4"})) + self.xUITest.executeCommand(".uno:ShowRow") + #verify + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A4"})) + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "3") + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"UP"})) + #verify A3 (row 3 is not hidden) + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "2") + + self.ui_test.close_doc() + + def test_row_test_move(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() + #select A3 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "2") + #down + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + #verify A4 + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "3") + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"UP"})) + #verify A2 + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "2") + + self.ui_test.close_doc() + + def test_row_height_insert_below(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 + 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 /cm + xunitlb = xDialogOpt.getChild("unitlb") + props = {"TEXT": "Centimeter"} + actionProps = mkPropertyValues(props) + xunitlb.executeAction("SELECT", actionProps) + xOKBtn = xDialogOpt.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #select A3 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) + #row height + self.ui_test.execute_dialog_through_command(".uno:RowHeight") + xDialog = self.xUITest.getTopFocusWindow() + xvalue = xDialog.getChild("value") + xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xvalue.executeAction("TYPE", mkPropertyValues({"TEXT":"1 cm"})) + # Click Ok + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + #select row 3 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) + self.xUITest.executeCommand(".uno:SelectRow") + #insert rows below + self.xUITest.executeCommand(".uno:InsertRowsAfter") + + #verify + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) + self.ui_test.execute_dialog_through_command(".uno:RowHeight") + xDialog = self.xUITest.getTopFocusWindow() + xvalue = xDialog.getChild("value") + self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.00 cm") + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A4"})) + self.ui_test.execute_dialog_through_command(".uno:RowHeight") + xDialog = self.xUITest.getTopFocusWindow() + xvalue = xDialog.getChild("value") + self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.00 cm") + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests/sheetRename.py b/sc/qa/uitest/calc_tests/sheetRename.py new file mode 100644 index 000000000..28acb90cf --- /dev/null +++ b/sc/qa/uitest/calc_tests/sheetRename.py @@ -0,0 +1,111 @@ +# -*- 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 + +class sheetRename(UITestCase): + def test_sheet_rename(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.ui_test.execute_dialog_through_command(".uno:RenameTable") + xDialog = self.xUITest.getTopFocusWindow() + xname_entry = xDialog.getChild("name_entry") + xname_entry.executeAction("TYPE", mkPropertyValues({"TEXT":"NewName"})) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #Verify + self.ui_test.execute_dialog_through_command(".uno:RenameTable") + xDialog = self.xUITest.getTopFocusWindow() + xname_entry = xDialog.getChild("name_entry") + self.assertEqual(get_state_as_dict(xname_entry)["Text"], "NewName") + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + + self.ui_test.close_doc() + + def test_sheet_rename_invalid_sheet_name(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.ui_test.execute_dialog_through_command(".uno:RenameTable") + xDialog = self.xUITest.getTopFocusWindow() + xname_entry = xDialog.getChild("name_entry") + nameVal = get_state_as_dict(xname_entry)["Text"] + xname_entry.executeAction("TYPE", mkPropertyValues({"TEXT":"NewName**"})) + xOKBtn = xDialog.getChild("ok") + def handle_warn_dlg(dialog): + #show warning + xok = dialog.getChild("ok") + self.ui_test.close_dialog_through_button(xok) + + self.ui_test.execute_blocking_action(xOKBtn.executeAction, args=('CLICK', ()), + dialog_handler=handle_warn_dlg) + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + + #Verify + self.ui_test.execute_dialog_through_command(".uno:RenameTable") + xDialog = self.xUITest.getTopFocusWindow() + xname_entry = xDialog.getChild("name_entry") + self.assertEqual(get_state_as_dict(xname_entry)["Text"], nameVal) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.ui_test.close_doc() + +# def test_tdf81431_rename_sheet_clipboard_content_wiped_out(self): +# calc_doc = self.ui_test.create_doc_in_start_center("calc") +# xCalcDoc = self.xUITest.getTopFocusWindow() +# gridwin = xCalcDoc.getChild("grid_window") +# document = self.ui_test.get_component() +# #enter text and copy text to clipboard +# enter_text_to_cell(gridwin, "A1", "String") +# gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) +# self.xUITest.executeCommand(".uno:Copy") +# #rename sheet +# self.ui_test.execute_dialog_through_command(".uno:RenameTable") +# xDialog = self.xUITest.getTopFocusWindow() +# xname_entry = xDialog.getChild("name_entry") +# nameVal = get_state_as_dict(xname_entry)["Text"] +# xname_entry.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) +# xname_entry.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) +# xname_entry.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+V"})) + +# #fails here - text is not pasted +# self.assertEqual(get_state_as_dict(xname_entry)["Text"], "String") + +# xOKBtn = xDialog.getChild("ok") +# self.ui_test.close_dialog_through_button(xOKBtn) +# #paste text to cell +# gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1"})) +# self.xUITest.executeCommand(".uno:Paste") +# self.assertEqual(get_cell_by_position(document, 0, 2, 0).getString(), "String") +# #undo +# self.xUITest.executeCommand(".uno:Undo") +# self.xUITest.executeCommand(".uno:Undo") +# #verify undo cell paste +# self.assertEqual(get_cell_by_position(document, 0, 2, 0).getString(), "") +# #verify undo sheet rename +# self.ui_test.execute_dialog_through_command(".uno:RenameTable") +# xDialog = self.xUITest.getTopFocusWindow() +# xname_entry = xDialog.getChild("name_entry") +# self.assertEqual(get_state_as_dict(xname_entry)["Text"], nameVal) +# 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_tests/sorting.py b/sc/qa/uitest/calc_tests/sorting.py new file mode 100644 index 000000000..4b56ceea7 --- /dev/null +++ b/sc/qa/uitest/calc_tests/sorting.py @@ -0,0 +1,303 @@ +# -*- 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 +#Testcases Sorting TCS_Sorting + +class CalcSorting(UITestCase): + + def test_Sortingbuttons_detect_columnheaders(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: Number; 3; 4; 6; 2 / In column B enter: Misc; s; d; f; g + enter_text_to_cell(gridwin, "A1", "Number") + enter_text_to_cell(gridwin, "A2", "3") + enter_text_to_cell(gridwin, "A3", "4") + enter_text_to_cell(gridwin, "A4", "6") + enter_text_to_cell(gridwin, "A5", "2") + enter_text_to_cell(gridwin, "B1", "Misc") + enter_text_to_cell(gridwin, "B2", "s") + enter_text_to_cell(gridwin, "B3", "d") + enter_text_to_cell(gridwin, "B4", "f") + enter_text_to_cell(gridwin, "B5", "g") + #Select cell A3 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) + #Press toolbarbutton for descending sorting .uno:SortDescending + self.xUITest.executeCommand(".uno:SortDescending") + #Verify that cell A1 still contains "Number" and B1 "Misc" + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Number") + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "Misc") + #UNDO + self.xUITest.executeCommand(".uno:Undo") + #Select cell B3 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B3"})) + #Press toolbar button for ascending sorting + self.xUITest.executeCommand(".uno:SortAscending") + #Verify that cell A1 still contains "Number" and B1 "Misc" + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Number") + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "Misc") + #UNDO + self.xUITest.executeCommand(".uno:Undo") + #Select cell A3 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) + #Open sort dialog by DATA - SORT /Switch to tabpage Options + self.ui_test.execute_dialog_through_command(".uno:DataSort") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") + #Verify that option "Range contains column labels" is set + xHeader = xDialog.getChild("header") + self.assertEqual(get_state_as_dict(xHeader)["Selected"], "true") + #Cancel dialog + xCanc = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCanc) + #Select Range A1:B5 + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B5"})) + #Press toolbarbutton for descending sorting + self.xUITest.executeCommand(".uno:SortDescending") + #Verify that cell A1 still contains "Number" and B1 "Misc" + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Number") + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "Misc") + self.ui_test.close_doc() + + def test_Sortingbuttons_list_has_not_columnheaders(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: 5; 3; 4; 6; 2 / In column B enter: e; s; d; f; g + enter_text_to_cell(gridwin, "A1", "5") + enter_text_to_cell(gridwin, "A2", "3") + enter_text_to_cell(gridwin, "A3", "4") + enter_text_to_cell(gridwin, "A4", "6") + enter_text_to_cell(gridwin, "A5", "2") + enter_text_to_cell(gridwin, "B1", "e") + enter_text_to_cell(gridwin, "B2", "s") + enter_text_to_cell(gridwin, "B3", "d") + enter_text_to_cell(gridwin, "B4", "f") + enter_text_to_cell(gridwin, "B5", "g") + #Select cell A3 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) + #Press toolbar button for ascending sorting + self.xUITest.executeCommand(".uno:SortAscending") + #Verify that cell A1 no longer contains "5" and B1 no longer contains "e" + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString() != "5", True) + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString() != "e", True) + #UNDO + self.xUITest.executeCommand(".uno:Undo") + #Select cell B3 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B3"})) + #Open sort dialog by DATA - SORT /Switch to tabpage Options + self.ui_test.execute_dialog_through_command(".uno:DataSort") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") + #Verify that option "Range contains column labels" is not set + xHeader = xDialog.getChild("header") + self.assertEqual(get_state_as_dict(xHeader)["Selected"], "false") + #Cancel dialog + xCanc = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCanc) + self.ui_test.close_doc() + + def test_Sorting_default_to_selected_column(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: Number; 3; 4; 6; 2 / In column B enter: Misc; s; d; f; g + enter_text_to_cell(gridwin, "A1", "Number") + enter_text_to_cell(gridwin, "A2", "3") + enter_text_to_cell(gridwin, "A3", "4") + enter_text_to_cell(gridwin, "A4", "6") + enter_text_to_cell(gridwin, "A5", "2") + enter_text_to_cell(gridwin, "B1", "Misc") + enter_text_to_cell(gridwin, "B2", "s") + enter_text_to_cell(gridwin, "B3", "d") + enter_text_to_cell(gridwin, "B4", "f") + enter_text_to_cell(gridwin, "B5", "g") + #Select cell A3 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) + #Press toolbarbutton for descending sorting .uno:SortDescending + self.xUITest.executeCommand(".uno:SortDescending") + #Verify that the sortorder was determined for column A (Number;2;3;4;6) + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Number") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 6) + self.assertEqual(get_cell_by_position(document, 0, 0, 2).getValue(), 4) + self.assertEqual(get_cell_by_position(document, 0, 0, 3).getValue(), 3) + self.assertEqual(get_cell_by_position(document, 0, 0, 4).getValue(), 2) + #UNDO + self.xUITest.executeCommand(".uno:Undo") + #Select cell B3 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B3"})) + #Press toolbar button for ascending sorting + self.xUITest.executeCommand(".uno:SortAscending") + #Verify that the sortorder was determined for column B (Misc;s;g;f;d) + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "Misc") + self.assertEqual(get_cell_by_position(document, 0, 1, 1).getString(), "d") + self.assertEqual(get_cell_by_position(document, 0, 1, 2).getString(), "f") + self.assertEqual(get_cell_by_position(document, 0, 1, 3).getString(), "g") + self.assertEqual(get_cell_by_position(document, 0, 1, 4).getString(), "s") + + self.ui_test.close_doc() + + def test_Sorting_default_to_selected_TAB_A_column(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: Number; 3; 4; 6; 2 / In column B enter: Misc; s; d; f; g + enter_text_to_cell(gridwin, "A1", "Number") + enter_text_to_cell(gridwin, "A2", "3") + enter_text_to_cell(gridwin, "A3", "4") + enter_text_to_cell(gridwin, "A4", "6") + enter_text_to_cell(gridwin, "A5", "2") + enter_text_to_cell(gridwin, "B1", "Misc") + enter_text_to_cell(gridwin, "B2", "s") + enter_text_to_cell(gridwin, "B3", "d") + enter_text_to_cell(gridwin, "B4", "f") + enter_text_to_cell(gridwin, "B5", "g") + #Select Range A1:B5 + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B5"})) + #Move the active cell inside the range to column A by using the TAB key + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"})) + #Press toolbar button for ascending sorting + self.xUITest.executeCommand(".uno:SortAscending") + #Verify that the sortorder was determined for column A (Number;2;3;4;6) + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Number") + 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(), 6) + + self.ui_test.close_doc() + + def test_Sorting_default_to_selected_TAB_B_column(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: Number; 3; 4; 6; 2 / In column B enter: Misc; s; d; f; g + enter_text_to_cell(gridwin, "A1", "Number") + enter_text_to_cell(gridwin, "A2", "3") + enter_text_to_cell(gridwin, "A3", "4") + enter_text_to_cell(gridwin, "A4", "6") + enter_text_to_cell(gridwin, "A5", "2") + enter_text_to_cell(gridwin, "B1", "Misc") + enter_text_to_cell(gridwin, "B2", "s") + enter_text_to_cell(gridwin, "B3", "d") + enter_text_to_cell(gridwin, "B4", "f") + enter_text_to_cell(gridwin, "B5", "g") + #Select Range A1:B5 + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B5"})) + #Move the active cell inside the range to column B by using the TAB key + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"})) + #Press toolbar button for ascending sorting + self.xUITest.executeCommand(".uno:SortAscending") + #Verify that the sortorder was determined for column B (Misc;d;f;g;s) + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "Misc") + self.assertEqual(get_cell_by_position(document, 0, 1, 1).getString(), "d") + self.assertEqual(get_cell_by_position(document, 0, 1, 2).getString(), "f") + self.assertEqual(get_cell_by_position(document, 0, 1, 3).getString(), "g") + self.assertEqual(get_cell_by_position(document, 0, 1, 4).getString(), "s") + + self.ui_test.close_doc() + + def test_Sorting_sort_criteria(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: Number; 3; 4; 6; 2 / In column B enter: Misc; s; d; f; g + enter_text_to_cell(gridwin, "A1", "Number") + enter_text_to_cell(gridwin, "A2", "3") + enter_text_to_cell(gridwin, "A3", "4") + enter_text_to_cell(gridwin, "A4", "6") + enter_text_to_cell(gridwin, "A5", "2") + enter_text_to_cell(gridwin, "B1", "Misc") + enter_text_to_cell(gridwin, "B2", "s") + enter_text_to_cell(gridwin, "B3", "d") + enter_text_to_cell(gridwin, "B4", "f") + enter_text_to_cell(gridwin, "B5", "g") + #Select cell A3 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) + #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, "0") + #Verify that the first sort criteria is set to "Number(ascending)" + xSortKey1 = xDialog.getChild("sortlb") + xAsc = xDialog.getChild("up") + self.assertEqual(get_state_as_dict(xSortKey1)["SelectEntryText"], "Number") + self.assertEqual(get_state_as_dict(xAsc)["Checked"], "true") + #Cancel dialog + xCanc = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCanc) + #Select cell B3 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B3"})) + #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, "0") + #Verify that the first sort criteria is set to "Misc (ascending)" + xSortKey1 = xDialog.getChild("sortlb") + xAsc = xDialog.getChild("up") + self.assertEqual(get_state_as_dict(xSortKey1)["SelectEntryText"], "Misc") + self.assertEqual(get_state_as_dict(xAsc)["Checked"], "true") + #Cancel dialog + xCanc = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCanc) + #Select Range A1:B5 + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B5"})) + #Move the active cell inside the range to column A by using the TAB key + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"})) + #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, "0") + #Verify that the first sort criteria is set to "Number(ascending)" + xSortKey1 = xDialog.getChild("sortlb") + xAsc = xDialog.getChild("up") + self.assertEqual(get_state_as_dict(xSortKey1)["SelectEntryText"], "Number") + self.assertEqual(get_state_as_dict(xAsc)["Checked"], "true") + #Cancel dialog + xCanc = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCanc) + #Select Range A1:B5 + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B5"})) + #Move the active cell inside the range to column B by using the TAB key + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"})) + #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, "0") + #Verify that the first sort criteria is set to "Misc (ascending)" + xSortKey1 = xDialog.getChild("sortlb") + xAsc = xDialog.getChild("up") + self.assertEqual(get_state_as_dict(xSortKey1)["SelectEntryText"], "Misc") + self.assertEqual(get_state_as_dict(xAsc)["Checked"], "true") + #Cancel dialog + xCanc = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCanc) + + 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_tests/tdf120161.py b/sc/qa/uitest/calc_tests/tdf120161.py new file mode 100755 index 000000000..18c5f3ed4 --- /dev/null +++ b/sc/qa/uitest/calc_tests/tdf120161.py @@ -0,0 +1,85 @@ +# -*- 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 libreoffice.uno.propertyvalue import mkPropertyValues +import org.libreoffice.unotest +import os +import pathlib +from tempfile import TemporaryDirectory + + +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + + +# Bug 120161: PRINTING, PDF Export: Problem with selected cells which cross pages +class tdf120161(UITestCase): + def getFileContent(self, pathAndFileName): + with open(pathAndFileName, 'rb') as theFile: # b is important -> binary + # Return as binary string + data = theFile.read() + return data + + def verifyExportToFile(self, xDoc, xContext, xRange, xFontName, xFilename): + # set selection + xGridWin = xDoc.getChild("grid_window") + xGridWin.executeAction("SELECT", mkPropertyValues({"RANGE": xRange})) + + # set print area + self.xUITest.executeCommand(".uno:DefinePrintArea") + + # create temp file name + xURL = 'file:///' + xFilename + + # prepare to export into pdf + xServiceManager = xContext.ServiceManager + xDispatcher = xServiceManager.createInstanceWithContext( + 'com.sun.star.frame.DispatchHelper', xContext) + xDocFrame = self.ui_test.get_desktop().getCurrentFrame() + document = self.ui_test.get_component() + + # get selection + xSelection = document.Sheets.getByName("Sheet1").getCellRangeByName(xRange) + self.assertIsNotNone(xSelection) + + # run export into pdf + xFilterData = mkPropertyValues( + {'Selection': xSelection, 'ViewPDFAfterExport': True, 'Printing': '2'}) + xParams = mkPropertyValues( + {'URL': xURL, 'FilterName': 'calc_pdf_Export', 'FilterData': xFilterData}) + xDispatcher.executeDispatch(xDocFrame, '.uno:ExportToPDF', '', 0, xParams) + + # check resulting pdf file + xFileContent = self.getFileContent(xFilename) + position = xFileContent.find(xFontName) + return position > 0 + + # create temp directory and filename inside it + def verifyExport(self, xDoc, xContext, xRange, xFontName): + with TemporaryDirectory() as tempdir: + if os.altsep: # we need URL so replace "\" with "/" + tempdir = tempdir.replace(os.sep, os.altsep) + xFilename = tempdir + "/tdf120161-temp.pdf" + return self.verifyExportToFile(xDoc, xContext, xRange, xFontName, xFilename) + return False + + def test_tdf120161(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf120161.ods")) + xDoc = self.xUITest.getTopFocusWindow() + xContext = self.xContext + + # check different areas to be printed without any lost cell + # note: + # 1. Visually in GridView G1 is on page-1 and H1 is on page-2 + # 2. DejaVuSans is used only in H1 + self.assertFalse(self.verifyExport(xDoc, xContext, "A1:G1", b"DejaVuSans")) + self.assertTrue(self.verifyExport(xDoc, xContext, "H1:I1", b"DejaVuSans")) + self.assertTrue(self.verifyExport(xDoc, xContext, "G1:H1", b"DejaVuSans")) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests2/consolidate.py b/sc/qa/uitest/calc_tests2/consolidate.py new file mode 100644 index 000000000..b52e3be8f --- /dev/null +++ b/sc/qa/uitest/calc_tests2/consolidate.py @@ -0,0 +1,130 @@ +# -*- 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() + +#consolidatedialog.ui +class consolidate(UITestCase): + def test_consolidate(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("consolidate.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + self.ui_test.execute_modeless_dialog_through_command(".uno:DataConsolidate") + xDialog = self.xUITest.getTopFocusWindow() + xfunc = xDialog.getChild("func") + xlbdataarea = xDialog.getChild("lbdataarea") + xadd = xDialog.getChild("add") + xbyrow = xDialog.getChild("byrow") + xbycol = xDialog.getChild("bycol") + xeddestarea = xDialog.getChild("eddestarea") + + props = {"TEXT": "Sum"} + actionProps = mkPropertyValues(props) + xfunc.executeAction("SELECT", actionProps) + + propsA = {"TEXT": "range1"} + actionPropsA = mkPropertyValues(propsA) + xlbdataarea.executeAction("SELECT", actionPropsA) + xadd.executeAction("CLICK", tuple()) + propsB = {"TEXT": "range2"} + actionPropsB = mkPropertyValues(propsB) + xlbdataarea.executeAction("SELECT", actionPropsB) + 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"})) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #verify + self.assertEqual(get_cell_by_position(document, 0, 1, 2).getValue(), 300) + self.assertEqual(get_cell_by_position(document, 0, 1, 3).getValue(), 303) + self.assertEqual(get_cell_by_position(document, 0, 1, 4).getValue(), 306) + self.assertEqual(get_cell_by_position(document, 0, 1, 5).getValue(), 309) + + self.assertEqual(get_cell_by_position(document, 0, 2, 2).getValue(), 303) + self.assertEqual(get_cell_by_position(document, 0, 2, 3).getValue(), 306) + self.assertEqual(get_cell_by_position(document, 0, 2, 4).getValue(), 309) + self.assertEqual(get_cell_by_position(document, 0, 2, 5).getValue(), 312) + + self.assertEqual(get_cell_by_position(document, 0, 3, 2).getValue(), 306) + self.assertEqual(get_cell_by_position(document, 0, 3, 3).getValue(), 309) + self.assertEqual(get_cell_by_position(document, 0, 3, 4).getValue(), 312) + self.assertEqual(get_cell_by_position(document, 0, 3, 5).getValue(), 315) + + self.assertEqual(get_cell_by_position(document, 0, 4, 2).getValue(), 309) + self.assertEqual(get_cell_by_position(document, 0, 4, 3).getValue(), 312) + self.assertEqual(get_cell_by_position(document, 0, 4, 4).getValue(), 315) + self.assertEqual(get_cell_by_position(document, 0, 4, 5).getValue(), 318) + #verify dialog + self.ui_test.execute_modeless_dialog_through_command(".uno:DataConsolidate") + xDialog = self.xUITest.getTopFocusWindow() + 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") + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.assertEqual(get_cell_by_position(document, 0, 1, 2).getValue(), 200) + self.assertEqual(get_cell_by_position(document, 0, 1, 3).getValue(), 202) + self.assertEqual(get_cell_by_position(document, 0, 1, 4).getValue(), 204) + self.assertEqual(get_cell_by_position(document, 0, 1, 5).getValue(), 206) + + self.assertEqual(get_cell_by_position(document, 0, 2, 2).getValue(), 202) + self.assertEqual(get_cell_by_position(document, 0, 2, 3).getValue(), 204) + self.assertEqual(get_cell_by_position(document, 0, 2, 4).getValue(), 206) + self.assertEqual(get_cell_by_position(document, 0, 2, 5).getValue(), 208) + + self.assertEqual(get_cell_by_position(document, 0, 3, 2).getValue(), 204) + self.assertEqual(get_cell_by_position(document, 0, 3, 3).getValue(), 206) + self.assertEqual(get_cell_by_position(document, 0, 3, 4).getValue(), 208) + self.assertEqual(get_cell_by_position(document, 0, 3, 5).getValue(), 210) + + self.assertEqual(get_cell_by_position(document, 0, 4, 2).getValue(), 206) + self.assertEqual(get_cell_by_position(document, 0, 4, 3).getValue(), 208) + self.assertEqual(get_cell_by_position(document, 0, 4, 4).getValue(), 210) + self.assertEqual(get_cell_by_position(document, 0, 4, 5).getValue(), 212) + + # test cancel button + self.ui_test.execute_modeless_dialog_through_command(".uno:DataConsolidate") + xDialog = self.xUITest.getTopFocusWindow() + xCancelBtn = xDialog.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_tests2/dataform.py b/sc/qa/uitest/calc_tests2/dataform.py new file mode 100644 index 000000000..0ffe0e70d --- /dev/null +++ b/sc/qa/uitest/calc_tests2/dataform.py @@ -0,0 +1,27 @@ +# -*- 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 libreoffice.uno.propertyvalue import mkPropertyValues +import org.libreoffice.unotest + +#dataformdialog.ui +class dataform(UITestCase): + def test_dataform(self): + calc_doc = 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"})) + + self.ui_test.execute_dialog_through_command(".uno:DataForm") + xDialog = self.xUITest.getTopFocusWindow() + + xCloseBtn = xDialog.getChild("close") + self.ui_test.close_dialog_through_button(xCloseBtn) + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests2/stableSorting.py b/sc/qa/uitest/calc_tests2/stableSorting.py new file mode 100644 index 000000000..986c7cc3d --- /dev/null +++ b/sc/qa/uitest/calc_tests2/stableSorting.py @@ -0,0 +1,104 @@ +# -*- 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/. +# + +import org.libreoffice.unotest +import pathlib +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 +#Testcases Sorting TCS_Sorting Stable sorting +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +class CalcStableSorting(UITestCase): + + def test_Must_keep_sort_order_previous_sorting_toolbar_button_Ascending(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("stableSorting.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #Select cell E1 ("Sales") and press toolbar button for ascending sorting. + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "E1"})) + self.xUITest.executeCommand(".uno:SortAscending") + #Select cell D1 ("Product") and press toolbar button for ascending sorting. + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D1"})) + self.xUITest.executeCommand(".uno:SortAscending") + #Select cell C1 ("Salesman") and press toolbar button for ascending sorting. + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1"})) + self.xUITest.executeCommand(".uno:SortAscending") + # Select cell B1 ("Region") and press toolbar button for ascending sorting. + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B1"})) + self.xUITest.executeCommand(".uno:SortAscending") + #Verify that the numbers in column "CheckOrder" are ascending + for i in range(1, 501): + self.assertEqual(get_cell_by_position(document, 0, 5, i).getValue(), i) + self.ui_test.close_doc() + + def test_Must_keep_sort_order_previous_sorting_toolbar_button_Descending(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("stableSorting.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #Select cell E1 ("Sales") and press toolbar button for descending sorting. + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "E1"})) + self.xUITest.executeCommand(".uno:SortDescending") + #Select cell D1 ("Product") and press toolbar button for descending sorting. + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D1"})) + self.xUITest.executeCommand(".uno:SortDescending") + #Select cell C1 ("Salesman") and press toolbar button for descending sorting. + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1"})) + self.xUITest.executeCommand(".uno:SortDescending") + # Select cell B1 ("Region") and press toolbar button for descending sorting. + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B1"})) + self.xUITest.executeCommand(".uno:SortDescending") + #Verify that the numbers in column "CheckOrder" are ascending + for i in range(1, 501): + j = 501 - i + self.assertEqual(get_cell_by_position(document, 0, 5, i).getValue(), j) + self.ui_test.close_doc() + + # def test_Must_keep_sort_order_previous_sorting_using_sort_dialog(self): +# cannot test for now - criteria names are identical - Markus https://gerrit.libreoffice.org/#/c/52534/ + # calc_doc = self.ui_test.load_file(get_url_for_data_file("stableSorting.ods")) + # xCalcDoc = self.xUITest.getTopFocusWindow() + # gridwin = xCalcDoc.getChild("grid_window") + # document = self.ui_test.get_component() +# Select cell A1 and open sort dialog by DATA - SORT + # gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) +# Open sort dialog by DATA - SORT /Switch to tabpage Options + # self.ui_test.execute_dialog_through_command(".uno:DataSort") + # xDialog = self.xUITest.getTopFocusWindow() + # xTabs = xDialog.getChild("tabcontrol") + # select_pos(xTabs, "1") +# Check option "Range contains column labels" + # xHeader = xDialog.getChild("header") + # self.assertEqual(get_state_as_dict(xHeader)["Selected"], "true") +# Switch to tabpage "Sort Criteria" + # select_pos(xTabs, "0") +# Choose "Salesman(ascending)" as first criteria + # xSortKey1 = xDialog.getChild("sortlb") + # xAsc = xDialog.getChild("up") + # props = {"TEXT": "Salesman"} + # actionProps = mkPropertyValues(props) + # xSortKey1.executeAction("SELECT", actionProps) + # self.assertEqual(get_state_as_dict(xAsc)["Checked"], "true") + #Choose "Product (ascending)" as second criteria + # xSortKey2 = xDialog.getChild("sortuserlb") + # xAsc = xDialog.getChild("up") + # props = {"TEXT": "Salesman"} + # actionProps = mkPropertyValues(props) + # xSortKey1.executeAction("SELECT", actionProps) + # self.assertEqual(get_state_as_dict(xAsc)["Checked"], "true") + # self.ui_test.close_doc() + +# 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..6519fe6af --- /dev/null +++ b/sc/qa/uitest/calc_tests2/standardFilter.py @@ -0,0 +1,743 @@ +# -*- 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 113979 - Paste unformatted text does not ignore empty cells +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +class standardFilter(UITestCase): + def test_standard_filter(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("standardFilter.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C8"})) + + self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") + xDialog = self.xUITest.getTopFocusWindow() + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xconnect2 = xDialog.getChild("connect2") + xfield2 = xDialog.getChild("field2") + xval2 = xDialog.getChild("val2") + + props = {"TEXT": "a"} + actionProps = mkPropertyValues(props) + xfield1.executeAction("SELECT", actionProps) + xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) + propsA = {"TEXT": "OR"} + actionPropsA = mkPropertyValues(propsA) + xconnect2.executeAction("SELECT", actionPropsA) + props2 = {"TEXT": "b"} + actionProps2 = mkPropertyValues(props2) + xfield2.executeAction("SELECT", actionProps2) + xval2.executeAction("TYPE", mkPropertyValues({"TEXT":"3"})) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #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"})) + self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") + xDialog = self.xUITest.getTopFocusWindow() + 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") + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + self.ui_test.close_doc() + + def test_standard_filter_copy_result(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("standardFilter.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C8"})) + + self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") + xDialog = self.xUITest.getTopFocusWindow() + 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") + props = {"TEXT": "a"} + actionProps = mkPropertyValues(props) + xfield1.executeAction("SELECT", actionProps) + xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) + propsA = {"TEXT": "OR"} + actionPropsA = mkPropertyValues(propsA) + xconnect2.executeAction("SELECT", actionPropsA) + props2 = {"TEXT": "b"} + actionProps2 = mkPropertyValues(props2) + xfield2.executeAction("SELECT", actionProps2) + xval2.executeAction("TYPE", mkPropertyValues({"TEXT":"3"})) + xcopyresult.executeAction("CLICK", tuple()) + xedcopyarea.executeAction("TYPE", mkPropertyValues({"TEXT":"F1"})) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #verify + self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "a") + self.assertEqual(get_cell_by_position(document, 0, 6, 0).getString(), "b") + self.assertEqual(get_cell_by_position(document, 0, 7, 0).getString(), "c") + self.assertEqual(get_cell_by_position(document, 0, 5, 1).getValue(), 1) + self.assertEqual(get_cell_by_position(document, 0, 6, 1).getValue(), 2) + self.assertEqual(get_cell_by_position(document, 0, 7, 1).getValue(), 3) + self.assertEqual(get_cell_by_position(document, 0, 5, 2).getValue(), 2) + self.assertEqual(get_cell_by_position(document, 0, 6, 2).getValue(), 3) + self.assertEqual(get_cell_by_position(document, 0, 7, 2).getValue(), 4) + self.ui_test.close_doc() + + def test_standard_filter_copy_result_next_sheet(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("standardFilter.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C8"})) + + self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") + xDialog = self.xUITest.getTopFocusWindow() + 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") + props = {"TEXT": "a"} + actionProps = mkPropertyValues(props) + xfield1.executeAction("SELECT", actionProps) + xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) + propsA = {"TEXT": "OR"} + actionPropsA = mkPropertyValues(propsA) + xconnect2.executeAction("SELECT", actionPropsA) + props2 = {"TEXT": "b"} + actionProps2 = mkPropertyValues(props2) + xfield2.executeAction("SELECT", actionProps2) + xval2.executeAction("TYPE", mkPropertyValues({"TEXT":"3"})) + xcopyresult.executeAction("CLICK", tuple()) + xedcopyarea.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet2.$F$1"})) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #verify + self.assertEqual(get_cell_by_position(document, 1, 5, 0).getString(), "a") + self.assertEqual(get_cell_by_position(document, 1, 6, 0).getString(), "b") + self.assertEqual(get_cell_by_position(document, 1, 7, 0).getString(), "c") + self.assertEqual(get_cell_by_position(document, 1, 5, 1).getValue(), 1) + self.assertEqual(get_cell_by_position(document, 1, 6, 1).getValue(), 2) + self.assertEqual(get_cell_by_position(document, 1, 7, 1).getValue(), 3) + self.assertEqual(get_cell_by_position(document, 1, 5, 2).getValue(), 2) + self.assertEqual(get_cell_by_position(document, 1, 6, 2).getValue(), 3) + self.assertEqual(get_cell_by_position(document, 1, 7, 2).getValue(), 4) + self.ui_test.close_doc() + + def test_standard_filter_case_sensitive(self): + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + enter_text_to_cell(gridwin, "A1", "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"})) + self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") + xDialog = self.xUITest.getTopFocusWindow() + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xcase = xDialog.getChild("case") + + props = {"TEXT": "first"} + actionProps = mkPropertyValues(props) + xfield1.executeAction("SELECT", actionProps) + xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"a1"})) + xcase.executeAction("CLICK", tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #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"})) + self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") + xDialog = self.xUITest.getTopFocusWindow() + 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") + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + self.ui_test.close_doc() + + def test_standard_filter_regular_expression(self): + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + enter_text_to_cell(gridwin, "A1", "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"})) + self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") + xDialog = self.xUITest.getTopFocusWindow() + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xregexp = xDialog.getChild("regexp") + + props = {"TEXT": "first"} + actionProps = mkPropertyValues(props) + xfield1.executeAction("SELECT", actionProps) + xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"a*"})) + xregexp.executeAction("CLICK", tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #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"})) + self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") + xDialog = self.xUITest.getTopFocusWindow() + 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") + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + self.ui_test.close_doc() + + def test_standard_filter_condition_contains(self): + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + enter_text_to_cell(gridwin, "A1", "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"})) + self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") + xDialog = self.xUITest.getTopFocusWindow() + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xregexp = xDialog.getChild("regexp") + + props = {"TEXT": "first"} + actionProps = mkPropertyValues(props) + xfield1.executeAction("SELECT", actionProps) + xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"a*"})) + xregexp.executeAction("CLICK", tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #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"})) + self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") + xDialog = self.xUITest.getTopFocusWindow() + 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") + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + self.ui_test.close_doc() + + #from testcasespecification OOo + def test_standard_filter_condition_contains2(self): + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + enter_text_to_cell(gridwin, "A1", "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 + 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": "A"} + actionProps = mkPropertyValues(props) + xfield1.executeAction("SELECT", actionProps) + props2 = {"TEXT": "Contains"} + actionProps2 = mkPropertyValues(props2) + xcond1.executeAction("SELECT", actionProps2) + xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"cio"})) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #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"})) + 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"], "A") + self.assertEqual(get_state_as_dict(xval1)["Text"], "cio") + self.assertEqual(get_state_as_dict(xcond1)["SelectEntryText"], "Contains") + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + self.ui_test.close_doc() + + def test_standard_filter_condition_does_not_contains(self): + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + enter_text_to_cell(gridwin, "A1", "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 + 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": "A"} + actionProps = mkPropertyValues(props) + xfield1.executeAction("SELECT", actionProps) + props2 = {"TEXT": "Does not contain"} + actionProps2 = mkPropertyValues(props2) + xcond1.executeAction("SELECT", actionProps2) + xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"cio"})) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #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"})) + 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"], "A") + self.assertEqual(get_state_as_dict(xval1)["Text"], "cio") + self.assertEqual(get_state_as_dict(xcond1)["SelectEntryText"], "Does not contain") + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + + self.ui_test.close_doc() + + def test_standard_filter_condition_Begins_with(self): + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + enter_text_to_cell(gridwin, "A1", "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 + 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": "A"} + actionProps = mkPropertyValues(props) + xfield1.executeAction("SELECT", actionProps) + props2 = {"TEXT": "Begins with"} + actionProps2 = mkPropertyValues(props2) + xcond1.executeAction("SELECT", actionProps2) + xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"so"})) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #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"})) + 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"], "A") + self.assertEqual(get_state_as_dict(xval1)["Text"], "so") + self.assertEqual(get_state_as_dict(xcond1)["SelectEntryText"], "Begins with") + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + + self.ui_test.close_doc() + + def test_standard_filter_condition_Does_not_begin_with(self): + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + enter_text_to_cell(gridwin, "A1", "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 + 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": "A"} + actionProps = mkPropertyValues(props) + xfield1.executeAction("SELECT", actionProps) + props2 = {"TEXT": "Does not begin with"} + actionProps2 = mkPropertyValues(props2) + xcond1.executeAction("SELECT", actionProps2) + xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"so"})) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #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"})) + 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"], "A") + self.assertEqual(get_state_as_dict(xval1)["Text"], "so") + self.assertEqual(get_state_as_dict(xcond1)["SelectEntryText"], "Does not begin with") + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + + self.ui_test.close_doc() + + def test_standard_filter_condition_Ends_with(self): + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + enter_text_to_cell(gridwin, "A1", "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 + 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": "A"} + actionProps = mkPropertyValues(props) + xfield1.executeAction("SELECT", actionProps) + props2 = {"TEXT": "Ends with"} + actionProps2 = mkPropertyValues(props2) + xcond1.executeAction("SELECT", actionProps2) + xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"s"})) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #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"})) + 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"], "A") + self.assertEqual(get_state_as_dict(xval1)["Text"], "s") + self.assertEqual(get_state_as_dict(xcond1)["SelectEntryText"], "Ends with") + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + + self.ui_test.close_doc() + + def test_standard_filter_condition_Does_not_end_with(self): + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + enter_text_to_cell(gridwin, "A1", "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 + 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": "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":"s"})) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #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"})) + 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"], "A") + self.assertEqual(get_state_as_dict(xval1)["Text"], "s") + 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: diff --git a/sc/qa/uitest/calc_tests2/subtotals.py b/sc/qa/uitest/calc_tests2/subtotals.py new file mode 100644 index 000000000..31e87d9ac --- /dev/null +++ b/sc/qa/uitest/calc_tests2/subtotals.py @@ -0,0 +1,196 @@ +# -*- 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 libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.framework import UITestCase +from libreoffice.calc.document import get_column +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.document import get_cell_by_position +from uitest.uihelper.common import select_pos +from uitest.uihelper.common import get_state_as_dict +import org.libreoffice.unotest +import pathlib +import time +from uitest.debug import sleep + +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +class Subtotals(UITestCase): + + def test_tdf114720(self): + calc_doc = self.ui_test.create_doc_in_start_center("calc") + XcalcDoc = self.xUITest.getTopFocusWindow() + document = self.ui_test.get_component() + gridwin = XcalcDoc.getChild("grid_window") + + enter_text_to_cell(gridwin, "A1", "1") + enter_text_to_cell(gridwin, "A2", "1") + enter_text_to_cell(gridwin, "A3", "1") + enter_text_to_cell(gridwin, "A4", "1") + enter_text_to_cell(gridwin, "A5", "1") + enter_text_to_cell(gridwin, "A6", "1") + enter_text_to_cell(gridwin, "A7", "1") + enter_text_to_cell(gridwin, "A8", "1") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A9"})) + + self.ui_test.execute_dialog_through_command(".uno:DataSubTotals") + xDialog = self.xUITest.getTopFocusWindow() + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + self.assertEqual(get_cell_by_position(document, 0, 0, 7).getValue(), 1) + self.assertEqual(get_cell_by_position(document, 0, 0, 8).getString(), "") + + # check cancel button + self.ui_test.execute_dialog_through_command(".uno:DataSubTotals") + xDialog = self.xUITest.getTopFocusWindow() + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + + self.ui_test.close_doc() + + def test_tdf88792(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf88792.ods")) + XcalcDoc = self.xUITest.getTopFocusWindow() + document = self.ui_test.get_component() + gridwin = XcalcDoc.getChild("grid_window") + + # go to cell A1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + # Select from the menu bar Data + # Select option subtotal + # Subtotal dialog displays + self.ui_test.execute_dialog_through_command(".uno:DataSubTotals") + xDialog = self.xUITest.getTopFocusWindow() + # Select group by: Category + xGroupBy = xDialog.getChild("group_by") + props = {"TEXT": "Category"} + actionProps = mkPropertyValues(props) + xGroupBy.executeAction("SELECT", actionProps) + # Select calculate subtotals for the months - selected by default + # Select tab options + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "3") + # select option include formats + xformats = xDialog.getChild("formats") + xformats.executeAction("CLICK", tuple()) + # apply with OK + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.assertEqual(get_cell_by_position(document, 0, 3, 5).getValue(), 28000) + self.ui_test.close_doc() + + def test_tdf88735(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf88735.ods")) + XcalcDoc = self.xUITest.getTopFocusWindow() + document = self.ui_test.get_component() + gridwin = XcalcDoc.getChild("grid_window") + # 1 select all cells + self.xUITest.executeCommand(".uno:SelectAll")#use uno command Menu Edit->Select All + # 2 invoke sub-total menu and select none + self.ui_test.execute_dialog_through_command(".uno:DataSubTotals") + xDialog = self.xUITest.getTopFocusWindow() + xGroupBy = xDialog.getChild("group_by") + props = {"TEXT": "- none -"} + actionProps = mkPropertyValues(props) + xGroupBy.executeAction("SELECT", actionProps) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + # 2 invoke sort menu and... crash + self.ui_test.execute_dialog_through_command(".uno:DataSort") + xDialog = self.xUITest.getTopFocusWindow() + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + + self.assertEqual(get_cell_by_position(document, 0, 0, 8).getString(), "z") + self.assertEqual(get_cell_by_position(document, 0, 1, 8).getValue(), 8) + self.ui_test.close_doc() + + def test_tdf56958(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf56958.ods")) + XcalcDoc = self.xUITest.getTopFocusWindow() + document = self.ui_test.get_component() + gridwin = XcalcDoc.getChild("grid_window") + # 1. Open the test file + # 2. Data->Subtotals + self.ui_test.execute_dialog_through_command(".uno:DataSubTotals") + xDialog = self.xUITest.getTopFocusWindow() + # 3. Group by->Trans date + xGroupBy = xDialog.getChild("group_by") + props = {"TEXT": "Trans Date"} + actionProps = mkPropertyValues(props) + xGroupBy.executeAction("SELECT", actionProps) + # 4. Tick 'Calculate subtotals for' -> Amount (grid1) + xCheckListMenu = xDialog.getChild("grid1") + xTreeList = xCheckListMenu.getChild("columns") + xFirstEntry = xTreeList.getChild("2") + xFirstEntry.executeAction("CLICK", tuple()) + # 5. Click OK + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + # 6. Data->Subtotals + self.ui_test.execute_dialog_through_command(".uno:DataSubTotals") + xDialog = self.xUITest.getTopFocusWindow() + # 7. Group by->-none- + xGroupBy = xDialog.getChild("group_by") + props = {"TEXT": "- none -"} + actionProps = mkPropertyValues(props) + xGroupBy.executeAction("SELECT", actionProps) + # 8. Untick 'Calculate subtotals for' -> Amount + xCheckListMenu = xDialog.getChild("grid1") + xTreeList = xCheckListMenu.getChild("columns") + xFirstEntry = xTreeList.getChild("2") + xFirstEntry.executeAction("CLICK", tuple()) + # 9. Click OK + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + # 10. Data->Sort + self.ui_test.execute_dialog_through_command(".uno:DataSort") + xDialog = self.xUITest.getTopFocusWindow() + # 11. Sort key 1->Post Date. + sortkey1 = xDialog.getChild("sortlb") + props = {"TEXT": "Post Date"} + actionProps = mkPropertyValues(props) + sortkey1.executeAction("SELECT", actionProps) + # 12. Sort key 2->-undefined- + sortkey2 = xDialog.getChild("sortuserlb") + props = {"TEXT": "- undefined -"} + actionProps = mkPropertyValues(props) + sortkey2.executeAction("SELECT", actionProps) + # 13. Click OK + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + self.assertEqual(get_cell_by_position(document, 0, 2, 1).getValue(), -0.25) + self.ui_test.close_doc() + + def test_tdf55734(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf55734.ods")) + XcalcDoc = self.xUITest.getTopFocusWindow() + document = self.ui_test.get_component() + gridwin = XcalcDoc.getChild("grid_window") + # 1. Open attached document + # 2. Place cursor in cell outside of subtotals range (e.g. B7) + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B7"})) + # 3. Data → Subtotals + self.ui_test.execute_dialog_through_command(".uno:DataSubTotals") + xDialog = self.xUITest.getTopFocusWindow() + # 4. Group by: "- none -" + xGroupBy = xDialog.getChild("group_by") + props = {"TEXT": "- none -"} + actionProps = mkPropertyValues(props) + xGroupBy.executeAction("SELECT", actionProps) + # 5. Press "OK" and watch LibreOffice crash. + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 1) + self.assertEqual(get_cell_by_position(document, 0, 1, 1).getValue(), 2) + self.ui_test.close_doc() + +# 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..84ab28580 --- /dev/null +++ b/sc/qa/uitest/calc_tests2/tdf104117.py @@ -0,0 +1,54 @@ +# -*- 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 104117 - Crash in Calc when selecting "Uniform Integer" with an max value "100000000000000" in "Random Number Generator +class tdf104117(UITestCase): + def test_tdf104117(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() + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"})) + self.ui_test.execute_modeless_dialog_through_command(".uno:RandomNumberGeneratorDialog") + xDialog = self.xUITest.getTopFocusWindow() + xcellrangeedit = xDialog.getChild("cell-range-edit") + xdistributioncombo = xDialog.getChild("distribution-combo") + xparameter1spin = xDialog.getChild("parameter1-spin") + xparameter2spin = xDialog.getChild("parameter2-spin") + xenableseedcheck = xDialog.getChild("enable-seed-check") + xseedspin = xDialog.getChild("seed-spin") + xenableroundingcheck = xDialog.getChild("enable-rounding-check") + xdecimalplacesspin = xDialog.getChild("decimal-places-spin") + + xcellrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$A$2"})) + props = {"TEXT": "Uniform Integer"} + actionProps = mkPropertyValues(props) + xdistributioncombo.executeAction("SELECT", actionProps) + xparameter2spin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xparameter2spin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xparameter2spin.executeAction("TYPE", mkPropertyValues({"TEXT":"1000000000000000000000000000000000000000000000"})) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #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) + 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_tests2/tdf105268.py b/sc/qa/uitest/calc_tests2/tdf105268.py new file mode 100644 index 000000000..f501e3511 --- /dev/null +++ b/sc/qa/uitest/calc_tests2/tdf105268.py @@ -0,0 +1,35 @@ +# -*- 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 105268 - Auto Fill: The Next Value for "001-001-001" is "001-001-002" Rather than "001-001000" + +class tdf105268(UITestCase): + def test_tdf105268(self): + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + enter_text_to_cell(gridwin, "A1", "001-001-001") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A3"})) + self.ui_test.execute_dialog_through_command(".uno:FillSeries") + xDialog = self.xUITest.getTopFocusWindow() + xautofill = xDialog.getChild("autofill") + xautofill.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(), "001-001-001") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "001-001-002") + self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "001-001-003") + + 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_tests2/tdf114992.py b/sc/qa/uitest/calc_tests2/tdf114992.py new file mode 100644 index 000000000..0e4b30c2a --- /dev/null +++ b/sc/qa/uitest/calc_tests2/tdf114992.py @@ -0,0 +1,32 @@ +# -*- 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 pathlib +#Bug: Delete a sheet in a calc document and LO crashes +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +class tdf114992(UITestCase): + def test_tdf114992_delete_sheet_crash(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf114992.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + self.ui_test.execute_dialog_through_command(".uno:Remove") #delete sheet + xDialog = self.xUITest.getTopFocusWindow() + xOKButton = xDialog.getChild("yes") + xOKButton.executeAction("CLICK", tuple()) + + self.assertEqual(document.Sheets.getCount(), 1) + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(document.Sheets.getCount(), 2) + + 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_tests2/tdf116215.py b/sc/qa/uitest/calc_tests2/tdf116215.py new file mode 100644 index 000000000..958546077 --- /dev/null +++ b/sc/qa/uitest/calc_tests2/tdf116215.py @@ -0,0 +1,42 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +import os +from uitest.uihelper.common import get_state_as_dict +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: Sum button: Calc adds wrong sum formulas if you select more than one row or column + +class tdf116215(UITestCase): + + def test_tdf116215_autosum_wrong_more_rows_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() + enter_text_to_cell(gridwin, "A1", "1") + enter_text_to_cell(gridwin, "A2", "1") + enter_text_to_cell(gridwin, "B1", "1") + enter_text_to_cell(gridwin, "B2", "1") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C3"})) + self.xUITest.executeCommand(".uno:AutoSum") + + self.assertEqual(get_cell_by_position(document, 0, 0, 2).getValue(), 2) + self.assertEqual(get_cell_by_position(document, 0, 0, 2).getFormula(), "=SUM(A1:A2)") + self.assertEqual(get_cell_by_position(document, 0, 1, 2).getValue(), 2) + self.assertEqual(get_cell_by_position(document, 0, 1, 2).getFormula(), "=SUM(B1:B2)") + self.assertEqual(get_cell_by_position(document, 0, 2, 0).getValue(), 2) + self.assertEqual(get_cell_by_position(document, 0, 2, 0).getFormula(), "=SUM(A1:B1)") + self.assertEqual(get_cell_by_position(document, 0, 2, 1).getValue(), 2) + self.assertEqual(get_cell_by_position(document, 0, 2, 1).getFormula(), "=SUM(A2:B2)") + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests2/tdf116421.py b/sc/qa/uitest/calc_tests2/tdf116421.py new file mode 100644 index 000000000..c6d86f164 --- /dev/null +++ b/sc/qa/uitest/calc_tests2/tdf116421.py @@ -0,0 +1,36 @@ +# -*- 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 os +from uitest.uihelper.common import get_state_as_dict +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: autosum is not working + +class tdf116421(UITestCase): + + def test_tdf116421_autosum_not_working(self): + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + enter_text_to_cell(gridwin, "A1", "1") + enter_text_to_cell(gridwin, "A2", "1") + enter_text_to_cell(gridwin, "A3", "1") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A4"})) + self.xUITest.executeCommand(".uno:AutoSum") + + self.assertEqual(get_cell_by_position(document, 0, 0, 3).getValue(), 3) + self.assertEqual(get_cell_by_position(document, 0, 0, 3).getFormula(), "=SUM(A1:A3)") + + 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_tests2/tdf117367.py b/sc/qa/uitest/calc_tests2/tdf117367.py new file mode 100644 index 000000000..36f3e2580 --- /dev/null +++ b/sc/qa/uitest/calc_tests2/tdf117367.py @@ -0,0 +1,55 @@ +# -*- 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 117367 - FORMATTING Merge cells dialog radio buttons cannot be unselected + +class tdf117367(UITestCase): + def test_tdf117367_merge_cells_radio_buttons(self): + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + enter_text_to_cell(gridwin, "A1", "AAA") + enter_text_to_cell(gridwin, "A2", "BBB") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B4"})) + + #Right-click - Merge cells /Select all three options + self.ui_test.execute_dialog_through_command(".uno:MergeCells") + xDialog = self.xUITest.getTopFocusWindow() + 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") + + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests2/tdf118189.py b/sc/qa/uitest/calc_tests2/tdf118189.py new file mode 100644 index 000000000..e49a471fd --- /dev/null +++ b/sc/qa/uitest/calc_tests2/tdf118189.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 uitest.debug import sleep +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +import org.libreoffice.unotest +import pathlib + +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +#Bug 118189 - EDITING Crashes on Undo after Cut conditional formatting data + +class tdf118189(UITestCase): + def test_tdf118189(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() + #1. Open attached document + #2. Copy Column A + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + self.xUITest.executeCommand(".uno:SelectColumn") + self.xUITest.executeCommand(".uno:Copy") + #3. New Spreadsheet + calc_doc2 = self.ui_test.load_file(get_url_for_data_file("emptyFile.ods")) + gridwin2 = xCalcDoc.getChild("grid_window") + document2 = self.ui_test.get_component() + + frames = self.ui_test.get_frames() + frames[1].activate() + #4. Paste it + gridwin2.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + self.xUITest.executeCommand(".uno:Paste") + #5. Cut it + self.xUITest.executeCommand(".uno:Cut") + #6. Undo + self.xUITest.executeCommand(".uno:Undo") + + #-> CRASH + self.assertEqual(get_cell_by_position(document2, 0, 0, 0).getString(), "On Back Order") + + 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_tests2/tdf120174.py b/sc/qa/uitest/calc_tests2/tdf120174.py new file mode 100644 index 000000000..e078147a9 --- /dev/null +++ b/sc/qa/uitest/calc_tests2/tdf120174.py @@ -0,0 +1,35 @@ +# -*- 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 libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.calc import enter_text_to_cell +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() + +class tdf120174(UITestCase): + def test_tdf120174(self): + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + enter_text_to_cell(gridwin, "A1", "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 + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests2/tdf37623.py b/sc/qa/uitest/calc_tests2/tdf37623.py new file mode 100644 index 000000000..cd976269c --- /dev/null +++ b/sc/qa/uitest/calc_tests2/tdf37623.py @@ -0,0 +1,40 @@ +# -*- 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.calc.document import get_cell_by_position +from uitest.path import get_srcdir_url +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() + +class tdf37623(UITestCase): + + def test_tdf37623_autofill_rows_hidden(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf37623.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A2:A6"})) + self.ui_test.execute_dialog_through_command(".uno:FillSeries") + xDialog = self.xUITest.getTopFocusWindow() + xautofill = xDialog.getChild("autofill") + xautofill.executeAction("CLICK", tuple()) + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 1) + self.assertEqual(get_cell_by_position(document, 0, 0, 2).getValue(), 0) + self.assertEqual(get_cell_by_position(document, 0, 0, 3).getValue(), 0) + self.assertEqual(get_cell_by_position(document, 0, 0, 4).getValue(), 2) + self.assertEqual(get_cell_by_position(document, 0, 0, 5).getValue(), 3) + 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_tests2/tdf46138.py b/sc/qa/uitest/calc_tests2/tdf46138.py new file mode 100644 index 000000000..7aadac6e1 --- /dev/null +++ b/sc/qa/uitest/calc_tests2/tdf46138.py @@ -0,0 +1,37 @@ +# -*- 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 46138 - Calc Frozen after "undo" "Filling Series Number in a Column" + +class tdf46138(UITestCase): + def test_tdf46138(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() + #Choose a column, + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + self.xUITest.executeCommand(".uno:SelectColumn") + #select 'edit'>'fill'>'series'>Starting Value '1' then "OK", + self.ui_test.execute_dialog_through_command(".uno:FillSeries") + xDialog = self.xUITest.getTopFocusWindow() + xStart = xDialog.getChild("startValue") + xStart.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + 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(), "") + 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_tests2/tdf51700.py b/sc/qa/uitest/calc_tests2/tdf51700.py new file mode 100644 index 000000000..ed0cb934d --- /dev/null +++ b/sc/qa/uitest/calc_tests2/tdf51700.py @@ -0,0 +1,55 @@ +# -*- 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 51700 - Text to columns puts result into first line if whole column is selected + +class tdf51700(UITestCase): + def test_tdf51700_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, "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") + # Data - Text to Columns + self.ui_test.execute_dialog_through_command(".uno:TextToColumns") + xDialog = self.xUITest.getTopFocusWindow() + xcomma = xDialog.getChild("comma") + if (get_state_as_dict(xcomma)["Selected"]) == "false": + xcomma.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, 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, 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, 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, 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_tests2/tdf53482.py b/sc/qa/uitest/calc_tests2/tdf53482.py new file mode 100644 index 000000000..33ffa71d6 --- /dev/null +++ b/sc/qa/uitest/calc_tests2/tdf53482.py @@ -0,0 +1,96 @@ +# -*- 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 53482 - UI: Option 'Range contains column headings' ignored + +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +class tdf53482(UITestCase): + + def test_tdf53482_Range_contains_column_headings_file(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf53482.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #1. Highlight cells to be sorted A8:J124 + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A8:J124"})) + #2. Click Data menu, Sort + self.ui_test.execute_dialog_through_command(".uno:DataSort") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") + #3. On Options tab, tick 'Range contains column labels' + xHeader = xDialog.getChild("header") + xHeader.executeAction("CLICK", tuple()) + if (get_state_as_dict(xHeader)["Selected"]) == "false": + xHeader.executeAction("CLICK", tuple()) + #4. On Sort Criteria tab, set appropriate criteria + select_pos(xTabs, "0") + xDown = xDialog.getChild("down") + xDown.executeAction("CLICK", tuple()) + xSortKey1 = xDialog.getChild("sortlb") + props = {"TEXT": "Occupation"} + actionProps = mkPropertyValues(props) + xSortKey1.executeAction("SELECT", actionProps) + #5. Click Ok + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + #6. Expected behavior: Ignore column labels when sorting + self.assertEqual(get_cell_by_position(document, 0, 6, 7).getString(), "Occupation") + self.assertEqual(get_cell_by_position(document, 0, 6, 8).getString(), "Travel Industry") + self.assertEqual(get_cell_by_position(document, 0, 6, 123).getString(), "13") + + self.ui_test.close_doc() + + def test_tdf53482_Range_contains_column_headings(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: Misc; s; d; f; g + enter_text_to_cell(gridwin, "A1", "Misc") + enter_text_to_cell(gridwin, "A2", "s") + enter_text_to_cell(gridwin, "A3", "d") + enter_text_to_cell(gridwin, "A4", "f") + enter_text_to_cell(gridwin, "A5", "g") + #1. Highlight cells to be sorted + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A5"})) + #2. Click Data menu, Sort + self.ui_test.execute_dialog_through_command(".uno:DataSort") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") + #3. On Options tab, tick 'Range contains column labels' + xHeader = xDialog.getChild("header") + xHeader.executeAction("CLICK", tuple()) + if (get_state_as_dict(xHeader)["Selected"]) == "false": + xHeader.executeAction("CLICK", tuple()) + #4. On Sort Criteria tab, set appropriate criteria + select_pos(xTabs, "0") + xDown = xDialog.getChild("down") + xDown.executeAction("CLICK", tuple()) + #5. Click Ok + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + #6. Expected behavior: Ignore column labels when sorting + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Misc") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "s") + self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "g") + self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "f") + self.assertEqual(get_cell_by_position(document, 0, 0, 4).getString(), "d") + + 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_tests2/tdf54018.py b/sc/qa/uitest/calc_tests2/tdf54018.py new file mode 100644 index 000000000..b1d31e751 --- /dev/null +++ b/sc/qa/uitest/calc_tests2/tdf54018.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_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +import org.libreoffice.unotest +import pathlib +#Bug 54018 - EDITING: CRASH sorting cells range with Comments +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +class tdf54018(UITestCase): + def test_td54018_sort_with_comments(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf54018.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + #click top left columns / rows heading field to select all cells + self.xUITest.executeCommand(".uno:SelectAll") + #Menu 'Data -> Sort -> Column D -> Descending' <ok> + self.ui_test.execute_dialog_through_command(".uno:DataSort") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + xSortKey1 = xDialog.getChild("sortlb") + xdown = xDialog.getChild("down") + props = {"TEXT": "Column B"} + actionProps = mkPropertyValues(props) + xSortKey1.executeAction("SELECT", actionProps) + xdown.executeAction("CLICK", tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #Bug: When progress bar reaches 40% LibO Stops responding + #Verify + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "7") + self.assertEqual(get_cell_by_position(document, 0, 1, 1).getString(), "6") + self.assertEqual(get_cell_by_position(document, 0, 1, 2).getString(), "5") + self.assertEqual(get_cell_by_position(document, 0, 1, 3).getString(), "4") + self.assertEqual(get_cell_by_position(document, 0, 1, 4).getString(), "3") + self.assertEqual(get_cell_by_position(document, 0, 1, 5).getString(), "2") + self.assertEqual(get_cell_by_position(document, 0, 1, 6).getString(), "1") + + 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_tests3/clearCells.py b/sc/qa/uitest/calc_tests3/clearCells.py new file mode 100644 index 000000000..162ac86e1 --- /dev/null +++ b/sc/qa/uitest/calc_tests3/clearCells.py @@ -0,0 +1,311 @@ +# -*- 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 +#deletecontents.ui +#+ Bug 101904 - Delete Contents dialog -- won't delete cell content "Date & time" +class clearCells(UITestCase): + def test_clear_cells_text(self): + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + enter_text_to_cell(gridwin, "A1", "aa") + enter_text_to_cell(gridwin, "A2", "1") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"})) + self.ui_test.execute_dialog_through_command(".uno:Delete") + xDialog = self.xUITest.getTopFocusWindow() + xdeleteall = xDialog.getChild("deleteall") + xtext = xDialog.getChild("text") + xdatetime = xDialog.getChild("datetime") + xcomments = xDialog.getChild("comments") + xobjects = xDialog.getChild("objects") + xnumbers = xDialog.getChild("numbers") + xformulas = xDialog.getChild("formulas") + xformats = xDialog.getChild("formats") + + if (get_state_as_dict(xdeleteall)["Selected"]) == "true": + xdeleteall.executeAction("CLICK", tuple()) + if (get_state_as_dict(xtext)["Selected"]) == "false": + xtext.executeAction("CLICK", tuple()) + if (get_state_as_dict(xdatetime)["Selected"]) == "true": + xdatetime.executeAction("CLICK", tuple()) + if (get_state_as_dict(xcomments)["Selected"]) == "true": + xcomments.executeAction("CLICK", tuple()) + if (get_state_as_dict(xobjects)["Selected"]) == "true": + xobjects.executeAction("CLICK", tuple()) + if (get_state_as_dict(xnumbers)["Selected"]) == "true": + xnumbers.executeAction("CLICK", tuple()) + if (get_state_as_dict(xformulas)["Selected"]) == "true": + xformulas.executeAction("CLICK", tuple()) + if (get_state_as_dict(xformats)["Selected"]) == "true": + xformats.executeAction("CLICK", tuple()) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #Verify + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString() , "") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue() , 1) + + self.ui_test.close_doc() + + def test_clear_cells_date_tdf101904(self): + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + enter_text_to_cell(gridwin, "A1", "01/01/2000") + enter_text_to_cell(gridwin, "A2", "1") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"})) + self.ui_test.execute_dialog_through_command(".uno:Delete") + xDialog = self.xUITest.getTopFocusWindow() + xdeleteall = xDialog.getChild("deleteall") + xtext = xDialog.getChild("text") + xdatetime = xDialog.getChild("datetime") + xcomments = xDialog.getChild("comments") + xobjects = xDialog.getChild("objects") + xnumbers = xDialog.getChild("numbers") + xformulas = xDialog.getChild("formulas") + xformats = xDialog.getChild("formats") + + if (get_state_as_dict(xdeleteall)["Selected"]) == "true": + xdeleteall.executeAction("CLICK", tuple()) + if (get_state_as_dict(xtext)["Selected"]) == "true": + xtext.executeAction("CLICK", tuple()) + if (get_state_as_dict(xdatetime)["Selected"]) == "false": + xdatetime.executeAction("CLICK", tuple()) + if (get_state_as_dict(xcomments)["Selected"]) == "true": + xcomments.executeAction("CLICK", tuple()) + if (get_state_as_dict(xobjects)["Selected"]) == "true": + xobjects.executeAction("CLICK", tuple()) + if (get_state_as_dict(xnumbers)["Selected"]) == "true": + xnumbers.executeAction("CLICK", tuple()) + if (get_state_as_dict(xformulas)["Selected"]) == "true": + xformulas.executeAction("CLICK", tuple()) + if (get_state_as_dict(xformats)["Selected"]) == "true": + xformats.executeAction("CLICK", tuple()) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #Verify + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString() , "") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue() , 1) + + self.ui_test.close_doc() + + def test_clear_cells_number(self): + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + enter_text_to_cell(gridwin, "A1", "aa") + enter_text_to_cell(gridwin, "A2", "1") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"})) + self.ui_test.execute_dialog_through_command(".uno:Delete") + xDialog = self.xUITest.getTopFocusWindow() + xdeleteall = xDialog.getChild("deleteall") + xtext = xDialog.getChild("text") + xdatetime = xDialog.getChild("datetime") + xcomments = xDialog.getChild("comments") + xobjects = xDialog.getChild("objects") + xnumbers = xDialog.getChild("numbers") + xformulas = xDialog.getChild("formulas") + xformats = xDialog.getChild("formats") + + if (get_state_as_dict(xdeleteall)["Selected"]) == "true": + xdeleteall.executeAction("CLICK", tuple()) + if (get_state_as_dict(xtext)["Selected"]) == "true": + xtext.executeAction("CLICK", tuple()) + if (get_state_as_dict(xdatetime)["Selected"]) == "true": + xdatetime.executeAction("CLICK", tuple()) + if (get_state_as_dict(xcomments)["Selected"]) == "true": + xcomments.executeAction("CLICK", tuple()) + if (get_state_as_dict(xobjects)["Selected"]) == "true": + xobjects.executeAction("CLICK", tuple()) + if (get_state_as_dict(xnumbers)["Selected"]) == "false": + xnumbers.executeAction("CLICK", tuple()) + if (get_state_as_dict(xformulas)["Selected"]) == "true": + xformulas.executeAction("CLICK", tuple()) + if (get_state_as_dict(xformats)["Selected"]) == "true": + xformats.executeAction("CLICK", tuple()) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #Verify + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString() , "aa") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue() , 0) + + self.ui_test.close_doc() + def test_clear_cells_formulas(self): + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + enter_text_to_cell(gridwin, "A1", "1") + enter_text_to_cell(gridwin, "A2", "=A1+1") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"})) + self.ui_test.execute_dialog_through_command(".uno:Delete") + xDialog = self.xUITest.getTopFocusWindow() + xdeleteall = xDialog.getChild("deleteall") + xtext = xDialog.getChild("text") + xdatetime = xDialog.getChild("datetime") + xcomments = xDialog.getChild("comments") + xobjects = xDialog.getChild("objects") + xnumbers = xDialog.getChild("numbers") + xformulas = xDialog.getChild("formulas") + xformats = xDialog.getChild("formats") + + if (get_state_as_dict(xdeleteall)["Selected"]) == "true": + xdeleteall.executeAction("CLICK", tuple()) + if (get_state_as_dict(xtext)["Selected"]) == "true": + xtext.executeAction("CLICK", tuple()) + if (get_state_as_dict(xdatetime)["Selected"]) == "true": + xdatetime.executeAction("CLICK", tuple()) + if (get_state_as_dict(xcomments)["Selected"]) == "true": + xcomments.executeAction("CLICK", tuple()) + if (get_state_as_dict(xobjects)["Selected"]) == "true": + xobjects.executeAction("CLICK", tuple()) + if (get_state_as_dict(xnumbers)["Selected"]) == "true": + xnumbers.executeAction("CLICK", tuple()) + if (get_state_as_dict(xformulas)["Selected"]) == "false": + xformulas.executeAction("CLICK", tuple()) + if (get_state_as_dict(xformats)["Selected"]) == "true": + xformats.executeAction("CLICK", tuple()) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #Verify + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString() , "1") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString() , "") + + self.ui_test.close_doc() + + def test_clear_cells_formats(self): + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + enter_text_to_cell(gridwin, "A1", "aa") + enter_text_to_cell(gridwin, "A2", "1") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"})) + self.xUITest.executeCommand(".uno:Bold") + self.ui_test.execute_dialog_through_command(".uno:Delete") + xDialog = self.xUITest.getTopFocusWindow() + xdeleteall = xDialog.getChild("deleteall") + xtext = xDialog.getChild("text") + xdatetime = xDialog.getChild("datetime") + xcomments = xDialog.getChild("comments") + xobjects = xDialog.getChild("objects") + xnumbers = xDialog.getChild("numbers") + xformulas = xDialog.getChild("formulas") + xformats = xDialog.getChild("formats") + + if (get_state_as_dict(xdeleteall)["Selected"]) == "true": + xdeleteall.executeAction("CLICK", tuple()) + if (get_state_as_dict(xtext)["Selected"]) == "true": + xtext.executeAction("CLICK", tuple()) + if (get_state_as_dict(xdatetime)["Selected"]) == "true": + xdatetime.executeAction("CLICK", tuple()) + if (get_state_as_dict(xcomments)["Selected"]) == "true": + xcomments.executeAction("CLICK", tuple()) + if (get_state_as_dict(xobjects)["Selected"]) == "true": + xobjects.executeAction("CLICK", tuple()) + if (get_state_as_dict(xnumbers)["Selected"]) == "true": + xnumbers.executeAction("CLICK", tuple()) + if (get_state_as_dict(xformulas)["Selected"]) == "true": + xformulas.executeAction("CLICK", tuple()) + if (get_state_as_dict(xformats)["Selected"]) == "false": + xformats.executeAction("CLICK", tuple()) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #Verify + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") #tab Font + + xstylelb = xDialog.getChild("weststylelb-cjk") + print(get_state_as_dict(xstylelb)) + + + self.assertEqual(get_state_as_dict(xstylelb)["Text"], "Regular") + + xOK = xDialog.getChild("ok") + xOK.executeAction("CLICK", tuple()) + + self.ui_test.close_doc() + + def test_clear_cells_all(self): + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + enter_text_to_cell(gridwin, "A1", "aa") + enter_text_to_cell(gridwin, "A2", "1") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"})) + self.xUITest.executeCommand(".uno:Bold") + self.ui_test.execute_dialog_through_command(".uno:Delete") + xDialog = self.xUITest.getTopFocusWindow() + xdeleteall = xDialog.getChild("deleteall") + xtext = xDialog.getChild("text") + xdatetime = xDialog.getChild("datetime") + xcomments = xDialog.getChild("comments") + xobjects = xDialog.getChild("objects") + xnumbers = xDialog.getChild("numbers") + xformulas = xDialog.getChild("formulas") + xformats = xDialog.getChild("formats") + + if (get_state_as_dict(xdeleteall)["Selected"]) == "false": + xdeleteall.executeAction("CLICK", tuple()) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #Verify + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString() , "") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString() , "") + + self.ui_test.close_doc() + + def test_cancel_clear_cells_all(self): + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + enter_text_to_cell(gridwin, "A1", "aa") + enter_text_to_cell(gridwin, "A2", "1") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"})) + self.ui_test.execute_dialog_through_command(".uno:Delete") + xDialog = self.xUITest.getTopFocusWindow() + xdeleteall = xDialog.getChild("deleteall") + + if (get_state_as_dict(xdeleteall)["Selected"]) == "false": + xdeleteall.executeAction("CLICK", tuple()) + + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + #Verify + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString() , "aa") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString() , "1") + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests3/insertQrCodeGen.py b/sc/qa/uitest/calc_tests3/insertQrCodeGen.py new file mode 100644 index 000000000..831fe40ee --- /dev/null +++ b/sc/qa/uitest/calc_tests3/insertQrCodeGen.py @@ -0,0 +1,81 @@ +# -*- 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 libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict, type_text +from com.sun.star.lang import IndexOutOfBoundsException + +class insertQrCode(UITestCase): + + def test_insert_qr_code_gen(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() + + # cancel the dialog without doing anything + self.ui_test.execute_dialog_through_command(".uno:InsertQrCode") + xDialog = self.xUITest.getTopFocusWindow() + + xURL = xDialog.getChild("edit_text") + type_text(xURL, "www.libreoffice.org") + + xCloseBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCloseBtn) + with self.assertRaises(IndexOutOfBoundsException): + document.Sheets.getByIndex(0).DrawPage.getByIndex(0) + + # Reopen the dialog box + self.ui_test.execute_dialog_through_command(".uno:InsertQrCode") + xDialog = self.xUITest.getTopFocusWindow() + + # Get elements in the Dialog Box + xURL = xDialog.getChild("edit_text") + xECC_Low = xDialog.getChild("button_low") #How radio button input is written in text. + xBorder = xDialog.getChild("edit_border") + + type_text(xURL, "www.libreoffice.org") #set the QR code + xECC_Low.executeAction("CLICK", tuple()) + xBorder.executeAction("UP", tuple()) + xBorder.executeAction("DOWN", tuple()) + xOKBtn = xDialog.getChild("ok") + xOKBtn.executeAction("CLICK", tuple()) + + # check the QR code in the document + self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).QRCodeProperties.Payload, "www.libreoffice.org") + self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).QRCodeProperties.ErrorCorrection, 1) + self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).QRCodeProperties.Border, 1) + + self.ui_test.close_doc() + + def test_insert_qr_code_gen2(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.ui_test.execute_dialog_through_command(".uno:InsertQrCode") + xDialog = self.xUITest.getTopFocusWindow() + + xURL = xDialog.getChild("edit_text") + xECC_Low = xDialog.getChild("button_low") + xBorder = xDialog.getChild("edit_border") + + type_text(xURL, "www.libreoffice.org") #set the QR code + xECC_Low.executeAction("CLICK", tuple()) + xBorder.executeAction("UP", tuple()) + xBorder.executeAction("DOWN", tuple()) + xOKBtn = xDialog.getChild("ok") + xOKBtn.executeAction("CLICK", tuple()) + + #check the QR Code in the document + self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).QRCodeProperties.Payload, "www.libreoffice.org") + self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).QRCodeProperties.ErrorCorrection, 1) + self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).QRCodeProperties.Border, 1) + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests3/tdf57274.py b/sc/qa/uitest/calc_tests3/tdf57274.py new file mode 100644 index 000000000..a3c77109c --- /dev/null +++ b/sc/qa/uitest/calc_tests3/tdf57274.py @@ -0,0 +1,51 @@ +# -*- 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.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +#Bug: Paste Special Link Checkbox fails to insert cell references when the source cell is blank +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +class tdf57274(UITestCase): + + def test_tdf57274_tdf116385_row_only(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf57274.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + #* Source Cells, range B6..E6 + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "B6:E6"})) + self.xUITest.executeCommand(".uno:Copy") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B11"})) + self.ui_test.execute_dialog_through_command(".uno:PasteSpecial") + xDialog = self.xUITest.getTopFocusWindow() + #We paste here using Paste Special with 'Link' Checkbox activated + xLink = xDialog.getChild("link") + xLink.executeAction("CLICK", tuple()) + xOkBtn = xDialog.getChild("ok") + # self.ui_test.close_dialog_through_button(xOkBtn) + def handle_confirm_dlg(dialog): + xOKBtn = dialog.getChild("yes") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.ui_test.execute_blocking_action(xOkBtn.executeAction, args=('CLICK', ()), + dialog_handler=handle_confirm_dlg) + #we would expect a reference to cell E6 here and a zero being displayed, but the cell is also simply blank. + self.assertEqual(get_cell_by_position(document, 0, 4, 10).getValue(), 0) + self.assertEqual(get_cell_by_position(document, 0, 4, 10).getFormula(), "=$Sheet1.$E$6") + 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_tests3/tdf62267.py b/sc/qa/uitest/calc_tests3/tdf62267.py new file mode 100644 index 000000000..3d1f0e0c8 --- /dev/null +++ b/sc/qa/uitest/calc_tests3/tdf62267.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 +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 + +#Bug 62267 - Conditional formatting lost after paste special of text, numbers and dates. +#If you have a cell with conditional formatting and you use paste special only inserting only text, +#numbers and dates the formatting is lost. Undo do not recover the conditional formatting. + +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +class tdf62267(UITestCase): + + def test_tdf62267(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf62267.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + #* Copy A1, then paste special to C1; + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + self.xUITest.executeCommand(".uno:Copy") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1"})) + self.ui_test.execute_dialog_through_command(".uno:PasteSpecial") + xDialog = self.xUITest.getTopFocusWindow() + #it's the default - text, numbers and dates + xOkBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) + + #--> Cell formatting should stay as before + self.ui_test.execute_dialog_through_command(".uno:ConditionalFormatManagerDialog") + + xCondFormatMgr = self.xUITest.getTopFocusWindow() + + # check that we have exactly 1 conditional format + 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\tCell value = 1") + + 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_tests3/tdf63805.py b/sc/qa/uitest/calc_tests3/tdf63805.py new file mode 100644 index 000000000..bdc7f8775 --- /dev/null +++ b/sc/qa/uitest/calc_tests3/tdf63805.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 +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 +#Bug 63805 - EDITING: 'Autofill - Date - Months' wrong if day of month exceeds max. days of month + +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +class tdf63805(UITestCase): + + def test_tdf63805_autofill_Date_Months(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf63805.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + #1 - A1: 2012-10-31 + enter_text_to_cell(gridwin, "A1", "2012-10-31") + #2 - Select A1:A20 + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A20"})) + #3 - Edit -> fill -> Series -> Down - Date-Month-Increment=1 <ok> + self.ui_test.execute_dialog_through_command(".uno:FillSeries") + xDialog = self.xUITest.getTopFocusWindow() + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + #5 -Expected: All Cells show last day of month / Actual: some months skipped + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getValue(), 41213) + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 41243) + self.assertEqual(get_cell_by_position(document, 0, 0, 2).getValue(), 41274) + self.assertEqual(get_cell_by_position(document, 0, 0, 3).getValue(), 41305) + self.assertEqual(get_cell_by_position(document, 0, 0, 4).getValue(), 41333) + self.assertEqual(get_cell_by_position(document, 0, 0, 5).getValue(), 41364) + self.assertEqual(get_cell_by_position(document, 0, 0, 6).getValue(), 41394) + self.assertEqual(get_cell_by_position(document, 0, 0, 7).getValue(), 41425) + self.assertEqual(get_cell_by_position(document, 0, 0, 8).getValue(), 41455) + self.assertEqual(get_cell_by_position(document, 0, 0, 9).getValue(), 41486) + self.assertEqual(get_cell_by_position(document, 0, 0, 10).getValue(), 41517) + self.assertEqual(get_cell_by_position(document, 0, 0, 11).getValue(), 41547) + self.assertEqual(get_cell_by_position(document, 0, 0, 12).getValue(), 41578) + self.assertEqual(get_cell_by_position(document, 0, 0, 13).getValue(), 41608) + self.assertEqual(get_cell_by_position(document, 0, 0, 14).getValue(), 41639) + self.assertEqual(get_cell_by_position(document, 0, 0, 15).getValue(), 41670) + self.assertEqual(get_cell_by_position(document, 0, 0, 16).getValue(), 41698) + self.assertEqual(get_cell_by_position(document, 0, 0, 17).getValue(), 41729) + self.assertEqual(get_cell_by_position(document, 0, 0, 18).getValue(), 41759) + self.assertEqual(get_cell_by_position(document, 0, 0, 19).getValue(), 41790) + #4 - undo. + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getValue(), 41213) + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 0) + 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_tests3/tdf64001.py b/sc/qa/uitest/calc_tests3/tdf64001.py new file mode 100644 index 000000000..4c19f32c9 --- /dev/null +++ b/sc/qa/uitest/calc_tests3/tdf64001.py @@ -0,0 +1,40 @@ +# -*- 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.calc import enter_text_to_cell +from uitest.debug import sleep +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + +class tdf64001(UITestCase): + + def test_tdf64001(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) Type TRUE in cell A1 + enter_text_to_cell(gridwin, "A1", "TRUE") + #2) Autofill/drag A1 to A10, all cells show TRUE + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A10"})) + self.ui_test.execute_dialog_through_command(".uno:FillSeries") + xDialog = self.xUITest.getTopFocusWindow() + xautofill = xDialog.getChild("autofill") + xautofill.executeAction("CLICK", tuple()) + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + #3) Type FALSE in A11 + enter_text_to_cell(gridwin, "A11", "FALSE") + #4) Enter in B1: =COUNTIF(A1:A11,TRUE) , hit enter + enter_text_to_cell(gridwin, "B1", "=COUNTIF(A1:A11,TRUE)") + #The formula changes to =COUNTIF(A1:A11,1) and displays result of 1 not 10. + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1"})) + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getValue(), 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_tests3/tdf65856.py b/sc/qa/uitest/calc_tests3/tdf65856.py new file mode 100644 index 000000000..c3e03ec7a --- /dev/null +++ b/sc/qa/uitest/calc_tests3/tdf65856.py @@ -0,0 +1,105 @@ +# -*- 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 +from libreoffice.calc.document import get_cell_by_position + +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +class tdf65856(UITestCase): + + def test_tdf65856_paste_special_shift_right(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf65856.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + #- mark D1:E14; copy + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "D1:E14"})) + self.xUITest.executeCommand(".uno:Copy") + #mark cell D1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D1"})) + self.ui_test.execute_dialog_through_command(".uno:PasteSpecial") + xDialog = self.xUITest.getTopFocusWindow() + + xmove_right = xDialog.getChild("move_right") + xmove_right.executeAction("CLICK", tuple()) + + xOkBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) + + #check + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "T1") + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "TE1") + self.assertEqual(get_cell_by_position(document, 0, 2, 0).getString(), "TES1") + self.assertEqual(get_cell_by_position(document, 0, 3, 0).getString(), "TEST1") + self.assertEqual(get_cell_by_position(document, 0, 4, 0).getString(), "TEST1") + self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "TEST1") + self.assertEqual(get_cell_by_position(document, 0, 6, 0).getString(), "TEST1") + self.assertEqual(get_cell_by_position(document, 0, 0, 13).getString(), "T14") + self.assertEqual(get_cell_by_position(document, 0, 1, 13).getString(), "TE14") + self.assertEqual(get_cell_by_position(document, 0, 2, 13).getString(), "TES14") + self.assertEqual(get_cell_by_position(document, 0, 3, 13).getString(), "TEST14") + self.assertEqual(get_cell_by_position(document, 0, 4, 13).getString(), "TEST14") + self.assertEqual(get_cell_by_position(document, 0, 5, 13).getString(), "TEST14") + self.assertEqual(get_cell_by_position(document, 0, 6, 13).getString(), "TEST14") + self.ui_test.close_doc() + + def test_tdf65856_paste_special_shift_right_2(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf65856_2.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + #- select range C2:D4; copy + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "C2:D4"})) + self.xUITest.executeCommand(".uno:Copy") + #mark cell B2 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B2"})) + self.ui_test.execute_dialog_through_command(".uno:PasteSpecial") + xDialog = self.xUITest.getTopFocusWindow() + + xmove_right = xDialog.getChild("move_right") + xmove_right.executeAction("CLICK", tuple()) + + xOkBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) + + #check + self.assertEqual(get_cell_by_position(document, 0, 1, 1).getString(), "1") + self.assertEqual(get_cell_by_position(document, 0, 2, 1).getString(), "1") + self.assertEqual(get_cell_by_position(document, 0, 3, 1).getString(), "1") + self.assertEqual(get_cell_by_position(document, 0, 4, 1).getString(), "1") + self.assertEqual(get_cell_by_position(document, 0, 5, 1).getString(), "1") + self.assertEqual(get_cell_by_position(document, 0, 1, 2).getString(), "2") + self.assertEqual(get_cell_by_position(document, 0, 2, 2).getString(), "2") + self.assertEqual(get_cell_by_position(document, 0, 3, 2).getString(), "2") + self.assertEqual(get_cell_by_position(document, 0, 4, 2).getString(), "2") + self.assertEqual(get_cell_by_position(document, 0, 5, 2).getString(), "2") + self.assertEqual(get_cell_by_position(document, 0, 1, 3).getString(), "3") + self.assertEqual(get_cell_by_position(document, 0, 2, 3).getString(), "3") + self.assertEqual(get_cell_by_position(document, 0, 3, 3).getString(), "3") + self.assertEqual(get_cell_by_position(document, 0, 4, 3).getString(), "3") + self.assertEqual(get_cell_by_position(document, 0, 5, 3).getString(), "3") + self.assertEqual(get_cell_by_position(document, 0, 4, 1).getFormula(), "=D2") + self.assertEqual(get_cell_by_position(document, 0, 5, 1).getFormula(), "=D2") + self.assertEqual(get_cell_by_position(document, 0, 3, 2).getFormula(), "=E3") + self.assertEqual(get_cell_by_position(document, 0, 5, 2).getFormula(), "=E3") + self.assertEqual(get_cell_by_position(document, 0, 3, 3).getFormula(), "=F4") + self.assertEqual(get_cell_by_position(document, 0, 4, 3).getFormula(), "=F4") + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: + diff --git a/sc/qa/uitest/calc_tests3/tdf68290.py b/sc/qa/uitest/calc_tests3/tdf68290.py new file mode 100644 index 000000000..b186efa88 --- /dev/null +++ b/sc/qa/uitest/calc_tests3/tdf68290.py @@ -0,0 +1,38 @@ +# -*- 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 +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 +#Enhancement: EDITING: cursor moves with Enter key +def get_url_for_data_file(file_name): + return get_srcdir_url() + "/sc/qa/uitest/calc_tests/data/" + file_name + +class tdf68290(UITestCase): + + def test_tdf68290_cursor_moves_with_Enter_key(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf68290.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "2") + self.assertEqual(gridWinState["CurrentColumn"], "12") + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests3/tdf69450.py b/sc/qa/uitest/calc_tests3/tdf69450.py new file mode 100644 index 000000000..ad375fecf --- /dev/null +++ b/sc/qa/uitest/calc_tests3/tdf69450.py @@ -0,0 +1,63 @@ +# -*- 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.calc.document import get_sheet_from_doc +from uitest.debug import sleep +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.document import get_cell_by_position + +class tdf69450(UITestCase): + + def test_tdf69450(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 text to A1 and B1 + enter_text_to_cell(gridwin, "A1", "A") + enter_text_to_cell(gridwin, "B1", "B") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + self.xUITest.executeCommand(".uno:Copy") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B1"})) + 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) + + #check B1 text + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "B") + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A2"})) + self.xUITest.executeCommand(".uno:Bold") + self.xUITest.executeCommand(".uno:Copy") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B1"})) + self.ui_test.execute_dialog_through_command(".uno:PasteSpecial") + xDialog = self.xUITest.getTopFocusWindow() #previous settings should be remembered (only format) + + xOkBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) + + #check B1 text + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "B") + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: + diff --git a/sc/qa/uitest/calc_tests3/tdf69981.py b/sc/qa/uitest/calc_tests3/tdf69981.py new file mode 100644 index 000000000..34a4852b8 --- /dev/null +++ b/sc/qa/uitest/calc_tests3/tdf69981.py @@ -0,0 +1,93 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import select_pos +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.document import get_sheet_from_doc +from libreoffice.calc.conditional_format import get_conditional_format_from_sheet +from uitest.debug import sleep +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +import org.libreoffice.unotest +import pathlib + +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +class tdf69981(UITestCase): + + def test_tdf69981_text_to_columns(self): + + # FIXME flaky test, passed once, but broke multiple times. + return + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf69981.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 A2:A7 + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A2:A7"})) + #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") + xtab.executeAction("CLICK", tuple()) + xcomma.executeAction("CLICK", tuple()) + #Click Ok + #overwrite warning come up + #press 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).getString(), "Original") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "a") + self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "") + self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "") + self.assertEqual(get_cell_by_position(document, 0, 0, 4).getString(), "a") + self.assertEqual(get_cell_by_position(document, 0, 0, 5).getString(), "a") + self.assertEqual(get_cell_by_position(document, 0, 0, 6).getString(), "a") + + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "Copy") + self.assertEqual(get_cell_by_position(document, 0, 1, 1).getString(), "b") + self.assertEqual(get_cell_by_position(document, 0, 1, 2).getString(), "b") + self.assertEqual(get_cell_by_position(document, 0, 1, 3).getString(), "") + self.assertEqual(get_cell_by_position(document, 0, 1, 4).getString(), "") + self.assertEqual(get_cell_by_position(document, 0, 1, 5).getString(), "b") + self.assertEqual(get_cell_by_position(document, 0, 1, 6).getString(), "") + + self.assertEqual(get_cell_by_position(document, 0, 2, 0).getString(), "") + self.assertEqual(get_cell_by_position(document, 0, 2, 1).getString(), "c") + self.assertEqual(get_cell_by_position(document, 0, 2, 2).getString(), "c") + self.assertEqual(get_cell_by_position(document, 0, 2, 3).getString(), "c") + self.assertEqual(get_cell_by_position(document, 0, 2, 4).getString(), "") + self.assertEqual(get_cell_by_position(document, 0, 2, 5).getString(), "") + self.assertEqual(get_cell_by_position(document, 0, 2, 6).getString(), "c") + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests3/tdf71339.py b/sc/qa/uitest/calc_tests3/tdf71339.py new file mode 100644 index 000000000..0935d3168 --- /dev/null +++ b/sc/qa/uitest/calc_tests3/tdf71339.py @@ -0,0 +1,35 @@ +# -*- 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 os +from uitest.uihelper.common import get_state_as_dict +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: EDITING sigma icon (sum function) operating on selected range + +class tdf71339(UITestCase): + + def test_tdf71339_autosum_on_selected_range(self): + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + enter_text_to_cell(gridwin, "A2", "1") + enter_text_to_cell(gridwin, "A3", "1") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A3"})) + self.xUITest.executeCommand(".uno:AutoSum") + + self.assertEqual(get_cell_by_position(document, 0, 0, 3).getValue(), 2) + self.assertEqual(get_cell_by_position(document, 0, 0, 3).getFormula(), "=SUM(A1:A3)") + + 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_tests3/tdf73006.py b/sc/qa/uitest/calc_tests3/tdf73006.py new file mode 100644 index 000000000..8124bb420 --- /dev/null +++ b/sc/qa/uitest/calc_tests3/tdf73006.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 +#Bug 73006 - EDITING: Results filled in wrong cells after Text to Columns + +class tdf73006(UITestCase): + def test_tdf73006_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, "A2", "A B") + #select column A + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + self.xUITest.executeCommand(".uno:SelectColumn") + # 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, 0, 1).getString(), "A") + self.assertEqual(get_cell_by_position(document, 0, 1, 1).getString(), "B") + + 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_tests3/tdf77509.py b/sc/qa/uitest/calc_tests3/tdf77509.py new file mode 100644 index 000000000..216a6f763 --- /dev/null +++ b/sc/qa/uitest/calc_tests3/tdf77509.py @@ -0,0 +1,65 @@ +# -*- 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 +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() + +#consolidatedialog.ui +class tdf77509(UITestCase): + def test_tdf77509_consolidate(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf77509.xls")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #1. Open attachment: Consolidate-test.xls + #2. Select any empty cell, eg. cell D1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D1"})) + #3. Tab: Data > Consolidate + self.ui_test.execute_modeless_dialog_through_command(".uno:DataConsolidate") + xDialog = self.xUITest.getTopFocusWindow() + xfunc = xDialog.getChild("func") + xeddataarea = xDialog.getChild("eddataarea") + xadd = xDialog.getChild("add") + xbyrow = xDialog.getChild("byrow") + xbycol = xDialog.getChild("bycol") + xeddestarea = xDialog.getChild("eddestarea") + + props = {"TEXT": "Sum"} + actionProps = mkPropertyValues(props) + xfunc.executeAction("SELECT", actionProps) + #4. Source data ranges: $Sheet1.$A$1:$B$7 + #5. Click 'Add' so that ranges appear in "Consolidation ranges" + xeddataarea.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$B$7"})) + xadd.executeAction("CLICK", tuple()) + #6. Click 'Options' > check 'Row labels' > click OK + xbyrow.executeAction("CLICK", tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #verify + self.assertEqual(get_cell_by_position(document, 0, 3, 0).getString(), "A 1") + self.assertEqual(get_cell_by_position(document, 0, 3, 1).getString(), "AB 1") + self.assertEqual(get_cell_by_position(document, 0, 3, 2).getString(), "AB 12") + self.assertEqual(get_cell_by_position(document, 0, 3, 3).getString(), "AB 123") + self.assertEqual(get_cell_by_position(document, 0, 3, 4).getString(), "ABC 1") + + self.assertEqual(get_cell_by_position(document, 0, 4, 0).getValue(), 1) + self.assertEqual(get_cell_by_position(document, 0, 4, 1).getValue(), 2) + self.assertEqual(get_cell_by_position(document, 0, 4, 2).getValue(), 2) + self.assertEqual(get_cell_by_position(document, 0, 4, 3).getValue(), 1) + self.assertEqual(get_cell_by_position(document, 0, 4, 4).getValue(), 1) + 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_tests3/tdf79983.py b/sc/qa/uitest/calc_tests3/tdf79983.py new file mode 100644 index 000000000..f4afc77ea --- /dev/null +++ b/sc/qa/uitest/calc_tests3/tdf79983.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 +from uitest.debug import sleep +#Bug 79983 - Calc sort lists aren't case sensitive + +class tdf79983(UITestCase): + def test_tdf79983_sort_list_case_sensitive(self): + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + enter_text_to_cell(gridwin, "A1", "AAA") + enter_text_to_cell(gridwin, "A2", "BBB") + enter_text_to_cell(gridwin, "A3", "CCC") + enter_text_to_cell(gridwin, "A4", "DDD") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"})) + + #Tools / Options / LibreOffice Calc / Sort Lists + 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()) + xCalcSortEntry = xCalcEntry.getChild('5') + xCalcSortEntry.executeAction("SELECT", tuple()) #Sort List + #copy new list from selected cells + xcopy = xDialogOpt.getChild("copy") + xcopy.executeAction("CLICK", tuple()) + xOKBtn = xDialogOpt.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DELETE"})) + + enter_text_to_cell(gridwin, "A1", "AAA") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"})) + #fill down + self.ui_test.execute_dialog_through_command(".uno:FillSeries") + xDialog = self.xUITest.getTopFocusWindow() + xautofill = xDialog.getChild("autofill") + xautofill.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(), "AAA") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "BBB") + self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "CCC") + self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "DDD") + #UNDO + self.xUITest.executeCommand(".uno:Undo") + #verify + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "AAA") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "") + self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "") + self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "") + + 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_tests3/tdf80693.py b/sc/qa/uitest/calc_tests3/tdf80693.py new file mode 100644 index 000000000..f416fce81 --- /dev/null +++ b/sc/qa/uitest/calc_tests3/tdf80693.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_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 80693 - EDITING: fill cell with random numbers with min = max +class tdf80693(UITestCase): + def test_tdf80693_random_numbers_min_max(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() + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"})) + self.ui_test.execute_modeless_dialog_through_command(".uno:RandomNumberGeneratorDialog") + xDialog = self.xUITest.getTopFocusWindow() + xcellrangeedit = xDialog.getChild("cell-range-edit") + xdistributioncombo = xDialog.getChild("distribution-combo") + xparameter1spin = xDialog.getChild("parameter1-spin") + xparameter2spin = xDialog.getChild("parameter2-spin") + xenableseedcheck = xDialog.getChild("enable-seed-check") + xseedspin = xDialog.getChild("seed-spin") + xenableroundingcheck = xDialog.getChild("enable-rounding-check") + xdecimalplacesspin = xDialog.getChild("decimal-places-spin") + + xcellrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$A$2"})) + props = {"TEXT": "Uniform"} + actionProps = mkPropertyValues(props) + xdistributioncombo.executeAction("SELECT", actionProps) + + xparameter1spin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xparameter1spin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xparameter1spin.executeAction("TYPE", mkPropertyValues({"TEXT":"2"})) + xparameter2spin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xparameter2spin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xparameter2spin.executeAction("TYPE", mkPropertyValues({"TEXT":"2"})) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #Verify + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getValue(), 2) + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue() , 2) + #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) + 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_tests3/tdf81351.py b/sc/qa/uitest/calc_tests3/tdf81351.py new file mode 100644 index 000000000..520f1c3c6 --- /dev/null +++ b/sc/qa/uitest/calc_tests3/tdf81351.py @@ -0,0 +1,82 @@ +# -*- 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 libreoffice.uno.propertyvalue import mkPropertyValues + +from uitest.framework import UITestCase +from libreoffice.calc.document import get_column +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 tdf81351(UITestCase): + + def test_tdf81351(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf81351.ods")) + xTopWindow = self.xUITest.getTopFocusWindow() + document = self.ui_test.get_component() + gridwin = xTopWindow.getChild("grid_window") + + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), ".uno:Paste") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:F5"})) + + self.xUITest.executeCommand(".uno:SortAscending") + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B7"})) + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), ".uno:Bold") + + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), ".uno:Paste") + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B7"})) + + def test_tdf81351_comment4(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf81351.ods")) + xTopWindow = self.xUITest.getTopFocusWindow() + document = self.ui_test.get_component() + + gridwin = xTopWindow.getChild("grid_window") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:F5"})) + + + self.xUITest.executeCommand(".uno:SortAscending") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), ".uno:Bold") + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B7"})) + + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), ".uno:Paste") + + self.xUITest.executeCommand(".uno:Redo") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), ".uno:Bold") + + def test_sort_descending(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf81351.ods")) + xTopWindow = self.xUITest.getTopFocusWindow() + document = self.ui_test.get_component() + + gridwin = xTopWindow.getChild("grid_window") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:F5"})) + + self.xUITest.executeCommand(".uno:SortDescending") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), ".uno:Undo") + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B7"})) + + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), ".uno:Paste") + + self.xUITest.executeCommand(".uno:Redo") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), ".uno:Undo") + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests3/tdf82398.py b/sc/qa/uitest/calc_tests3/tdf82398.py new file mode 100644 index 000000000..66e8d5784 --- /dev/null +++ b/sc/qa/uitest/calc_tests3/tdf82398.py @@ -0,0 +1,63 @@ +# -*- 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 82398 - EDITING: "Text to Columns" not applied to selected cells after change 'Format Cells' + +class tdf82398(UITestCase): + def test_tdf82398_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 A1:A4 / .uno:NumberFormatDate + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"})) + self.xUITest.executeCommand(".uno:NumberFormatDate") + # 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/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: diff --git a/sc/qa/uitest/calc_tests6/autoFormat.py b/sc/qa/uitest/calc_tests6/autoFormat.py new file mode 100644 index 000000000..c38165f36 --- /dev/null +++ b/sc/qa/uitest/calc_tests6/autoFormat.py @@ -0,0 +1,78 @@ +# -*- 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 +#uitest sc / AutoFormat Styles + +class autoFormat(UITestCase): + def test_autoformat_styles(self): + writer_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() + #select A1:C5 + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C5"})) + #AutoFormat Styles + self.ui_test.execute_dialog_through_command(".uno:AutoFormat") + xDialog = self.xUITest.getTopFocusWindow() + + formatlb = xDialog.getChild("formatlb") + numformatcb = xDialog.getChild("numformatcb") + bordercb = xDialog.getChild("bordercb") + fontcb = xDialog.getChild("fontcb") + patterncb = xDialog.getChild("patterncb") + alignmentcb = xDialog.getChild("alignmentcb") + autofitcb = xDialog.getChild("autofitcb") + + entry = formatlb.getChild("7") #Financial + entry.executeAction("SELECT", tuple()) + numformatcb.executeAction("CLICK", tuple()) + bordercb.executeAction("CLICK", tuple()) + fontcb.executeAction("CLICK", tuple()) + patterncb.executeAction("CLICK", tuple()) + alignmentcb.executeAction("CLICK", tuple()) + autofitcb.executeAction("CLICK", tuple()) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #verify + self.ui_test.execute_dialog_through_command(".uno:AutoFormat") + xDialog = self.xUITest.getTopFocusWindow() + + formatlb = xDialog.getChild("formatlb") + numformatcb = xDialog.getChild("numformatcb") + bordercb = xDialog.getChild("bordercb") + fontcb = xDialog.getChild("fontcb") + patterncb = xDialog.getChild("patterncb") + alignmentcb = xDialog.getChild("alignmentcb") + autofitcb = xDialog.getChild("autofitcb") + + entry = formatlb.getChild("7") #Financial + entry.executeAction("SELECT", tuple()) + self.assertEqual(get_state_as_dict(numformatcb)["Selected"], "false") + self.assertEqual(get_state_as_dict(bordercb)["Selected"], "false") + self.assertEqual(get_state_as_dict(fontcb)["Selected"], "false") + self.assertEqual(get_state_as_dict(patterncb)["Selected"], "false") + self.assertEqual(get_state_as_dict(alignmentcb)["Selected"], "false") + self.assertEqual(get_state_as_dict(autofitcb)["Selected"], "false") + numformatcb.executeAction("CLICK", tuple()) + bordercb.executeAction("CLICK", tuple()) + fontcb.executeAction("CLICK", tuple()) + patterncb.executeAction("CLICK", tuple()) + alignmentcb.executeAction("CLICK", tuple()) + autofitcb.executeAction("CLICK", tuple()) + 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_tests6/autocorrectOptions.py b/sc/qa/uitest/calc_tests6/autocorrectOptions.py new file mode 100644 index 000000000..146e3300f --- /dev/null +++ b/sc/qa/uitest/calc_tests6/autocorrectOptions.py @@ -0,0 +1,95 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This 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 +import time +from uitest.debug import sleep +from uitest.uihelper.common import select_pos + +class autocorrectOptions(UITestCase): + + def test_autocorrect_options_calc(self): + 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.ui_test.execute_dialog_through_command(".uno:AutoCorrectDlg") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") #tab replace + origtext = xDialog.getChild("origtext") + newtext = xDialog.getChild("newtext") + xnew = xDialog.getChild("new") + xdelete = xDialog.getChild("delete") + xtabview = xDialog.getChild("tabview") + xreset = xDialog.getChild("reset") + nrRows = get_state_as_dict(xtabview)["VisibleCount"] + + #add new rule + origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + origtext.executeAction("TYPE", mkPropertyValues({"TEXT":"::::"})) + newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + newtext.executeAction("TYPE", mkPropertyValues({"TEXT":"dvojtecky"})) + xnew.executeAction("CLICK", tuple()) + nrRowsNew = get_state_as_dict(xtabview)["VisibleCount"] + nrRowsDiff = int(nrRowsNew) - int(nrRows) + self.assertEqual(nrRowsDiff, 1) #we have +1 rule + #delete rule + origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + origtext.executeAction("TYPE", mkPropertyValues({"TEXT":"::::"})) + newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + newtext.executeAction("TYPE", mkPropertyValues({"TEXT":"dvojtecky"})) + xdelete.executeAction("CLICK", tuple()) + self.assertEqual(get_state_as_dict(xtabview)["VisibleCount"], nrRows) #we have default nr of rules + + select_pos(xTabs, "1") #tab Exceptions + #abbreviations + abbrev = xDialog.getChild("abbrev") + newabbrev = xDialog.getChild("newabbrev") + delabbrev = xDialog.getChild("delabbrev") + abbrevlist = xDialog.getChild("abbrevlist") + + nrRowsAbb = get_state_as_dict(abbrevlist)["Children"] + abbrev.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + abbrev.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + abbrev.executeAction("TYPE", mkPropertyValues({"TEXT":"qqqqq"})) + newabbrev.executeAction("CLICK", tuple()) + nrRowsAbbNew = get_state_as_dict(abbrevlist)["Children"] + nrRowsAbbDiff = int(nrRowsAbbNew) - int(nrRowsAbb) + self.assertEqual(nrRowsAbbDiff, 1) #we have +1 rule + delabbrev.executeAction("CLICK", tuple()) + self.assertEqual(get_state_as_dict(abbrevlist)["Children"], nrRowsAbb) #we have default nr of rules + + #words with two initial capitals + double = xDialog.getChild("double") + newdouble = xDialog.getChild("newdouble") + deldouble = xDialog.getChild("deldouble") + doublelist = xDialog.getChild("doublelist") + + nrRowsDouble = get_state_as_dict(doublelist)["Children"] + double.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + double.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + double.executeAction("TYPE", mkPropertyValues({"TEXT":"QQqqq"})) + newdouble.executeAction("CLICK", tuple()) + nrRowsDoubleNew = get_state_as_dict(doublelist)["Children"] + nrRowsDoubleDiff = int(nrRowsDoubleNew) - int(nrRowsDouble) #convert string and + self.assertEqual(nrRowsDoubleDiff, 1) #we have +1 rule + deldouble.executeAction("CLICK", tuple()) + self.assertEqual(get_state_as_dict(doublelist)["Children"], nrRowsDouble) #we have default nr of rules + + xCancelButton = xDialog.getChild("cancel") + xCancelButton.executeAction("CLICK", tuple()) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests6/moveCopySheet.py b/sc/qa/uitest/calc_tests6/moveCopySheet.py new file mode 100644 index 000000000..16370451e --- /dev/null +++ b/sc/qa/uitest/calc_tests6/moveCopySheet.py @@ -0,0 +1,84 @@ +# -*- 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.debug import sleep +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +#uitest sc - move/copy sheet dialog + +class moveCopySheet(UITestCase): + def test_copy_move_sheet(self): + writer_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() + #default - 1 sheet; select the sheet (is selected), dialog move/copy sheet + self.ui_test.execute_dialog_through_command(".uno:Move") + xDialog = self.xUITest.getTopFocusWindow() + #new name = newName + newName = xDialog.getChild("newName") + newName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + newName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + newName.executeAction("TYPE", mkPropertyValues({"TEXT":"newName"})) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #verify, the file has 2 sheets; first one "newName" is selected + self.assertEqual(document.Sheets.getCount(), 2) + # dialog move/copy sheet ; Move is selected; select -move to end position - ; New Name = moveName + self.ui_test.execute_dialog_through_command(".uno:Move") + xDialog = self.xUITest.getTopFocusWindow() + insertBefore = xDialog.getChild("insertBefore") + + xTreeEntry = insertBefore.getChild('2') + xTreeEntry.executeAction("SELECT", tuple()) + + newName = xDialog.getChild("newName") + self.assertEqual(get_state_as_dict(newName)["Text"], "newName") + newName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + newName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + newName.executeAction("TYPE", mkPropertyValues({"TEXT":"moveName"})) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + # Verify, the file has 2 sheets; first one is "Sheet1" ; second one is "moveName" + self.assertEqual(document.Sheets.getCount(), 2) + + self.assertEqual(document.Sheets[0].Name, "Sheet1") + self.assertEqual(document.Sheets[1].Name, "moveName") + + # Verify that the cancel button does not do anything + self.ui_test.execute_dialog_through_command(".uno:Move") + xDialog = self.xUITest.getTopFocusWindow() + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + + self.assertEqual(document.Sheets.getCount(), 2) + self.assertEqual(document.Sheets[0].Name, "Sheet1") + self.assertEqual(document.Sheets[1].Name, "moveName") + + #Check copy option + self.ui_test.execute_dialog_through_command(".uno:Move") + xDialog = self.xUITest.getTopFocusWindow() + xCopy = xDialog.getChild("copy") + xCopy.executeAction("CLICK", tuple()) + sheetName = "moveName_2" + newName = xDialog.getChild("newName") + self.assertEqual(get_state_as_dict(newName)["Text"], sheetName) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.assertEqual(document.Sheets.getCount(), 3) + self.assertEqual(document.Sheets[0].Name, sheetName) + self.assertEqual(document.Sheets[1].Name, "Sheet1") + self.assertEqual(document.Sheets[2].Name, "moveName") + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests6/multipleOperations.py b/sc/qa/uitest/calc_tests6/multipleOperations.py new file mode 100644 index 000000000..34fc4691d --- /dev/null +++ b/sc/qa/uitest/calc_tests6/multipleOperations.py @@ -0,0 +1,129 @@ +# -*- 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 libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict +import time +from libreoffice.calc.document import get_cell_by_position +from uitest.uihelper.calc import enter_text_to_cell +from uitest.debug import sleep +from uitest.uihelper.common import select_pos + +#https://www.linuxtopia.org/online_books/office_guides/openoffice_3_calc_user_guide/openoffice_calc_Multiple_operations_Multiple_operations_in_columns_or_rows.html + +class multipleOperations(UITestCase): + + def test_multiple_operations_one_variable(self): + self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + #enter data + enter_text_to_cell(xGridWindow, "B1", "10") + enter_text_to_cell(xGridWindow, "B2", "2") + enter_text_to_cell(xGridWindow, "B3", "10000") + enter_text_to_cell(xGridWindow, "B4", "2000") + enter_text_to_cell(xGridWindow, "B5", "=B4*(B1-B2)-B3") + + enter_text_to_cell(xGridWindow, "D2", "500") + enter_text_to_cell(xGridWindow, "D3", "1000") + enter_text_to_cell(xGridWindow, "D4", "1500") + enter_text_to_cell(xGridWindow, "D5", "2000") + enter_text_to_cell(xGridWindow, "D6", "2500") + enter_text_to_cell(xGridWindow, "D7", "3000") + enter_text_to_cell(xGridWindow, "D8", "3500") + enter_text_to_cell(xGridWindow, "D9", "4000") + enter_text_to_cell(xGridWindow, "D10", "4500") + enter_text_to_cell(xGridWindow, "D11", "5000") + #Select the range D2:E11 + xGridWindow.executeAction("SELECT", mkPropertyValues({"RANGE": "D2:E11"})) + #Choose Data > Multiple Operations. + self.ui_test.execute_modeless_dialog_through_command(".uno:TableOperationDialog") + xDialog = self.xUITest.getTopFocusWindow() + #Formulas = B5 ; Column input cell = B4 + formulas = xDialog.getChild("formulas") + col = xDialog.getChild("col") + formulas.executeAction("TYPE", mkPropertyValues({"TEXT":"$B$5"})) + col.executeAction("TYPE", mkPropertyValues({"TEXT":"$B$4"})) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #verify + self.assertEqual(get_cell_by_position(document, 0, 4, 1).getValue(), -6000) + self.assertEqual(get_cell_by_position(document, 0, 4, 2).getValue(), -2000) + self.assertEqual(get_cell_by_position(document, 0, 4, 3).getValue(), 2000) + self.assertEqual(get_cell_by_position(document, 0, 4, 4).getValue(), 6000) + self.assertEqual(get_cell_by_position(document, 0, 4, 5).getValue(), 10000) + self.assertEqual(get_cell_by_position(document, 0, 4, 6).getValue(), 14000) + self.assertEqual(get_cell_by_position(document, 0, 4, 7).getValue(), 18000) + self.assertEqual(get_cell_by_position(document, 0, 4, 8).getValue(), 22000) + self.assertEqual(get_cell_by_position(document, 0, 4, 9).getValue(), 26000) + self.assertEqual(get_cell_by_position(document, 0, 4, 10).getValue(), 30000) + + self.ui_test.close_doc() + def test_multiple_operations_several_formulas(self): + self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + #enter data + enter_text_to_cell(xGridWindow, "B1", "10") + enter_text_to_cell(xGridWindow, "B2", "2") + enter_text_to_cell(xGridWindow, "B3", "10000") + enter_text_to_cell(xGridWindow, "B4", "2000") + enter_text_to_cell(xGridWindow, "B5", "=B4*(B1-B2)-B3") + enter_text_to_cell(xGridWindow, "C5", "=B5/B4") + + enter_text_to_cell(xGridWindow, "D2", "500") + enter_text_to_cell(xGridWindow, "D3", "1000") + enter_text_to_cell(xGridWindow, "D4", "1500") + enter_text_to_cell(xGridWindow, "D5", "2000") + enter_text_to_cell(xGridWindow, "D6", "2500") + enter_text_to_cell(xGridWindow, "D7", "3000") + enter_text_to_cell(xGridWindow, "D8", "3500") + enter_text_to_cell(xGridWindow, "D9", "4000") + enter_text_to_cell(xGridWindow, "D10", "4500") + enter_text_to_cell(xGridWindow, "D11", "5000") + #Select the range D2:F11 + xGridWindow.executeAction("SELECT", mkPropertyValues({"RANGE": "D2:F11"})) + #Choose Data > Multiple Operations. + self.ui_test.execute_modeless_dialog_through_command(".uno:TableOperationDialog") + xDialog = self.xUITest.getTopFocusWindow() + #Formulas = B5 ; Column input cell = B4 + formulas = xDialog.getChild("formulas") + col = xDialog.getChild("col") + formulas.executeAction("TYPE", mkPropertyValues({"TEXT":"$B$5:$C$5"})) + col.executeAction("TYPE", mkPropertyValues({"TEXT":"$B$4"})) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #verify + self.assertEqual(get_cell_by_position(document, 0, 4, 1).getValue(), -6000) + self.assertEqual(get_cell_by_position(document, 0, 4, 2).getValue(), -2000) + self.assertEqual(get_cell_by_position(document, 0, 4, 3).getValue(), 2000) + self.assertEqual(get_cell_by_position(document, 0, 4, 4).getValue(), 6000) + self.assertEqual(get_cell_by_position(document, 0, 4, 5).getValue(), 10000) + self.assertEqual(get_cell_by_position(document, 0, 4, 6).getValue(), 14000) + self.assertEqual(get_cell_by_position(document, 0, 4, 7).getValue(), 18000) + self.assertEqual(get_cell_by_position(document, 0, 4, 8).getValue(), 22000) + self.assertEqual(get_cell_by_position(document, 0, 4, 9).getValue(), 26000) + self.assertEqual(get_cell_by_position(document, 0, 4, 10).getValue(), 30000) + + self.assertEqual(get_cell_by_position(document, 0, 5, 1).getValue(), -12) + self.assertEqual(get_cell_by_position(document, 0, 5, 2).getValue(), -2) + self.assertEqual(round(get_cell_by_position(document, 0, 5, 3).getValue(),2), 1.33) + self.assertEqual(get_cell_by_position(document, 0, 5, 4).getValue(), 3) + self.assertEqual(get_cell_by_position(document, 0, 5, 5).getValue(), 4) + self.assertEqual(round(get_cell_by_position(document, 0, 5, 6).getValue(),2), 4.67) + self.assertEqual(round(get_cell_by_position(document, 0, 5, 7).getValue(),2), 5.14) + self.assertEqual(get_cell_by_position(document, 0, 5, 8).getValue(), 5.5) + self.assertEqual(round(get_cell_by_position(document, 0, 5, 9).getValue(),2), 5.78) + self.assertEqual(get_cell_by_position(document, 0, 5, 10).getValue(), 6) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests6/scenarios.py b/sc/qa/uitest/calc_tests6/scenarios.py new file mode 100644 index 000000000..67f7952ae --- /dev/null +++ b/sc/qa/uitest/calc_tests6/scenarios.py @@ -0,0 +1,55 @@ +# -*- 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 libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict +import time +from libreoffice.calc.document import get_cell_by_position +from uitest.uihelper.calc import enter_text_to_cell +from uitest.debug import sleep +from uitest.uihelper.common import select_pos + +# uitest Tools - Scenarios + +class scenarios(UITestCase): + + def test_scenarios(self): + self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + #fill B1:B4 with 1, select B1:B4; + enter_text_to_cell(xGridWindow, "B1", "1") + enter_text_to_cell(xGridWindow, "B2", "1") + enter_text_to_cell(xGridWindow, "B3", "1") + enter_text_to_cell(xGridWindow, "B4", "1") + xGridWindow.executeAction("SELECT", mkPropertyValues({"RANGE": "B1:B4"})) + #scenarios - scenario A1 + self.ui_test.execute_dialog_through_command(".uno:ScenarioManager") + xDialog = self.xUITest.getTopFocusWindow() + + name = xDialog.getChild("name") + name.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + name.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + name.executeAction("TYPE", mkPropertyValues({"TEXT":"A1"})) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #next scenarios - scenario B1 + self.ui_test.execute_dialog_through_command(".uno:ScenarioManager") + xDialog = self.xUITest.getTopFocusWindow() + + name = xDialog.getChild("name") + name.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + name.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + name.executeAction("TYPE", mkPropertyValues({"TEXT":"B1"})) + 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_tests6/shareSpreadsheet.py b/sc/qa/uitest/calc_tests6/shareSpreadsheet.py new file mode 100644 index 000000000..a2f5be555 --- /dev/null +++ b/sc/qa/uitest/calc_tests6/shareSpreadsheet.py @@ -0,0 +1,38 @@ +# -*- 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 libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict +import time +from libreoffice.calc.document import get_cell_by_position +from uitest.uihelper.calc import enter_text_to_cell +from uitest.debug import sleep +from uitest.uihelper.common import select_pos + +#just open dialog, select Share, check name and cancel [save not allowed in uitest] + +class shareSpreadsheet(UITestCase): + + def test_share_spreadsheet(self): + self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + #dialog shareSpreadsheet + self.ui_test.execute_dialog_through_command(".uno:ShareDocument") + xDialog = self.xUITest.getTopFocusWindow() + + share = xDialog.getChild("share") + share.executeAction("CLICK", tuple()) + users = xDialog.getChild("users") + self.assertEqual(get_state_as_dict(users)["Children"], "1") + xCancelBtn = xDialog.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_tests6/tdf107267.py b/sc/qa/uitest/calc_tests6/tdf107267.py new file mode 100644 index 000000000..34a9a4fa0 --- /dev/null +++ b/sc/qa/uitest/calc_tests6/tdf107267.py @@ -0,0 +1,104 @@ +# -*- 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 libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.framework import UITestCase +from libreoffice.calc.document import get_column +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.document import get_cell_by_position +from uitest.uihelper.common import select_pos +from uitest.uihelper.common import get_state_as_dict +import time +from uitest.debug import sleep + +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 107267 - During a sub-total calculation or sum, the data set is not computed well. +class Subtotals(UITestCase): + + + def test_tdf107267(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf107267.ods")) + XcalcDoc = self.xUITest.getTopFocusWindow() + document = self.ui_test.get_component() + gridwin = XcalcDoc.getChild("grid_window") + # 1. Open the test file + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:F123"})) + # 2. Data->Subtotals + self.ui_test.execute_dialog_through_command(".uno:DataSubTotals") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + # = 1st group = 3. Group by "Person Number", select "shipping time" and use the Max function. + xGroupBy = xDialog.getChild("group_by") + props = {"TEXT": "Person Number"} + actionProps = mkPropertyValues(props) + xGroupBy.executeAction("SELECT", actionProps) + # 4. Tick 'Calculate subtotals for' -> "shipping time" - already selected +# xCheckListMenu = xDialog.getChild("grid1") +# xTreeList = xCheckListMenu.getChild("columns") +# x6Entry = xTreeList.getChild("5") +# xFirstEntry.executeAction("CLICK", tuple()) + #use the Max function + xfunctions = xDialog.getChild("functions") + propsF = {"TEXT": "Max"} + actionPropsF = mkPropertyValues(propsF) + xfunctions.executeAction("SELECT", actionPropsF) + + #= 2nd group =5. Group by "Person Number", select "shipping time" and use the Min function. + select_pos(xTabs, "1") + xGroupBy = xDialog.getChild("group_by") + props = {"TEXT": "Person Number"} + actionProps = mkPropertyValues(props) + xGroupBy.executeAction("SELECT", actionProps) + # 4. Tick 'Calculate subtotals for' -> "shipping time" - already selected +# xCheckListMenu = xDialog.getChild("grid1") +# xTreeList = xCheckListMenu.getChild("columns") +# x6Entry = xTreeList.getChild("5") +# xFirstEntry.executeAction("CLICK", tuple()) + #use the Min function + xfunctions = xDialog.getChild("functions") + propsF2 = {"TEXT": "Min"} + actionPropsF2 = mkPropertyValues(propsF2) + xfunctions.executeAction("SELECT", actionPropsF2) + + #= 3rd group = Group by "Person Number", select "shipping time" and use the Average function. + select_pos(xTabs, "2") + xGroupBy = xDialog.getChild("group_by") + props = {"TEXT": "Person Number"} + actionProps = mkPropertyValues(props) + xGroupBy.executeAction("SELECT", actionProps) + # 4. Tick 'Calculate subtotals for' -> "shipping time" - already selected +# xCheckListMenu = xDialog.getChild("grid1") +# xTreeList = xCheckListMenu.getChild("columns") +# x6Entry = xTreeList.getChild("5") +# xFirstEntry.executeAction("CLICK", tuple()) + #use the Average function + xfunctions = xDialog.getChild("functions") + propsF3 = {"TEXT": "Average"} + actionPropsF3 = mkPropertyValues(propsF3) + xfunctions.executeAction("SELECT", actionPropsF3) + + # 5. Click OK + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #verify + self.assertEqual(get_cell_by_position(document, 0, 0, 141).getString(), "Grand Average") + self.assertEqual(get_cell_by_position(document, 0, 0, 142).getString(), "Grand Min") + self.assertEqual(get_cell_by_position(document, 0, 0, 143).getString(), "Grand Max") + + self.assertEqual(round(get_cell_by_position(document, 0, 5, 141).getValue(), 13), 3.3852459016393) + self.assertEqual(get_cell_by_position(document, 0, 5, 142).getValue(), 0) + self.assertEqual(get_cell_by_position(document, 0, 5, 143).getValue(), 26) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests6/tdf107869.py b/sc/qa/uitest/calc_tests6/tdf107869.py new file mode 100644 index 000000000..d38861043 --- /dev/null +++ b/sc/qa/uitest/calc_tests6/tdf107869.py @@ -0,0 +1,93 @@ +# -*- 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 + +#https://bugs.documentfoundation.org/show_bug.cgi?id=107869 +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +class tdf107869(UITestCase): + def test_tdf107869_undo_redo_delete_row_with_comment(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("comments.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #- Delete the row with comment. + #select row 1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + self.xUITest.executeCommand(".uno:SelectRow") + #delete row 1 + self.xUITest.executeCommand(".uno:DeleteRows") + #A1 should be "B" + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "B") + #- Undo-redo deletion a few times. + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "A") + self.xUITest.executeCommand(".uno:Redo") + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "B") + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "A") + self.xUITest.executeCommand(".uno:Redo") + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "B") + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "A") + self.xUITest.executeCommand(".uno:Redo") + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "B") + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "A") + self.xUITest.executeCommand(".uno:Redo") + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "B") + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "A") + self.xUITest.executeCommand(".uno:Redo") + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "B") + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "A") + self.xUITest.executeCommand(".uno:Redo") + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "B") + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "A") + + #select row 1 and 2 + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"})) + self.xUITest.executeCommand(".uno:SelectRow") + #delete row 1 + self.xUITest.executeCommand(".uno:DeleteRows") + #A1 should be "" + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "") + #- Undo-redo deletion a few times. + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "A") + self.xUITest.executeCommand(".uno:Redo") + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "") + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "A") + self.xUITest.executeCommand(".uno:Redo") + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "") + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "A") + self.xUITest.executeCommand(".uno:Redo") + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "") + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "A") + self.xUITest.executeCommand(".uno:Redo") + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "") + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "A") + self.xUITest.executeCommand(".uno:Redo") + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "") + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests6/tdf108654.py b/sc/qa/uitest/calc_tests6/tdf108654.py new file mode 100644 index 000000000..93576fe41 --- /dev/null +++ b/sc/qa/uitest/calc_tests6/tdf108654.py @@ -0,0 +1,48 @@ +# -*- 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 108654 - CRASH while undoing paste on a new sheet +class tdf108654(UITestCase): + def test_tdf108654_Undo_paste_crash(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf108654.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #Sheet3 - CTRL+A & CTRL+C + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + self.xUITest.executeCommand(".uno:SelectAll") + self.xUITest.executeCommand(".uno:Copy") + #Create a new sheet & paste (CTRL-V) + self.ui_test.execute_dialog_through_command(".uno:Insert") #insert sheet + xDialog = self.xUITest.getTopFocusWindow() + xOKButton = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKButton) + + self.assertEqual(document.Sheets.getCount(), 4) + + self.xUITest.executeCommand(".uno:Paste") + #Undo the action twice + self.xUITest.executeCommand(".uno:Undo") + self.xUITest.executeCommand(".uno:Undo") + + #-> CRASH + self.assertEqual(document.Sheets.getCount(), 3) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests6/tdf116996.py b/sc/qa/uitest/calc_tests6/tdf116996.py new file mode 100644 index 000000000..77647d1f5 --- /dev/null +++ b/sc/qa/uitest/calc_tests6/tdf116996.py @@ -0,0 +1,65 @@ +# -*- 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 116996 - Crash recover on selecting Tools -> Options -> Advanced: Enable experimental features + +class tdf116996(UITestCase): + def test_tdf116996_enable_experimental_feature(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.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog + xDialogOpt = self.xUITest.getTopFocusWindow() + + xPages = xDialogOpt.getChild("pages") + xLOEntry = xPages.getChild('0') # Libreoffice + xLOEntry.executeAction("EXPAND", tuple()) + xAdvancedEntry = xLOEntry.getChild('10') + xAdvancedEntry.executeAction("SELECT", tuple()) #Libreoffice / Advanced + xexperimental = xDialogOpt.getChild("experimental") + xexperimental.executeAction("CLICK", tuple()) #enable experimental features + + xOKBtn = xDialogOpt.getChild("ok") + + def handle_confirm_dlg(dialog): + xLaterBtn = dialog.getChild("no") + self.ui_test.close_dialog_through_button(xLaterBtn) + + self.ui_test.execute_blocking_action(xOKBtn.executeAction, args=('CLICK', ()), + dialog_handler=handle_confirm_dlg) + + #reopen options dialog and verify + self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog + xDialogOpt = self.xUITest.getTopFocusWindow() + xPages = xDialogOpt.getChild("pages") + xLOEntry = xPages.getChild('0') # Libreoffice + xLOEntry.executeAction("EXPAND", tuple()) + xAdvancedEntry = xLOEntry.getChild('10') + xAdvancedEntry.executeAction("SELECT", tuple()) #Libreoffice / Advanced + xexperimental = xDialogOpt.getChild("experimental") + + self.assertEqual(get_state_as_dict(xexperimental)["Selected"], "true") + xexperimental.executeAction("CLICK", tuple()) #disable experimental features + xOKBtn = xDialogOpt.getChild("ok") + + def handle_confirm_dlg(dialog): + xLaterBtn = dialog.getChild("no") + self.ui_test.close_dialog_through_button(xLaterBtn) + + self.ui_test.execute_blocking_action(xOKBtn.executeAction, args=('CLICK', ()), + dialog_handler=handle_confirm_dlg) + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests6/tdf118638.py b/sc/qa/uitest/calc_tests6/tdf118638.py new file mode 100644 index 000000000..b6e700e01 --- /dev/null +++ b/sc/qa/uitest/calc_tests6/tdf118638.py @@ -0,0 +1,69 @@ +# -*- 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 libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.framework import UITestCase +from libreoffice.calc.document import get_column +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.document import get_cell_by_position +from uitest.uihelper.common import select_pos +from uitest.uihelper.common import get_state_as_dict +import time +from uitest.debug import sleep + +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 118638 - subtotal option loses doesn't contain existing format for column +class Subtotals(UITestCase): + + + def test_tdf118638_subtotal_format(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf118638.ods")) + XcalcDoc = self.xUITest.getTopFocusWindow() + document = self.ui_test.get_component() + gridwin = XcalcDoc.getChild("grid_window") + # Open the test file + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B15"})) + #Data->Subtotals + self.ui_test.execute_dialog_through_command(".uno:DataSubTotals") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + xGroupBy = xDialog.getChild("group_by") + props = {"TEXT": "Store Name"} + actionProps = mkPropertyValues(props) + xGroupBy.executeAction("SELECT", actionProps) + xCheckListMenu = xDialog.getChild("grid1") + xTreeList = xCheckListMenu.getChild("columns") + xEntry = xTreeList.getChild("1") + xEntry.executeAction("CLICK", tuple()) + + #use the SUM function +# xfunctions = xDialog.getChild("functions") +# propsF = {"TEXT": "Sum"} +# actionPropsF = mkPropertyValues(propsF) +# xfunctions.executeAction("SELECT", actionPropsF) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #verify + self.assertEqual(get_cell_by_position(document, 0, 0, 15).getString(), "5408 Sum") + self.assertEqual(get_cell_by_position(document, 0, 0, 16).getString(), "Grand Sum") + + self.assertEqual(get_cell_by_position(document, 0, 1, 15).getValue(), 238.89) + self.assertEqual(get_cell_by_position(document, 0, 1, 16).getValue(), 238.89) + + self.assertEqual(get_cell_by_position(document, 0, 1, 15).getString(), "$238.89") + self.assertEqual(get_cell_by_position(document, 0, 1, 16).getString(), "$238.89") + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests6/tdf121263.py b/sc/qa/uitest/calc_tests6/tdf121263.py new file mode 100644 index 000000000..cb66c5772 --- /dev/null +++ b/sc/qa/uitest/calc_tests6/tdf121263.py @@ -0,0 +1,51 @@ +# -*- 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 libreoffice.uno.propertyvalue import mkPropertyValues + +from uitest.framework import UITestCase +from libreoffice.calc.document import get_column +from uitest.path import get_srcdir_url +from uitest.uihelper.common import get_state_as_dict +from libreoffice.calc.document import get_cell_by_position +import time +from uitest.debug import sleep + +class tdf121263(UITestCase): + + def test_tdf121263_hide_more_sheets(self): + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xTopWindow = self.xUITest.getTopFocusWindow() + document = self.ui_test.get_component() + gridwin = xTopWindow.getChild("grid_window") + + self.ui_test.execute_dialog_through_command(".uno:Insert") #insert sheet + xDialog = self.xUITest.getTopFocusWindow() + xOKButton = xDialog.getChild("ok") + xOKButton.executeAction("CLICK", tuple()) + self.ui_test.execute_dialog_through_command(".uno:Insert") #insert sheet + xDialog = self.xUITest.getTopFocusWindow() + xOKButton = xDialog.getChild("ok") + xOKButton.executeAction("CLICK", tuple()) + + gridwin.executeAction("SELECT", mkPropertyValues({"TABLE": "2"})) + #select previous sheet + self.xUITest.executeCommand(".uno:JumpToPrevTableSel") + + #hide sheet + self.xUITest.executeCommand(".uno:Hide") + + #show sheet Dialog + self.ui_test.execute_dialog_through_command(".uno:Show") + xDialog = self.xUITest.getTopFocusWindow() + treeview = xDialog.getChild("treeview") + self.assertEqual(get_state_as_dict(treeview)["Children"], "2") + xcancel = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xcancel) + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests6/tdf91726.py b/sc/qa/uitest/calc_tests6/tdf91726.py new file mode 100644 index 000000000..38703cb7e --- /dev/null +++ b/sc/qa/uitest/calc_tests6/tdf91726.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 uitest.debug import sleep +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +#Bug 91726 - AutoFormat: Crash when using an existing name for a new preset + +class tdf91726(UITestCase): + def test_tdf91726_new_style(self): + writer_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() + #select A1:E9 + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:E9"})) + #AutoFormat Styles + self.ui_test.execute_dialog_through_command(".uno:AutoFormat") + xDialog = self.xUITest.getTopFocusWindow() + #add new style "Default" + xadd = xDialog.getChild("add") + def handle_name_dlg(dialog): + nameEntry = dialog.getChild("name_entry") + nameEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"Default"})) + xOKBtn = dialog.getChild("ok") + def handle_error_dlg(dialog2): + #Error message: You have entered an invalid name. + #AutoFormat could not be created. + #Try again using a different name. + xOKBtn2 = dialog2.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn2) + + self.ui_test.execute_blocking_action(xOKBtn.executeAction, args=('CLICK', ()), + dialog_handler=handle_error_dlg) + + xDialog = self.xUITest.getTopFocusWindow() + nameEntry = xDialog.getChild("name_entry") + #back to name dialog, LO should not crash + self.assertEqual(get_state_as_dict(nameEntry)["Text"], "Default") + xCanceltn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCanceltn) + + self.ui_test.execute_blocking_action(xadd.executeAction, args=('CLICK', ()), + dialog_handler=handle_name_dlg) + + xCanceltn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCanceltn) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests7/tdf106667.py b/sc/qa/uitest/calc_tests7/tdf106667.py new file mode 100644 index 000000000..5475c7680 --- /dev/null +++ b/sc/qa/uitest/calc_tests7/tdf106667.py @@ -0,0 +1,37 @@ +# -*- 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.calc import enter_text_to_cell +from libreoffice.uno.propertyvalue import mkPropertyValues +from libreoffice.calc.document import get_cell_by_position +from uitest.debug import sleep + +class tdf106667(UITestCase): + + def test_tdf106667_about_dlg_all(self): + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + enter_text_to_cell(gridwin, "A1", "A") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A1000"})) + + self.xUITest.executeCommand(".uno:FillDown") + + self.xUITest.executeCommand(".uno:SelectAll") + + self.ui_test.execute_dialog_through_command(".uno:About") + xAboutDlg = self.xUITest.getTopFocusWindow() + xCloseBtn = xAboutDlg.getChild("btnClose") + self.ui_test.close_dialog_through_button(xCloseBtn) + + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "A") + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests7/tdf120660.py b/sc/qa/uitest/calc_tests7/tdf120660.py new file mode 100644 index 000000000..d36ad13bc --- /dev/null +++ b/sc/qa/uitest/calc_tests7/tdf120660.py @@ -0,0 +1,66 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import select_pos +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.document import get_sheet_from_doc +from libreoffice.calc.conditional_format import get_conditional_format_from_sheet +from uitest.debug import sleep +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +import org.libreoffice.unotest +import pathlib + +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +#Bug 120660 - cells not recalculated after copy/paste different range of cells + +class tdf120660(UITestCase): + def test_tdf120660_undo_recalculate(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf120660.ods")) + 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 unselected + #turn off message: You are pasting data into cells that already contain data + 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"]) == "true": + xreplwarncb.executeAction("CLICK", tuple()) + xOKBtn = xDialogOpt.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A8:E8"})) + self.xUITest.executeCommand(".uno:Copy") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A4:E4"})) + self.xUITest.executeCommand(".uno:Paste") + self.assertEqual(get_cell_by_position(document, 0, 4, 3).getValue(), 1200) + + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 4, 3).getValue(), 2200) + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A8:D8"})) + self.xUITest.executeCommand(".uno:Copy") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A4:D4"})) + self.xUITest.executeCommand(".uno:Paste") + self.assertEqual(get_cell_by_position(document, 0, 4, 3).getValue(), 1200) + + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 4, 3).getValue(), 2200) + + 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_tests7/tdf122509.py b/sc/qa/uitest/calc_tests7/tdf122509.py new file mode 100644 index 000000000..87b28cb69 --- /dev/null +++ b/sc/qa/uitest/calc_tests7/tdf122509.py @@ -0,0 +1,61 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import select_pos +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.document import get_sheet_from_doc +from libreoffice.calc.conditional_format import get_conditional_format_from_sheet +from uitest.debug import sleep +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +import org.libreoffice.unotest +import pathlib + +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +#Bug 122509 - EDITING Calc crashes when manipulating Negative numbers in red on Currency ( not gtk3 ) + +class tdf122509(UITestCase): + def test_tdf122509_format_cell_negative_numbers(self): + #numberingformatpage.ui + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf122509.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #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(xformatted)["Text"], "#,##0.00 [$USD];[RED]-#,##0.00 [$USD]") + #click negative + xnegnumred.executeAction("CLICK", tuple()) + #format check; https://bugs.documentfoundation.org/show_bug.cgi?id=122509#c7 + self.assertEqual(get_state_as_dict(xformatted)["Text"], "#,##0.00 [$USD];-#,##0.00 [$USD]") + # click negative + xnegnumred.executeAction("CLICK", tuple()) + #OK + xOk = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOk) + #verify; no crashes + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getValue(), 2) + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests7/tdf123052.py b/sc/qa/uitest/calc_tests7/tdf123052.py new file mode 100644 index 000000000..f3e7f8796 --- /dev/null +++ b/sc/qa/uitest/calc_tests7/tdf123052.py @@ -0,0 +1,72 @@ +# -*- 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 123052 - [regression] Shift+Tab not working +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +class tdf123052(UITestCase): + def test_tdf123052_shit_tab(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf123052.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #Holding the Shift key and repeated pressing the Tab key does not correctly cycle though the unprotected cells + #I'm at 7, hold TAB for cycling + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"})) + # Assert that the correct cell has been selected + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "2") + self.assertEqual(gridWinState["CurrentColumn"], "5") + + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"})) + # Assert that the correct cell has been selected + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "4") + self.assertEqual(gridWinState["CurrentColumn"], "3") + + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"})) + # Assert that the correct cell has been selected + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "4") + self.assertEqual(gridWinState["CurrentColumn"], "4") + + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"})) + # Assert that the correct cell has been selected + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "5") + self.assertEqual(gridWinState["CurrentColumn"], "5") + + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"})) + # Assert that the correct cell has been selected + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "7") + self.assertEqual(gridWinState["CurrentColumn"], "0") + + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"})) + # Assert that the correct cell has been selected + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "8") + self.assertEqual(gridWinState["CurrentColumn"], "4") + #now shift + tab + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "SHIFT+TAB"})) + # Assert that the correct cell has been selected + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "7") + self.assertEqual(gridWinState["CurrentColumn"], "0") + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests7/tdf123122.py b/sc/qa/uitest/calc_tests7/tdf123122.py new file mode 100644 index 000000000..f489f3c2f --- /dev/null +++ b/sc/qa/uitest/calc_tests7/tdf123122.py @@ -0,0 +1,72 @@ +# -*- 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 123122 - Invoking the number format dialog the format code field is blank for a user-defined date+time format. + +class tdf123122(UITestCase): + def test_tdf123122_format_cell_datetime(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() + #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") + + #Format cells and enter NN MMM DD YYYY HH:MM as format code + xformatted.executeAction("CLEAR", tuple()) #clear textbox + xformatted.executeAction("TYPE", mkPropertyValues({"TEXT":"NN MMM DD YYYY HH:MM"})) + #save - OK + xOk = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOk) + + #verify + 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"], "Date") + self.assertEqual(get_state_as_dict(xformatted)["Text"], "NN MMM DD YYYY HH:MM") + xOk = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOk) + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests7/tdf123479.py b/sc/qa/uitest/calc_tests7/tdf123479.py new file mode 100644 index 000000000..046bf8303 --- /dev/null +++ b/sc/qa/uitest/calc_tests7/tdf123479.py @@ -0,0 +1,51 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import select_pos +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.document import get_sheet_from_doc +from libreoffice.calc.conditional_format import get_conditional_format_from_sheet +from uitest.debug import sleep +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +import org.libreoffice.unotest +import pathlib + +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +#Bug 123479 - Crash in: ScFormulaResult::GetMatrixFormulaCellToken() + +class tdf123479(UITestCase): + def test_tdf123479_Crash_ScFormulaResult_GetMatrixFormulaCellToken(self): + #numberingformatpage.ui + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf123479.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #Select D14:D16 + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "D14:D16"})) + #Open Formula Wizard (Ctrl+F2) + self.ui_test.execute_modeless_dialog_through_command(".uno:FunctionDialog") + xDialog = self.xUITest.getTopFocusWindow() + edArg1 = xDialog.getChild("ED_ARG1") + edArg2 = xDialog.getChild("ED_ARG2") + formulaRes = xDialog.getChild("formula_result") + + #check formula wizard data + self.assertEqual(get_state_as_dict(edArg1)["Text"], "CHAR(10)") + self.assertEqual(get_state_as_dict(edArg2)["Text"], "OFFSET($Data.$A$2:$Data.$A$4,0,COLUMN()-3)") + self.assertEqual(get_state_as_dict(formulaRes)["Text"], "{4;4;4}") + + xOk = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOk) + #verify; no crashes + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "Pass/Fail") + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests7/tdf124818.py b/sc/qa/uitest/calc_tests7/tdf124818.py new file mode 100644 index 000000000..134548426 --- /dev/null +++ b/sc/qa/uitest/calc_tests7/tdf124818.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 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.uihelper.common import get_state_as_dict, type_text +from uitest.debug import sleep +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 124818 - CRASH: selecting all and switching spreadsheet + +class tdf124818(UITestCase): + def test_tdf124818_crash_select_all_and_switch_spreadsheet(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf124818.xls")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + #Select all ( Ctrl + A );Go to sheet Graph2;Select all;Crash + self.xUITest.executeCommand(".uno:SelectAll") + self.xUITest.executeCommand(".uno:JumpToPrevTable") + self.xUITest.executeCommand(".uno:SelectAll") + + #verify; no crashes + self.assertEqual(document.Sheets.getCount(), 3) + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests7/tdf124822.py b/sc/qa/uitest/calc_tests7/tdf124822.py new file mode 100644 index 000000000..8c438df79 --- /dev/null +++ b/sc/qa/uitest/calc_tests7/tdf124822.py @@ -0,0 +1,37 @@ +# -*- 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.uihelper.common import get_state_as_dict, type_text +from uitest.debug import sleep +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 124822 - CRASH: cutting and undoing + +class tdf124822(UITestCase): + def test_tdf124822_crash_cut_undo(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf124822.xls")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + #Select all ( Ctrl + A ) ; Cut ( Ctrl + X );Undo + self.xUITest.executeCommand(".uno:selectAll") + self.xUITest.executeCommand(".uno:Cut") + self.xUITest.executeCommand(".uno:Undo") + #verify; no crashes + self.assertEqual(get_cell_by_position(document, 2, 0, 0).getString(), "X") + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests7/tdf124896.py b/sc/qa/uitest/calc_tests7/tdf124896.py new file mode 100644 index 000000000..b2f016847 --- /dev/null +++ b/sc/qa/uitest/calc_tests7/tdf124896.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 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.uihelper.common import get_state_as_dict, type_text +from uitest.debug import sleep +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 124896 - CRASH: deleting sheet + +class tdf124896(UITestCase): + def test_tdf124896_crash_delete_sheet(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf124896.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + # Remove X Bar R Chart (2) sheet + self.ui_test.execute_dialog_through_command(".uno:Remove") #delete sheet + xDialog = self.xUITest.getTopFocusWindow() + xOKButton = xDialog.getChild("yes") + xOKButton.executeAction("CLICK", tuple()) + #verify; no crashes + self.assertEqual(document.Sheets.getCount(), 2) + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests7/tdf125030.py b/sc/qa/uitest/calc_tests7/tdf125030.py new file mode 100644 index 000000000..5aaa81abc --- /dev/null +++ b/sc/qa/uitest/calc_tests7/tdf125030.py @@ -0,0 +1,36 @@ +# -*- 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 os +from uitest.uihelper.common import get_state_as_dict +from uitest.debug import sleep +from libreoffice.uno.propertyvalue import mkPropertyValues +from libreoffice.calc.document import get_cell_by_position +from uitest.uihelper.calc import enter_text_to_cell + +#Bug 125030 - nice crash by repeating apply style (Ctrl+Shft+Y) + +class tdf125030(UITestCase): + def test_tdf125030_repeat_crash(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", "aaaa") + enter_text_to_cell(gridwin, "B1", "bbbb") + #select A1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + self.xUITest.executeCommand(".uno:StyleApply?Style:string=Heading%201&FamilyName:string=CellStyles") + #focus on A2 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A2"})) + #repeat (Ctrl+Shft+Y) + self.xUITest.executeCommand(".uno:Repeat") + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "aaaa") + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests7/tdf132173.py b/sc/qa/uitest/calc_tests7/tdf132173.py new file mode 100644 index 000000000..d74f7dc74 --- /dev/null +++ b/sc/qa/uitest/calc_tests7/tdf132173.py @@ -0,0 +1,33 @@ +# -*- 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.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + +class tdf132173(UITestCase): + def test_tdf132173(self): + self.ui_test.create_doc_in_start_center("calc") + + self.ui_test.execute_modeless_dialog_through_command(".uno:FunctionDialog") + xDialog = self.xUITest.getTopFocusWindow() + xFormula = xDialog.getChild("ed_formula") + xFormula.executeAction("TYPE", mkPropertyValues({"TEXT": 'FIND({"A";"B";"C"},"SAMPLE TEXT")'})) + + self.assertEqual(get_state_as_dict(xFormula)["Text"], '=FIND({"A";"B";"C"},"SAMPLE TEXT")') + + xOk = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOk) + + document = self.ui_test.get_component() + + #Without the fix in place, cell's value would have been #NAME? + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "2") + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests7/tdf31805.py b/sc/qa/uitest/calc_tests7/tdf31805.py new file mode 100644 index 000000000..76d30cf22 --- /dev/null +++ b/sc/qa/uitest/calc_tests7/tdf31805.py @@ -0,0 +1,47 @@ +# -*- 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 31805 - Deleting a column or row from merged cells +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +class tdf31805(UITestCase): + def test_tdf31805_delete_column_merged(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf31805.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #1. open "sample.ods" + #2. click 'G1' + #3. Menu 'edit -> Delete Cell - Delete entire Column' + #expected: Column with cell containing "g" will be deleted, + # a merged cell range will remain left row 1 + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "G1"})) + self.assertEqual(get_cell_by_position(document, 0, 2, 4).getIsMerged(), True) + self.xUITest.executeCommand(".uno:DeleteColumns") + #verify. C5:F11 should be merged + #isMerged returns true if this cell is merged with another cell. + self.assertEqual(get_cell_by_position(document, 0, 2, 4).getIsMerged(), True) #C5 + self.assertEqual(get_cell_by_position(document, 0, 6, 4).getIsMerged(), False) #G5 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A11"})) + self.xUITest.executeCommand(".uno:DeleteRows") + self.assertEqual(get_cell_by_position(document, 0, 2, 4).getIsMerged(), True) #C5 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D1"})) + self.xUITest.executeCommand(".uno:DeleteColumns") + self.assertEqual(get_cell_by_position(document, 0, 2, 4).getIsMerged(), True) #C5 + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests7/tdf45020.py b/sc/qa/uitest/calc_tests7/tdf45020.py new file mode 100644 index 000000000..270446941 --- /dev/null +++ b/sc/qa/uitest/calc_tests7/tdf45020.py @@ -0,0 +1,38 @@ +# -*- 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 + +class tdf45020(UITestCase): + def test_tdf45020_hide_rows_select(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 cell A1-A4: apple pear melon mango + enter_text_to_cell(gridwin, "A1", "apple") + enter_text_to_cell(gridwin, "A1", "pear") + enter_text_to_cell(gridwin, "A1", "melon") + enter_text_to_cell(gridwin, "A1", "mango") + #select A2 and A3 + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A2:A3"})) + #format > Row > Hide + self.ui_test._xUITest.executeCommand(".uno:HideRow") + #select A1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #press Shift+down + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"SHIFT+DOWN"})) + #verify A1:A4 selected + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["MarkedArea"], "Sheet1.A1:Sheet1.A4") + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests7/tdf91425.py b/sc/qa/uitest/calc_tests7/tdf91425.py new file mode 100644 index 000000000..cacd96726 --- /dev/null +++ b/sc/qa/uitest/calc_tests7/tdf91425.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 libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict, type_text +from libreoffice.calc.document import get_cell_by_position +import time +from uitest.debug import sleep +import org.libreoffice.unotest +import pathlib + + +#Bug 91425 - CRASH - Calc Insert Columns Left + +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +class tdf91425(UITestCase): + def test_tdf91425_insert_columns_left(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf91425.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #1) Open test file provided in report + #2) Move mouse pointer over Column A header, the right mouse button click + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #3) Insert columns left + self.xUITest.executeCommand(".uno:InsertColumnsBefore") + #verify + self.assertEqual(get_cell_by_position(document, 0, 3, 0).getString(), "C") + #undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 2, 0).getString(), "C") + #redo + self.xUITest.executeCommand(".uno:Redo") + self.assertEqual(get_cell_by_position(document, 0, 3, 0).getString(), "C") + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests8/navigator.py b/sc/qa/uitest/calc_tests8/navigator.py new file mode 100644 index 000000000..4026ca665 --- /dev/null +++ b/sc/qa/uitest/calc_tests8/navigator.py @@ -0,0 +1,117 @@ +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict +from uitest.path import get_srcdir_url + +def get_url_for_data_file(file_name): + return get_srcdir_url() + "/sc/qa/uitest/calc_tests/data/" + file_name + +class navigator(UITestCase): + + def test_rename_sheet(self): + self.ui_test.load_file(get_url_for_data_file("navigator.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWin = xCalcDoc.getChild("grid_window") + + self.xUITest.executeCommand(".uno:Sidebar") + xGridWin.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "ScNavigatorPanel"})) + + xCalcDoc = self.xUITest.getTopFocusWindow() + xNavigatorPanel = xCalcDoc.getChild("NavigatorPanelParent") + xContentBox = xNavigatorPanel.getChild('contentbox') + xSheets = xContentBox.getChild("0") + self.assertEqual(get_state_as_dict(xSheets)['Text'], 'Sheets') + self.assertEqual(len(xSheets.getChildren()), 2) + self.assertEqual(get_state_as_dict(xSheets.getChild('0'))['Text'], 'Sheet1') + self.assertEqual(get_state_as_dict(xSheets.getChild('1'))['Text'], 'S2') + xRangeNames = xContentBox.getChild("1") + self.assertEqual(get_state_as_dict(xRangeNames)['Text'], 'Range names') + self.assertEqual(len(xRangeNames.getChildren()), 2) + self.assertEqual(get_state_as_dict(xRangeNames.getChild('0'))['Text'], 'first (Sheet1)') + self.assertEqual(get_state_as_dict(xRangeNames.getChild('1'))['Text'], 'second (Sheet1)') + + #The document has one comment too + xComments = xContentBox.getChild("6") + self.assertEqual(get_state_as_dict(xComments)['Text'], 'Comments') + self.assertEqual(len(xComments.getChildren()), 1) + self.assertEqual(get_state_as_dict(xComments.getChild('0'))['Text'], 'Test Comment') + + self.ui_test.execute_dialog_through_command(".uno:RenameTable") + xDialog = self.xUITest.getTopFocusWindow() + xname_entry = xDialog.getChild("name_entry") + xname_entry.executeAction("TYPE", mkPropertyValues({"TEXT": "S1"})) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + xCalcDoc = self.xUITest.getTopFocusWindow() + xNavigatorPanel = xCalcDoc.getChild("NavigatorPanelParent") + xContentBox = xNavigatorPanel.getChild('contentbox') + xSheets = xContentBox.getChild("0") + self.assertEqual(get_state_as_dict(xSheets)['Text'], 'Sheets') + self.assertEqual(len(xSheets.getChildren()), 2) + self.assertEqual(get_state_as_dict(xSheets.getChild('0'))['Text'], 'S1') + self.assertEqual(get_state_as_dict(xSheets.getChild('1'))['Text'], 'S2') + xRangeNames = xContentBox.getChild("1") + self.assertEqual(get_state_as_dict(xRangeNames)['Text'], 'Range names') + self.assertEqual(len(xRangeNames.getChildren()), 2) + self.assertEqual(get_state_as_dict(xRangeNames.getChild('0'))['Text'], 'first (S1)') + self.assertEqual(get_state_as_dict(xRangeNames.getChild('1'))['Text'], 'second (S1)') + + self.xUITest.executeCommand(".uno:Undo") + + xCalcDoc = self.xUITest.getTopFocusWindow() + xNavigatorPanel = xCalcDoc.getChild("NavigatorPanelParent") + xContentBox = xNavigatorPanel.getChild('contentbox') + xSheets = xContentBox.getChild("0") + self.assertEqual(get_state_as_dict(xSheets)['Text'], 'Sheets') + self.assertEqual(len(xSheets.getChildren()), 2) + self.assertEqual(get_state_as_dict(xSheets.getChild('0'))['Text'], 'Sheet1') + self.assertEqual(get_state_as_dict(xSheets.getChild('1'))['Text'], 'S2') + xRangeNames = xContentBox.getChild("1") + self.assertEqual(get_state_as_dict(xRangeNames)['Text'], 'Range names') + self.assertEqual(len(xRangeNames.getChildren()), 2) + #FIXME: tdf#133082 + #self.assertEqual(get_state_as_dict(xRangeNames.getChild('0'))['Text'], 'first (Sheet1)') + #self.assertEqual(get_state_as_dict(xRangeNames.getChild('1'))['Text'], 'second (Sheet1)') + + self.xUITest.executeCommand(".uno:Sidebar") + self.ui_test.close_doc() + + def test_tdf98493(self): + + self.ui_test.load_file(get_url_for_data_file("tdf98493.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWin = xCalcDoc.getChild("grid_window") + + self.assertEqual(get_state_as_dict(xGridWin)["SelectedTable"], "2") + + self.xUITest.executeCommand(".uno:Sidebar") + xGridWin.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "ScNavigatorPanel"})) + + xCalcDoc = self.xUITest.getTopFocusWindow() + xNavigatorPanel = xCalcDoc.getChild("NavigatorPanelParent") + xNavigatorPanel.executeAction("ROOT", tuple()) + xContentBox = xNavigatorPanel.getChild('contentbox') + + # tdf#133079, without the fix in place, it would be 8 + self.assertEqual(len(xContentBox.getChildren()), 1) + + xSheets = xContentBox.getChild('0') + self.assertEqual(len(xSheets.getChildren()), 12) + + #key=item position, value=sheet ( there are hidden sheets ) + results = { '1': '0', '5': '4', '6': '4', '11': '10'} + + for k, v in results.items(): + xChild = xSheets.getChild(k) + xChild.executeAction("DOUBLECLICK", tuple()) + + self.assertEqual(get_state_as_dict(xGridWin)["SelectedTable"], v) + + self.xUITest.executeCommand(".uno:Sidebar") + self.ui_test.close_doc() diff --git a/sc/qa/uitest/calc_tests8/tdf119343.py b/sc/qa/uitest/calc_tests8/tdf119343.py new file mode 100644 index 000000000..82c0e11b4 --- /dev/null +++ b/sc/qa/uitest/calc_tests8/tdf119343.py @@ -0,0 +1,42 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import select_pos +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.document import get_sheet_from_doc +from libreoffice.calc.conditional_format import get_conditional_format_from_sheet +from uitest.debug import sleep +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +import org.libreoffice.unotest +import pathlib +from uitest.path import get_srcdir_url +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +#Bug 119343 - EDITING: copied and pasted cells containing formulas are not recalculated (2) + +class tdf119343(UITestCase): + def test_tdf119343_copy_paste_formula(self): + #numberingformatpage.ui + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf119343.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "M295"})) + self.xUITest.executeCommand(".uno:Copy") + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + self.xUITest.executeCommand(".uno:Paste") + #verify + self.assertEqual(get_cell_by_position(document, 0, 12, 295).getString(), "Q11005355") + self.assertEqual(get_cell_by_position(document, 0, 12, 294).getString(), "Q1099565") + self.assertEqual(get_cell_by_position(document, 0, 12, 293).getString(), "Q108420") + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests8/tdf124829.py b/sc/qa/uitest/calc_tests8/tdf124829.py new file mode 100644 index 000000000..97a43f641 --- /dev/null +++ b/sc/qa/uitest/calc_tests8/tdf124829.py @@ -0,0 +1,41 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import select_pos +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.document import get_sheet_from_doc +from libreoffice.calc.conditional_format import get_conditional_format_from_sheet +from uitest.debug import sleep +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +import org.libreoffice.unotest +import pathlib + +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +#Bug 124829 - CRASH: cutting and undoing a sheet with external links + +class tdf124829(UITestCase): + def test_tdf124829_Crash_cutting_undo_sheet_external_links(self): + #numberingformatpage.ui + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf124829.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + self.xUITest.executeCommand(".uno:SelectAll") + self.xUITest.executeCommand(".uno:Cut") + for i in range(40): + self.xUITest.executeCommand(".uno:Undo") + + #verify; no crashes + self.assertEqual(document.Sheets.getCount(), 6) + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests8/tdf125051.py b/sc/qa/uitest/calc_tests8/tdf125051.py new file mode 100644 index 000000000..d993aacdf --- /dev/null +++ b/sc/qa/uitest/calc_tests8/tdf125051.py @@ -0,0 +1,50 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import select_pos +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + +#Bug 125051 - EDITING: CRASH when start SpellCheck + +class tdf125051(UITestCase): + def test_tdf125051_crash_spelling_dialog(self): + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + enter_text_to_cell(gridwin, "A1", "text") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + self.ui_test.execute_dialog_through_command(".uno:SpellDialog") + xDialog = self.xUITest.getTopFocusWindow() #Spelling dialog + + xDialog2 = self.xUITest.getTopFocusWindow() # info dialog "The spellcheck of this sheet has been completed.-> OK" + okBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(okBtn) + + xDialog = self.xUITest.getTopFocusWindow() #Spelling dialog + #open options + optionsBtn = xDialog.getChild("options") + def handle_options_dlg(dialog): + #print(dialog.getChildren()) + xCancelBtn = dialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + + self.ui_test.execute_blocking_action(optionsBtn.executeAction, args=('CLICK', ()), + dialog_handler=handle_options_dlg) + + closeBtn = xDialog.getChild("close") #close Spelling dialog + self.ui_test.close_dialog_through_button(closeBtn) + + #verify, we didn't crash + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "text") + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests9/tdf121949.py b/sc/qa/uitest/calc_tests9/tdf121949.py new file mode 100644 index 000000000..92dd66866 --- /dev/null +++ b/sc/qa/uitest/calc_tests9/tdf121949.py @@ -0,0 +1,30 @@ +# -*- 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 libreoffice.uno.propertyvalue import mkPropertyValues + +class tdf121949 (UITestCase): + + def test_tdf121949_copy_block_with_single_cell_not_included(self): + self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + # mark a range with a single cell left our and copy to clipboard + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A3"})) + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "B1:B1", "EXTEND":"1"})) + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "B3:B3", "EXTEND":"1"})) + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "C1:C3", "EXTEND":"1"})) + self.ui_test.execute_dialog_through_command(".uno:Copy") + xDialog = self.xUITest.getTopFocusWindow() + 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_tests9/tdf126673.py b/sc/qa/uitest/calc_tests9/tdf126673.py new file mode 100644 index 000000000..8eb99a123 --- /dev/null +++ b/sc/qa/uitest/calc_tests9/tdf126673.py @@ -0,0 +1,66 @@ +# -*- 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 126673 - Calc: Auto-fit column and auto-fit row don't work with line break + +class tdf126673(UITestCase): + def test_tdf126673_auto_fit_row_height(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf126673.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + #set cm Tools-options-StarOffice Calc-General + 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 /cm + xunitlb = xDialogOpt.getChild("unitlb") + props = {"TEXT": "Centimeter"} + actionProps = mkPropertyValues(props) + xunitlb.executeAction("SELECT", actionProps) + xOKBtn = xDialogOpt.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #select A2 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A2"})) + #optimal row height + self.ui_test.execute_dialog_through_command(".uno:SetOptimalRowHeight") + xDialog = self.xUITest.getTopFocusWindow() + # Click Ok + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + #select A2 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A2"})) + #row height + self.ui_test.execute_dialog_through_command(".uno:RowHeight") + xDialog = self.xUITest.getTopFocusWindow() + xvalue = xDialog.getChild("value") + heightStrOrig = get_state_as_dict(xvalue)["Text"] + heightVal = heightStrOrig[:4] #default 0.45 cm, + self.assertEqual(heightVal > '0.45', True) #new value is bigger then default + # Click Ok + xcancel = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xcancel) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests9/tdf130371.py b/sc/qa/uitest/calc_tests9/tdf130371.py new file mode 100644 index 000000000..6a8f00cbf --- /dev/null +++ b/sc/qa/uitest/calc_tests9/tdf130371.py @@ -0,0 +1,72 @@ +# -*- 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 libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict +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() + +class namedRanges(UITestCase): + + def test_tdf130371(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf130371.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + text1 = "value\t$Sheet2.$B$2\tSheet2" + text2 = "value\t$Sheet3.$B$2\tSheet3" + text3 = "value\t$Sheet4.$B$2\tSheet4" + + self.ui_test.execute_dialog_through_command(".uno:DefineName") + xDialog = self.xUITest.getTopFocusWindow() + namesList = xDialog.getChild('names') + self.assertEqual(2, len(namesList.getChildren())) + self.assertEqual(get_state_as_dict(namesList.getChild('0'))["Text"], text1) + self.assertEqual(get_state_as_dict(namesList.getChild('1'))["Text"], text2) + + xOkBtn = xDialog.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B3"})) + self.xUITest.executeCommand(".uno:Copy") + + self.xUITest.executeCommand(".uno:JumpToNextTable") + self.xUITest.executeCommand(".uno:JumpToNextTable") + + self.xUITest.executeCommand(".uno:Paste") + + self.ui_test.execute_dialog_through_command(".uno:DefineName") + xDialog = self.xUITest.getTopFocusWindow() + namesList = xDialog.getChild('names') + self.assertEqual(3, len(namesList.getChildren())) + self.assertEqual(get_state_as_dict(namesList.getChild('0'))["Text"], text1) + self.assertEqual(get_state_as_dict(namesList.getChild('1'))["Text"], text2) + self.assertEqual(get_state_as_dict(namesList.getChild('2'))["Text"], text3) + + xOkBtn = xDialog.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) + + self.xUITest.executeCommand(".uno:Undo") + + self.ui_test.execute_dialog_through_command(".uno:DefineName") + xDialog = self.xUITest.getTopFocusWindow() + namesList = xDialog.getChild('names') + self.assertEqual(2, len(namesList.getChildren())) + self.assertEqual(get_state_as_dict(namesList.getChild('0'))["Text"], text1) + self.assertEqual(get_state_as_dict(namesList.getChild('1'))["Text"], text2) + + xCancelBtn = xDialog.getChild("cancel") + xCancelBtn.executeAction("CLICK", tuple()) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests9/tdf91217.py b/sc/qa/uitest/calc_tests9/tdf91217.py new file mode 100644 index 000000000..54f56a9fd --- /dev/null +++ b/sc/qa/uitest/calc_tests9/tdf91217.py @@ -0,0 +1,45 @@ +# -*- 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 91217 - Crash when deleting rows + +class tdf91217(UITestCase): + def test_tdf91217_crash_deleting_rows(self): + # FIXME disable this will it's clear what existing problem did this test uncover. + return + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf91217.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #Select rows 76-1125 in sheet 3 (Daily), right click, Delete Rows. Instant crash. + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A76:A1125"})) + self.xUITest.executeCommand(".uno:SelectRow") + #delete rows + self.xUITest.executeCommand(".uno:DeleteRows") + #A1 should be "Dist" + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Dist") + #- Undo-redo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Dist") + + self.xUITest.executeCommand(".uno:Redo") + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Dist") + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/chart/chartArea.py b/sc/qa/uitest/chart/chartArea.py new file mode 100644 index 000000000..f04084f33 --- /dev/null +++ b/sc/qa/uitest/chart/chartArea.py @@ -0,0 +1,161 @@ +# -*- 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.uihelper.common import get_state_as_dict, type_text +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() + +#Chart Area dialog + +class chartArea(UITestCase): + def test_chart_area_dialog(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("chartArea.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog, set centimeters + xDialog = self.xUITest.getTopFocusWindow() + + xPages = xDialog.getChild("pages") + xCalcEntry = xPages.getChild('3') # calc + xCalcEntry.executeAction("EXPAND", tuple()) + xCalcGeneralEntry = xCalcEntry.getChild('0') + xCalcGeneralEntry.executeAction("SELECT", tuple()) #General + xMetric = xDialog.getChild("unitlb") + props = {"TEXT": "Centimeter"} + actionProps = mkPropertyValues(props) + xMetric.executeAction("SELECT", actionProps) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramArea"})) + xDialog = self.xUITest.getTopFocusWindow() + #Click on tab "Borders". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + + xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") + transparency = xDialog.getChild("MTR_LINE_TRANSPARENT") + + xWidth.executeAction("UP", tuple()) + transparency.executeAction("UP", tuple()) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #reopen and verify tab "Borders". + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramArea"})) + xDialog = self.xUITest.getTopFocusWindow() + + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") + transparency = xDialog.getChild("MTR_LINE_TRANSPARENT") + + self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm") + self.assertEqual(get_state_as_dict(transparency)["Text"], "5%") + + #Click on tab "Area" + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "1") + + btncolor = xDialog.getChild("btncolor") + btncolor.executeAction("CLICK", tuple()) + + rCustom = xDialog.getChild("R_custom") + gCustom = xDialog.getChild("G_custom") + bCustom = xDialog.getChild("B_custom") + + rCustom.executeAction("CLEAR", tuple()) + rCustom.executeAction("TYPE", mkPropertyValues({"TEXT":"35"})) + rCustom.executeAction("UP", tuple()) + rCustom.executeAction("DOWN", tuple()) #without this save data doesn't works + self.assertEqual(get_state_as_dict(rCustom)["Text"], "35") + gCustom.executeAction("CLEAR", tuple()) + gCustom.executeAction("TYPE", mkPropertyValues({"TEXT":"169"})) + gCustom.executeAction("UP", tuple()) + gCustom.executeAction("DOWN", tuple()) #without this save data doesn't works + bCustom.executeAction("CLEAR", tuple()) + bCustom.executeAction("TYPE", mkPropertyValues({"TEXT":"211"})) + bCustom.executeAction("UP", tuple()) + bCustom.executeAction("DOWN", tuple()) #without this save data doesn't works + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #reopen and verify tab "Area". + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramArea"})) + xDialog = self.xUITest.getTopFocusWindow() + + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "1") + + rCustom = xDialog.getChild("R_custom") + gCustom = xDialog.getChild("G_custom") + bCustom = xDialog.getChild("B_custom") + + self.assertEqual(get_state_as_dict(rCustom)["Text"], "35") + self.assertEqual(get_state_as_dict(gCustom)["Text"], "169") + self.assertEqual(get_state_as_dict(bCustom)["Text"], "211") + + #change tab "Transparency" + select_pos(tabcontrol, "2") + transparency = xDialog.getChild("RBT_TRANS_LINEAR") + transparencyPercent = xDialog.getChild("MTR_TRANSPARENT") #51% + + transparency.executeAction("CLICK", tuple()) + transparencyPercent.executeAction("UP", tuple()) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #reopen and verify tab "Transparency" + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramArea"})) + xDialog = self.xUITest.getTopFocusWindow() + + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "2") + + transparency = xDialog.getChild("RBT_TRANS_LINEAR") + transparencyPercent = xDialog.getChild("MTR_TRANSPARENT") #51% + + self.assertEqual(get_state_as_dict(transparency)["Checked"], "true") + self.assertEqual(get_state_as_dict(transparencyPercent)["Text"], "51%") + + 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/chart/chartAxes.py b/sc/qa/uitest/chart/chartAxes.py new file mode 100644 index 000000000..883ec8306 --- /dev/null +++ b/sc/qa/uitest/chart/chartAxes.py @@ -0,0 +1,74 @@ +# -*- 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.uihelper.common import get_state_as_dict, type_text +from uitest.debug import sleep +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() + +#Chart Enable Axes dialog + +class chartAxes(UITestCase): + def test_chart_enable_grids_dialog(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf98390.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuAxes"})) + xDialog = self.xUITest.getTopFocusWindow() + + primaryX = xDialog.getChild("primaryX") + primaryY = xDialog.getChild("primaryY") + secondaryX = xDialog.getChild("secondaryX") + secondaryY = xDialog.getChild("secondaryY") + + primaryX.executeAction("CLICK", tuple()) + primaryY.executeAction("CLICK", tuple()) + secondaryX.executeAction("CLICK", tuple()) + secondaryY.executeAction("CLICK", tuple()) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #reopen and verify Grids dialog + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuAxes"})) + xDialog = self.xUITest.getTopFocusWindow() + + primaryX = xDialog.getChild("primaryX") + primaryY = xDialog.getChild("primaryY") + secondaryX = xDialog.getChild("secondaryX") + secondaryY = xDialog.getChild("secondaryY") + + self.assertEqual(get_state_as_dict(primaryX)["Selected"], "false") + self.assertEqual(get_state_as_dict(primaryY)["Selected"], "false") + self.assertEqual(get_state_as_dict(secondaryX)["Selected"], "true") + self.assertEqual(get_state_as_dict(secondaryY)["Selected"], "true") + + 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/chart/chartDataLabels.py b/sc/qa/uitest/chart/chartDataLabels.py new file mode 100644 index 000000000..378670fae --- /dev/null +++ b/sc/qa/uitest/chart/chartDataLabels.py @@ -0,0 +1,323 @@ +# -*- 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.uihelper.common import get_state_as_dict, type_text +from uitest.debug import sleep +import org.libreoffice.unotest +import pathlib + +from com.sun.star.lang import Locale + +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +#Chart Display Data Labels dialog + +class chartDataLabels(UITestCase): + def test_chart_data_labels_dialog(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf98390.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + + xDataSeries = document.Sheets[0].Charts[0].getEmbeddedObject().getFirstDiagram().CoordinateSystems[0].ChartTypes[0].DataSeries + self.assertFalse(xDataSeries[0].Label.ShowNumber) + self.assertFalse(xDataSeries[0].Label.ShowCategoryName) + self.assertFalse(xDataSeries[0].Label.ShowLegendSymbol) + self.assertEqual(xDataSeries[0].LabelSeparator, " ") + + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuDataLabels"})) + xDialog = self.xUITest.getTopFocusWindow() + + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") + + self.assertTrue(xDataSeries[0].Label.ShowNumber) + self.assertFalse(xDataSeries[0].Label.ShowCategoryName) + self.assertFalse(xDataSeries[0].Label.ShowLegendSymbol) + self.assertEqual(xDataSeries[0].LabelSeparator, " ") + + valueAsNumber = xDialog.getChild("CB_VALUE_AS_NUMBER") + category = xDialog.getChild("CB_CATEGORY") + legend = xDialog.getChild("CB_SYMBOL") + wrapText = xDialog.getChild("CB_WRAP_TEXT") + separator = xDialog.getChild("LB_TEXT_SEPARATOR") + placement = xDialog.getChild("LB_LABEL_PLACEMENT") + degrees = xDialog.getChild("NF_LABEL_DEGREES") + textDirection = xDialog.getChild("LB_LABEL_TEXTDIR") + + #valueAsNumber.executeAction("CLICK", tuple()) + category.executeAction("CLICK", tuple()) + legend.executeAction("CLICK", tuple()) + wrapText.executeAction("CLICK", tuple()) + props = {"TEXT": "Comma"} + actionProps = mkPropertyValues(props) + separator.executeAction("SELECT", actionProps) + + props2 = {"TEXT": "Below"} + actionProps2 = mkPropertyValues(props2) + placement.executeAction("SELECT", actionProps2) + degrees.executeAction("UP", tuple()) + props3 = {"TEXT": "Right-to-left"} + actionProps3 = mkPropertyValues(props3) + textDirection.executeAction("SELECT", actionProps3) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.assertTrue(xDataSeries[0].Label.ShowNumber) + self.assertTrue(xDataSeries[0].Label.ShowCategoryName) + self.assertTrue(xDataSeries[0].Label.ShowLegendSymbol) + self.assertEqual(xDataSeries[0].LabelSeparator, ", ") + + #reopen and verify InsertMenuDataLabels dialog + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuDataLabels"})) + xDialog = self.xUITest.getTopFocusWindow() + + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") + + self.assertTrue(xDataSeries[0].Label.ShowNumber) + self.assertTrue(xDataSeries[0].Label.ShowCategoryName) + self.assertTrue(xDataSeries[0].Label.ShowLegendSymbol) + self.assertEqual(xDataSeries[0].LabelSeparator, ", ") + + valueAsNumber = xDialog.getChild("CB_VALUE_AS_NUMBER") + category = xDialog.getChild("CB_CATEGORY") + legend = xDialog.getChild("CB_SYMBOL") + wrapText = xDialog.getChild("CB_WRAP_TEXT") + separator = xDialog.getChild("LB_TEXT_SEPARATOR") + placement = xDialog.getChild("LB_LABEL_PLACEMENT") + degrees = xDialog.getChild("NF_LABEL_DEGREES") + textDirection = xDialog.getChild("LB_LABEL_TEXTDIR") + + self.assertEqual(get_state_as_dict(valueAsNumber)["Selected"], "true") + self.assertEqual(get_state_as_dict(category)["Selected"], "true") + self.assertEqual(get_state_as_dict(legend)["Selected"], "true") + self.assertEqual(get_state_as_dict(wrapText)["Selected"], "true") + self.assertEqual(get_state_as_dict(separator)["SelectEntryText"], "Comma") + self.assertEqual(get_state_as_dict(placement)["SelectEntryText"], "Below") + self.assertEqual(get_state_as_dict(degrees)["Text"], "1°") + self.assertEqual(get_state_as_dict(textDirection)["SelectEntryText"], "Right-to-left") + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.assertTrue(xDataSeries[0].Label.ShowNumber) + self.assertTrue(xDataSeries[0].Label.ShowCategoryName) + self.assertTrue(xDataSeries[0].Label.ShowLegendSymbol) + self.assertEqual(xDataSeries[0].LabelSeparator, ", ") + + self.ui_test.close_doc() + + def test_chart_data_labels_percentage_dialog(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("dataLabels.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + + xDataSeries = document.Sheets[0].Charts[0].getEmbeddedObject().getFirstDiagram().CoordinateSystems[0].ChartTypes[0].DataSeries + self.assertTrue(xDataSeries[0].Label.ShowNumber) + self.assertFalse(xDataSeries[0].Label.ShowNumberInPercent) + self.assertIsNone(xDataSeries[0].PercentageNumberFormat) + + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatDataLabels"})) + xDialog = self.xUITest.getTopFocusWindow() + + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") + + self.assertTrue(xDataSeries[0].Label.ShowNumber) + self.assertFalse(xDataSeries[0].Label.ShowNumberInPercent) + self.assertIsNone(xDataSeries[0].PercentageNumberFormat) + + valueAsNumber = xDialog.getChild("CB_VALUE_AS_NUMBER") + valueAsPercentage = xDialog.getChild("CB_VALUE_AS_PERCENTAGE") + category = xDialog.getChild("CB_CATEGORY") + legend = xDialog.getChild("CB_SYMBOL") + wrapText = xDialog.getChild("CB_WRAP_TEXT") + separator = xDialog.getChild("LB_TEXT_SEPARATOR") + placement = xDialog.getChild("LB_LABEL_PLACEMENT") + degrees = xDialog.getChild("NF_LABEL_DEGREES") + textDirection = xDialog.getChild("LB_LABEL_TEXTDIR") + buttonPercentage = xDialog.getChild("PB_PERCENT_NUMBERFORMAT") + + valueAsNumber.executeAction("CLICK", tuple()) + valueAsPercentage.executeAction("CLICK", tuple()) + #button Percentage format + + def handle_perc_dlg(dialog): + sourceformat = dialog.getChild("sourceformat") + decimalsed = dialog.getChild("decimalsed") + leadzerosed = dialog.getChild("leadzerosed") + negnumred = dialog.getChild("negnumred") + thousands = dialog.getChild("thousands") + formatted = dialog.getChild("formatted") + + sourceformat.executeAction("CLICK", tuple()) + decimalsed.executeAction("UP", tuple()) + leadzerosed.executeAction("UP", tuple()) + negnumred.executeAction("CLICK", tuple()) + thousands.executeAction("CLICK", tuple()) + self.assertEqual(get_state_as_dict(formatted)["Text"], "#,#00.0%;[RED]-#,#00.0%") + + xOKButton = dialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKButton) + + self.ui_test.execute_blocking_action(buttonPercentage.executeAction, args=('CLICK', ()), + dialog_handler=handle_perc_dlg) + + self.assertEqual(get_state_as_dict(valueAsNumber)["Selected"], "false") + self.assertEqual(get_state_as_dict(valueAsPercentage)["Selected"], "true") + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + xNumberFormats = document.Sheets[0].Charts[0].getEmbeddedObject().getNumberFormats() + xLocale = Locale('en', 'US', '') + xFormat = xNumberFormats.queryKey("#,#00.0%;[RED]-#,#00.0%", xLocale, True) + + self.assertFalse(xDataSeries[0].Label.ShowNumber) + self.assertTrue(xDataSeries[0].Label.ShowNumberInPercent) + self.assertEqual(xDataSeries[0].PercentageNumberFormat, xFormat) + + #reopen and verify Percentage dialog + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatDataLabels"})) + xDialog = self.xUITest.getTopFocusWindow() + + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") + + self.assertFalse(xDataSeries[0].Label.ShowNumber) + self.assertTrue(xDataSeries[0].Label.ShowNumberInPercent) + self.assertEqual(xDataSeries[0].PercentageNumberFormat, xFormat) + + valueAsNumber = xDialog.getChild("CB_VALUE_AS_NUMBER") + valueAsPercentage = xDialog.getChild("CB_VALUE_AS_PERCENTAGE") + category = xDialog.getChild("CB_CATEGORY") + legend = xDialog.getChild("CB_SYMBOL") + wrapText = xDialog.getChild("CB_WRAP_TEXT") + separator = xDialog.getChild("LB_TEXT_SEPARATOR") + placement = xDialog.getChild("LB_LABEL_PLACEMENT") + degrees = xDialog.getChild("NF_LABEL_DEGREES") + textDirection = xDialog.getChild("LB_LABEL_TEXTDIR") + buttonPercentage = xDialog.getChild("PB_PERCENT_NUMBERFORMAT") + + self.assertEqual(get_state_as_dict(valueAsNumber)["Selected"], "false") + self.assertEqual(get_state_as_dict(valueAsPercentage)["Selected"], "true") + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.assertFalse(xDataSeries[0].Label.ShowNumber) + self.assertTrue(xDataSeries[0].Label.ShowNumberInPercent) + self.assertEqual(xDataSeries[0].PercentageNumberFormat, xFormat) + + self.ui_test.close_doc() + + def test_tdf131291(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf131291.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + + xDataSeries = document.Sheets[0].Charts[0].getEmbeddedObject().getFirstDiagram().CoordinateSystems[0].ChartTypes[0].DataSeries + self.assertTrue(xDataSeries[0].Label.ShowNumber) + self.assertFalse(xDataSeries[0].Label.ShowNumberInPercent) + + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatDataLabels"})) + xDialog = self.xUITest.getTopFocusWindow() + + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") + + self.assertTrue(xDataSeries[0].Label.ShowNumber) + self.assertFalse(xDataSeries[0].Label.ShowNumberInPercent) + + xNumberFormatBtn = xDialog.getChild("PB_NUMBERFORMAT") + + def handle_number_dlg(dialog): + categoryformat = dialog.getChild("categorylb") + formatted = dialog.getChild("formatted") + sourceformat = dialog.getChild("sourceformat") + + # Select currency + sourceformat.executeAction("CLICK", tuple()); + categoryformat.getChild("4").executeAction("SELECT", tuple()); + + self.assertEqual(get_state_as_dict(categoryformat)["SelectEntryText"], "Currency") + + self.assertEqual(get_state_as_dict(formatted)["Text"], "[$$-409]#,##0.00;[RED]-[$$-409]#,##0.00") + + xOKButton = dialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKButton) + + self.ui_test.execute_blocking_action(xNumberFormatBtn.executeAction, args=('CLICK', ()), + dialog_handler=handle_number_dlg) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + xNumberFormats = document.Sheets[0].Charts[0].getEmbeddedObject().getNumberFormats() + xLocale = Locale() + xFormat = xNumberFormats.queryKey("[$$-409]#,##0.00;[RED]-[$$-409]#,##0.00", xLocale, True) + + self.assertTrue(xDataSeries[0].Label.ShowNumber) + self.assertFalse(xDataSeries[0].Label.ShowNumberInPercent) + self.assertEqual(xDataSeries[0].NumberFormat, xFormat) + + #reopen and verify the previous changes + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatDataLabels"})) + xDialog = self.xUITest.getTopFocusWindow() + + self.assertTrue(xDataSeries[0].Label.ShowNumber) + self.assertFalse(xDataSeries[0].Label.ShowNumberInPercent) + # tdf#131291: it would fail here: AssertionError: 0 != 104 + self.assertEqual(xDataSeries[0].NumberFormat, xFormat) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.assertTrue(xDataSeries[0].Label.ShowNumber) + self.assertFalse(xDataSeries[0].Label.ShowNumberInPercent) + self.assertEqual(xDataSeries[0].NumberFormat, xFormat) + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/chart/chartGrid.py b/sc/qa/uitest/chart/chartGrid.py new file mode 100644 index 000000000..85cd9f8e9 --- /dev/null +++ b/sc/qa/uitest/chart/chartGrid.py @@ -0,0 +1,251 @@ +# -*- 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.uihelper.common import get_state_as_dict, type_text +from uitest.debug import sleep +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() + +#Chart Grid dialog +#Bug 98390 - Crash when modifying minor grid + +class chartGrid(UITestCase): + def test_tdf98390_chart_grid_dialog(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf98390.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog, set centimeters + xDialog = self.xUITest.getTopFocusWindow() + + xPages = xDialog.getChild("pages") + xCalcEntry = xPages.getChild('3') # calc + xCalcEntry.executeAction("EXPAND", tuple()) + xCalcGeneralEntry = xCalcEntry.getChild('0') + xCalcGeneralEntry.executeAction("SELECT", tuple()) #General + xMetric = xDialog.getChild("unitlb") + props = {"TEXT": "Centimeter"} + actionProps = mkPropertyValues(props) + xMetric.executeAction("SELECT", actionProps) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #X Axis Major Grid + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridYMain"})) + xDialog = self.xUITest.getTopFocusWindow() + #tab "Line". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + + xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") + transparency = xDialog.getChild("MTR_LINE_TRANSPARENT") + + xWidth.executeAction("UP", tuple()) + transparency.executeAction("UP", tuple()) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #reopen and verify X Axis Major Grid + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridYMain"})) + xDialog = self.xUITest.getTopFocusWindow() + + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") + transparency = xDialog.getChild("MTR_LINE_TRANSPARENT") + + self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm") + self.assertEqual(get_state_as_dict(transparency)["Text"], "5%") + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #Y Axis Major Grid + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridXMain"})) + xDialog = self.xUITest.getTopFocusWindow() + + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + + xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") + transparency = xDialog.getChild("MTR_LINE_TRANSPARENT") + + xWidth.executeAction("UP", tuple()) + transparency.executeAction("UP", tuple()) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #reopen and verify Y Axis Major Grid + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridXMain"})) + xDialog = self.xUITest.getTopFocusWindow() + + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + + xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") + transparency = xDialog.getChild("MTR_LINE_TRANSPARENT") + + self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm") + self.assertEqual(get_state_as_dict(transparency)["Text"], "5%") + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #Y Axis Minor Grid + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridXHelp"})) + xDialog = self.xUITest.getTopFocusWindow() + + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + + xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") + transparency = xDialog.getChild("MTR_LINE_TRANSPARENT") + + xWidth.executeAction("UP", tuple()) + transparency.executeAction("UP", tuple()) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #reopen and verify Y Axis Minor Grid + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridXHelp"})) + xDialog = self.xUITest.getTopFocusWindow() + + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") + transparency = xDialog.getChild("MTR_LINE_TRANSPARENT") + + self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm") + self.assertEqual(get_state_as_dict(transparency)["Text"], "5%") + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #X Axis Minor Grid + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridYHelp"})) + xDialog = self.xUITest.getTopFocusWindow() + + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + + xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") + transparency = xDialog.getChild("MTR_LINE_TRANSPARENT") + + xWidth.executeAction("UP", tuple()) + transparency.executeAction("UP", tuple()) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #reopen and verify X Axis Minor Grid + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridYHelp"})) + xDialog = self.xUITest.getTopFocusWindow() + + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") + transparency = xDialog.getChild("MTR_LINE_TRANSPARENT") + + self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm") + self.assertEqual(get_state_as_dict(transparency)["Text"], "5%") + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #All Grids + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridAll"})) + xDialog = self.xUITest.getTopFocusWindow() + + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + + xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") + transparency = xDialog.getChild("MTR_LINE_TRANSPARENT") + + xWidth.executeAction("UP", tuple()) + transparency.executeAction("UP", tuple()) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #reopen and verify X Axis Minor Grid (changed in All Grids) + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridYHelp"})) + xDialog = self.xUITest.getTopFocusWindow() + + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") + transparency = xDialog.getChild("MTR_LINE_TRANSPARENT") + + self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.20 cm") + self.assertEqual(get_state_as_dict(transparency)["Text"], "10%") + + 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/chart/chartGrids.py b/sc/qa/uitest/chart/chartGrids.py new file mode 100644 index 000000000..5c52212b1 --- /dev/null +++ b/sc/qa/uitest/chart/chartGrids.py @@ -0,0 +1,101 @@ +# -*- 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.uihelper.common import get_state_as_dict, type_text +from uitest.debug import sleep +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() + +#Chart Enable Grids dialog + +class chartGrids(UITestCase): + def test_chart_enable_grids_dialog(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf98390.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuGrids"})) + xDialog = self.xUITest.getTopFocusWindow() + + primaryX = xDialog.getChild("primaryX") + primaryY = xDialog.getChild("primaryY") + secondaryX = xDialog.getChild("secondaryX") + secondaryY = xDialog.getChild("secondaryY") + + primaryX.executeAction("CLICK", tuple()) + primaryY.executeAction("CLICK", tuple()) + secondaryX.executeAction("CLICK", tuple()) + secondaryY.executeAction("CLICK", tuple()) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #reopen and verify Grids dialog + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuGrids"})) + xDialog = self.xUITest.getTopFocusWindow() + + primaryX = xDialog.getChild("primaryX") + primaryY = xDialog.getChild("primaryY") + secondaryX = xDialog.getChild("secondaryX") + secondaryY = xDialog.getChild("secondaryY") + + self.assertEqual(get_state_as_dict(primaryX)["Selected"], "false") + self.assertEqual(get_state_as_dict(primaryY)["Selected"], "false") + self.assertEqual(get_state_as_dict(secondaryX)["Selected"], "false") + self.assertEqual(get_state_as_dict(secondaryY)["Selected"], "false") + + primaryX.executeAction("CLICK", tuple()) + primaryY.executeAction("CLICK", tuple()) + secondaryX.executeAction("CLICK", tuple()) + secondaryY.executeAction("CLICK", tuple()) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #reopen and verify Grids dialog + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuGrids"})) + xDialog = self.xUITest.getTopFocusWindow() + + primaryX = xDialog.getChild("primaryX") + primaryY = xDialog.getChild("primaryY") + secondaryX = xDialog.getChild("secondaryX") + secondaryY = xDialog.getChild("secondaryY") + + self.assertEqual(get_state_as_dict(primaryX)["Selected"], "true") + self.assertEqual(get_state_as_dict(primaryY)["Selected"], "true") + self.assertEqual(get_state_as_dict(secondaryX)["Selected"], "true") + self.assertEqual(get_state_as_dict(secondaryY)["Selected"], "true") + + 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/chart/chartLegend.py b/sc/qa/uitest/chart/chartLegend.py new file mode 100644 index 000000000..414a2de09 --- /dev/null +++ b/sc/qa/uitest/chart/chartLegend.py @@ -0,0 +1,98 @@ +# -*- 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.uihelper.common import get_state_as_dict, type_text +from uitest.debug import sleep +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() + +#Chart Display Legend dialog + +class chartLegend(UITestCase): + def test_chart_display_legend_dialog(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf98390.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuLegend"})) + xDialog = self.xUITest.getTopFocusWindow() + + left = xDialog.getChild("left") + right = xDialog.getChild("right") + top = xDialog.getChild("top") + bottom = xDialog.getChild("bottom") + + left.executeAction("CLICK", tuple()) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #reopen and verify InsertMenuLegend dialog + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuLegend"})) + xDialog = self.xUITest.getTopFocusWindow() + + left = xDialog.getChild("left") + right = xDialog.getChild("right") + top = xDialog.getChild("top") + bottom = xDialog.getChild("bottom") + show = xDialog.getChild("show") + + self.assertEqual(get_state_as_dict(left)["Checked"], "true") + self.assertEqual(get_state_as_dict(right)["Checked"], "false") + self.assertEqual(get_state_as_dict(top)["Checked"], "false") + self.assertEqual(get_state_as_dict(bottom)["Checked"], "false") + + show.executeAction("CLICK", tuple()) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #reopen and verify InsertMenuLegend dialog + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuLegend"})) + xDialog = self.xUITest.getTopFocusWindow() + + left = xDialog.getChild("left") + right = xDialog.getChild("right") + top = xDialog.getChild("top") + bottom = xDialog.getChild("bottom") + show = xDialog.getChild("show") + + self.assertEqual(get_state_as_dict(left)["Checked"], "true") + self.assertEqual(get_state_as_dict(right)["Checked"], "false") + self.assertEqual(get_state_as_dict(top)["Checked"], "false") + self.assertEqual(get_state_as_dict(bottom)["Checked"], "false") + + self.assertEqual(get_state_as_dict(show)["Selected"], "false") + + 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/chart/chartTitles.py b/sc/qa/uitest/chart/chartTitles.py new file mode 100644 index 000000000..8b500ccba --- /dev/null +++ b/sc/qa/uitest/chart/chartTitles.py @@ -0,0 +1,82 @@ +# -*- 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.uihelper.common import get_state_as_dict, type_text +from uitest.debug import sleep +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() + +#Chart Display Titles dialog + +class chartTitles(UITestCase): + def test_chart_display_titles_dialog(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf98390.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuTitles"})) + xDialog = self.xUITest.getTopFocusWindow() + + maintitle = xDialog.getChild("maintitle") + subtitle = xDialog.getChild("subtitle") + primaryXaxis = xDialog.getChild("primaryXaxis") + primaryYaxis = xDialog.getChild("primaryYaxis") + secondaryXaxis = xDialog.getChild("secondaryXaxis") + secondaryYaxis = xDialog.getChild("secondaryYaxis") + + maintitle.executeAction("TYPE", mkPropertyValues({"TEXT":"A"})) + subtitle.executeAction("TYPE", mkPropertyValues({"TEXT":"B"})) + primaryXaxis.executeAction("TYPE", mkPropertyValues({"TEXT":"C"})) + primaryYaxis.executeAction("TYPE", mkPropertyValues({"TEXT":"D"})) + secondaryXaxis.executeAction("TYPE", mkPropertyValues({"TEXT":"E"})) + secondaryYaxis.executeAction("TYPE", mkPropertyValues({"TEXT":"F"})) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #reopen and verify InsertMenuTitles dialog + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuTitles"})) + xDialog = self.xUITest.getTopFocusWindow() + + maintitle = xDialog.getChild("maintitle") + subtitle = xDialog.getChild("subtitle") + primaryXaxis = xDialog.getChild("primaryXaxis") + primaryYaxis = xDialog.getChild("primaryYaxis") + secondaryXaxis = xDialog.getChild("secondaryXaxis") + secondaryYaxis = xDialog.getChild("secondaryYaxis") + + self.assertEqual(get_state_as_dict(maintitle)["Text"], "A") + self.assertEqual(get_state_as_dict(subtitle)["Text"], "B") + self.assertEqual(get_state_as_dict(primaryXaxis)["Text"], "C") + self.assertEqual(get_state_as_dict(primaryYaxis)["Text"], "D") + self.assertEqual(get_state_as_dict(secondaryXaxis)["Text"], "E") + self.assertEqual(get_state_as_dict(secondaryYaxis)["Text"], "F") + + 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/chart/chartWall.py b/sc/qa/uitest/chart/chartWall.py new file mode 100644 index 000000000..d0546401b --- /dev/null +++ b/sc/qa/uitest/chart/chartWall.py @@ -0,0 +1,202 @@ +# -*- 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.uihelper.common import get_state_as_dict, type_text +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() + +#Chart Wall dialog + +class chartWall(UITestCase): + def test_chart_wall_dialog(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf122398.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog, set centimeters + xDialog = self.xUITest.getTopFocusWindow() + + xPages = xDialog.getChild("pages") + xCalcEntry = xPages.getChild('3') # calc + xCalcEntry.executeAction("EXPAND", tuple()) + xCalcGeneralEntry = xCalcEntry.getChild('0') + xCalcGeneralEntry.executeAction("SELECT", tuple()) #General + xMetric = xDialog.getChild("unitlb") + props = {"TEXT": "Centimeter"} + actionProps = mkPropertyValues(props) + xMetric.executeAction("SELECT", actionProps) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + xWall = document.Sheets[0].Charts[0].getEmbeddedObject().getFirstDiagram().Wall + self.assertEqual(xWall.LineWidth, 0) + self.assertEqual(xWall.LineTransparence, 0) + self.assertEqual(hex(xWall.FillColor), '0xe6e6e6') + self.assertEqual(xWall.FillTransparence, 0) + + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramWall"})) + xDialog = self.xUITest.getTopFocusWindow() + #Click on tab "Borders". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + + xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") + transparency = xDialog.getChild("MTR_LINE_TRANSPARENT") + + xWidth.executeAction("UP", tuple()) + transparency.executeAction("UP", tuple()) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.assertEqual(xWall.LineWidth, 100) + self.assertEqual(xWall.LineTransparence, 5) + self.assertEqual(hex(xWall.FillColor), '0xe6e6e6') + self.assertEqual(xWall.FillTransparence, 0) + + #reopen and verify tab "Borders". + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramWall"})) + xDialog = self.xUITest.getTopFocusWindow() + + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") + transparency = xDialog.getChild("MTR_LINE_TRANSPARENT") + + self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm") + self.assertEqual(get_state_as_dict(transparency)["Text"], "5%") + + self.assertEqual(xWall.LineWidth, 100) + self.assertEqual(xWall.LineTransparence, 5) + self.assertEqual(hex(xWall.FillColor), '0xe6e6e6') + self.assertEqual(xWall.FillTransparence, 0) + + #Click on tab "Area" + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "1") + + btncolor = xDialog.getChild("btncolor") + btncolor.executeAction("CLICK", tuple()) + + rCustom = xDialog.getChild("R_custom") + gCustom = xDialog.getChild("G_custom") + bCustom = xDialog.getChild("B_custom") + + rCustom.executeAction("CLEAR", tuple()) + rCustom.executeAction("TYPE", mkPropertyValues({"TEXT":"35"})) + rCustom.executeAction("UP", tuple()) + rCustom.executeAction("DOWN", tuple()) #without this save data doesn't works + self.assertEqual(get_state_as_dict(rCustom)["Text"], "35") + gCustom.executeAction("CLEAR", tuple()) + gCustom.executeAction("TYPE", mkPropertyValues({"TEXT":"169"})) + gCustom.executeAction("UP", tuple()) + gCustom.executeAction("DOWN", tuple()) #without this save data doesn't works + bCustom.executeAction("CLEAR", tuple()) + bCustom.executeAction("TYPE", mkPropertyValues({"TEXT":"211"})) + bCustom.executeAction("UP", tuple()) + bCustom.executeAction("DOWN", tuple()) #without this save data doesn't works + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.assertEqual(xWall.LineWidth, 100) + self.assertEqual(xWall.LineTransparence, 5) + self.assertEqual(hex(xWall.FillColor), '0x23a9d3') + self.assertEqual(xWall.FillTransparence, 0) + + #reopen and verify tab "Area". + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramWall"})) + xDialog = self.xUITest.getTopFocusWindow() + + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "1") + + rCustom = xDialog.getChild("R_custom") + gCustom = xDialog.getChild("G_custom") + bCustom = xDialog.getChild("B_custom") + + self.assertEqual(get_state_as_dict(rCustom)["Text"], "35") + self.assertEqual(get_state_as_dict(gCustom)["Text"], "169") + self.assertEqual(get_state_as_dict(bCustom)["Text"], "211") + + self.assertEqual(xWall.LineWidth, 100) + self.assertEqual(xWall.LineTransparence, 5) + self.assertEqual(hex(xWall.FillColor), '0x23a9d3') + self.assertEqual(xWall.FillTransparence, 0) + + #change tab "Transparency" + select_pos(tabcontrol, "2") + transparency = xDialog.getChild("RBT_TRANS_LINEAR") + transparencyPercent = xDialog.getChild("MTR_TRANSPARENT") #51% + + transparency.executeAction("CLICK", tuple()) + transparencyPercent.executeAction("UP", tuple()) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.assertEqual(xWall.LineWidth, 100) + self.assertEqual(xWall.LineTransparence, 5) + self.assertEqual(hex(xWall.FillColor), '0x23a9d3') + self.assertEqual(xWall.FillTransparence, 51) + + #reopen and verify tab "Transparency" + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramWall"})) + xDialog = self.xUITest.getTopFocusWindow() + + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "2") + + transparency = xDialog.getChild("RBT_TRANS_LINEAR") + transparencyPercent = xDialog.getChild("MTR_TRANSPARENT") #51% + + self.assertEqual(get_state_as_dict(transparency)["Checked"], "true") + self.assertEqual(get_state_as_dict(transparencyPercent)["Text"], "51%") + + self.assertEqual(xWall.LineWidth, 100) + self.assertEqual(xWall.LineTransparence, 5) + self.assertEqual(hex(xWall.FillColor), '0x23a9d3') + self.assertEqual(xWall.FillTransparence, 51) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.assertEqual(xWall.LineWidth, 100) + self.assertEqual(xWall.LineTransparence, 5) + self.assertEqual(hex(xWall.FillColor), '0x23a9d3') + self.assertEqual(xWall.FillTransparence, 51) + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/chart/chartXAxis.py b/sc/qa/uitest/chart/chartXAxis.py new file mode 100644 index 000000000..f49302f22 --- /dev/null +++ b/sc/qa/uitest/chart/chartXAxis.py @@ -0,0 +1,290 @@ +# -*- 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.uihelper.common import get_state_as_dict, type_text +from uitest.debug import sleep +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() + +#Chart - X Axis + +class chartXAxis(UITestCase): + def test_chart_x_axis_dialog(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf122398.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog, set centimeters + xDialog = self.xUITest.getTopFocusWindow() + + xPages = xDialog.getChild("pages") + xCalcEntry = xPages.getChild('3') # calc + xCalcEntry.executeAction("EXPAND", tuple()) + xCalcGeneralEntry = xCalcEntry.getChild('0') + xCalcGeneralEntry.executeAction("SELECT", tuple()) #General + xMetric = xDialog.getChild("unitlb") + props = {"TEXT": "Centimeter"} + actionProps = mkPropertyValues(props) + xMetric.executeAction("SELECT", actionProps) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) # X Axis... + xDialog = self.xUITest.getTopFocusWindow() + #Click on tab "Scale". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + + reverseDirection = xDialog.getChild("CBX_REVERSE") + logarithmicScale = xDialog.getChild("CBX_LOGARITHM") + autoMinimum = xDialog.getChild("CBX_AUTO_MIN") + autoMaximum = xDialog.getChild("CBX_AUTO_MAX") + majorInterval = xDialog.getChild("CBX_AUTO_STEP_MAIN") + minorInterval = xDialog.getChild("CBX_AUTO_STEP_HELP") + minimum = xDialog.getChild("EDT_MIN") + maximum = xDialog.getChild("EDT_MAX") + major = xDialog.getChild("EDT_STEP_MAIN") + minor = xDialog.getChild("MT_STEPHELP") + + reverseDirection.executeAction("CLICK", tuple()) + logarithmicScale.executeAction("CLICK", tuple()) + autoMinimum.executeAction("CLICK", tuple()) + autoMaximum.executeAction("CLICK", tuple()) + majorInterval.executeAction("CLICK", tuple()) + minorInterval.executeAction("CLICK", tuple()) + + minimum.executeAction("DOWN", tuple()) #10.12.2017 + maximum.executeAction("DOWN", tuple()) #29.04.2018 + major.executeAction("DOWN", tuple()) #19 + minor.executeAction("UP", tuple()) #3 + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #reopen and verify + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) + xDialog = self.xUITest.getTopFocusWindow() + #Click on tab "Scale". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + + reverseDirection = xDialog.getChild("CBX_REVERSE") + logarithmicScale = xDialog.getChild("CBX_LOGARITHM") + autoMinimum = xDialog.getChild("CBX_AUTO_MIN") + autoMaximum = xDialog.getChild("CBX_AUTO_MAX") + majorInterval = xDialog.getChild("CBX_AUTO_STEP_MAIN") + minorInterval = xDialog.getChild("CBX_AUTO_STEP_HELP") + minimum = xDialog.getChild("EDT_MIN") + maximum = xDialog.getChild("EDT_MAX") + major = xDialog.getChild("EDT_STEP_MAIN") + minor = xDialog.getChild("MT_STEPHELP") + + self.assertEqual(get_state_as_dict(reverseDirection)["Selected"], "true") + self.assertEqual(get_state_as_dict(logarithmicScale)["Selected"], "true") + self.assertEqual(get_state_as_dict(autoMinimum)["Selected"], "false") + self.assertEqual(get_state_as_dict(autoMaximum)["Selected"], "false") + self.assertEqual(get_state_as_dict(majorInterval)["Selected"], "false") + self.assertEqual(get_state_as_dict(minorInterval)["Selected"], "false") + self.assertEqual(get_state_as_dict(minimum)["Text"], "10.12.2017") + self.assertEqual(get_state_as_dict(maximum)["Text"], "29.04.2018") + self.assertEqual(get_state_as_dict(major)["Text"], "19") + self.assertEqual(get_state_as_dict(minor)["Text"], "3") + + #Click on tab "positioning". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "1") + + crossAxis = xDialog.getChild("LB_CROSSES_OTHER_AXIS_AT") + crossAxisValue = xDialog.getChild("EDT_CROSSES_OTHER_AXIS_AT") #only available when crossAxis = Value + placeLabels = xDialog.getChild("LB_PLACE_LABELS") + innerMajorTick = xDialog.getChild("CB_TICKS_INNER") + outerMajorTick = xDialog.getChild("CB_TICKS_OUTER") + innerMinorTick = xDialog.getChild("CB_MINOR_INNER") + outerMinorTick = xDialog.getChild("CB_MINOR_OUTER") + placeMarks = xDialog.getChild("LB_PLACE_TICKS") + + props = {"TEXT": "Start"} + actionProps = mkPropertyValues(props) + crossAxis.executeAction("SELECT", actionProps) + props2 = {"TEXT": "Outside end"} + actionProps2 = mkPropertyValues(props2) + placeLabels.executeAction("SELECT", actionProps2) + innerMajorTick.executeAction("CLICK", tuple()) + outerMajorTick.executeAction("CLICK", tuple()) + innerMinorTick.executeAction("CLICK", tuple()) + outerMinorTick.executeAction("CLICK", tuple()) + props3 = {"TEXT": "At axis"} + actionProps3 = mkPropertyValues(props3) + placeMarks.executeAction("SELECT", actionProps3) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #reopen and verify tab "positioning". + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) + xDialog = self.xUITest.getTopFocusWindow() + + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "1") + + crossAxis = xDialog.getChild("LB_CROSSES_OTHER_AXIS_AT") + crossAxisValue = xDialog.getChild("EDT_CROSSES_OTHER_AXIS_AT") #only available when crossAxis = Value + placeLabels = xDialog.getChild("LB_PLACE_LABELS") + innerMajorTick = xDialog.getChild("CB_TICKS_INNER") + outerMajorTick = xDialog.getChild("CB_TICKS_OUTER") + innerMinorTick = xDialog.getChild("CB_MINOR_INNER") + outerMinorTick = xDialog.getChild("CB_MINOR_OUTER") + placeMarks = xDialog.getChild("LB_PLACE_TICKS") + + self.assertEqual(get_state_as_dict(crossAxis)["SelectEntryText"], "Start") + self.assertEqual(get_state_as_dict(placeLabels)["SelectEntryText"], "Outside end") + self.assertEqual(get_state_as_dict(innerMajorTick)["Selected"], "true") + self.assertEqual(get_state_as_dict(outerMajorTick)["Selected"], "false") + self.assertEqual(get_state_as_dict(innerMinorTick)["Selected"], "true") + self.assertEqual(get_state_as_dict(outerMinorTick)["Selected"], "true") + self.assertEqual(get_state_as_dict(placeMarks)["SelectEntryText"], "At axis") + #change tab "positioning". + props = {"TEXT": "Value"} + actionProps = mkPropertyValues(props) + crossAxis.executeAction("SELECT", actionProps) + crossAxisValue.executeAction("UP", tuple()) #1 + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #reopen and verify tab "positioning". + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) + xDialog = self.xUITest.getTopFocusWindow() + + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "1") + + crossAxis = xDialog.getChild("LB_CROSSES_OTHER_AXIS_AT") + crossAxisValue = xDialog.getChild("EDT_CROSSES_OTHER_AXIS_AT") #only available when crossAxis = Value + placeLabels = xDialog.getChild("LB_PLACE_LABELS") + innerMajorTick = xDialog.getChild("CB_TICKS_INNER") + outerMajorTick = xDialog.getChild("CB_TICKS_OUTER") + innerMinorTick = xDialog.getChild("CB_MINOR_INNER") + outerMinorTick = xDialog.getChild("CB_MINOR_OUTER") + placeMarks = xDialog.getChild("LB_PLACE_TICKS") + + self.assertEqual(get_state_as_dict(crossAxis)["SelectEntryText"], "Value") + self.assertEqual(get_state_as_dict(crossAxisValue)["Text"], "1") + self.assertEqual(get_state_as_dict(placeLabels)["SelectEntryText"], "Outside end") + self.assertEqual(get_state_as_dict(innerMajorTick)["Selected"], "true") + self.assertEqual(get_state_as_dict(outerMajorTick)["Selected"], "false") + self.assertEqual(get_state_as_dict(innerMinorTick)["Selected"], "true") + self.assertEqual(get_state_as_dict(outerMinorTick)["Selected"], "true") + self.assertEqual(get_state_as_dict(placeMarks)["SelectEntryText"], "At axis") + #change tab "Line". + select_pos(tabcontrol, "2") + + xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") + transparency = xDialog.getChild("MTR_LINE_TRANSPARENT") + + xWidth.executeAction("UP", tuple()) + transparency.executeAction("UP", tuple()) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #reopen and verify tab "Line". + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) + xDialog = self.xUITest.getTopFocusWindow() + + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "2") + + xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") + transparency = xDialog.getChild("MTR_LINE_TRANSPARENT") + + self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm") + self.assertEqual(get_state_as_dict(transparency)["Text"], "5%") + + #change tab "Label" + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "3") + + tile = xDialog.getChild("tile") + overlapCB = xDialog.getChild("overlapCB") + breakCB = xDialog.getChild("breakCB") + stackedCB = xDialog.getChild("stackedCB") + textdirLB = xDialog.getChild("textdirLB") + + tile.executeAction("CLICK", tuple()) + overlapCB.executeAction("CLICK", tuple()) + breakCB.executeAction("CLICK", tuple()) + stackedCB.executeAction("CLICK", tuple()) + props = {"TEXT": "Right-to-left"} + actionProps = mkPropertyValues(props) + textdirLB.executeAction("SELECT", actionProps) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #reopen and verify tab "Label". + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) + xDialog = self.xUITest.getTopFocusWindow() + + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "3") + + tile = xDialog.getChild("tile") + overlapCB = xDialog.getChild("overlapCB") + breakCB = xDialog.getChild("breakCB") + stackedCB = xDialog.getChild("stackedCB") + textdirLB = xDialog.getChild("textdirLB") + + self.assertEqual(get_state_as_dict(tile)["Checked"], "true") + self.assertEqual(get_state_as_dict(overlapCB)["Selected"], "true") + self.assertEqual(get_state_as_dict(breakCB)["Selected"], "true") + self.assertEqual(get_state_as_dict(stackedCB)["Selected"], "true") + self.assertEqual(get_state_as_dict(textdirLB)["SelectEntryText"], "Right-to-left") + + 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/chart/chartYAxis.py b/sc/qa/uitest/chart/chartYAxis.py new file mode 100644 index 000000000..2a14d15a9 --- /dev/null +++ b/sc/qa/uitest/chart/chartYAxis.py @@ -0,0 +1,292 @@ +# -*- 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.uihelper.common import get_state_as_dict, type_text +from uitest.debug import sleep +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() + +#Chart - Y Axis + +class chartYAxis(UITestCase): + def test_chart_y_axis_dialog(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf122398.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog, set centimeters + xDialog = self.xUITest.getTopFocusWindow() + + xPages = xDialog.getChild("pages") + xCalcEntry = xPages.getChild('3') # calc + xCalcEntry.executeAction("EXPAND", tuple()) + xCalcGeneralEntry = xCalcEntry.getChild('0') + xCalcGeneralEntry.executeAction("SELECT", tuple()) #General + xMetric = xDialog.getChild("unitlb") + props = {"TEXT": "Centimeter"} + actionProps = mkPropertyValues(props) + xMetric.executeAction("SELECT", actionProps) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisY"})) # X Axis... + xDialog = self.xUITest.getTopFocusWindow() + #Click on tab "Scale". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + + + reverseDirection = xDialog.getChild("CBX_REVERSE") + logarithmicScale = xDialog.getChild("CBX_LOGARITHM") + autoMinimum = xDialog.getChild("CBX_AUTO_MIN") + autoMaximum = xDialog.getChild("CBX_AUTO_MAX") + majorInterval = xDialog.getChild("CBX_AUTO_STEP_MAIN") + minorInterval = xDialog.getChild("CBX_AUTO_STEP_HELP") + minimum = xDialog.getChild("EDT_MIN") + maximum = xDialog.getChild("EDT_MAX") + major = xDialog.getChild("EDT_STEP_MAIN") + minor = xDialog.getChild("MT_STEPHELP") + + reverseDirection.executeAction("CLICK", tuple()) + logarithmicScale.executeAction("CLICK", tuple()) + autoMinimum.executeAction("CLICK", tuple()) + autoMaximum.executeAction("CLICK", tuple()) + majorInterval.executeAction("CLICK", tuple()) + minorInterval.executeAction("CLICK", tuple()) + + minimum.executeAction("UP", tuple()) #1 + maximum.executeAction("DOWN", tuple()) #17 + major.executeAction("DOWN", tuple()) #1 + minor.executeAction("UP", tuple()) #3 + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #reopen and verify + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisY"})) + xDialog = self.xUITest.getTopFocusWindow() + #Click on tab "Scale". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + + reverseDirection = xDialog.getChild("CBX_REVERSE") + logarithmicScale = xDialog.getChild("CBX_LOGARITHM") + autoMinimum = xDialog.getChild("CBX_AUTO_MIN") + autoMaximum = xDialog.getChild("CBX_AUTO_MAX") + majorInterval = xDialog.getChild("CBX_AUTO_STEP_MAIN") + minorInterval = xDialog.getChild("CBX_AUTO_STEP_HELP") + minimum = xDialog.getChild("EDT_MIN") + maximum = xDialog.getChild("EDT_MAX") + major = xDialog.getChild("EDT_STEP_MAIN") + minor = xDialog.getChild("MT_STEPHELP") + + self.assertEqual(get_state_as_dict(reverseDirection)["Selected"], "true") + self.assertEqual(get_state_as_dict(logarithmicScale)["Selected"], "true") + self.assertEqual(get_state_as_dict(autoMinimum)["Selected"], "false") + self.assertEqual(get_state_as_dict(autoMaximum)["Selected"], "false") + self.assertEqual(get_state_as_dict(majorInterval)["Selected"], "false") + self.assertEqual(get_state_as_dict(minorInterval)["Selected"], "false") + self.assertEqual(get_state_as_dict(minimum)["Text"], "1") + self.assertEqual(get_state_as_dict(maximum)["Text"], "17") + self.assertEqual(get_state_as_dict(major)["Text"], "1") + self.assertEqual(get_state_as_dict(minor)["Text"], "3") + + #Click on tab "positioning". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "1") + + crossAxis = xDialog.getChild("LB_CROSSES_OTHER_AXIS_AT") + crossAxisValue = xDialog.getChild("EDT_CROSSES_OTHER_AXIS_AT") #only available when crossAxis = Value + placeLabels = xDialog.getChild("LB_PLACE_LABELS") + innerMajorTick = xDialog.getChild("CB_TICKS_INNER") + outerMajorTick = xDialog.getChild("CB_TICKS_OUTER") + innerMinorTick = xDialog.getChild("CB_MINOR_INNER") + outerMinorTick = xDialog.getChild("CB_MINOR_OUTER") + placeMarks = xDialog.getChild("LB_PLACE_TICKS") + + props = {"TEXT": "Start"} + actionProps = mkPropertyValues(props) + crossAxis.executeAction("SELECT", actionProps) + props2 = {"TEXT": "Outside end"} + actionProps2 = mkPropertyValues(props2) + placeLabels.executeAction("SELECT", actionProps2) + innerMajorTick.executeAction("CLICK", tuple()) + outerMajorTick.executeAction("CLICK", tuple()) + innerMinorTick.executeAction("CLICK", tuple()) + outerMinorTick.executeAction("CLICK", tuple()) + props3 = {"TEXT": "At axis"} + actionProps3 = mkPropertyValues(props3) + placeMarks.executeAction("SELECT", actionProps3) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #reopen and verify tab "positioning". + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisY"})) + xDialog = self.xUITest.getTopFocusWindow() + + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "1") + + crossAxis = xDialog.getChild("LB_CROSSES_OTHER_AXIS_AT") + crossAxisValue = xDialog.getChild("EDT_CROSSES_OTHER_AXIS_AT") #only available when crossAxis = Value + placeLabels = xDialog.getChild("LB_PLACE_LABELS") + innerMajorTick = xDialog.getChild("CB_TICKS_INNER") + outerMajorTick = xDialog.getChild("CB_TICKS_OUTER") + innerMinorTick = xDialog.getChild("CB_MINOR_INNER") + outerMinorTick = xDialog.getChild("CB_MINOR_OUTER") + placeMarks = xDialog.getChild("LB_PLACE_TICKS") + + self.assertEqual(get_state_as_dict(crossAxis)["SelectEntryText"], "Start") + self.assertEqual(get_state_as_dict(placeLabels)["SelectEntryText"], "Outside end") + self.assertEqual(get_state_as_dict(innerMajorTick)["Selected"], "true") + self.assertEqual(get_state_as_dict(outerMajorTick)["Selected"], "false") + self.assertEqual(get_state_as_dict(innerMinorTick)["Selected"], "true") + self.assertEqual(get_state_as_dict(outerMinorTick)["Selected"], "true") + self.assertEqual(get_state_as_dict(placeMarks)["SelectEntryText"], "At axis") + #change tab "positioning". + props = {"TEXT": "Value"} + actionProps = mkPropertyValues(props) + crossAxis.executeAction("SELECT", actionProps) + crossAxisValue.executeAction("CLEAR", tuple()) + crossAxisValue.executeAction("TYPE", mkPropertyValues({"TEXT":"19.01.2018"})) #19.01.2018 + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #reopen and verify tab "positioning". + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisY"})) + xDialog = self.xUITest.getTopFocusWindow() + + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "1") + + crossAxis = xDialog.getChild("LB_CROSSES_OTHER_AXIS_AT") + crossAxisValue = xDialog.getChild("EDT_CROSSES_OTHER_AXIS_AT") #only available when crossAxis = Value + placeLabels = xDialog.getChild("LB_PLACE_LABELS") + innerMajorTick = xDialog.getChild("CB_TICKS_INNER") + outerMajorTick = xDialog.getChild("CB_TICKS_OUTER") + innerMinorTick = xDialog.getChild("CB_MINOR_INNER") + outerMinorTick = xDialog.getChild("CB_MINOR_OUTER") + placeMarks = xDialog.getChild("LB_PLACE_TICKS") + + self.assertEqual(get_state_as_dict(crossAxis)["SelectEntryText"], "Value") + #self.assertEqual(get_state_as_dict(crossAxisValue)["Text"], "19.01.2018") #bug 123520 + self.assertEqual(get_state_as_dict(placeLabels)["SelectEntryText"], "Outside end") + self.assertEqual(get_state_as_dict(innerMajorTick)["Selected"], "true") + self.assertEqual(get_state_as_dict(outerMajorTick)["Selected"], "false") + self.assertEqual(get_state_as_dict(innerMinorTick)["Selected"], "true") + self.assertEqual(get_state_as_dict(outerMinorTick)["Selected"], "true") + self.assertEqual(get_state_as_dict(placeMarks)["SelectEntryText"], "At axis") + #change tab "Line". + select_pos(tabcontrol, "2") + + xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") + transparency = xDialog.getChild("MTR_LINE_TRANSPARENT") + + xWidth.executeAction("UP", tuple()) + transparency.executeAction("UP", tuple()) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #reopen and verify tab "Line". + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisY"})) + xDialog = self.xUITest.getTopFocusWindow() + + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "2") + + xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") + transparency = xDialog.getChild("MTR_LINE_TRANSPARENT") + + self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm") + self.assertEqual(get_state_as_dict(transparency)["Text"], "5%") + + #change tab "Label" + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "3") + + tile = xDialog.getChild("tile") + overlapCB = xDialog.getChild("overlapCB") + breakCB = xDialog.getChild("breakCB") + stackedCB = xDialog.getChild("stackedCB") + textdirLB = xDialog.getChild("textdirLB") + + tile.executeAction("CLICK", tuple()) + overlapCB.executeAction("CLICK", tuple()) + breakCB.executeAction("CLICK", tuple()) + stackedCB.executeAction("CLICK", tuple()) + props = {"TEXT": "Right-to-left"} + actionProps = mkPropertyValues(props) + textdirLB.executeAction("SELECT", actionProps) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #reopen and verify tab "Label". + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisY"})) + xDialog = self.xUITest.getTopFocusWindow() + + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "3") + + tile = xDialog.getChild("tile") + overlapCB = xDialog.getChild("overlapCB") + breakCB = xDialog.getChild("breakCB") + stackedCB = xDialog.getChild("stackedCB") + textdirLB = xDialog.getChild("textdirLB") + + self.assertEqual(get_state_as_dict(tile)["Checked"], "true") + self.assertEqual(get_state_as_dict(overlapCB)["Selected"], "true") + self.assertEqual(get_state_as_dict(breakCB)["Selected"], "true") + self.assertEqual(get_state_as_dict(stackedCB)["Selected"], "true") + self.assertEqual(get_state_as_dict(textdirLB)["SelectEntryText"], "Right-to-left") + + 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/chart/formatDataSeries.py b/sc/qa/uitest/chart/formatDataSeries.py new file mode 100644 index 000000000..3db37320c --- /dev/null +++ b/sc/qa/uitest/chart/formatDataSeries.py @@ -0,0 +1,129 @@ +# -*- 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.uihelper.common import get_state_as_dict, type_text +from uitest.debug import sleep +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() + +# test Chart - Data series dialog /core/chart2/uiconfig/ui/tp_SeriesToAxis.ui + +class chartFormatDataSeries(UITestCase): + def test_chart_format_data_series_dialog(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf93506.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog, set centimeters + xDialog = self.xUITest.getTopFocusWindow() + + xPages = xDialog.getChild("pages") + xCalcEntry = xPages.getChild('3') # calc + xCalcEntry.executeAction("EXPAND", tuple()) + xCalcGeneralEntry = xCalcEntry.getChild('0') + xCalcGeneralEntry.executeAction("SELECT", tuple()) #General + xMetric = xDialog.getChild("unitlb") + props = {"TEXT": "Centimeter"} + actionProps = mkPropertyValues(props) + xMetric.executeAction("SELECT", actionProps) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatDataSeries"})) + xDialog = self.xUITest.getTopFocusWindow() + #Click on tab "Options". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + + primaryYAxis = xDialog.getChild("RBT_OPT_AXIS_1") + secondaryYAxis = xDialog.getChild("RBT_OPT_AXIS_2") + leaveGap = xDialog.getChild("RB_DONT_PAINT") + assumeZero = xDialog.getChild("RB_ASSUME_ZERO") + continueLine = xDialog.getChild("RB_CONTINUE_LINE") + includeHiddenCells = xDialog.getChild("CB_INCLUDE_HIDDEN_CELLS") + hideLegend = xDialog.getChild("CB_LEGEND_ENTRY_HIDDEN") + + secondaryYAxis.executeAction("CLICK", tuple()) + leaveGap.executeAction("CLICK", tuple()) + includeHiddenCells.executeAction("CLICK", tuple()) + hideLegend.executeAction("CLICK", tuple()) + + #Click on tab "Line". + select_pos(tabcontrol, "1") + + xWidth = xDialog.getChild("MF_SYMBOL_WIDTH") + xHeight = xDialog.getChild("MF_SYMBOL_HEIGHT") + xKeep = xDialog.getChild("CB_SYMBOL_RATIO") + + xKeep.executeAction("CLICK", tuple()) + xWidth.executeAction("UP", tuple()) + xWidth.executeAction("UP", tuple()) + xHeight.executeAction("UP", tuple()) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #reopen and verify + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatDataSeries"})) + xDialog = self.xUITest.getTopFocusWindow() + #Click on tab "Options". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + + primaryYAxis = xDialog.getChild("RBT_OPT_AXIS_1") + secondaryYAxis = xDialog.getChild("RBT_OPT_AXIS_2") + leaveGap = xDialog.getChild("RB_DONT_PAINT") + assumeZero = xDialog.getChild("RB_ASSUME_ZERO") + continueLine = xDialog.getChild("RB_CONTINUE_LINE") + includeHiddenCells = xDialog.getChild("CB_INCLUDE_HIDDEN_CELLS") + hideLegend = xDialog.getChild("CB_LEGEND_ENTRY_HIDDEN") + + self.assertEqual(get_state_as_dict(secondaryYAxis)["Checked"], "true") + self.assertEqual(get_state_as_dict(leaveGap)["Checked"], "true") + self.assertEqual(get_state_as_dict(includeHiddenCells)["Selected"], "true") + self.assertEqual(get_state_as_dict(hideLegend)["Selected"], "true") + + #Click on tab "Line". + select_pos(tabcontrol, "1") + + xWidth = xDialog.getChild("MF_SYMBOL_WIDTH") + xHeight = xDialog.getChild("MF_SYMBOL_HEIGHT") + xKeep = xDialog.getChild("CB_SYMBOL_RATIO") + + self.assertEqual(get_state_as_dict(xKeep)["Selected"], "true") #checked as default even after reopen + self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.35 cm") + self.assertEqual(get_state_as_dict(xHeight)["Text"], "0.30 cm") + #click up, should up both values, because Keep ratio is checked + xWidth.executeAction("UP", tuple()) + xHeight.executeAction("UP", tuple()) + self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.41 cm") + self.assertEqual(get_state_as_dict(xHeight)["Text"], "0.35 cm") + + 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/chart/tdf122398.py b/sc/qa/uitest/chart/tdf122398.py new file mode 100644 index 000000000..48842e374 --- /dev/null +++ b/sc/qa/uitest/chart/tdf122398.py @@ -0,0 +1,101 @@ +# -*- 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.uihelper.common import get_state_as_dict, type_text +from uitest.debug import sleep +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 122398 - UI: Cannot specify min/max in axis scale or axis position. Limited between 0 and 100 + +class tdf122398(UITestCase): + def test_tdf122398_chart_min_max_x_axis(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf122398.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + #Open attached file. Set chart into edit mode. Select x-axis and then Format Selection. + #Disable the Automatic for min and max. You cannot change the values at all, neither with direct + #input nor with up-down arrow buttons. + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) # X Axis... + xDialog = self.xUITest.getTopFocusWindow() + #Click on tab "Scale". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + + autoMinimum = xDialog.getChild("CBX_AUTO_MIN") + autoMaximum = xDialog.getChild("CBX_AUTO_MAX") + majorInterval = xDialog.getChild("CBX_AUTO_STEP_MAIN") + minorInterval = xDialog.getChild("CBX_AUTO_STEP_HELP") + minimum = xDialog.getChild("EDT_MIN") + maximum = xDialog.getChild("EDT_MAX") + major = xDialog.getChild("EDT_STEP_MAIN") + minor = xDialog.getChild("MT_STEPHELP") + + autoMinimum.executeAction("CLICK", tuple()) + autoMaximum.executeAction("CLICK", tuple()) + majorInterval.executeAction("CLICK", tuple()) + minorInterval.executeAction("CLICK", tuple()) + #In a chart that contains an axis with a date datatype, the UI does not allow specifying + #a minimum or maximum value greater than 09/04/1900 (i.e., April 9, 1900) + minimum.executeAction("CLEAR", tuple()) + minimum.executeAction("TYPE", mkPropertyValues({"TEXT":"01.01.2018"})) + maximum.executeAction("DOWN", tuple()) #29.04.2018 + major.executeAction("UP", tuple()) #21 + minor.executeAction("DOWN", tuple()) #1 + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #reopen and verify + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) + xDialog = self.xUITest.getTopFocusWindow() + #Click on tab "Scale". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + + autoMinimum = xDialog.getChild("CBX_AUTO_MIN") + autoMaximum = xDialog.getChild("CBX_AUTO_MAX") + majorInterval = xDialog.getChild("CBX_AUTO_STEP_MAIN") + minorInterval = xDialog.getChild("CBX_AUTO_STEP_HELP") + minimum = xDialog.getChild("EDT_MIN") + maximum = xDialog.getChild("EDT_MAX") + major = xDialog.getChild("EDT_STEP_MAIN") + minor = xDialog.getChild("MT_STEPHELP") + + self.assertEqual(get_state_as_dict(autoMinimum)["Selected"], "false") + self.assertEqual(get_state_as_dict(autoMaximum)["Selected"], "false") + self.assertEqual(get_state_as_dict(majorInterval)["Selected"], "false") + self.assertEqual(get_state_as_dict(minorInterval)["Selected"], "false") + self.assertEqual(get_state_as_dict(minimum)["Text"], "01.01.2018") + self.assertEqual(get_state_as_dict(maximum)["Text"], "29.04.2018") + self.assertEqual(get_state_as_dict(major)["Text"], "21") + self.assertEqual(get_state_as_dict(minor)["Text"], "1") + + 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/chart/tdf123013.py b/sc/qa/uitest/chart/tdf123013.py new file mode 100644 index 000000000..421861f65 --- /dev/null +++ b/sc/qa/uitest/chart/tdf123013.py @@ -0,0 +1,66 @@ +# -*- 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.uihelper.common import get_state_as_dict, type_text +from uitest.debug import sleep +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 123013 - Can not change Trendline name in charts + +class tdf123013(UITestCase): + def test_tdf96432_chart_trendline_name(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf123013.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) + xDialog = self.xUITest.getTopFocusWindow() + #Click on tab "Type". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + #add name + xentryname = xDialog.getChild("entry_name") + xentryname.executeAction("TYPE", mkPropertyValues({"TEXT":"Tline"})) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #reopen and try again + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + + #Right-click on the chart; from the pop-up menu select "Format Y bars + # The program presents dialog "Format Y bars", tab "Line". + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) + xDialog = self.xUITest.getTopFocusWindow() + #Click on tab "Type". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + #add name + xentryname = xDialog.getChild("entry_name") + self.assertEqual(get_state_as_dict(xentryname)["Text"], "Tline") + 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/chart/tdf123231.py b/sc/qa/uitest/chart/tdf123231.py new file mode 100644 index 000000000..11e561803 --- /dev/null +++ b/sc/qa/uitest/chart/tdf123231.py @@ -0,0 +1,89 @@ +# -*- 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.uihelper.common import get_state_as_dict, type_text +from uitest.debug import sleep +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 123231 - Chart set trendline format regression type Power twice + +class tdf123231(UITestCase): + def test_tdf123231_chart_trendline_dialog_power(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf93506.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + #Change regression Type to Power + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) + xDialog = self.xUITest.getTopFocusWindow() + #Click on tab "Type". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + logarithmic = xDialog.getChild("logarithmic") #type regression logarithmic + exponential = xDialog.getChild("exponential") #type regression exponential + power = xDialog.getChild("exponential") #type regression power + + power.executeAction("CLICK", tuple()) #set power + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #reopen dialog and close dialog + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) + xDialog = self.xUITest.getTopFocusWindow() + #Click on tab "Type". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + logarithmic = xDialog.getChild("logarithmic") #type regression logarithmic + exponential = xDialog.getChild("exponential") #type regression exponential + power = xDialog.getChild("exponential") #type regression power + self.assertEqual(get_state_as_dict(power)["Checked"], "true") + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #reopen and verify Power + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) + xDialog = self.xUITest.getTopFocusWindow() + #Click on tab "Type". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + + logarithmic = xDialog.getChild("logarithmic") #type regression logarithmic + exponential = xDialog.getChild("exponential") #type regression exponential + power = xDialog.getChild("exponential") #type regression power + + self.assertEqual(get_state_as_dict(power)["Checked"], "true") + + 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/chart/tdf123520.py b/sc/qa/uitest/chart/tdf123520.py new file mode 100644 index 000000000..2210446ac --- /dev/null +++ b/sc/qa/uitest/chart/tdf123520.py @@ -0,0 +1,89 @@ +# -*- 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.uihelper.common import get_state_as_dict, type_text +from uitest.debug import sleep +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 123520 - Y axis - positioning tab, textbox "Cross other axis at" date changed + +class tdf123520(UITestCase): + def test_tdf123520_chart_y_cross_other_axis(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf123520.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisY"})) # Y Axis + xDialog = self.xUITest.getTopFocusWindow() + #Click on tab "positioning". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "1") + + crossAxis = xDialog.getChild("LB_CROSSES_OTHER_AXIS_AT") + crossAxisValue = xDialog.getChild("EDT_CROSSES_OTHER_AXIS_AT") #only available when crossAxis = Value + placeLabels = xDialog.getChild("LB_PLACE_LABELS") + innerMajorTick = xDialog.getChild("CB_TICKS_INNER") + outerMajorTick = xDialog.getChild("CB_TICKS_OUTER") + innerMinorTick = xDialog.getChild("CB_MINOR_INNER") + outerMinorTick = xDialog.getChild("CB_MINOR_OUTER") + placeMarks = xDialog.getChild("LB_PLACE_TICKS") + crossAxisValue.executeAction("CLEAR", tuple()) + crossAxisValue.executeAction("TYPE", mkPropertyValues({"TEXT":"01.01.2018"})) + #crossAxisValue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"TAB"})) + #TAB doesn't works- add "a" at the end of textbox + #workaround - edit another ui item, it should trigger leave of textbox + props2 = {"TEXT": "Outside start"} + actionProps2 = mkPropertyValues(props2) + placeLabels.executeAction("SELECT", actionProps2) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #reopen and verify tab "positioning". + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisY"})) + xDialog = self.xUITest.getTopFocusWindow() + + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "1") + + crossAxis = xDialog.getChild("LB_CROSSES_OTHER_AXIS_AT") + crossAxisValue = xDialog.getChild("EDT_CROSSES_OTHER_AXIS_AT") #only available when crossAxis = Value + placeLabels = xDialog.getChild("LB_PLACE_LABELS") + innerMajorTick = xDialog.getChild("CB_TICKS_INNER") + outerMajorTick = xDialog.getChild("CB_TICKS_OUTER") + innerMinorTick = xDialog.getChild("CB_MINOR_INNER") + outerMinorTick = xDialog.getChild("CB_MINOR_OUTER") + placeMarks = xDialog.getChild("LB_PLACE_TICKS") + + self.assertEqual(get_state_as_dict(crossAxis)["SelectEntryText"], "Value") + self.assertEqual(get_state_as_dict(crossAxisValue)["Text"], "01.01.2018") + self.assertEqual(get_state_as_dict(placeLabels)["SelectEntryText"], "Outside start") + + 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/chart/tdf124111.py b/sc/qa/uitest/chart/tdf124111.py new file mode 100644 index 000000000..b9be7858b --- /dev/null +++ b/sc/qa/uitest/chart/tdf124111.py @@ -0,0 +1,81 @@ +# -*- 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.uihelper.common import get_state_as_dict, type_text +from uitest.debug import sleep +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 124111 - Cannot enter negative number for cross other axis at value + +class tdf124111(UITestCase): + def test_tdf124111_chart_x_negative_cross(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf124111.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) # X Axis... + xDialog = self.xUITest.getTopFocusWindow() + #Click on tab "positioning". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "1") + + crossAxis = xDialog.getChild("LB_CROSSES_OTHER_AXIS_AT") + crossAxisValue = xDialog.getChild("EDT_CROSSES_OTHER_AXIS_AT") #only available when crossAxis = Value + placeLabels = xDialog.getChild("LB_PLACE_LABELS") + innerMajorTick = xDialog.getChild("CB_TICKS_INNER") + outerMajorTick = xDialog.getChild("CB_TICKS_OUTER") + innerMinorTick = xDialog.getChild("CB_MINOR_INNER") + outerMinorTick = xDialog.getChild("CB_MINOR_OUTER") + placeMarks = xDialog.getChild("LB_PLACE_TICKS") + crossAxisValue.executeAction("DOWN", tuple()) #-1 + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #reopen and verify tab "positioning". + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) + xDialog = self.xUITest.getTopFocusWindow() + + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "1") + + crossAxis = xDialog.getChild("LB_CROSSES_OTHER_AXIS_AT") + crossAxisValue = xDialog.getChild("EDT_CROSSES_OTHER_AXIS_AT") #only available when crossAxis = Value + placeLabels = xDialog.getChild("LB_PLACE_LABELS") + innerMajorTick = xDialog.getChild("CB_TICKS_INNER") + outerMajorTick = xDialog.getChild("CB_TICKS_OUTER") + innerMinorTick = xDialog.getChild("CB_MINOR_INNER") + outerMinorTick = xDialog.getChild("CB_MINOR_OUTER") + placeMarks = xDialog.getChild("LB_PLACE_TICKS") + + self.assertEqual(get_state_as_dict(crossAxis)["SelectEntryText"], "Value") + self.assertEqual(get_state_as_dict(crossAxisValue)["Text"], "-1") + + 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/chart/tdf131715.py b/sc/qa/uitest/chart/tdf131715.py new file mode 100644 index 000000000..380aac21e --- /dev/null +++ b/sc/qa/uitest/chart/tdf131715.py @@ -0,0 +1,28 @@ +# +# 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 + +class tdf131715(UITestCase): + + def test_tdf131715(self): + self.ui_test.create_doc_in_start_center("calc") + self.ui_test.execute_dialog_through_command(".uno:InsertObjectChart") + xChartDlg = self.xUITest.getTopFocusWindow() + + xWizard = xChartDlg.getChild('Wizard') + + for i in range(10): + #without the fix in place, it would crash here + select_pos(xWizard, "2") + + self.assertEqual(get_state_as_dict(xWizard)['CurrentStep'], "2") + + xOkBtn = xChartDlg.getChild("finish") + self.ui_test.close_dialog_through_button(xOkBtn) + + self.ui_test.close_doc() diff --git a/sc/qa/uitest/chart/tdf46885.py b/sc/qa/uitest/chart/tdf46885.py new file mode 100644 index 000000000..cf49539f8 --- /dev/null +++ b/sc/qa/uitest/chart/tdf46885.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 46885 - LibO crash when creating chart with no cells selected + +class tdf46885(UITestCase): + def test_tdf46885_crash_chart_no_cell_selected_nextButton(self): + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + enter_text_to_cell(gridwin, "A10", "col1") + #When you start a new chart and have one empty cell selected LibO will crash when you select the Next>> button. + self.ui_test.execute_dialog_through_command(".uno:InsertObjectChart") + xChartDlg = self.xUITest.getTopFocusWindow() + xNextBtn = xChartDlg.getChild("next") + xNextBtn.executeAction("CLICK", tuple()) + xOkBtn = xChartDlg.getChild("finish") + self.ui_test.close_dialog_through_button(xOkBtn) + + #verify, we didn't crash + self.assertEqual(get_cell_by_position(document, 0, 0, 9).getString(), "col1") + + self.ui_test.close_doc() + + def test_tdf46885_crash_chart_multiple_empty_cells_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() + enter_text_to_cell(gridwin, "A10", "col1") + #If you select multiple empty cells and then start a new chart LibO will crash immediately. + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C4"})) + self.ui_test.execute_dialog_through_command(".uno:InsertObjectChart") + xChartDlg = self.xUITest.getTopFocusWindow() + xNextBtn = xChartDlg.getChild("next") + xNextBtn.executeAction("CLICK", tuple()) + xOkBtn = xChartDlg.getChild("finish") + self.ui_test.close_dialog_through_button(xOkBtn) + + #verify, we didn't crash + self.assertEqual(get_cell_by_position(document, 0, 0, 9).getString(), "col1") + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/chart/tdf62349.py b/sc/qa/uitest/chart/tdf62349.py new file mode 100644 index 000000000..9800f6ed9 --- /dev/null +++ b/sc/qa/uitest/chart/tdf62349.py @@ -0,0 +1,48 @@ +# -*- 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 62349 - Calc crashes when a newly created chart copied to clipboard + +class tdf62349(UITestCase): + def test_tdf62349_crash_copy_chart_clipboard(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf62349.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #3: select all data cells C5:H9 + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "C5:H9"})) + # 4: create a chart with insert/chart menu + self.ui_test.execute_dialog_through_command(".uno:InsertObjectChart") + xChartDlg = self.xUITest.getTopFocusWindow() + + xOkBtn = xChartDlg.getChild("finish") + self.ui_test.close_dialog_through_button(xOkBtn) + + # 5: (single) click to an empty cell to finalize the chart + gridwin.executeAction("DESELECT", mkPropertyValues({"OBJECT": ""})) + # 6: (single) click back inside the chart to select it + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + # 7: press CTRL-C + self.xUITest.executeCommand(".uno:Copy") + self.xUITest.executeCommand(".uno:Paste") + #check we didn't crash + self.assertEqual(get_cell_by_position(document, 0, 2, 5).getString(), "group1") + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/chart/tdf93506_trendline.py b/sc/qa/uitest/chart/tdf93506_trendline.py new file mode 100644 index 000000000..de57a8699 --- /dev/null +++ b/sc/qa/uitest/chart/tdf93506_trendline.py @@ -0,0 +1,484 @@ +# -*- 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.uihelper.common import get_state_as_dict, type_text +from uitest.debug import sleep +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 93506 - Crash when selecting chart containing a trend line +# test all dialog items - trend Line dialog + +class tdf93506(UITestCase): + def test_tdf93506_chart_trendline_dialog(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf93506.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog, set centimeters + xDialog = self.xUITest.getTopFocusWindow() + + xPages = xDialog.getChild("pages") + xCalcEntry = xPages.getChild('3') # calc + xCalcEntry.executeAction("EXPAND", tuple()) + xCalcGeneralEntry = xCalcEntry.getChild('0') + xCalcGeneralEntry.executeAction("SELECT", tuple()) #General + xMetric = xDialog.getChild("unitlb") + props = {"TEXT": "Centimeter"} + actionProps = mkPropertyValues(props) + xMetric.executeAction("SELECT", actionProps) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) + xDialog = self.xUITest.getTopFocusWindow() + #Click on tab "Type". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + # print(xDialog.getChildren()) + #('AttributeDialog', 'CBX_SYNCHRONIZE', 'CB_SYMBOL_RATIO', 'CTL_PREVIEW', 'FL_EDGE_STYLE', 'FL_LINE', 'FL_LINE_ENDS', 'FL_SYMBOL_FORMAT', 'FT_CAP_STYLE', 'FT_COLOR', 'FT_EDGE_STYLE', 'FT_LINE_ENDS_STYLE', 'FT_LINE_END_WIDTH', 'FT_LINE_START_WIDTH', 'FT_LINE_STYLE', 'FT_LINE_WIDTH', 'FT_SYMBOL_HEIGHT', 'FT_SYMBOL_WIDTH', 'FT_TRANSPARENT', 'LB_CAP_STYLE', 'LB_COLOR', 'LB_EDGE_STYLE', 'LB_END_STYLE', 'LB_LINE_STYLE', 'LB_START_STYLE', 'LineTabPage', 'MB_SYMBOL_BITMAP', 'MF_SYMBOL_HEIGHT', 'MF_SYMBOL_WIDTH', 'MTR_FLD_END_WIDTH', 'MTR_FLD_LINE_WIDTH', 'MTR_FLD_START_WIDTH', 'MTR_LINE_TRANSPARENT', 'TP_TRENDLINE', 'TSB_CENTER_END', 'TSB_CENTER_START', 'alignment1', 'alignment2', 'alignment3', 'alignment4', 'alignment6', 'auto_color_button', 'box1', 'box2', 'box3', 'box4', 'box5', 'boxARROW_STYLES', 'boxCOLOR', 'boxEND', 'boxSTART', 'boxTRANSPARENCY', 'boxWIDTH', 'cancel', 'color_picker_button', 'colorset', 'colorsetwin', 'degree', 'dialog-action_area1', 'dialog-vbox1', 'entry_Xname', 'entry_Yname', 'entry_name', 'exponential', 'extrapolateBackward', 'extrapolateForward', 'frame1', 'frame2', 'grid1', 'grid2', 'grid3', 'grid5', 'gridEDGE_CAPS', 'gridICON_SIZE', 'help', 'imageExponential', 'imageLinear', 'imageLogarithmic', 'imageMovingAverage', 'imagePolynomial', 'imagePower', 'interceptValue', 'label1', 'label2', 'label3', 'label4', 'label5', 'label6', 'label7', 'label8', 'label9', 'linear', 'logarithmic', 'movingAverage', 'none_color_button', 'ok', 'palette_listbox', 'palette_popup_window', 'period', 'polynomial', 'power', 'recent_colorset', 'reset', 'separator1', 'separator3', 'separator4', 'setIntercept', 'showCorrelationCoefficient', 'showEquation', 'tabcontrol') + + logarithmic = xDialog.getChild("logarithmic") #type regression logarithmic + xentryname = xDialog.getChild("entry_name") #add name + extrapolateForward = xDialog.getChild("extrapolateForward") + extrapolateBackward = xDialog.getChild("extrapolateBackward") + setIntercept = xDialog.getChild("setIntercept") + interceptValue = xDialog.getChild("interceptValue") + showEquation = xDialog.getChild("showEquation") + showCorrelationCoefficient = xDialog.getChild("showCorrelationCoefficient") + xVarname = xDialog.getChild("entry_Xname") + yVarName = xDialog.getChild("entry_Yname") + + logarithmic.executeAction("CLICK", tuple()) + xentryname.executeAction("TYPE", mkPropertyValues({"TEXT":"Name"})) + extrapolateForward.executeAction("UP", tuple()) + extrapolateBackward.executeAction("UP", tuple()) + showEquation.executeAction("CLICK", tuple()) + showCorrelationCoefficient.executeAction("CLICK", tuple()) + xVarname.executeAction("CLEAR", tuple()) + xVarname.executeAction("TYPE", mkPropertyValues({"TEXT":"a"})) + yVarName.executeAction("CLEAR", tuple()) + yVarName.executeAction("TYPE", mkPropertyValues({"TEXT":"f(a)"})) + + #Click on tab "Line". + select_pos(tabcontrol, "1") + # print(xDialog.getChildren()) + # ('AttributeDialog', 'CBX_SYNCHRONIZE', 'CB_SYMBOL_RATIO', 'CTL_PREVIEW', 'FL_EDGE_STYLE', 'FL_LINE', 'FL_LINE_ENDS', 'FL_SYMBOL_FORMAT', 'FT_CAP_STYLE', 'FT_COLOR', 'FT_EDGE_STYLE', 'FT_LINE_ENDS_STYLE', 'FT_LINE_END_WIDTH', 'FT_LINE_START_WIDTH', 'FT_LINE_STYLE', 'FT_LINE_WIDTH', 'FT_SYMBOL_HEIGHT', 'FT_SYMBOL_WIDTH', 'FT_TRANSPARENT', 'LB_CAP_STYLE', 'LB_COLOR', 'LB_EDGE_STYLE', 'LB_END_STYLE', 'LB_LINE_STYLE', 'LB_START_STYLE', 'LineTabPage', 'MB_SYMBOL_BITMAP', 'MF_SYMBOL_HEIGHT', 'MF_SYMBOL_WIDTH', 'MTR_FLD_END_WIDTH', 'MTR_FLD_LINE_WIDTH', 'MTR_FLD_START_WIDTH', 'MTR_LINE_TRANSPARENT', 'TP_TRENDLINE', 'TSB_CENTER_END', 'TSB_CENTER_START', 'alignment1', 'alignment2', 'alignment3', 'alignment4', 'alignment6', 'auto_color_button', 'box1', 'box2', 'box3', 'box4', 'box5', 'boxARROW_STYLES', 'boxCOLOR', 'boxEND', 'boxSTART', 'boxTRANSPARENCY', 'boxWIDTH', 'cancel', 'color_picker_button', 'colorset', 'colorsetwin', 'degree', 'dialog-action_area1', 'dialog-vbox1', 'entry_Xname', 'entry_Yname', 'entry_name', 'exponential', 'extrapolateBackward', 'extrapolateForward', 'frame1', 'frame2', 'grid1', 'grid2', 'grid3', 'grid5', 'gridEDGE_CAPS', 'gridICON_SIZE', 'help', 'imageExponential', 'imageLinear', 'imageLogarithmic', 'imageMovingAverage', 'imagePolynomial', 'imagePower', 'interceptValue', 'label1', 'label2', 'label3', 'label4', 'label5', 'label6', 'label7', 'label8', 'label9', 'linear', 'logarithmic', 'movingAverage', 'none_color_button', 'ok', 'palette_listbox', 'palette_popup_window', 'period', 'polynomial', 'power', 'recent_colorset', 'reset', 'separator1', 'separator3', 'separator4', 'setIntercept', 'showCorrelationCoefficient', 'showEquation', 'tabcontrol') + + xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") + xTransparent = xDialog.getChild("MTR_LINE_TRANSPARENT") + + xWidth.executeAction("UP", tuple()) + xTransparent.executeAction("UP", tuple()) + self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm") + self.assertEqual(get_state_as_dict(xTransparent)["Text"], "5%") + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #reopen and verify + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) + xDialog = self.xUITest.getTopFocusWindow() + #Click on tab "Type". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + + logarithmic = xDialog.getChild("logarithmic") #type regression logarithmic + xentryname = xDialog.getChild("entry_name") #add name + extrapolateForward = xDialog.getChild("extrapolateForward") + extrapolateBackward = xDialog.getChild("extrapolateBackward") + setIntercept = xDialog.getChild("setIntercept") + interceptValue = xDialog.getChild("interceptValue") + showEquation = xDialog.getChild("showEquation") + showCorrelationCoefficient = xDialog.getChild("showCorrelationCoefficient") + xVarname = xDialog.getChild("entry_Xname") + yVarName = xDialog.getChild("entry_Yname") + + self.assertEqual(get_state_as_dict(logarithmic)["Checked"], "true") + self.assertEqual(get_state_as_dict(xentryname)["Text"], "Name") + self.assertEqual(get_state_as_dict(extrapolateForward)["Text"], "1") + self.assertEqual(get_state_as_dict(extrapolateBackward)["Text"], "1") + self.assertEqual(get_state_as_dict(showEquation)["Selected"], "true") + self.assertEqual(get_state_as_dict(showCorrelationCoefficient)["Selected"], "true") + self.assertEqual(get_state_as_dict(xVarname)["Text"], "a") + self.assertEqual(get_state_as_dict(yVarName)["Text"], "f(a)") + + #Click on tab "Line". + select_pos(tabcontrol, "1") + xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") + xTransparent = xDialog.getChild("MTR_LINE_TRANSPARENT") + + self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm") + self.assertEqual(get_state_as_dict(xTransparent)["Text"], "5%") + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #Now change regression Type to Exponential + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) + xDialog = self.xUITest.getTopFocusWindow() + #Click on tab "Type". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + logarithmic = xDialog.getChild("logarithmic") #type regression logarithmic + exponential = xDialog.getChild("exponential") #type regression exponential + xentryname = xDialog.getChild("entry_name") #add name + extrapolateForward = xDialog.getChild("extrapolateForward") + extrapolateBackward = xDialog.getChild("extrapolateBackward") + setIntercept = xDialog.getChild("setIntercept") + interceptValue = xDialog.getChild("interceptValue") + showEquation = xDialog.getChild("showEquation") + showCorrelationCoefficient = xDialog.getChild("showCorrelationCoefficient") + xVarname = xDialog.getChild("entry_Xname") + yVarName = xDialog.getChild("entry_Yname") + + exponential.executeAction("CLICK", tuple()) #set exponential + #set Force intercept + setIntercept.executeAction("CLICK", tuple()) + interceptValue.executeAction("UP", tuple()) + + #Click on tab "Line". + select_pos(tabcontrol, "1") + xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") + xTransparent = xDialog.getChild("MTR_LINE_TRANSPARENT") + + self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm") + self.assertEqual(get_state_as_dict(xTransparent)["Text"], "5%") + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #reopen and verify Exponential + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) + xDialog = self.xUITest.getTopFocusWindow() + #Click on tab "Type". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + + logarithmic = xDialog.getChild("logarithmic") #type regression logarithmic + exponential = xDialog.getChild("exponential") #type regression exponential + xentryname = xDialog.getChild("entry_name") #add name + extrapolateForward = xDialog.getChild("extrapolateForward") + extrapolateBackward = xDialog.getChild("extrapolateBackward") + setIntercept = xDialog.getChild("setIntercept") + interceptValue = xDialog.getChild("interceptValue") + showEquation = xDialog.getChild("showEquation") + showCorrelationCoefficient = xDialog.getChild("showCorrelationCoefficient") + xVarname = xDialog.getChild("entry_Xname") + yVarName = xDialog.getChild("entry_Yname") + + self.assertEqual(get_state_as_dict(exponential)["Checked"], "true") + self.assertEqual(get_state_as_dict(xentryname)["Text"], "Name") + self.assertEqual(get_state_as_dict(extrapolateForward)["Text"], "1") + self.assertEqual(get_state_as_dict(extrapolateBackward)["Text"], "1") + self.assertEqual(get_state_as_dict(showEquation)["Selected"], "true") + self.assertEqual(get_state_as_dict(setIntercept)["Selected"], "true") + self.assertEqual(get_state_as_dict(interceptValue)["Text"], "1") + self.assertEqual(get_state_as_dict(showCorrelationCoefficient)["Selected"], "true") + self.assertEqual(get_state_as_dict(xVarname)["Text"], "a") + self.assertEqual(get_state_as_dict(yVarName)["Text"], "f(a)") + + #Click on tab "Line". + select_pos(tabcontrol, "1") + xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") + xTransparent = xDialog.getChild("MTR_LINE_TRANSPARENT") + + self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm") + self.assertEqual(get_state_as_dict(xTransparent)["Text"], "5%") + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #Now change regression Type to Power + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) + xDialog = self.xUITest.getTopFocusWindow() + #Click on tab "Type". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + logarithmic = xDialog.getChild("logarithmic") #type regression logarithmic + exponential = xDialog.getChild("exponential") #type regression exponential + power = xDialog.getChild("exponential") #type regression power + xentryname = xDialog.getChild("entry_name") #add name + extrapolateForward = xDialog.getChild("extrapolateForward") + extrapolateBackward = xDialog.getChild("extrapolateBackward") + setIntercept = xDialog.getChild("setIntercept") + interceptValue = xDialog.getChild("interceptValue") + showEquation = xDialog.getChild("showEquation") + showCorrelationCoefficient = xDialog.getChild("showCorrelationCoefficient") + xVarname = xDialog.getChild("entry_Xname") + yVarName = xDialog.getChild("entry_Yname") + + power.executeAction("CLICK", tuple()) #set power + + #Click on tab "Line". + select_pos(tabcontrol, "1") + xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") + xTransparent = xDialog.getChild("MTR_LINE_TRANSPARENT") + + self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm") + self.assertEqual(get_state_as_dict(xTransparent)["Text"], "5%") + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #reopen and verify Power + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) + xDialog = self.xUITest.getTopFocusWindow() + #Click on tab "Type". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + + logarithmic = xDialog.getChild("logarithmic") #type regression logarithmic + exponential = xDialog.getChild("exponential") #type regression exponential + power = xDialog.getChild("exponential") #type regression power + xentryname = xDialog.getChild("entry_name") #add name + extrapolateForward = xDialog.getChild("extrapolateForward") + extrapolateBackward = xDialog.getChild("extrapolateBackward") + setIntercept = xDialog.getChild("setIntercept") + interceptValue = xDialog.getChild("interceptValue") + showEquation = xDialog.getChild("showEquation") + showCorrelationCoefficient = xDialog.getChild("showCorrelationCoefficient") + xVarname = xDialog.getChild("entry_Xname") + yVarName = xDialog.getChild("entry_Yname") + + self.assertEqual(get_state_as_dict(power)["Checked"], "true") + self.assertEqual(get_state_as_dict(xentryname)["Text"], "Name") + self.assertEqual(get_state_as_dict(extrapolateForward)["Text"], "1") + self.assertEqual(get_state_as_dict(extrapolateBackward)["Text"], "1") + self.assertEqual(get_state_as_dict(showEquation)["Selected"], "true") + # self.assertEqual(get_state_as_dict(setIntercept)["Selected"], "true") + # self.assertEqual(get_state_as_dict(interceptValue)["Text"], "1") + self.assertEqual(get_state_as_dict(showCorrelationCoefficient)["Selected"], "true") + self.assertEqual(get_state_as_dict(xVarname)["Text"], "a") + self.assertEqual(get_state_as_dict(yVarName)["Text"], "f(a)") + + #Click on tab "Line". + select_pos(tabcontrol, "1") + xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") + xTransparent = xDialog.getChild("MTR_LINE_TRANSPARENT") + + self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm") + self.assertEqual(get_state_as_dict(xTransparent)["Text"], "5%") + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #Now change regression Type to Polynomial + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) + xDialog = self.xUITest.getTopFocusWindow() + #Click on tab "Type". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + logarithmic = xDialog.getChild("logarithmic") #type regression logarithmic + exponential = xDialog.getChild("exponential") #type regression exponential + power = xDialog.getChild("exponential") #type regression power + polynomial = xDialog.getChild("polynomial") #type regression polynomial + degree = xDialog.getChild("degree") + xentryname = xDialog.getChild("entry_name") #add name + extrapolateForward = xDialog.getChild("extrapolateForward") + extrapolateBackward = xDialog.getChild("extrapolateBackward") + setIntercept = xDialog.getChild("setIntercept") + interceptValue = xDialog.getChild("interceptValue") + showEquation = xDialog.getChild("showEquation") + showCorrelationCoefficient = xDialog.getChild("showCorrelationCoefficient") + xVarname = xDialog.getChild("entry_Xname") + yVarName = xDialog.getChild("entry_Yname") + + polynomial.executeAction("CLICK", tuple()) #set polynomial + degree.executeAction("UP", tuple()) + + #Click on tab "Line". + select_pos(tabcontrol, "1") + xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") + xTransparent = xDialog.getChild("MTR_LINE_TRANSPARENT") + + self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm") + self.assertEqual(get_state_as_dict(xTransparent)["Text"], "5%") + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #reopen and verify Polynomial + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) + xDialog = self.xUITest.getTopFocusWindow() + #Click on tab "Type". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + + logarithmic = xDialog.getChild("logarithmic") #type regression logarithmic + exponential = xDialog.getChild("exponential") #type regression exponential + power = xDialog.getChild("exponential") #type regression power + polynomial = xDialog.getChild("polynomial") #type regression polynomial + degree = xDialog.getChild("degree") + xentryname = xDialog.getChild("entry_name") #add name + extrapolateForward = xDialog.getChild("extrapolateForward") + extrapolateBackward = xDialog.getChild("extrapolateBackward") + setIntercept = xDialog.getChild("setIntercept") + interceptValue = xDialog.getChild("interceptValue") + showEquation = xDialog.getChild("showEquation") + showCorrelationCoefficient = xDialog.getChild("showCorrelationCoefficient") + xVarname = xDialog.getChild("entry_Xname") + yVarName = xDialog.getChild("entry_Yname") + + self.assertEqual(get_state_as_dict(polynomial)["Checked"], "true") + self.assertEqual(get_state_as_dict(degree)["Text"], "3") + self.assertEqual(get_state_as_dict(xentryname)["Text"], "Name") + self.assertEqual(get_state_as_dict(extrapolateForward)["Text"], "1") + self.assertEqual(get_state_as_dict(extrapolateBackward)["Text"], "1") + self.assertEqual(get_state_as_dict(showEquation)["Selected"], "true") + self.assertEqual(get_state_as_dict(setIntercept)["Selected"], "true") + self.assertEqual(get_state_as_dict(interceptValue)["Text"], "1") + self.assertEqual(get_state_as_dict(showCorrelationCoefficient)["Selected"], "true") + self.assertEqual(get_state_as_dict(xVarname)["Text"], "a") + self.assertEqual(get_state_as_dict(yVarName)["Text"], "f(a)") + + #Click on tab "Line". + select_pos(tabcontrol, "1") + xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") + xTransparent = xDialog.getChild("MTR_LINE_TRANSPARENT") + + self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm") + self.assertEqual(get_state_as_dict(xTransparent)["Text"], "5%") + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #Now change regression Type to Moving average + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) + xDialog = self.xUITest.getTopFocusWindow() + #Click on tab "Type". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + logarithmic = xDialog.getChild("logarithmic") #type regression logarithmic + exponential = xDialog.getChild("exponential") #type regression exponential + power = xDialog.getChild("exponential") #type regression power + movingAverage = xDialog.getChild("movingAverage") #type regression Moving average + period = xDialog.getChild("period") + xentryname = xDialog.getChild("entry_name") #add name + extrapolateForward = xDialog.getChild("extrapolateForward") + extrapolateBackward = xDialog.getChild("extrapolateBackward") + setIntercept = xDialog.getChild("setIntercept") + interceptValue = xDialog.getChild("interceptValue") + showEquation = xDialog.getChild("showEquation") + showCorrelationCoefficient = xDialog.getChild("showCorrelationCoefficient") + xVarname = xDialog.getChild("entry_Xname") + yVarName = xDialog.getChild("entry_Yname") + + movingAverage.executeAction("CLICK", tuple()) #set polynomial + period.executeAction("UP", tuple()) + + #Click on tab "Line". + select_pos(tabcontrol, "1") + xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") + xTransparent = xDialog.getChild("MTR_LINE_TRANSPARENT") + + self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm") + self.assertEqual(get_state_as_dict(xTransparent)["Text"], "5%") + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #reopen and verify Moving average + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) + xDialog = self.xUITest.getTopFocusWindow() + #Click on tab "Type". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + + logarithmic = xDialog.getChild("logarithmic") #type regression logarithmic + exponential = xDialog.getChild("exponential") #type regression exponential + power = xDialog.getChild("exponential") #type regression power + polynomial = xDialog.getChild("polynomial") #type regression polynomial + movingAverage = xDialog.getChild("movingAverage") #type regression Moving average + degree = xDialog.getChild("degree") + period = xDialog.getChild("period") + xentryname = xDialog.getChild("entry_name") #add name + extrapolateForward = xDialog.getChild("extrapolateForward") + extrapolateBackward = xDialog.getChild("extrapolateBackward") + setIntercept = xDialog.getChild("setIntercept") + interceptValue = xDialog.getChild("interceptValue") + showEquation = xDialog.getChild("showEquation") + showCorrelationCoefficient = xDialog.getChild("showCorrelationCoefficient") + xVarname = xDialog.getChild("entry_Xname") + yVarName = xDialog.getChild("entry_Yname") + + self.assertEqual(get_state_as_dict(movingAverage)["Checked"], "true") + self.assertEqual(get_state_as_dict(period)["Text"], "3") + self.assertEqual(get_state_as_dict(xentryname)["Text"], "Name") + + #Click on tab "Line". + select_pos(tabcontrol, "1") + xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") + xTransparent = xDialog.getChild("MTR_LINE_TRANSPARENT") + + self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm") + self.assertEqual(get_state_as_dict(xTransparent)["Text"], "5%") + + 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/chart/tdf96432.py b/sc/qa/uitest/chart/tdf96432.py new file mode 100644 index 000000000..58f02fb72 --- /dev/null +++ b/sc/qa/uitest/chart/tdf96432.py @@ -0,0 +1,78 @@ +# -*- 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.uihelper.common import get_state_as_dict, type_text +from uitest.debug import sleep +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 96432 - FORMATTING: Crash when transparency is applied to an error bar + +class tdf96432(UITestCase): + def test_tdf96432_chart_crash_transparency_error_bar_dialog(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf96432.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + + #Right-click on the chart; from the pop-up menu select "Format Y bars + # The program presents dialog "Format Y bars", tab "Line". + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatYErrorBars"})) + xDialog = self.xUITest.getTopFocusWindow() + #Click on tab "Line". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "1") + #Type a non-zero integer into the "Transparency:" Edit Field, or use the up arrow to select one + xTransparency = xDialog.getChild("MTR_LINE_TRANSPARENT") + xTransparency.executeAction("UP", tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #verify - we didn't crash + gridwin.executeAction("DESELECT", mkPropertyValues({"OBJECT": ""})) + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 7) + + #reopen and try again + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + + #Right-click on the chart; from the pop-up menu select "Format Y bars + # The program presents dialog "Format Y bars", tab "Line". + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatYErrorBars"})) + xDialog = self.xUITest.getTopFocusWindow() + #Click on tab "Line". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "1") + #Type a non-zero integer into the "Transparency:" Edit Field, or use the up arrow to select one + xTransparency = xDialog.getChild("MTR_LINE_TRANSPARENT") + self.assertEqual(get_state_as_dict(xTransparency)["Text"][0], "5") + xTransparency.executeAction("UP", tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #verify - we didn't crash + gridwin.executeAction("DESELECT", mkPropertyValues({"OBJECT": ""})) + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 7) + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/chart/tdf99069.py b/sc/qa/uitest/chart/tdf99069.py new file mode 100644 index 000000000..0988efc09 --- /dev/null +++ b/sc/qa/uitest/chart/tdf99069.py @@ -0,0 +1,78 @@ +# -*- 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.uihelper.common import get_state_as_dict, type_text +from uitest.debug import sleep +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 99069 - assertion "SolarMutex not locked" from <Cancel> Data Ranges dialog + +class tdf99069(UITestCase): + def test_tdf99069_chart_cancel_data_ranges_dialog(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf99069.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #(1) Download and open example.ods attached to tdf#97266 with cell B1 active. + #(2) In tool bar, click the chart icon. Program presents Chart Wizard. + self.ui_test.execute_dialog_through_command(".uno:InsertObjectChart") + xDialog = self.xUITest.getTopFocusWindow() + #(3) In Chart Wizard, click <Finish>. The program closes the wizard; + # the chart shows a border with handles on each side and at each corner. + xFinishBtn = xDialog.getChild("finish") + self.ui_test.close_dialog_through_button(xFinishBtn) + for _ in range(0,5): + #(4) Click outside the chart, for example in cell C23. The borders + #disappear from the chart and the program restores the menubar to + #the window. (Yes, this step is necessary to the crash.) + gridwin.executeAction("DESELECT", mkPropertyValues({"OBJECT": ""})) + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C23"})) + #(5) Double-click on the chart. The program shows a border around the + # chart. (It may be necessary to do this a second time before the + # pop-up menu will offer "Data Ranges...". + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + + #(6) Right-click on the chart; from the pop-up menu select "Data + # Ranges...". The program presents dialog "Data Ranges", tab "Data Range". + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DataRanges"})) + xDialog = self.xUITest.getTopFocusWindow() + + #(7) Click on tab "Data Series". (Actually, tab "Data Range" crashes, + # too. This step is just a remnant of what I was doing when I + # stumbled over the bug.) + notebook = xDialog.getChild("tabcontrol") + select_pos(notebook, "0") + select_pos(notebook, "1") + + #(8) Click <Cancel>. In the versions that I deemed bad while + # bibisecting, the program crashed here five times out of seven. + # The other two attempts, both on daily bibisect version 2016-02-18, + # crashed after I closed the Data Ranges dialog an additional three + # times, one of those times using by typing <Esc>. + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + + #verify - we didn't crash + gridwin.executeAction("DESELECT", mkPropertyValues({"OBJECT": ""})) + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getValue(), 0.529084) + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/conditional_format/__init__.py b/sc/qa/uitest/conditional_format/__init__.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/sc/qa/uitest/conditional_format/__init__.py diff --git a/sc/qa/uitest/conditional_format/tdf100793.py b/sc/qa/uitest/conditional_format/tdf100793.py new file mode 100644 index 000000000..5d6c95126 --- /dev/null +++ b/sc/qa/uitest/conditional_format/tdf100793.py @@ -0,0 +1,103 @@ +# -*- 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 os +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 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 100793 - FORMATTING - conditional formatting gets corrupted upon copy/paste/insert +class tdf100793(UITestCase): + def test_tdf100793(self): + + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf100793.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + sheet = get_sheet_from_doc(calc_doc, 2) + conditional_format_list = get_conditional_format_from_sheet(sheet) + self.assertEqual(conditional_format_list.getLength(), 1) + #2) Go to sheet "plan" + gridwin.executeAction("SELECT", mkPropertyValues({"TABLE": "2"})) + #3) Open the conditional formatting management dialog-> The indicated range should be G18:K29,F18,F20:F29 + self.ui_test.execute_dialog_through_command(".uno:ConditionalFormatManagerDialog") + + xCondFormatMgr = self.xUITest.getTopFocusWindow() + + # check that we have exactly one conditional formats in the beginning + xList = xCondFormatMgr.getChild("CONTAINER") + list_state = get_state_as_dict(xList) + self.assertEqual(list_state['Children'], '1') + + #3) Click Edit & try to change to intended one, F18:K33 + xEditBtn = xCondFormatMgr.getChild("edit") + self.ui_test.execute_dialog_through_action(xEditBtn, "CLICK", event_name = "ModelessDialogVisible") + xCondFormatDlg = self.xUITest.getTopFocusWindow() + + #modify textbox + xedassign = xCondFormatDlg.getChild("edassign") + #go at the beginning + xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "END"})) + xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "HOME"})) + # 11x right + xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"})) + xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"})) + xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"})) + xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"})) + xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"})) + xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"})) + xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"})) + xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"})) + xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"})) + xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"})) + xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"})) + #now I'm at F18 - write :K33 + xedassign.executeAction("TYPE", mkPropertyValues({"TEXT":":K33"})) + + xCondFormatOkBtn = xCondFormatDlg.getChild("ok") + self.ui_test.close_dialog_through_button(xCondFormatOkBtn) + + # we need to get a pointer again as the old window has been deleted + xCondFormatMgr = self.xUITest.getTopFocusWindow() + + # check again that we still have 1 entry in the list + # and still only 1 conditional format in the document + xList = xCondFormatMgr.getChild("CONTAINER") + list_state = get_state_as_dict(xList) + self.assertEqual(list_state['Children'], '1') + + self.assertEqual(conditional_format_list.getLength(), 1) + + # close the conditional format manager + xOKBtn = xCondFormatMgr.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #verify - reopen, check range + self.ui_test.execute_dialog_through_command(".uno:ConditionalFormatManagerDialog") + xCondFormatMgr = self.xUITest.getTopFocusWindow() + xEditBtn = xCondFormatMgr.getChild("edit") + self.ui_test.execute_dialog_through_action(xEditBtn, "CLICK", event_name = "ModelessDialogVisible") + xCondFormatDlg = self.xUITest.getTopFocusWindow() + xedassign = xCondFormatDlg.getChild("edassign") + self.assertEqual(get_state_as_dict(xedassign)["Text"], "G18:K29,F18:K33,F20:F29") + xCondFormatOkBtn = xCondFormatDlg.getChild("ok") + self.ui_test.close_dialog_through_button(xCondFormatOkBtn) + xCondFormatMgr = self.xUITest.getTopFocusWindow() + 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/conditional_format/tdf105351.py b/sc/qa/uitest/conditional_format/tdf105351.py new file mode 100644 index 000000000..2f9d55ff5 --- /dev/null +++ b/sc/qa/uitest/conditional_format/tdf105351.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 +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 105351 - FORMATTING: Unable to change Data Bar conditional formatting +class tdf105351(UITestCase): + def test_tdf105351_cond_format_data_bar(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() + #2. Set the value of cell A1 to 5 + enter_text_to_cell(gridwin, "A1", "5") + #3. Select cell A1, then choose from the menus Format -> Conditional Formatting -> Data Bar + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + self.ui_test.execute_modeless_dialog_through_command(".uno:DataBarFormatDialog") + xDialog = self.xUITest.getTopFocusWindow() + xcolscalemin = xDialog.getChild("colscalemin") + xedcolscalemin = xDialog.getChild("edcolscalemin") + xcolscalemax = xDialog.getChild("colscalemax") + xedcolscalemax = xDialog.getChild("edcolscalemax") + #4. In the conditional formatting window, select the dropdown on the left that says "Automatic" + #and change it to "Value". In the text field below it enter 0. + #5. Select the dropdown on the right that says "Automatic" and change it to "Value". In the text field below it enter 10 + props = {"TEXT": "Value"} + actionProps = mkPropertyValues(props) + xcolscalemin.executeAction("SELECT", actionProps) + xedcolscalemin.executeAction("TYPE", mkPropertyValues({"TEXT":"0"})) + + props2 = {"TEXT": "Value"} + actionProps2 = mkPropertyValues(props2) + xcolscalemax.executeAction("SELECT", actionProps2) + xedcolscalemax.executeAction("TYPE", mkPropertyValues({"TEXT":"10"})) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #Verify : The conditions set for cell A1 should be shown and editable. + self.ui_test.execute_modeless_dialog_through_command(".uno:DataBarFormatDialog") + xDialog = self.xUITest.getTopFocusWindow() + xcolscalemin = xDialog.getChild("colscalemin") + xedcolscalemin = xDialog.getChild("edcolscalemin") + xcolscalemax = xDialog.getChild("colscalemax") + xedcolscalemax = xDialog.getChild("edcolscalemax") + + self.assertEqual(get_state_as_dict(xcolscalemin)["SelectEntryText"], "Value") + self.assertEqual(get_state_as_dict(xedcolscalemin)["Text"], "0") + self.assertEqual(get_state_as_dict(xcolscalemax)["SelectEntryText"], "Value") + self.assertEqual(get_state_as_dict(xedcolscalemax)["Text"], "10") + #editable - change value and then verify + xedcolscalemax.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) + self.assertEqual(get_state_as_dict(xedcolscalemax)["Text"], "110") + + 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/conditional_format/tdf105411.py b/sc/qa/uitest/conditional_format/tdf105411.py new file mode 100644 index 000000000..8f08c2f22 --- /dev/null +++ b/sc/qa/uitest/conditional_format/tdf105411.py @@ -0,0 +1,35 @@ +# -*- 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 + +class tdf105411(UITestCase): + + def test_delete_conditional_format(self): + + self.ui_test.create_doc_in_start_center("calc") + + self.ui_test.execute_modeless_dialog_through_command(".uno:ConditionalFormatDialog") + + xCondFormatDlg = self.xUITest.getTopFocusWindow() + + xDeleteBtn = xCondFormatDlg.getChild("delete") + xDeleteBtn.executeAction("CLICK", tuple()) + + xCondFormatDlg = self.xUITest.getTopFocusWindow() + + xDeleteBtn = xCondFormatDlg.getChild("add") + xDeleteBtn.executeAction("CLICK", tuple()) + + xCondFormatDlg = self.xUITest.getTopFocusWindow() + + xOkBtn = xCondFormatDlg.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/conditional_format/tdf105466.py b/sc/qa/uitest/conditional_format/tdf105466.py new file mode 100644 index 000000000..fa7db7e49 --- /dev/null +++ b/sc/qa/uitest/conditional_format/tdf105466.py @@ -0,0 +1,35 @@ +# -*- 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 libreoffice.uno.propertyvalue import mkPropertyValues + +import unittest + +class tdf105466(UITestCase): + + @unittest.skip("issue with floating windows") + def test_changing_conditional_format(self): + + self.ui_test.create_doc_in_start_center("calc") + + self.ui_test.execute_modeless_dialog_through_command(".uno:ConditionalFormatDialog") + + for i in range(0,4): + with self.subTest(i = i): + xCondFormatDlg = self.xUITest.getTopFocusWindow() + xTypeLstBox = xCondFormatDlg.getChild("type") + xTypeLstBox.executeAction("SELECT", mkPropertyValues({"POS": str(i)})) + + xCondFormatDlg = self.xUITest.getTopFocusWindow() + xOkBtn = xCondFormatDlg.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/conditional_format/tdf105544.py b/sc/qa/uitest/conditional_format/tdf105544.py new file mode 100644 index 000000000..828807e90 --- /dev/null +++ b/sc/qa/uitest/conditional_format/tdf105544.py @@ -0,0 +1,61 @@ +# -*- 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 os +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 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 105544 - Manage Conditional Formatting is not able to edit a condition +class tdf105544(UITestCase): + def test_tdf105544_Manage_Conditional_Formatting_edit_condition(self): + + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf105544.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #2. select B3. Format> conditional formatting> manage + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B3"})) + self.ui_test.execute_dialog_through_command(".uno:ConditionalFormatManagerDialog") + xCondFormatMgr = self.xUITest.getTopFocusWindow() + + # check that we have exactly four conditional formats in the beginning + xList = xCondFormatMgr.getChild("CONTAINER") + list_state = get_state_as_dict(xList) + self.assertEqual(list_state['Children'], '4') + + #select B3:B37 range and click edit, then click yes + xList.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) #2nd position in the list + xEditBtn = xCondFormatMgr.getChild("edit") + self.ui_test.execute_dialog_through_action(xEditBtn, "CLICK", event_name = "ModelessDialogVisible") + xCondFormatDlg = self.xUITest.getTopFocusWindow() + + xCondFormatOkBtn = xCondFormatDlg.getChild("ok") + self.ui_test.close_dialog_through_button(xCondFormatOkBtn) + + # we need to get a pointer again as the old window has been deleted + xCondFormatMgr = self.xUITest.getTopFocusWindow() + + # check again that we still have 4 entry in the list + xList = xCondFormatMgr.getChild("CONTAINER") + list_state = get_state_as_dict(xList) + self.assertEqual(list_state['Children'], '4') + + # close the conditional format manager + xOKBtn = xCondFormatMgr.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/conditional_format/tdf118206.py b/sc/qa/uitest/conditional_format/tdf118206.py new file mode 100644 index 000000000..015af9f7a --- /dev/null +++ b/sc/qa/uitest/conditional_format/tdf118206.py @@ -0,0 +1,48 @@ +# -*- 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 +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 118206 - [GTK3] Calc hangs copying/cutting a conditional format column +class tdf118206(UITestCase): + def test_tdf118206(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf118206.xlsx")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + self.xUITest.executeCommand(".uno:SelectColumn") + self.xUITest.executeCommand(".uno:Copy") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B1"})) + self.xUITest.executeCommand(".uno:SelectColumn") + self.xUITest.executeCommand(".uno:Paste") + + #verify + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "On Back Order") + self.assertEqual(get_cell_by_position(document, 0, 1, 1).getValue(), 0) + self.assertEqual(get_cell_by_position(document, 0, 1, 7).getValue(), 1) + + #Undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "On Back Order") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 0) + self.assertEqual(get_cell_by_position(document, 0, 0, 7).getValue(), 1) + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "") + self.assertEqual(get_cell_by_position(document, 0, 1, 1).getString(), "") + self.assertEqual(get_cell_by_position(document, 0, 1, 7).getString(), "") + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/conditional_format/tdf81696.py b/sc/qa/uitest/conditional_format/tdf81696.py new file mode 100644 index 000000000..9036e6376 --- /dev/null +++ b/sc/qa/uitest/conditional_format/tdf81696.py @@ -0,0 +1,51 @@ +# -*- 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 81696 - CRASH while sorting cells with conditional formatting + +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() + +class tdf81696(UITestCase): + + def test_tdf81696_sort_cell_conditional_formatting(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf81696.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B3"})) + #Open sort dialog by DATA - SORT,Just sort it by Column A, ascending. (it's default) + self.ui_test.execute_dialog_through_command(".uno:DataSort") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + xleftright = xDialog.getChild("leftright") + select_pos(xTabs, "0") + + 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") + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "B") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 1) + self.assertEqual(get_cell_by_position(document, 0, 1, 1).getValue(), 2) + self.assertEqual(get_cell_by_position(document, 0, 0, 2).getValue(), 2) + self.assertEqual(get_cell_by_position(document, 0, 1, 2).getValue(), 1) + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab:
\ No newline at end of file diff --git a/sc/qa/uitest/conditional_format/tdf96453.py b/sc/qa/uitest/conditional_format/tdf96453.py new file mode 100644 index 000000000..696fff87d --- /dev/null +++ b/sc/qa/uitest/conditional_format/tdf96453.py @@ -0,0 +1,89 @@ +# -*- 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 os + +from uitest.uihelper.common import get_state_as_dict +from uitest.path import get_srcdir_url + +from libreoffice.calc.document import get_sheet_from_doc +from libreoffice.calc.conditional_format import get_conditional_format_from_sheet + +def get_url_for_data_file(file_name): + return get_srcdir_url() + "/uitest/calc_tests/data/" + file_name + +class ConditionalFormatDlgTest(UITestCase): + + def test_simple_open_manager(self): + + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf96453.ods")) + + self.ui_test.execute_dialog_through_command(".uno:ConditionalFormatManagerDialog") + + xCondFormatMgr = self.xUITest.getTopFocusWindow() + + xCancelBtn = xCondFormatMgr.getChild("cancel") + xCancelBtn.executeAction("CLICK", tuple()) + + self.ui_test.close_doc() + + def test_tdf96453(self): + + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf96453.ods")) + + sheet = get_sheet_from_doc(calc_doc, 0) + conditional_format_list = get_conditional_format_from_sheet(sheet) + self.assertEqual(conditional_format_list.getLength(), 2) + + self.ui_test.execute_dialog_through_command(".uno:ConditionalFormatManagerDialog") + + xCondFormatMgr = self.xUITest.getTopFocusWindow() + + # check that we have exactly two conditional formats in the beginning + xList = xCondFormatMgr.getChild("CONTAINER") + list_state = get_state_as_dict(xList) + self.assertEqual(list_state['Children'], '2') + + # remove one conditional format + xRemoveBtn = xCondFormatMgr.getChild("remove") + xRemoveBtn.executeAction("CLICK", tuple()) + + # check that the table only shows one + # but the document still contains two + list_state = get_state_as_dict(xList) + self.assertEqual(list_state['Children'], '1') + + self.assertEqual(conditional_format_list.getLength(), 2) + + # add a new conditional format through the add button + xAddBtn = xCondFormatMgr.getChild("add") + self.ui_test.execute_dialog_through_action(xAddBtn, "CLICK", event_name = "ModelessDialogVisible") + + xCondFormatDlg = self.xUITest.getTopFocusWindow() + xCondFormatOkBtn = xCondFormatDlg.getChild("ok") + self.ui_test.close_dialog_through_button(xCondFormatOkBtn) + + # we need to get a pointer again as the old window has been deleted + xCondFormatMgr = self.xUITest.getTopFocusWindow() + + # check again that we now have 2 and not 3 entries in the list + # and still only 2 conditional formats in the document + xList = xCondFormatMgr.getChild("CONTAINER") + list_state = get_state_as_dict(xList) + self.assertEqual(list_state['Children'], '2') + + self.assertEqual(conditional_format_list.getLength(), 2) + + # close the conditional format manager + 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/goalSeek/goalSeek.py b/sc/qa/uitest/goalSeek/goalSeek.py new file mode 100644 index 000000000..59d8b8940 --- /dev/null +++ b/sc/qa/uitest/goalSeek/goalSeek.py @@ -0,0 +1,49 @@ +# -*- 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 +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() + + +class goalSeek(UITestCase): + def test_goalSeek(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("goalSeek.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B4"})) + self.ui_test.execute_modeless_dialog_through_command(".uno:GoalSeekDialog") + xDialog = self.xUITest.getTopFocusWindow() + xformulaedit = xDialog.getChild("formulaedit") + xtarget = xDialog.getChild("target") + xvaredit = xDialog.getChild("varedit") + xtarget.executeAction("TYPE", mkPropertyValues({"TEXT":"15000"})) + xvaredit.executeAction("TYPE", mkPropertyValues({"TEXT":"B1"})) + xOKBtn = xDialog.getChild("ok") + + def handle_OK_dlg(dialog): + print(dialog.getChildren()) + xYesButn = dialog.getChild("yes") + self.ui_test.close_dialog_through_button(xYesButn) + + self.ui_test.execute_blocking_action(xOKBtn.executeAction, args=('CLICK', ()), + dialog_handler=handle_OK_dlg) + #verify + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getValue(), 200000) + self.assertEqual(get_cell_by_position(document, 0, 1, 3).getValue(), 15000) + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/goalSeek/tdf37341.py b/sc/qa/uitest/goalSeek/tdf37341.py new file mode 100644 index 000000000..730c3482e --- /dev/null +++ b/sc/qa/uitest/goalSeek/tdf37341.py @@ -0,0 +1,46 @@ +# -*- 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 37341 - Goal Seek hangs indefinitely for too many calculation steps (Formula Cell $F$110) + +class tdf37341(UITestCase): + def test_tdf37341_goalSeek(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf37341.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "F111"})) + self.ui_test.execute_modeless_dialog_through_command(".uno:GoalSeekDialog") + xDialog = self.xUITest.getTopFocusWindow() + xformulaedit = xDialog.getChild("formulaedit") + xtarget = xDialog.getChild("target") + xvaredit = xDialog.getChild("varedit") + xtarget.executeAction("TYPE", mkPropertyValues({"TEXT":"0"})) + xvaredit.executeAction("TYPE", mkPropertyValues({"TEXT":"E7"})) + xOKBtn = xDialog.getChild("ok") + def handle_OK_dlg(dialog): + xYesButn = dialog.getChild("yes") + self.ui_test.close_dialog_through_button(xYesButn) + + self.ui_test.execute_blocking_action(xOKBtn.executeAction, args=('CLICK', ()), + dialog_handler=handle_OK_dlg) + #verify + self.assertEqual(get_cell_by_position(document, 0, 4, 6).getValue() > 0, True) + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab:
\ No newline at end of file diff --git a/sc/qa/uitest/goalSeek/tdf43693.py b/sc/qa/uitest/goalSeek/tdf43693.py new file mode 100644 index 000000000..ade370e2b --- /dev/null +++ b/sc/qa/uitest/goalSeek/tdf43693.py @@ -0,0 +1,46 @@ +# -*- 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 43693 - Goal Seek: reproducible crash using "target value search" + +class tdf43693(UITestCase): + def test_tdf43693_goalSeek(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf43693.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "K248"})) + self.ui_test.execute_modeless_dialog_through_command(".uno:GoalSeekDialog") + xDialog = self.xUITest.getTopFocusWindow() + xformulaedit = xDialog.getChild("formulaedit") + xtarget = xDialog.getChild("target") + xvaredit = xDialog.getChild("varedit") + xtarget.executeAction("TYPE", mkPropertyValues({"TEXT":"0"})) + xvaredit.executeAction("TYPE", mkPropertyValues({"TEXT":"H5"})) + xOKBtn = xDialog.getChild("ok") + def handle_OK_dlg(dialog): + xYesButn = dialog.getChild("yes") + self.ui_test.close_dialog_through_button(xYesButn) + + self.ui_test.execute_blocking_action(xOKBtn.executeAction, args=('CLICK', ()), + dialog_handler=handle_OK_dlg) + #verify + self.assertEqual(get_cell_by_position(document, 0, 7, 4).getValue(), 0.04) + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/hideShowSheet/hideShowSheet.py b/sc/qa/uitest/hideShowSheet/hideShowSheet.py new file mode 100644 index 000000000..da8feb166 --- /dev/null +++ b/sc/qa/uitest/hideShowSheet/hideShowSheet.py @@ -0,0 +1,56 @@ +# -*- 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 +#uitest sc / Show sheet dialog + +class hideShowSheet(UITestCase): + def test_hide_show_sheet(self): + writer_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() + #insert sheet + self.ui_test.execute_dialog_through_command(".uno:Insert") + current_dialog = self.xUITest.getTopFocusWindow() + xOkButton = current_dialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOkButton) + #select sheet + gridwin.executeAction("SELECT", mkPropertyValues({"TABLE":"1"})) + #hide sheet + self.xUITest.executeCommand(".uno:Hide") + #show sheet Dialog + self.ui_test.execute_dialog_through_command(".uno:Show") + xDialog = self.xUITest.getTopFocusWindow() + treeview = xDialog.getChild("treeview") + self.assertEqual(get_state_as_dict(treeview)["Children"], "1") + xcancel = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xcancel) + #insert 2nd sheet + self.ui_test.execute_dialog_through_command(".uno:Insert") + current_dialog = self.xUITest.getTopFocusWindow() + xOkButton = current_dialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOkButton) + #select sheet + gridwin.executeAction("SELECT", mkPropertyValues({"TABLE":"2"})) + #hide sheet + self.xUITest.executeCommand(".uno:Hide") + #show sheet Dialog + self.ui_test.execute_dialog_through_command(".uno:Show") + xDialog = self.xUITest.getTopFocusWindow() + treeview = xDialog.getChild("treeview") + self.assertEqual(get_state_as_dict(treeview)["Children"], "2") + xcancel = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xcancel) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/hide_cols/tdf95306.py b/sc/qa/uitest/hide_cols/tdf95306.py new file mode 100644 index 000000000..63f976849 --- /dev/null +++ b/sc/qa/uitest/hide_cols/tdf95306.py @@ -0,0 +1,42 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from libreoffice.uno.propertyvalue import mkPropertyValues + +from uitest.framework import UITestCase +from libreoffice.calc.document import get_column + +import time + +def get_column_hidden(doc, index): + column = get_column(doc, index) + val = column.getPropertyValue("IsVisible") + return not val + +class HideDisjointColumns(UITestCase): + + def test_hide_columns(self): + self.ui_test.create_doc_in_start_center("calc") + xTopWindow = self.xUITest.getTopFocusWindow() + + gridwin = xTopWindow.getChild("grid_window") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B1"})) + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D1", "EXTEND":"true"})) + + doc = self.ui_test.get_component() + self.assertFalse(get_column_hidden(doc, 1)) + self.assertFalse(get_column_hidden(doc, 3)) + self.ui_test._xUITest.executeCommand(".uno:HideColumn") + self.assertTrue(get_column_hidden(doc, 1)) + self.assertTrue(get_column_hidden(doc, 3)) + self.ui_test._xUITest.executeCommand(".uno:Undo") + self.assertFalse(get_column_hidden(doc, 1)) + self.assertFalse(get_column_hidden(doc, 3)) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/inputLine/tdf54197.py b/sc/qa/uitest/inputLine/tdf54197.py new file mode 100644 index 000000000..54f2c5f56 --- /dev/null +++ b/sc/qa/uitest/inputLine/tdf54197.py @@ -0,0 +1,38 @@ +# -*- 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 54197 - Calc single cell filling (Ctrl+D) does not change data at input line + +class tdf54197(UITestCase): + + def test_tdf54197_CTRL_D_input_line_change(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. go to cell A1 enter any text + enter_text_to_cell(gridwin, "A1", "t") + # 2. go to cell A2 press Ctrl+D + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A2"})) + self.xUITest.executeCommand(".uno:FillDown") + # The same text as above is displayed at cell A2, BUT input line is still blank + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "t") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "t") + xInputWin = xCalcDoc.getChild("sc_input_window") + self.assertEqual(get_state_as_dict(xInputWin)["Text"], "t") + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/inputLine/tdf67346.py b/sc/qa/uitest/inputLine/tdf67346.py new file mode 100644 index 000000000..324d8ca63 --- /dev/null +++ b/sc/qa/uitest/inputLine/tdf67346.py @@ -0,0 +1,45 @@ +# -*- 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 67346 - EDITING: Undo broken when pasting text that has been copied from the input line + +class tdf67346(UITestCase): + + def test_tdf67346_undo_paste_text_input_line(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() + # type 'Apple' in A1 + enter_text_to_cell(gridwin, "A1", "Apple") + # input line: copy the text from there + xInputWin = xCalcDoc.getChild("sc_input_window") + xInputWin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + self.xUITest.executeCommand(".uno:Copy") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A2"})) + # Ctrl-V + self.xUITest.executeCommand(".uno:Paste") + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Apple") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "Apple") + self.assertEqual(get_state_as_dict(xInputWin)["Text"], "Apple") + #Ctrl-Z + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Apple") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "") + self.assertEqual(get_state_as_dict(xInputWin)["Text"], "") + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/key_f4/f4.py b/sc/qa/uitest/key_f4/f4.py new file mode 100644 index 000000000..dbdbdbd5d --- /dev/null +++ b/sc/qa/uitest/key_f4/f4.py @@ -0,0 +1,138 @@ +# -*- 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 os +from uitest.uihelper.common import get_state_as_dict +from uitest.debug import sleep +from libreoffice.uno.propertyvalue import mkPropertyValues +from libreoffice.calc.document import get_cell_by_position +from uitest.uihelper.calc import enter_text_to_cell + +class keyF4(UITestCase): + def test_f4(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", "1") + enter_text_to_cell(gridwin, "A2", "2") + enter_text_to_cell(gridwin, "A3", "3") + enter_text_to_cell(gridwin, "B1", "=A1") + enter_text_to_cell(gridwin, "B2", "=A2") + enter_text_to_cell(gridwin, "B3", "=A3") + #select B1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B1"})) + #F4 + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "F4"})) + #verify + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getValue(), 1) + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getFormula(), "=$A$1") + #F4 + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "F4"})) + #verify + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getValue(), 1) + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getFormula(), "=A$1") + #F4 + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "F4"})) + #verify + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getValue(), 1) + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getFormula(), "=$A1") + + #non continuous select + #enter data + enter_text_to_cell(gridwin, "C1", "=A1") + enter_text_to_cell(gridwin, "C2", "=A2") + enter_text_to_cell(gridwin, "C3", "=A3") + + #select C1 and C3 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1"})) + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C3", "EXTEND":"1"})) + #F4 + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "F4"})) + #verify + self.assertEqual(get_cell_by_position(document, 0, 2, 0).getValue(), 1) + self.assertEqual(get_cell_by_position(document, 0, 2, 0).getFormula(), "=$A$1") + self.assertEqual(get_cell_by_position(document, 0, 2, 2).getValue(), 3) + self.assertEqual(get_cell_by_position(document, 0, 2, 2).getFormula(), "=$A$3") + #F4 + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "F4"})) + #verify + self.assertEqual(get_cell_by_position(document, 0, 2, 0).getValue(), 1) + self.assertEqual(get_cell_by_position(document, 0, 2, 0).getFormula(), "=A$1") + self.assertEqual(get_cell_by_position(document, 0, 2, 2).getValue(), 3) + self.assertEqual(get_cell_by_position(document, 0, 2, 2).getFormula(), "=A$3") + #F4 + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "F4"})) + #verify + self.assertEqual(get_cell_by_position(document, 0, 2, 0).getValue(), 1) + self.assertEqual(get_cell_by_position(document, 0, 2, 0).getFormula(), "=$A1") + self.assertEqual(get_cell_by_position(document, 0, 2, 2).getValue(), 3) + self.assertEqual(get_cell_by_position(document, 0, 2, 2).getFormula(), "=$A3") + + self.ui_test.close_doc() + + def test_tdf39650_F4_R1C1(self): + #Bug 39650 - Shift+F4 conversion from relative to absolute does not work for R1C1 syntax + 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() + #* Tools --> Options --> Calc --> Formula --> Syntax = Excel R1C1 + 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()) + xCalcFormulaEntry = xCalcEntry.getChild('4') + xCalcFormulaEntry.executeAction("SELECT", tuple()) #Formula + + formulasyntax = xDialogOpt.getChild("formulasyntax") + #Excel R1C1 + props = {"TEXT": "Excel R1C1"} + actionProps = mkPropertyValues(props) + formulasyntax.executeAction("SELECT", actionProps) + + xOKBtn = xDialogOpt.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #In cell R3C3 enter "xxx". + enter_text_to_cell(gridwin, "C3", "xxx") + # In cell R2C2 type = and then click on the xxx in R3C3. + enter_text_to_cell(gridwin, "B2", "=R[1]C[1]") + # With cell R2C2 still selected, type Shift-F4. + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B2"})) + + #F4 + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "F4"})) + + #This should change the formula in R2C2 from =R[1]C[1] to =R3C3. + self.assertEqual(get_cell_by_position(document, 0, 1, 1).getString(), "xxx") + enter_text_to_cell(gridwin, "A1", "=FORMULA(R[1]C[1])") + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "=R3C3") + + #Give it back Tools --> Options --> Calc --> Formula --> Syntax = Calc A1 + 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()) + xCalcFormulaEntry = xCalcEntry.getChild('4') + xCalcFormulaEntry.executeAction("SELECT", tuple()) #Formula + + formulasyntax = xDialogOpt.getChild("formulasyntax") + #Excel R1C1 + props = {"TEXT": "Calc A1"} + actionProps = mkPropertyValues(props) + formulasyntax.executeAction("SELECT", actionProps) + + xOKBtn = xDialogOpt.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/key_f4/tdf102525.py b/sc/qa/uitest/key_f4/tdf102525.py new file mode 100644 index 000000000..b93062b30 --- /dev/null +++ b/sc/qa/uitest/key_f4/tdf102525.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 +import os +from uitest.uihelper.common import get_state_as_dict +from uitest.debug import sleep +from libreoffice.uno.propertyvalue import mkPropertyValues +from libreoffice.calc.document import get_cell_by_position +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 102525 - F4 breaks array formula +class tdf102525(UITestCase): + def test_tdf102525_F4_key_array_formula(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf102525.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + #select B1:B4 + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "B1:B4"})) + #F4 + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "F4"})) + #verify + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getValue(), 2) + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getFormula(), "{=IF($A$1:$A$4>2;1;2)}") + self.assertEqual(get_cell_by_position(document, 0, 1, 1).getValue(), 2) + self.assertEqual(get_cell_by_position(document, 0, 1, 2).getValue(), 1) + self.assertEqual(get_cell_by_position(document, 0, 1, 3).getValue(), 1) + #Undo + self.xUITest.executeCommand(".uno:Undo") + #verify + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getValue(), 2) + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getFormula(), "{=IF(A1:A4>2;1;2)}") + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/options/tdf117458.py b/sc/qa/uitest/options/tdf117458.py new file mode 100644 index 000000000..8d12f3cf6 --- /dev/null +++ b/sc/qa/uitest/options/tdf117458.py @@ -0,0 +1,144 @@ +# -*- 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 117458 - Selection doesn't move left nor right by pressing ENTER + +class tdf117458(UITestCase): + def test_tdf117458_selection_move_by_enter(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() + #Go to Tools -> Options -> LibreOffice Calc -> General + 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 + xaligncb = xDialogOpt.getChild("aligncb") + xalignlb = xDialogOpt.getChild("alignlb") + if (get_state_as_dict(xaligncb)["Selected"]) == "false": + xaligncb.executeAction("CLICK", tuple()) + #Down + props = {"TEXT": "Down"} + actionProps = mkPropertyValues(props) + xalignlb.executeAction("SELECT", actionProps) + + xOKBtn = xDialogOpt.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #Select cell A1 + #and down up to "deselect" range + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + self.xUITest.executeCommand(".uno:GoDown") + self.xUITest.executeCommand(".uno:GoUp") + #press Enter + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + #Verify + self.assertEqual(get_state_as_dict(gridwin)["CurrentRow"], "1") + + #Go to Tools -> Options -> LibreOffice Calc -> General + 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 + xaligncb = xDialogOpt.getChild("aligncb") + xalignlb = xDialogOpt.getChild("alignlb") + if (get_state_as_dict(xaligncb)["Selected"]) == "false": + xaligncb.executeAction("CLICK", tuple()) + #Up + props = {"TEXT": "Up"} + actionProps = mkPropertyValues(props) + xalignlb.executeAction("SELECT", actionProps) + + xOKBtn = xDialogOpt.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #Select cell A2 + #and down up to "deselect" range + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A2"})) + self.xUITest.executeCommand(".uno:GoDown") + self.xUITest.executeCommand(".uno:GoUp") + #press Enter + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + #Verify + self.assertEqual(get_state_as_dict(gridwin)["CurrentRow"], "0") + + #Go to Tools -> Options -> LibreOffice Calc -> General + 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 + xaligncb = xDialogOpt.getChild("aligncb") + xalignlb = xDialogOpt.getChild("alignlb") + if (get_state_as_dict(xaligncb)["Selected"]) == "false": + xaligncb.executeAction("CLICK", tuple()) + #Right + props = {"TEXT": "Right"} + actionProps = mkPropertyValues(props) + xalignlb.executeAction("SELECT", actionProps) + + xOKBtn = xDialogOpt.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #Select cell A1 + #and down up to "deselect" range + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + self.xUITest.executeCommand(".uno:GoDown") + self.xUITest.executeCommand(".uno:GoUp") + #press Enter + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + #Verify + self.assertEqual(get_state_as_dict(gridwin)["CurrentColumn"], "1") + + #Go to Tools -> Options -> LibreOffice Calc -> General + 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 + xaligncb = xDialogOpt.getChild("aligncb") + xalignlb = xDialogOpt.getChild("alignlb") + if (get_state_as_dict(xaligncb)["Selected"]) == "false": + xaligncb.executeAction("CLICK", tuple()) + #Left + props = {"TEXT": "Left"} + actionProps = mkPropertyValues(props) + xalignlb.executeAction("SELECT", actionProps) + + xOKBtn = xDialogOpt.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #Select cell B1 + #and down up to "deselect" range + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B1"})) + self.xUITest.executeCommand(".uno:GoDown") + self.xUITest.executeCommand(".uno:GoUp") + #press Enter + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + #Verify + self.assertEqual(get_state_as_dict(gridwin)["CurrentColumn"], "0") + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab:
\ No newline at end of file diff --git a/sc/qa/uitest/options/tdf122977.py b/sc/qa/uitest/options/tdf122977.py new file mode 100644 index 000000000..11d0ff988 --- /dev/null +++ b/sc/qa/uitest/options/tdf122977.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 122977 - CRASH: "Tools"->"Options" "LibreOfficeDev"->"Charts"->"Default Colors" + +class chartDefaultColors(UITestCase): + def test_tdf122977_crash_chart_default_colors_options(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() + + #Go to Tools -> Options -> Charts -> Default Colors + self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog + xDialogOpt = self.xUITest.getTopFocusWindow() + + xPages = xDialogOpt.getChild("pages") + xChartEntry = xPages.getChild('5') # Charts + xChartEntry.executeAction("EXPAND", tuple()) + xChartGeneralEntry = xChartEntry.getChild('0') + xChartGeneralEntry.executeAction("SELECT", tuple()) #Default Colors + xColors = xDialogOpt.getChild("colors") + xAdd = xDialogOpt.getChild("add") + xDelete = xDialogOpt.getChild("delete") + xDefault = xDialogOpt.getChild("default") + + #click Default - reset + xDefault.executeAction("CLICK", tuple()) + nrDefaultColors = get_state_as_dict(xColors)["Children"] + nrDefaultColors1 = int(nrDefaultColors) + 1 + xAdd.executeAction("CLICK", tuple()) #add new color + self.assertEqual(get_state_as_dict(xColors)["Children"], str(nrDefaultColors1)) + + #delete new color + def handle_delete_dlg(dialog): + xyesBtn = dialog.getChild("yes") + self.ui_test.close_dialog_through_button(xyesBtn) + + self.ui_test.execute_blocking_action(xDelete.executeAction, args=('CLICK', ()), + dialog_handler=handle_delete_dlg) + self.assertEqual(get_state_as_dict(xColors)["Children"], nrDefaultColors) + + xAdd.executeAction("CLICK", tuple()) #add new color + self.assertEqual(get_state_as_dict(xColors)["Children"], str(nrDefaultColors1)) + #click Default + xDefault.executeAction("CLICK", tuple()) + self.assertEqual(get_state_as_dict(xColors)["Children"], nrDefaultColors) + + xCancelBtn = xDialogOpt.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/pageFormat/tdf123508.py b/sc/qa/uitest/pageFormat/tdf123508.py new file mode 100644 index 000000000..37d309815 --- /dev/null +++ b/sc/qa/uitest/pageFormat/tdf123508.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 +from uitest.uihelper.common import get_state_as_dict, type_text +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 123508 - "Fit print range(s) to width/height" value falls back to default when window closes + +class tdf123508(UITestCase): + def test_tdf123508_format_page_scale(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf123508.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #open "Format > Page - Sheet > Scale + self.ui_test.execute_dialog_through_command(".uno:PageFormatDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "6") #tab Scale + scalingMode = xDialog.getChild("comboLB_SCALEMODE") + spinEDSCALEPAGEWIDTH = xDialog.getChild("spinED_SCALEPAGEWIDTH") + spinEDSCALEPAGEHEIGHT = xDialog.getChild("spinED_SCALEPAGEHEIGHT") + #select "Fit print range(s) to width/height" from the scale mode drop-down list + props = {"TEXT": "Fit print range(s) to width/height"} + actionProps = mkPropertyValues(props) + scalingMode.executeAction("SELECT", actionProps) + #define a value for the page, e.g.: width 2; height 2 + spinEDSCALEPAGEWIDTH.executeAction("UP", tuple()) + spinEDSCALEPAGEHEIGHT.executeAction("UP", tuple()) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #verify + self.ui_test.execute_dialog_through_command(".uno:PageFormatDialog") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "6") #tab Scale + scalingMode = xDialog.getChild("comboLB_SCALEMODE") + spinEDSCALEPAGEWIDTH = xDialog.getChild("spinED_SCALEPAGEWIDTH") + spinEDSCALEPAGEHEIGHT = xDialog.getChild("spinED_SCALEPAGEHEIGHT") + + self.assertEqual(get_state_as_dict(scalingMode)["SelectEntryText"], "Fit print range(s) to width/height") + self.assertEqual(get_state_as_dict(spinEDSCALEPAGEWIDTH)["Text"], "2") + self.assertEqual(get_state_as_dict(spinEDSCALEPAGEHEIGHT)["Text"], "2") + + xCancelBtn = xDialog.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/protect/protectSheet.py b/sc/qa/uitest/protect/protectSheet.py new file mode 100644 index 000000000..90030b532 --- /dev/null +++ b/sc/qa/uitest/protect/protectSheet.py @@ -0,0 +1,62 @@ +# -*- 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 + +class protectSheet(UITestCase): + def test_protect_sheet(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 password - lock + self.ui_test.execute_dialog_through_command(".uno:Protect") + xDialog = self.xUITest.getTopFocusWindow() + xprotect = xDialog.getChild("protect") + xpassword1 = xDialog.getChild("password1") + xpassword2 = xDialog.getChild("password2") + + if (get_state_as_dict(xprotect)["Selected"]) == "false": + xprotect.executeAction("CLICK", tuple()) + xpassword1.executeAction("TYPE", mkPropertyValues({"TEXT":"aa"})) + xpassword2.executeAction("TYPE", mkPropertyValues({"TEXT":"aa"})) + + xOKBtn = xDialog.getChild("ok") +# self.ui_test.close_dialog_through_button(xOKBtn) + xOKBtn.executeAction("CLICK", tuple()) + #Unlock + + self.ui_test.execute_dialog_through_command(".uno:Protect") + xDialog = self.xUITest.getTopFocusWindow() + xpass1ed = xDialog.getChild("pass1ed") + + xpass1ed.executeAction("TYPE", mkPropertyValues({"TEXT":"aa"})) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #Verify - the sheet is unlocked + enter_text_to_cell(gridwin, "B2", "A") + self.assertEqual(get_cell_by_position(document, 0, 1, 1).getString(), "A") + + # test cancel button + self.ui_test.execute_dialog_through_command(".uno:Protect") + xDialog = self.xUITest.getTopFocusWindow() + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + enter_text_to_cell(gridwin, "B2", "B") + self.assertEqual(get_cell_by_position(document, 0, 1, 1).getString(), "B") + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/protect/protectSpreadsheet.py b/sc/qa/uitest/protect/protectSpreadsheet.py new file mode 100644 index 000000000..c0b78943f --- /dev/null +++ b/sc/qa/uitest/protect/protectSpreadsheet.py @@ -0,0 +1,46 @@ +# -*- 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 + +class protectSpreadsheet(UITestCase): + def test_protect_spreadsheet(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 password + self.ui_test.execute_dialog_through_command(".uno:ToolProtectionDocument") + xDialog = self.xUITest.getTopFocusWindow() + xpass1ed = xDialog.getChild("pass1ed") + xconfirm1ed = xDialog.getChild("confirm1ed") + + xpass1ed.executeAction("TYPE", mkPropertyValues({"TEXT":"aa"})) + xconfirm1ed.executeAction("TYPE", mkPropertyValues({"TEXT":"aa"})) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #Verify + self.ui_test.execute_dialog_through_command(".uno:ToolProtectionDocument") + xDialog = self.xUITest.getTopFocusWindow() + xpass1ed = xDialog.getChild("pass1ed") + + xpass1ed.executeAction("TYPE", mkPropertyValues({"TEXT":"aa"})) + + xCancelBtn = xDialog.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/range_name/tdf119954.py b/sc/qa/uitest/range_name/tdf119954.py new file mode 100644 index 000000000..c7ac8d56c --- /dev/null +++ b/sc/qa/uitest/range_name/tdf119954.py @@ -0,0 +1,88 @@ +# -*- 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.uihelper.common import get_state_as_dict, type_text +from uitest.uihelper.keyboard import select_all +from uitest.debug import sleep +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 119954 - Using a second defined database range in formula expression switches to first range. + +class tdf119954(UITestCase): + def test_tdf119954_second_db_range(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf119954.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #* new document + #* in A1 enter 1 + #* in C3 enter 2 + #* on A1 define a database range 'aaa' with $Sheet1.$A$1 + #* on C3 define a database range 'bbb' with $Sheet2.$C$3 + #* in any cell enter formula =bbb + # => result is 1 instead of 2 + #* place cell cursor on that formula cell again + # => see that the formula is =aaa instead of =bbb + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + self.ui_test.execute_modeless_dialog_through_command(".uno:DefineDBName") + xDefineNameDlg = self.xUITest.getTopFocusWindow() + + xEntryBox = xDefineNameDlg.getChild("entry") + type_text(xEntryBox, "aaa") + add = xDefineNameDlg.getChild("add") + assign = xDefineNameDlg.getChild("assign") + add.executeAction("CLICK", tuple()) + xOkBtn = xDefineNameDlg.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + self.ui_test.execute_modeless_dialog_through_command(".uno:DefineDBName") + xDefineNameDlg = self.xUITest.getTopFocusWindow() + xEntryBox = xDefineNameDlg.getChild("entry") + assign = xDefineNameDlg.getChild("assign") + select_all(xEntryBox) + type_text(xEntryBox, "bbb") + select_all(assign) + type_text(assign, "$Sheet2.$C$3") + add.executeAction("CLICK", tuple()) + + xOkBtn = xDefineNameDlg.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) + + enter_text_to_cell(gridwin, "B2", "=bbb") + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + self.assertEqual(get_cell_by_position(document, 0, 1, 1).getValue(), 2) + + enter_text_to_cell(gridwin, "C2", "=aaa") + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + self.assertEqual(get_cell_by_position(document, 0, 2, 1).getValue(), 1) + + self.xUITest.executeCommand(".uno:Undo") + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 2, 1).getValue(), 0) + self.assertEqual(get_cell_by_position(document, 0, 1, 1).getValue(), 0) + self.assertEqual(get_cell_by_position(document, 0, 1, 2).getFormula(), "") + self.assertEqual(get_cell_by_position(document, 0, 1, 1).getFormula(), "") + + # check cancel button + self.ui_test.execute_modeless_dialog_through_command(".uno:DefineDBName") + xDefineNameDlg = self.xUITest.getTopFocusWindow() + xCancelBtn = xDefineNameDlg.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/range_name/tdf86214.py b/sc/qa/uitest/range_name/tdf86214.py new file mode 100644 index 000000000..d529a47b9 --- /dev/null +++ b/sc/qa/uitest/range_name/tdf86214.py @@ -0,0 +1,58 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from libreoffice.uno.propertyvalue import mkPropertyValues + +from uitest.framework import UITestCase +from uitest.uihelper.common import type_text, get_state_as_dict +from uitest.uihelper.keyboard import select_all + +class InvalidNames(UITestCase): + + def test_invalid_names(self): + + self.ui_test.create_doc_in_start_center("calc") + + self.ui_test.execute_modeless_dialog_through_command(".uno:AddName") + + xAddNameDlg = self.xUITest.getTopFocusWindow() + + invalid_names = ["A1", "12", "1.2", "A1:B2", "test.a", \ + "test+", "test-", "test*", "test!abc", "test#", \ + "test^", "test°", "test$", "test§", "test%", \ + "test&", "test/", "test(", "test)", "test[", "test]", \ + "test\\", "test`", "test´", "test'", "test~", "test<", \ + "tst>", "test|", "test:t", "test;z"] + + xLabel = xAddNameDlg.getChild("label") + xAddBtn = xAddNameDlg.getChild("add") + xEdit = xAddNameDlg.getChild("edit") + + success_text = get_state_as_dict(xLabel)["Text"] + + for name in invalid_names: + with self.subTest(name = name): + select_all(xEdit) + type_text(xEdit, name) + + new_text = get_state_as_dict(xLabel)["Text"] + self.assertNotEqual(success_text, new_text) + self.assertEqual(get_state_as_dict(xAddBtn)["Enabled"], "false") + + + select_all(xEdit) + type_text(xEdit, "valid_name") + + new_text = get_state_as_dict(xLabel)["Text"] + self.assertEqual(success_text, new_text) + self.assertEqual(get_state_as_dict(xAddBtn)["Enabled"], "true") + + self.ui_test.close_dialog_through_button(xAddBtn) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/search_replace/data/tdf106194.ods b/sc/qa/uitest/search_replace/data/tdf106194.ods Binary files differnew file mode 100644 index 000000000..acc4199f3 --- /dev/null +++ b/sc/qa/uitest/search_replace/data/tdf106194.ods diff --git a/sc/qa/uitest/search_replace/data/tdf35020.ods b/sc/qa/uitest/search_replace/data/tdf35020.ods Binary files differnew file mode 100644 index 000000000..ef9a5455d --- /dev/null +++ b/sc/qa/uitest/search_replace/data/tdf35020.ods diff --git a/sc/qa/uitest/search_replace/data/tdf39959.ods b/sc/qa/uitest/search_replace/data/tdf39959.ods Binary files differnew file mode 100644 index 000000000..971bf877c --- /dev/null +++ b/sc/qa/uitest/search_replace/data/tdf39959.ods diff --git a/sc/qa/uitest/search_replace/data/tdf44861.ods b/sc/qa/uitest/search_replace/data/tdf44861.ods Binary files differnew file mode 100644 index 000000000..d4dd9efb4 --- /dev/null +++ b/sc/qa/uitest/search_replace/data/tdf44861.ods diff --git a/sc/qa/uitest/search_replace/replace.py b/sc/qa/uitest/search_replace/replace.py new file mode 100644 index 000000000..ae28348be --- /dev/null +++ b/sc/qa/uitest/search_replace/replace.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.path import get_srcdir_url + +from libreoffice.uno.propertyvalue import mkPropertyValues +from libreoffice.calc.document import get_row + +from uitest.uihelper.common import get_state_as_dict + +import time + +def get_url_for_data_file(file_name): + return get_srcdir_url() + "/sc/qa/uitest/search_replace/data/" + file_name + +class ReplaceTest(UITestCase): + + def test_tdf106194(self): + doc = self.ui_test.load_file(get_url_for_data_file("tdf106194.ods")) + + xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") + + self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog") + + xSearchDlg = self.xUITest.getTopFocusWindow() + + xSearchTerm = xSearchDlg.getChild("searchterm") + xSearchTerm.executeAction("TYPE", mkPropertyValues({"TEXT": "1"})) + xReplaceTerm = xSearchDlg.getChild("replaceterm") + xReplaceTerm.executeAction("TYPE", mkPropertyValues({"TEXT": "2"})) + + xSearchBtn = xSearchDlg.getChild("search") + xSearchBtn.executeAction("CLICK", tuple()) + + self.assertEqual(get_state_as_dict(xGridWin)["CurrentRow"], "1") + lastTopVisibleRow = int(get_state_as_dict(xGridWin)["TopVisibleRow"]) + + # start replacing + xReplaceBtn = xSearchDlg.getChild("replace") + xReplaceBtn.executeAction("CLICK", tuple()) + + # check position and visible range + self.assertEqual(get_state_as_dict(xGridWin)["CurrentRow"], "199") + currentTopVisibleRow = int(get_state_as_dict(xGridWin)["TopVisibleRow"]) + self.assertGreater(currentTopVisibleRow, lastTopVisibleRow) + + lastTopVisibleRow = currentTopVisibleRow + + # replace again + xReplaceBtn.executeAction("CLICK", tuple()) + + # check position and visible range + self.assertEqual(get_state_as_dict(xGridWin)["CurrentRow"], "499") + currentTopVisibleRow = int(get_state_as_dict(xGridWin)["TopVisibleRow"]) + self.assertGreater(currentTopVisibleRow, lastTopVisibleRow) + + xReplaceBtn.executeAction("CLICK", tuple()) + + xCloseBtn = xSearchDlg.getChild("close") + + self.ui_test.close_dialog_through_button(xCloseBtn) + + self.ui_test.close_doc() diff --git a/sc/qa/uitest/search_replace/tdf132097.py b/sc/qa/uitest/search_replace/tdf132097.py new file mode 100644 index 000000000..5585befb6 --- /dev/null +++ b/sc/qa/uitest/search_replace/tdf132097.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 + +class tdf132097(UITestCase): + + def test_tdf132097(self): + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + + self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog") + xDialog = self.xUITest.getTopFocusWindow() + xCols = xDialog.getChild('cols') + xSearchTerm = xDialog.getChild("searchterm") + xBackSearch = xDialog.getChild("backsearch") + xSeachLabel = xDialog.getChild("searchlabel") + + xCols.executeAction("CLICK", tuple()) + xSearchTerm.executeAction("TYPE", mkPropertyValues({"TEXT":"TEST"})) + + for i in range(10): + # without the fix in place it would crash here. + # Sometimes it doesn't crash at first so try a few times to be sure + xBackSearch.executeAction("CLICK", tuple()) + + self.assertEqual(get_state_as_dict(xSeachLabel)["Text"], "Search key not found") + + xcloseBtn = xDialog.getChild("close") + self.ui_test.close_dialog_through_button(xcloseBtn) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/search_replace/tdf132783.py b/sc/qa/uitest/search_replace/tdf132783.py new file mode 100644 index 000000000..097eaa8c2 --- /dev/null +++ b/sc/qa/uitest/search_replace/tdf132783.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.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 tdf132783(UITestCase): + + def test_tdf132783(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf132783.ods")) + + for i in range(5): + self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog") + xDialog = self.xUITest.getTopFocusWindow() + xSearchTerm = xDialog.getChild("searchterm") + + xSearchTerm.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) + + xSearch = xDialog.getChild("search") + xSearch.executeAction("CLICK", tuple()) + + xcloseBtn = xDialog.getChild("close") + self.ui_test.close_dialog_through_button(xcloseBtn) + + xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") + self.assertEqual(get_state_as_dict(xGridWin)["CurrentRow"], "1") + self.assertEqual(get_state_as_dict(xGridWin)["CurrentColumn"], str( 96 + i)) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/search_replace/tdf35020.py b/sc/qa/uitest/search_replace/tdf35020.py new file mode 100644 index 000000000..a0412697e --- /dev/null +++ b/sc/qa/uitest/search_replace/tdf35020.py @@ -0,0 +1,57 @@ +# -*- 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.uihelper.common import get_state_as_dict, type_text +from uitest.debug import sleep +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 35020 - Find and Replace changes case of sheet name in formulas + +class tdf35020(UITestCase): + def test_tdf39959_find_replace_all_sheets(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf35020.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog") + xDialog = self.xUITest.getTopFocusWindow() + searchterm = xDialog.getChild("searchterm") + searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"X6"})) + replaceterm = xDialog.getChild("replaceterm") + replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"A6"})) #replace textbox + allsheets = xDialog.getChild("allsheets") + allsheets.executeAction("CLICK", tuple()) + calcsearchin = xDialog.getChild("calcsearchin") + props = {"TEXT": "Formulas"} + actionProps = mkPropertyValues(props) + calcsearchin.executeAction("SELECT", actionProps) + replaceall = xDialog.getChild("replaceall") + replaceall.executeAction("CLICK", tuple()) + xcloseBtn = xDialog.getChild("close") + self.ui_test.close_dialog_through_button(xcloseBtn) + + #verify Sheet1.A13 A14 = 2 + self.assertEqual(get_cell_by_position(document, 0, 0, 12).getValue(), 2) + self.assertEqual(get_cell_by_position(document, 0, 0, 13).getValue(), 2) + #Undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 0, 12).getValue(), 1) + self.assertEqual(get_cell_by_position(document, 0, 0, 13).getValue(), 1) + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/search_replace/tdf39917.py b/sc/qa/uitest/search_replace/tdf39917.py new file mode 100644 index 000000000..1af5b9c39 --- /dev/null +++ b/sc/qa/uitest/search_replace/tdf39917.py @@ -0,0 +1,111 @@ +# -*- 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.uihelper.common import get_state_as_dict, type_text +from uitest.debug import sleep + +#Bug 39917 - EDITING Find/Replace modifies formula in R1C1 syntax to invalid lowercase + +class tdf39917(UITestCase): + def test_tdf39917_find_replace_R1C1(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() + #* Tools --> Options --> Calc --> Formula --> Syntax = Excel R1C1 + 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()) + xCalcFormulaEntry = xCalcEntry.getChild('4') + xCalcFormulaEntry.executeAction("SELECT", tuple()) #Formula + + formulasyntax = xDialogOpt.getChild("formulasyntax") + #Excel R1C1 + props = {"TEXT": "Excel R1C1"} + actionProps = mkPropertyValues(props) + formulasyntax.executeAction("SELECT", actionProps) + + xOKBtn = xDialogOpt.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #1. Create a workbook with 3 sheets: Page1, Page2, Page3. + # 2. Tools -> Options -> LibreOffice Calc -> Formula: Set syntax to Excel A1 + # 5. Fill fields: + + self.ui_test.execute_dialog_through_command(".uno:Insert") #insert sheet + xDialog = self.xUITest.getTopFocusWindow() + after = xDialog.getChild("after") + after.executeAction("CLICK", tuple()) + nameed = xDialog.getChild("nameed") + nameed.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + nameed.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + nameed.executeAction("TYPE", mkPropertyValues({"TEXT":"Page2"})) + xOKButton = xDialog.getChild("ok") + xOKButton.executeAction("CLICK", tuple()) + self.ui_test.execute_dialog_through_command(".uno:Insert") #insert sheet + xDialog = self.xUITest.getTopFocusWindow() + after = xDialog.getChild("after") + after.executeAction("CLICK", tuple()) + nameed = xDialog.getChild("nameed") + nameed.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + nameed.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + nameed.executeAction("TYPE", mkPropertyValues({"TEXT":"Page3"})) + xOKButton = xDialog.getChild("ok") + xOKButton.executeAction("CLICK", tuple()) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RIGHT"})) + # 3. Type in (for example) B4: =Page2!B4 + enter_text_to_cell(gridwin, "B4", "=Page2!RC") + # 4. Edit -> Find and Replace + # Find: Page2 + # Replace: Page3 + # 6. Press Replace all + self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog") + xDialog = self.xUITest.getTopFocusWindow() + searchterm = xDialog.getChild("searchterm") + searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"Page2"})) + replaceterm = xDialog.getChild("replaceterm") + replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"Page3"})) #replace textbox + replace = xDialog.getChild("replace") + replace.executeAction("CLICK", tuple()) + replace.executeAction("CLICK", tuple()) + xcloseBtn = xDialog.getChild("close") + self.ui_test.close_dialog_through_button(xcloseBtn) + + #verify + enter_text_to_cell(gridwin, "A1", "=FORMULA(R[3]C[1])") + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "=Page3!RC") + #Give it back Tools --> Options --> Calc --> Formula --> Syntax = Calc A1 + 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()) + xCalcFormulaEntry = xCalcEntry.getChild('4') + xCalcFormulaEntry.executeAction("SELECT", tuple()) #Formula + + formulasyntax = xDialogOpt.getChild("formulasyntax") + #Excel R1C1 + props = {"TEXT": "Calc A1"} + actionProps = mkPropertyValues(props) + formulasyntax.executeAction("SELECT", actionProps) + + xOKBtn = xDialogOpt.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/search_replace/tdf39959.py b/sc/qa/uitest/search_replace/tdf39959.py new file mode 100644 index 000000000..1f7c6a7a7 --- /dev/null +++ b/sc/qa/uitest/search_replace/tdf39959.py @@ -0,0 +1,59 @@ +# -*- 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.uihelper.common import get_state_as_dict, type_text +from uitest.debug import sleep +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 39959 - Find-and-replace doesn't search all tables anymore + +class tdf39959(UITestCase): + def test_tdf39959_find_replace_all_sheets(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf39959.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + # 1. Open a new document + # 2. Enter "asdf" in A1 + # 3. Activate Sheet2 + # 4. Try Find-and-replace (Ctrl+Alt+F) to search for "asdf" + # Whether the checkbox "in allen Tabellen suchen" is activated or not: LibO Calc never seems to find the text + + self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog") + xDialog = self.xUITest.getTopFocusWindow() + searchterm = xDialog.getChild("searchterm") + searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"asdf"})) + replaceterm = xDialog.getChild("replaceterm") + replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"bbb"})) #replace textbox + allsheets = xDialog.getChild("allsheets") + allsheets.executeAction("CLICK", tuple()) + replaceall = xDialog.getChild("replaceall") + replaceall.executeAction("CLICK", tuple()) + # print(xDialog.getChildren()) + xcloseBtn = xDialog.getChild("close") + self.ui_test.close_dialog_through_button(xcloseBtn) + + #verify Sheet2.A1 = "bbb" + self.assertEqual(get_cell_by_position(document, 1, 0, 0).getString(), "bbb ") + self.assertEqual(get_cell_by_position(document, 1, 0, 2).getString(), "abc") + #Undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 1, 0, 0).getString(), "asdf ") + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/search_replace/tdf44398.py b/sc/qa/uitest/search_replace/tdf44398.py new file mode 100644 index 000000000..c44305cb0 --- /dev/null +++ b/sc/qa/uitest/search_replace/tdf44398.py @@ -0,0 +1,93 @@ +# -*- 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.uihelper.common import get_state_as_dict, type_text +from uitest.debug import sleep + +#Bug 44398 - : Find, replace, regular expression bug + +class tdf44398(UITestCase): + def test_tdf44398_find_replace_regexp(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. A1 => 123456 + enter_text_to_cell(gridwin, "A1", "123456") + # 2. ctrl-h, in dialog + # Search: ([0-9]) + # Replace: $1 + # check regular expression + # hit replace all + + self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog") + xDialog = self.xUITest.getTopFocusWindow() + searchterm = xDialog.getChild("searchterm") + searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"([0-9])"})) + replaceterm = xDialog.getChild("replaceterm") + replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"$1"})) #replace textbox + regexp = xDialog.getChild("regexp") + regexp.executeAction("CLICK", tuple()) #regular expressions + replaceall = xDialog.getChild("replaceall") + replaceall.executeAction("CLICK", tuple()) + xcloseBtn = xDialog.getChild("close") + self.ui_test.close_dialog_through_button(xcloseBtn) + + #verify 3. A1 => 123456 + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "123456") + + self.ui_test.close_doc() + + def test_tdf44398_find_replace_regexp_string(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. A1 => VarNumberA + enter_text_to_cell(gridwin, "A1", "VarNumberA") + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RIGHT"})) + # 2. ctrl-h, in dialog + # Search: ([A-Z]) + # Replace: <space>$1 + # check regular expression + # check case + # hit replace all + + self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog") + xDialog = self.xUITest.getTopFocusWindow() + searchterm = xDialog.getChild("searchterm") + searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"([A-Z])"})) + replaceterm = xDialog.getChild("replaceterm") + replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":" $1"})) #replace textbox + regexp = xDialog.getChild("regexp") + if (get_state_as_dict(regexp)["Selected"]) == "false": + regexp.executeAction("CLICK", tuple()) #regular expressions + matchcase = xDialog.getChild("matchcase") + matchcase.executeAction("CLICK", tuple()) #case + + replaceall = xDialog.getChild("replaceall") + replaceall.executeAction("CLICK", tuple()) + + xcloseBtn = xDialog.getChild("close") + self.ui_test.close_dialog_through_button(xcloseBtn) + + #verify A1 => ' Var Number A' + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), " Var Number A") + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/search_replace/tdf44861.py b/sc/qa/uitest/search_replace/tdf44861.py new file mode 100644 index 000000000..de60cab07 --- /dev/null +++ b/sc/qa/uitest/search_replace/tdf44861.py @@ -0,0 +1,59 @@ +# -*- 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.uihelper.common import get_state_as_dict, type_text +from uitest.debug import sleep +import org.libreoffice.unotest +import pathlib + +#Bug 44861 - EDITING: result 'Find&Replace All' wrong for particular Regular Expression +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +class tdf44861(UITestCase): + def test_tdf44861_find_replaceAll_regexp(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf44861.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + # 2. ctrl-h, in dialog + # Search: ([0-9]{2})([0-9]{2}) + # Replace: $1.$2 + # check option "Enable regular expressions" + # Press "Replace all" + + self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog") + xDialog = self.xUITest.getTopFocusWindow() + searchterm = xDialog.getChild("searchterm") + searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"([0-9]{2})([0-9]{2})"})) + replaceterm = xDialog.getChild("replaceterm") + replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"$1.$2"})) #replace textbox + regexp = xDialog.getChild("regexp") + if (get_state_as_dict(regexp)["Selected"]) == "false": + regexp.executeAction("CLICK", tuple()) #regular expressions + replaceall = xDialog.getChild("replaceall") + replaceall.executeAction("CLICK", tuple()) + xcloseBtn = xDialog.getChild("close") + self.ui_test.close_dialog_through_button(xcloseBtn) + + #Expected: instead of 1345-1430 appears 13.45-14.30 + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "13.45-14.30") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "13.45-14.30") + self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "14.50-15.30") + self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "12.55-13.35") + self.assertEqual(get_cell_by_position(document, 0, 0, 4).getString(), "12.30-13.40") + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/signatureLine/insertSignatureLine.py b/sc/qa/uitest/signatureLine/insertSignatureLine.py new file mode 100644 index 000000000..51a321b34 --- /dev/null +++ b/sc/qa/uitest/signatureLine/insertSignatureLine.py @@ -0,0 +1,99 @@ +# -*- 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 libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict, type_text +from libreoffice.uno.propertyvalue import mkPropertyValues +from com.sun.star.lang import IndexOutOfBoundsException + +#Bug 117903 - Allow signature lines in Calc + +class insertSignatureLineCalc(UITestCase): + + def test_insert_signature_line_calc(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() + + # cancel the dialog without doing anything + self.ui_test.execute_dialog_through_command(".uno:InsertSignatureLine") + xDialog = self.xUITest.getTopFocusWindow() + + xName = xDialog.getChild("edit_name") + xName.executeAction("TYPE", mkPropertyValues({"TEXT":"Name"})) #set the signature line + + xCloseBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCloseBtn) + with self.assertRaises(IndexOutOfBoundsException): + document.Sheets.getByIndex(0).DrawPage.getByIndex(0) + + # set the signature line + self.ui_test.execute_dialog_through_command(".uno:InsertSignatureLine") + xDialog = self.xUITest.getTopFocusWindow() + + xName = xDialog.getChild("edit_name") + xTitle = xDialog.getChild("edit_title") + xEmail = xDialog.getChild("edit_email") + xComment = xDialog.getChild("checkbox_can_add_comments") + xInstructions = xDialog.getChild("edit_instructions") + + xName.executeAction("TYPE", mkPropertyValues({"TEXT":"Name"})) #set the signature line + xTitle.executeAction("TYPE", mkPropertyValues({"TEXT":"Title"})) + xEmail.executeAction("TYPE", mkPropertyValues({"TEXT":"Email"})) + xComment.executeAction("CLICK", tuple()) + xInstructions.executeAction("TYPE", mkPropertyValues({"TEXT":"Instructions"})) + xOKBtn = xDialog.getChild("ok") + xOKBtn.executeAction("CLICK", tuple()) + + #check the signature Line in the document + self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineSuggestedSignerName, "Name") + self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineSuggestedSignerTitle, "Title") + self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineSuggestedSignerEmail, "Email") + self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineSuggestedSignerTitle, "Title") + self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineCanAddComment, False) + self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineShowSignDate, True) + self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineSigningInstructions, "Instructions") + + self.ui_test.close_doc() + + def test_insert_signature_line2_calc(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.ui_test.execute_dialog_through_command(".uno:InsertSignatureLine") + xDialog = self.xUITest.getTopFocusWindow() + + xName = xDialog.getChild("edit_name") + xTitle = xDialog.getChild("edit_title") + xEmail = xDialog.getChild("edit_email") + xComment = xDialog.getChild("checkbox_can_add_comments") + xDate = xDialog.getChild("checkbox_show_sign_date") + xInstructions = xDialog.getChild("edit_instructions") + + xName.executeAction("TYPE", mkPropertyValues({"TEXT":"Name"})) #set the signature line + xTitle.executeAction("TYPE", mkPropertyValues({"TEXT":"Title"})) + xEmail.executeAction("TYPE", mkPropertyValues({"TEXT":"Email"})) + xDate.executeAction("CLICK", tuple()) + xComment.executeAction("CLICK", tuple()) + xInstructions.executeAction("TYPE", mkPropertyValues({"TEXT":"Instructions"})) + xOKBtn = xDialog.getChild("ok") + xOKBtn.executeAction("CLICK", tuple()) + + #check the signature Line in the document + self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineSuggestedSignerName, "Name") + self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineSuggestedSignerTitle, "Title") + self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineSuggestedSignerEmail, "Email") + self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineSuggestedSignerTitle, "Title") + self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineCanAddComment, False) + self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineShowSignDate, False) + self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineSigningInstructions, "Instructions") + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/solver/solver.py b/sc/qa/uitest/solver/solver.py new file mode 100644 index 000000000..9deca2174 --- /dev/null +++ b/sc/qa/uitest/solver/solver.py @@ -0,0 +1,61 @@ +# -*- 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() + +class solver(UITestCase): + def test_solver(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("solver.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B4"})) + self.ui_test.execute_modeless_dialog_through_command(".uno:SolverDialog") + xDialog = self.xUITest.getTopFocusWindow() + xtargetedit = xDialog.getChild("targetedit") + xvalue = xDialog.getChild("value") + xvalueedit = xDialog.getChild("valueedit") + xchangeedit = xDialog.getChild("changeedit") + xref1edit = xDialog.getChild("ref1edit") + xval1edit = xDialog.getChild("val1edit") + xref2edit = xDialog.getChild("ref2edit") + xval2edit = xDialog.getChild("val2edit") + xop2list = xDialog.getChild("op2list") + + xvalue.executeAction("CLICK", tuple()) + xvalueedit.executeAction("TYPE", mkPropertyValues({"TEXT":"1000"})) + xchangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"C2"})) + xref1edit.executeAction("TYPE", mkPropertyValues({"TEXT":"C2"})) + xval1edit.executeAction("TYPE", mkPropertyValues({"TEXT":"C4"})) + xref2edit.executeAction("TYPE", mkPropertyValues({"TEXT":"C4"})) + props = {"TEXT": "=>"} + actionProps = mkPropertyValues(props) + xop2list.executeAction("SELECT", actionProps) + + xval2edit.executeAction("TYPE", mkPropertyValues({"TEXT":"0"})) + xOKBtn = xDialog.getChild("ok") + def handle_OK_dlg(dialog): + #('SolverSuccessDialog', 'cancel', 'dialog-action_area1', 'dialog-vbox1', 'grid1', 'label1', 'label2', 'ok', 'result') + xYesButn = dialog.getChild("ok") + self.ui_test.close_dialog_through_button(xYesButn) + + self.ui_test.execute_blocking_action(xOKBtn.executeAction, args=('CLICK', ()), + dialog_handler=handle_OK_dlg) + #verify + self.assertEqual(get_cell_by_position(document, 0, 1, 1).getValue(), 400) + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/sort/tdf49531.py b/sc/qa/uitest/sort/tdf49531.py new file mode 100644 index 000000000..d88633c4e --- /dev/null +++ b/sc/qa/uitest/sort/tdf49531.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 +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 49531 - EDITING: Sort rows for will sort columns +#Bug 49520 - EDITING: CRASH when undo sort with chart +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +class tdf49531(UITestCase): + def test_td49531_sort_undo_crash(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf49531.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #select A3:C147 + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A3:C147"})) + + #Menu 'Data -> Sort -> Top to bottom - all otheroptions unchecked + #Column B - 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") + if (get_state_as_dict(xNatural)["Selected"]) == "true": + xNatural.executeAction("CLICK", tuple()) + if (get_state_as_dict(xHeader)["Selected"]) == "true": + xHeader.executeAction("CLICK", tuple()) + xtopdown.executeAction("CLICK", tuple()) + select_pos(xTabs, "0") + xSortKey1 = xDialog.getChild("sortlb") + xAsc = xDialog.getChild("up") + props = {"TEXT": "Column B"} + actionProps = mkPropertyValues(props) + xSortKey1.executeAction("SELECT", actionProps) + xAsc.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(), "x") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "0") + self.assertEqual(get_cell_by_position(document, 0, 2, 2).getValue(), 111) + self.assertEqual(get_cell_by_position(document, 0, 2, 3).getValue(), 48) + # UNDO Bug 49520 - EDITING: CRASH when undo sort with chart + self.xUITest.executeCommand(".uno:Undo") + # Verify + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "x") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "0") + self.assertEqual(get_cell_by_position(document, 0, 2, 2).getValue(), 2) + self.assertEqual(get_cell_by_position(document, 0, 2, 3).getValue(), 3) + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/statistics/anova.py b/sc/qa/uitest/statistics/anova.py new file mode 100644 index 000000000..50237ef92 --- /dev/null +++ b/sc/qa/uitest/statistics/anova.py @@ -0,0 +1,147 @@ +# -*- 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 + +class anova(UITestCase): + def test_statistic_anova(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() + #fill data + enter_text_to_cell(gridwin, "A1", "Maths") + enter_text_to_cell(gridwin, "A2", "47") + enter_text_to_cell(gridwin, "A3", "36") + enter_text_to_cell(gridwin, "A4", "40") + enter_text_to_cell(gridwin, "A5", "39") + enter_text_to_cell(gridwin, "A7", "47") + enter_text_to_cell(gridwin, "A8", "29") + enter_text_to_cell(gridwin, "A9", "27") + enter_text_to_cell(gridwin, "A10", "57") + enter_text_to_cell(gridwin, "A11", "56") + enter_text_to_cell(gridwin, "A12", "57") + enter_text_to_cell(gridwin, "A13", "26") + + enter_text_to_cell(gridwin, "B1", "Physics") + enter_text_to_cell(gridwin, "B2", "67") + enter_text_to_cell(gridwin, "B3", "68") + enter_text_to_cell(gridwin, "B4", "65") + enter_text_to_cell(gridwin, "B5", "64") + enter_text_to_cell(gridwin, "B6", "38") + enter_text_to_cell(gridwin, "B7", "84") + enter_text_to_cell(gridwin, "B8", "80") + enter_text_to_cell(gridwin, "B9", "49") + enter_text_to_cell(gridwin, "B10", "49") + enter_text_to_cell(gridwin, "B11", "33") + + enter_text_to_cell(gridwin, "C1", "Biology") + enter_text_to_cell(gridwin, "C2", "33") + enter_text_to_cell(gridwin, "C3", "42") + enter_text_to_cell(gridwin, "C4", "44") + enter_text_to_cell(gridwin, "C5", "60") + enter_text_to_cell(gridwin, "C6", "43") + enter_text_to_cell(gridwin, "C7", "62") + enter_text_to_cell(gridwin, "C8", "51") + enter_text_to_cell(gridwin, "C9", "40") + enter_text_to_cell(gridwin, "C10", "12") + enter_text_to_cell(gridwin, "C11", "60") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A2:C13"})) + self.ui_test.execute_modeless_dialog_through_command(".uno:AnalysisOfVarianceDialog") + xDialog = self.xUITest.getTopFocusWindow() + xinputrangeedit = xDialog.getChild("input-range-edit") + xoutputrangeedit = xDialog.getChild("output-range-edit") + xradiotwofactor = xDialog.getChild("radio-two-factor") + xradiosinglefactor = xDialog.getChild("radio-single-factor") + xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") + xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") + xalphaspin = xDialog.getChild("alpha-spin") + + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$2:$C$13"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$F$1"})) + xradiosinglefactor.executeAction("CLICK", tuple()) + xalphaspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xalphaspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xalphaspin.executeAction("TYPE", mkPropertyValues({"TEXT":"0.05"})) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #Verify + self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "ANOVA - Single Factor") + self.assertEqual(get_cell_by_position(document, 0, 5, 1).getString(), "Alpha") + self.assertEqual(get_cell_by_position(document, 0, 5, 3).getString(), "Groups") + self.assertEqual(get_cell_by_position(document, 0, 5, 4).getString(), "Column 1") + self.assertEqual(get_cell_by_position(document, 0, 5, 5).getString(), "Column 2") + self.assertEqual(get_cell_by_position(document, 0, 5, 6).getString(), "Column 3") + self.assertEqual(get_cell_by_position(document, 0, 5, 8).getString(), "Source of Variation") + self.assertEqual(get_cell_by_position(document, 0, 5, 9).getString(), "Between Groups") + self.assertEqual(get_cell_by_position(document, 0, 5, 10).getString(), "Within Groups") + self.assertEqual(get_cell_by_position(document, 0, 5, 11).getString(), "Total") + + self.assertEqual(get_cell_by_position(document, 0, 6, 1).getValue(), 0.05) + self.assertEqual(get_cell_by_position(document, 0, 6, 3).getString(), "Count") + self.assertEqual(get_cell_by_position(document, 0, 6, 4).getValue(), 11) + self.assertEqual(get_cell_by_position(document, 0, 6, 5).getValue(), 10) + self.assertEqual(get_cell_by_position(document, 0, 6, 6).getValue(), 10) + self.assertEqual(get_cell_by_position(document, 0, 6, 8).getString(), "SS") + self.assertEqual(round(get_cell_by_position(document, 0, 6, 9).getValue(),11), 1876.56832844573) + self.assertEqual(round(get_cell_by_position(document, 0, 6, 10).getValue(),10), 6025.1090909091) + #bug 80583 + self.assertEqual(round(get_cell_by_position(document, 0, 6, 11).getValue(),11), 7901.67741935484) + + self.assertEqual(get_cell_by_position(document, 0, 7, 3).getString(), "Sum") + self.assertEqual(get_cell_by_position(document, 0, 7, 4).getValue(), 461) + self.assertEqual(get_cell_by_position(document, 0, 7, 5).getValue(), 597) + self.assertEqual(get_cell_by_position(document, 0, 7, 6).getValue(), 447) + self.assertEqual(get_cell_by_position(document, 0, 7, 8).getString(), "df") + self.assertEqual(get_cell_by_position(document, 0, 7, 9).getValue(), 2) + self.assertEqual(get_cell_by_position(document, 0, 7, 10).getValue(), 28) + self.assertEqual(get_cell_by_position(document, 0, 7, 11).getValue(), 30) + + self.assertEqual(get_cell_by_position(document, 0, 8, 3).getString(), "Mean") + self.assertEqual(round(get_cell_by_position(document, 0, 8, 4).getValue(), 12), 41.909090909091) + self.assertEqual(get_cell_by_position(document, 0, 8, 5).getValue(), 59.7) + self.assertEqual(get_cell_by_position(document, 0, 8, 6).getValue(), 44.7) + self.assertEqual(get_cell_by_position(document, 0, 8, 8).getString(), "MS") + self.assertEqual(round(get_cell_by_position(document, 0, 8, 9).getValue(),11), 938.28416422287) + self.assertEqual(round(get_cell_by_position(document, 0, 8, 10).getValue(),11), 215.18246753247) + + self.assertEqual(get_cell_by_position(document, 0, 9, 3).getString(), "Variance") + self.assertEqual(round(get_cell_by_position(document, 0, 9, 4).getValue(),11), 139.49090909091) + self.assertEqual(round(get_cell_by_position(document, 0, 9, 5).getValue(),12), 287.122222222222) + self.assertEqual(round(get_cell_by_position(document, 0, 9, 6).getValue(),12), 227.344444444444) + self.assertEqual(get_cell_by_position(document, 0, 9, 8).getString(), "F") + self.assertEqual(round(get_cell_by_position(document, 0, 9, 9).getValue(),13), 4.3604117704492) + + self.assertEqual(get_cell_by_position(document, 0, 10, 8).getString(), "P-value") + self.assertEqual(round(get_cell_by_position(document, 0, 10, 9).getValue(),14), 0.02246149518799) + + self.assertEqual(get_cell_by_position(document, 0, 11, 8).getString(), "F critical") + self.assertEqual(round(get_cell_by_position(document, 0, 11, 9).getValue(),13), 3.3403855582378) + + #undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "") + + # test cancel button + self.ui_test.execute_modeless_dialog_through_command(".uno:AnalysisOfVarianceDialog") + xDialog = self.xUITest.getTopFocusWindow() + xCancelBtn = xDialog.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/statistics/chiSquare.py b/sc/qa/uitest/statistics/chiSquare.py new file mode 100644 index 000000000..5016e71f8 --- /dev/null +++ b/sc/qa/uitest/statistics/chiSquare.py @@ -0,0 +1,95 @@ +# -*- 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 + +class chiSquare(UITestCase): + def test_chiSquare(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() + #fill data + enter_text_to_cell(gridwin, "A1", "28") + enter_text_to_cell(gridwin, "A2", "26") + enter_text_to_cell(gridwin, "A3", "31") + enter_text_to_cell(gridwin, "A4", "23") + enter_text_to_cell(gridwin, "A5", "20") + enter_text_to_cell(gridwin, "A6", "27") + enter_text_to_cell(gridwin, "A7", "28") + enter_text_to_cell(gridwin, "A8", "14") + enter_text_to_cell(gridwin, "A9", "4") + enter_text_to_cell(gridwin, "A10", "0") + enter_text_to_cell(gridwin, "A11", "2") + enter_text_to_cell(gridwin, "A12", "8") + enter_text_to_cell(gridwin, "A13", "9") + + enter_text_to_cell(gridwin, "B1", "19") + enter_text_to_cell(gridwin, "B2", "13") + enter_text_to_cell(gridwin, "B3", "12") + enter_text_to_cell(gridwin, "B4", "5") + enter_text_to_cell(gridwin, "B5", "34") + enter_text_to_cell(gridwin, "B6", "31") + enter_text_to_cell(gridwin, "B7", "31") + enter_text_to_cell(gridwin, "B8", "12") + enter_text_to_cell(gridwin, "B9", "24") + enter_text_to_cell(gridwin, "B10", "23") + enter_text_to_cell(gridwin, "B11", "19") + enter_text_to_cell(gridwin, "B12", "10") + enter_text_to_cell(gridwin, "B13", "33") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B13"})) + self.ui_test.execute_modeless_dialog_through_command(".uno:ChiSquareTestDialog") + xDialog = self.xUITest.getTopFocusWindow() + xinputrangeedit = xDialog.getChild("input-range-edit") + xoutputrangeedit = xDialog.getChild("output-range-edit") + xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") + xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") + + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$B$13"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"F1"})) + xgroupedbycolumnsradio.executeAction("CLICK", tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #Verify + self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "Test of Independence (Chi-Square)") + self.assertEqual(get_cell_by_position(document, 0, 5, 1).getString(), "Alpha") + + self.assertEqual(get_cell_by_position(document, 0, 5, 2).getString(), "df") + self.assertEqual(get_cell_by_position(document, 0, 5, 3).getString(), "P-value") + self.assertEqual(get_cell_by_position(document, 0, 5, 4).getString(), "Test Statistic") + self.assertEqual(get_cell_by_position(document, 0, 5, 5).getString(), "Critical Value") + + self.assertEqual(get_cell_by_position(document, 0, 6, 1).getValue(), 0.05) + self.assertEqual(get_cell_by_position(document, 0, 6, 2).getValue(), 12) + self.assertEqual(round(get_cell_by_position(document, 0, 6, 4).getValue(),12), 91.687005584173) + self.assertEqual(round(get_cell_by_position(document, 0, 6, 5).getValue(),12), 21.026069817483) + + #undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "") + + # test cancel button + self.ui_test.execute_modeless_dialog_through_command(".uno:ChiSquareTestDialog") + xDialog = self.xUITest.getTopFocusWindow() + xCancelBtn = xDialog.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/statistics/correlation.py b/sc/qa/uitest/statistics/correlation.py new file mode 100644 index 000000000..a005e7830 --- /dev/null +++ b/sc/qa/uitest/statistics/correlation.py @@ -0,0 +1,202 @@ +# -*- 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 + +class correlation(UITestCase): + def test_statistic_correlation_column(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() + #fill data + enter_text_to_cell(gridwin, "A1", "Maths") + enter_text_to_cell(gridwin, "A2", "47") + enter_text_to_cell(gridwin, "A3", "36") + enter_text_to_cell(gridwin, "A4", "40") + enter_text_to_cell(gridwin, "A5", "39") + enter_text_to_cell(gridwin, "A7", "47") + enter_text_to_cell(gridwin, "A8", "29") + enter_text_to_cell(gridwin, "A9", "27") + enter_text_to_cell(gridwin, "A10", "57") + enter_text_to_cell(gridwin, "A11", "56") + enter_text_to_cell(gridwin, "A12", "57") + enter_text_to_cell(gridwin, "A13", "26") + + enter_text_to_cell(gridwin, "B1", "Physics") + enter_text_to_cell(gridwin, "B2", "67") + enter_text_to_cell(gridwin, "B3", "68") + enter_text_to_cell(gridwin, "B4", "65") + enter_text_to_cell(gridwin, "B5", "64") + enter_text_to_cell(gridwin, "B6", "38") + enter_text_to_cell(gridwin, "B7", "84") + enter_text_to_cell(gridwin, "B8", "80") + enter_text_to_cell(gridwin, "B9", "49") + enter_text_to_cell(gridwin, "B10", "49") + enter_text_to_cell(gridwin, "B11", "33") + + enter_text_to_cell(gridwin, "C1", "Biology") + enter_text_to_cell(gridwin, "C2", "33") + enter_text_to_cell(gridwin, "C3", "42") + enter_text_to_cell(gridwin, "C4", "44") + enter_text_to_cell(gridwin, "C5", "60") + enter_text_to_cell(gridwin, "C6", "43") + enter_text_to_cell(gridwin, "C7", "62") + enter_text_to_cell(gridwin, "C8", "51") + enter_text_to_cell(gridwin, "C9", "40") + enter_text_to_cell(gridwin, "C10", "12") + enter_text_to_cell(gridwin, "C11", "60") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C13"})) + self.ui_test.execute_modeless_dialog_through_command(".uno:CorrelationDialog") + xDialog = self.xUITest.getTopFocusWindow() + xinputrangeedit = xDialog.getChild("input-range-edit") + xoutputrangeedit = xDialog.getChild("output-range-edit") + xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") + xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") + + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$C$13"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$F$1"})) + xgroupedbyrowsradio.executeAction("CLICK", tuple()) + xgroupedbycolumnsradio.executeAction("CLICK", tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #Verify + self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "Correlations") + self.assertEqual(get_cell_by_position(document, 0, 5, 1).getString(), "Column 1") + self.assertEqual(get_cell_by_position(document, 0, 5, 2).getString(), "Column 2") + self.assertEqual(get_cell_by_position(document, 0, 5, 3).getString(), "Column 3") + + self.assertEqual(get_cell_by_position(document, 0, 6, 0).getString(), "Column 1") + self.assertEqual(get_cell_by_position(document, 0, 6, 1).getValue(), 1) + self.assertEqual(round(get_cell_by_position(document, 0, 6, 2).getValue(),14), -0.40292549168204) + self.assertEqual(round(get_cell_by_position(document, 0, 6, 3).getValue(),14), -0.21076428363645) + + self.assertEqual(get_cell_by_position(document, 0, 7, 0).getString(), "Column 2") + self.assertEqual(get_cell_by_position(document, 0, 7, 2).getValue(), 1) + self.assertEqual(round(get_cell_by_position(document, 0, 7, 3).getValue(),14), 0.23097140475091) + + self.assertEqual(get_cell_by_position(document, 0, 8, 0).getString(), "Column 3") + self.assertEqual(get_cell_by_position(document, 0, 8, 3).getValue(), 1) + + #undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "") + + # test cancel button + self.ui_test.execute_modeless_dialog_through_command(".uno:CorrelationDialog") + xDialog = self.xUITest.getTopFocusWindow() + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + + self.ui_test.close_doc() + + def test_statistic_correlation_row(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() + #fill data + enter_text_to_cell(gridwin, "A1", "Maths") + enter_text_to_cell(gridwin, "A2", "Physics") + enter_text_to_cell(gridwin, "A3", "Biology") + + enter_text_to_cell(gridwin, "B1", "47") + enter_text_to_cell(gridwin, "B2", "67") + enter_text_to_cell(gridwin, "B3", "33") + + enter_text_to_cell(gridwin, "C1", "36") + enter_text_to_cell(gridwin, "C2", "68") + enter_text_to_cell(gridwin, "C3", "42") + + enter_text_to_cell(gridwin, "D1", "40") + enter_text_to_cell(gridwin, "D2", "65") + enter_text_to_cell(gridwin, "D3", "44") + + enter_text_to_cell(gridwin, "E1", "39") + enter_text_to_cell(gridwin, "E2", "64") + enter_text_to_cell(gridwin, "E3", "60") + + enter_text_to_cell(gridwin, "F2", "38") + enter_text_to_cell(gridwin, "F3", "43") + + enter_text_to_cell(gridwin, "G1", "47") + enter_text_to_cell(gridwin, "G2", "84") + enter_text_to_cell(gridwin, "G3", "62") + + enter_text_to_cell(gridwin, "H1", "29") + enter_text_to_cell(gridwin, "H2", "80") + enter_text_to_cell(gridwin, "H3", "51") + + enter_text_to_cell(gridwin, "I1", "27") + enter_text_to_cell(gridwin, "I2", "49") + enter_text_to_cell(gridwin, "I3", "40") + + enter_text_to_cell(gridwin, "J1", "57") + enter_text_to_cell(gridwin, "J2", "49") + enter_text_to_cell(gridwin, "J3", "12") + + enter_text_to_cell(gridwin, "K1", "56") + enter_text_to_cell(gridwin, "K2", "33") + enter_text_to_cell(gridwin, "K3", "60") + + enter_text_to_cell(gridwin, "L1", "57") + + enter_text_to_cell(gridwin, "M1", "26") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:M3"})) + self.ui_test.execute_modeless_dialog_through_command(".uno:CorrelationDialog") + xDialog = self.xUITest.getTopFocusWindow() + xinputrangeedit = xDialog.getChild("input-range-edit") + xoutputrangeedit = xDialog.getChild("output-range-edit") + xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") + xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") + + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$M$3"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$A$7"})) + xgroupedbyrowsradio.executeAction("CLICK", tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #Verify + self.assertEqual(get_cell_by_position(document, 0, 0, 6).getString(), "Correlations") + self.assertEqual(get_cell_by_position(document, 0, 0, 7).getString(), "Row 1") + self.assertEqual(get_cell_by_position(document, 0, 0, 8).getString(), "Row 2") + self.assertEqual(get_cell_by_position(document, 0, 0, 9).getString(), "Row 3") + + self.assertEqual(get_cell_by_position(document, 0, 1, 6).getString(), "Row 1") + self.assertEqual(get_cell_by_position(document, 0, 1, 7).getValue(), 1) + self.assertEqual(round(get_cell_by_position(document, 0, 1, 8).getValue(),15), -0.402925491682042) + self.assertEqual(round(get_cell_by_position(document, 0, 1, 9).getValue(),15), -0.210764283636454) + + self.assertEqual(get_cell_by_position(document, 0, 2, 6).getString(), "Row 2") + self.assertEqual(get_cell_by_position(document, 0, 2, 8).getValue(), 1) + self.assertEqual(round(get_cell_by_position(document, 0, 2, 9).getValue(),14), 0.23097140475091) + + self.assertEqual(get_cell_by_position(document, 0, 3, 6).getString(), "Row 3") + self.assertEqual(get_cell_by_position(document, 0, 3, 9).getValue(), 1) + + #undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "") + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/statistics/covariance.py b/sc/qa/uitest/statistics/covariance.py new file mode 100644 index 000000000..3787a4586 --- /dev/null +++ b/sc/qa/uitest/statistics/covariance.py @@ -0,0 +1,200 @@ +# -*- 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 + +class covariance(UITestCase): + def test_statistic_covariance_column(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() + #fill data + enter_text_to_cell(gridwin, "A1", "Maths") + enter_text_to_cell(gridwin, "A2", "47") + enter_text_to_cell(gridwin, "A3", "36") + enter_text_to_cell(gridwin, "A4", "40") + enter_text_to_cell(gridwin, "A5", "39") + enter_text_to_cell(gridwin, "A7", "47") + enter_text_to_cell(gridwin, "A8", "29") + enter_text_to_cell(gridwin, "A9", "27") + enter_text_to_cell(gridwin, "A10", "57") + enter_text_to_cell(gridwin, "A11", "56") + enter_text_to_cell(gridwin, "A12", "57") + enter_text_to_cell(gridwin, "A13", "26") + + enter_text_to_cell(gridwin, "B1", "Physics") + enter_text_to_cell(gridwin, "B2", "67") + enter_text_to_cell(gridwin, "B3", "68") + enter_text_to_cell(gridwin, "B4", "65") + enter_text_to_cell(gridwin, "B5", "64") + enter_text_to_cell(gridwin, "B6", "38") + enter_text_to_cell(gridwin, "B7", "84") + enter_text_to_cell(gridwin, "B8", "80") + enter_text_to_cell(gridwin, "B9", "49") + enter_text_to_cell(gridwin, "B10", "49") + enter_text_to_cell(gridwin, "B11", "33") + + enter_text_to_cell(gridwin, "C1", "Biology") + enter_text_to_cell(gridwin, "C2", "33") + enter_text_to_cell(gridwin, "C3", "42") + enter_text_to_cell(gridwin, "C4", "44") + enter_text_to_cell(gridwin, "C5", "60") + enter_text_to_cell(gridwin, "C6", "43") + enter_text_to_cell(gridwin, "C7", "62") + enter_text_to_cell(gridwin, "C8", "51") + enter_text_to_cell(gridwin, "C9", "40") + enter_text_to_cell(gridwin, "C10", "12") + enter_text_to_cell(gridwin, "C11", "60") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C13"})) + self.ui_test.execute_modeless_dialog_through_command(".uno:CovarianceDialog") + xDialog = self.xUITest.getTopFocusWindow() + xinputrangeedit = xDialog.getChild("input-range-edit") + xoutputrangeedit = xDialog.getChild("output-range-edit") + xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") + xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") + + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$C$13"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$F$1"})) + xgroupedbycolumnsradio.executeAction("CLICK", tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #Verify + self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "Covariances") + self.assertEqual(get_cell_by_position(document, 0, 5, 1).getString(), "Column 1") + self.assertEqual(get_cell_by_position(document, 0, 5, 2).getString(), "Column 2") + self.assertEqual(get_cell_by_position(document, 0, 5, 3).getString(), "Column 3") + + self.assertEqual(get_cell_by_position(document, 0, 6, 0).getString(), "Column 1") + self.assertEqual(round(get_cell_by_position(document, 0, 6, 1).getValue(),11), 126.80991735537) + self.assertEqual(round(get_cell_by_position(document, 0, 6, 2).getValue(),12), -61.444444444444) + self.assertEqual(round(get_cell_by_position(document, 0, 6, 3).getValue()), -32) + + self.assertEqual(get_cell_by_position(document, 0, 7, 0).getString(), "Column 2") + self.assertEqual(round(get_cell_by_position(document, 0, 7, 2).getValue(),2), 258.41) + self.assertEqual(round(get_cell_by_position(document, 0, 7, 3).getValue(),2), 53.11) + + self.assertEqual(get_cell_by_position(document, 0, 8, 0).getString(), "Column 3") + self.assertEqual(round(get_cell_by_position(document, 0, 8, 3).getValue(),2), 204.61) + + #undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "") + + # test cancel button + self.ui_test.execute_modeless_dialog_through_command(".uno:CovarianceDialog") + xDialog = self.xUITest.getTopFocusWindow() + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + + self.ui_test.close_doc() + + def test_statistic_covariance_row(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() + #fill data + enter_text_to_cell(gridwin, "A1", "Maths") + enter_text_to_cell(gridwin, "A2", "Physics") + enter_text_to_cell(gridwin, "A3", "Biology") + + enter_text_to_cell(gridwin, "B1", "47") + enter_text_to_cell(gridwin, "B2", "67") + enter_text_to_cell(gridwin, "B3", "33") + + enter_text_to_cell(gridwin, "C1", "36") + enter_text_to_cell(gridwin, "C2", "68") + enter_text_to_cell(gridwin, "C3", "42") + + enter_text_to_cell(gridwin, "D1", "40") + enter_text_to_cell(gridwin, "D2", "65") + enter_text_to_cell(gridwin, "D3", "44") + + enter_text_to_cell(gridwin, "E1", "39") + enter_text_to_cell(gridwin, "E2", "64") + enter_text_to_cell(gridwin, "E3", "60") + + enter_text_to_cell(gridwin, "F2", "38") + enter_text_to_cell(gridwin, "F3", "43") + + enter_text_to_cell(gridwin, "G1", "47") + enter_text_to_cell(gridwin, "G2", "84") + enter_text_to_cell(gridwin, "G3", "62") + + enter_text_to_cell(gridwin, "H1", "29") + enter_text_to_cell(gridwin, "H2", "80") + enter_text_to_cell(gridwin, "H3", "51") + + enter_text_to_cell(gridwin, "I1", "27") + enter_text_to_cell(gridwin, "I2", "49") + enter_text_to_cell(gridwin, "I3", "40") + + enter_text_to_cell(gridwin, "J1", "57") + enter_text_to_cell(gridwin, "J2", "49") + enter_text_to_cell(gridwin, "J3", "12") + + enter_text_to_cell(gridwin, "K1", "56") + enter_text_to_cell(gridwin, "K2", "33") + enter_text_to_cell(gridwin, "K3", "60") + + enter_text_to_cell(gridwin, "L1", "57") + + enter_text_to_cell(gridwin, "M1", "26") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:M3"})) + self.ui_test.execute_modeless_dialog_through_command(".uno:CovarianceDialog") + xDialog = self.xUITest.getTopFocusWindow() + xinputrangeedit = xDialog.getChild("input-range-edit") + xoutputrangeedit = xDialog.getChild("output-range-edit") + xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") + xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") + + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$M$3"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$A$7"})) + xgroupedbyrowsradio.executeAction("CLICK", tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #Verify + self.assertEqual(get_cell_by_position(document, 0, 0, 6).getString(), "Covariances") + self.assertEqual(get_cell_by_position(document, 0, 0, 7).getString(), "Row 1") + self.assertEqual(get_cell_by_position(document, 0, 0, 8).getString(), "Row 2") + self.assertEqual(get_cell_by_position(document, 0, 0, 9).getString(), "Row 3") + + self.assertEqual(get_cell_by_position(document, 0, 1, 6).getString(), "Row 1") + self.assertEqual(round(get_cell_by_position(document, 0, 1, 7).getValue(),10), 126.8099173554) + self.assertEqual(round(get_cell_by_position(document, 0, 1, 8).getValue(),12), -61.444444444444) + self.assertEqual(round(get_cell_by_position(document, 0, 1, 9).getValue()), -32) + + self.assertEqual(get_cell_by_position(document, 0, 2, 6).getString(), "Row 2") + self.assertEqual(round(get_cell_by_position(document, 0, 2, 8).getValue(),2), 258.41) + self.assertEqual(round(get_cell_by_position(document, 0, 2, 9).getValue(),2), 53.11) + + self.assertEqual(get_cell_by_position(document, 0, 3, 6).getString(), "Row 3") + self.assertEqual(round(get_cell_by_position(document, 0, 3, 9).getValue(),2), 204.61) + + #undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "") + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/statistics/data/regression.ods b/sc/qa/uitest/statistics/data/regression.ods Binary files differnew file mode 100644 index 000000000..1c8b72cc9 --- /dev/null +++ b/sc/qa/uitest/statistics/data/regression.ods diff --git a/sc/qa/uitest/statistics/data/tdf76731.ods b/sc/qa/uitest/statistics/data/tdf76731.ods Binary files differnew file mode 100644 index 000000000..6435d5f50 --- /dev/null +++ b/sc/qa/uitest/statistics/data/tdf76731.ods diff --git a/sc/qa/uitest/statistics/descriptiveStatistics.py b/sc/qa/uitest/statistics/descriptiveStatistics.py new file mode 100644 index 000000000..112803418 --- /dev/null +++ b/sc/qa/uitest/statistics/descriptiveStatistics.py @@ -0,0 +1,163 @@ +# -*- 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 + +class descriptiveStatistics(UITestCase): + def test_descriptive_statistics(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() + #fill data + enter_text_to_cell(gridwin, "A1", "Math") + enter_text_to_cell(gridwin, "A2", "47") + enter_text_to_cell(gridwin, "A3", "36") + enter_text_to_cell(gridwin, "A4", "40") + enter_text_to_cell(gridwin, "A5", "39") + enter_text_to_cell(gridwin, "A7", "47") + enter_text_to_cell(gridwin, "A8", "29") + enter_text_to_cell(gridwin, "A9", "27") + enter_text_to_cell(gridwin, "A10", "57") + enter_text_to_cell(gridwin, "A11", "56") + enter_text_to_cell(gridwin, "A12", "57") + enter_text_to_cell(gridwin, "A13", "26") + + + enter_text_to_cell(gridwin, "B1", "Physics") + enter_text_to_cell(gridwin, "B2", "67") + enter_text_to_cell(gridwin, "B3", "68") + enter_text_to_cell(gridwin, "B4", "65") + enter_text_to_cell(gridwin, "B5", "64") + enter_text_to_cell(gridwin, "B6", "38") + enter_text_to_cell(gridwin, "B7", "84") + enter_text_to_cell(gridwin, "B8", "80") + enter_text_to_cell(gridwin, "B9", "49") + enter_text_to_cell(gridwin, "B10", "49") + enter_text_to_cell(gridwin, "B11", "33") + + enter_text_to_cell(gridwin, "C1", "Biology") + enter_text_to_cell(gridwin, "C2", "33") + enter_text_to_cell(gridwin, "C3", "42") + enter_text_to_cell(gridwin, "C4", "44") + enter_text_to_cell(gridwin, "C5", "60") + enter_text_to_cell(gridwin, "C6", "43") + enter_text_to_cell(gridwin, "C7", "62") + enter_text_to_cell(gridwin, "C8", "51") + enter_text_to_cell(gridwin, "C9", "40") + enter_text_to_cell(gridwin, "C10", "12") + enter_text_to_cell(gridwin, "C11", "60") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C13"})) + self.ui_test.execute_modeless_dialog_through_command(".uno:DescriptiveStatisticsDialog") + xDialog = self.xUITest.getTopFocusWindow() + xinputrangeedit = xDialog.getChild("input-range-edit") + xoutputrangeedit = xDialog.getChild("output-range-edit") + + xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") + xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") + + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$C$13"})) + + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$F$1"})) + + xgroupedbyrowsradio.executeAction("CLICK", tuple()) + xgroupedbycolumnsradio.executeAction("CLICK", tuple()) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #Verify + self.assertEqual(get_cell_by_position(document, 0, 5, 1).getString() , "Mean") + self.assertEqual(get_cell_by_position(document, 0, 5, 2).getString() , "Standard Error") + self.assertEqual(get_cell_by_position(document, 0, 5, 3).getString() , "Mode") + self.assertEqual(get_cell_by_position(document, 0, 5, 4).getString() , "Median") + self.assertEqual(get_cell_by_position(document, 0, 5, 5).getString() , "First Quartile") + self.assertEqual(get_cell_by_position(document, 0, 5, 6).getString() , "Third Quartile") + self.assertEqual(get_cell_by_position(document, 0, 5, 7).getString() , "Variance") + self.assertEqual(get_cell_by_position(document, 0, 5, 8).getString() , "Standard Deviation") + self.assertEqual(get_cell_by_position(document, 0, 5, 9).getString() , "Kurtosis") + self.assertEqual(get_cell_by_position(document, 0, 5, 10).getString() , "Skewness") + self.assertEqual(get_cell_by_position(document, 0, 5, 11).getString() , "Range") + self.assertEqual(get_cell_by_position(document, 0, 5, 12).getString() , "Minimum") + self.assertEqual(get_cell_by_position(document, 0, 5, 13).getString() , "Maximum") + self.assertEqual(get_cell_by_position(document, 0, 5, 14).getString() , "Sum") + self.assertEqual(get_cell_by_position(document, 0, 5, 15).getString() , "Count") + + self.assertEqual(get_cell_by_position(document, 0, 6, 0).getString() , "Column 1") + self.assertEqual(round(get_cell_by_position(document, 0, 6, 1).getValue(),12) , 41.909090909091) + self.assertEqual(round(get_cell_by_position(document, 0, 6, 2).getValue(),13) , 3.5610380137731) + self.assertEqual(get_cell_by_position(document, 0, 6, 3).getValue() , 47) + self.assertEqual(get_cell_by_position(document, 0, 6, 4).getValue() , 40) + self.assertEqual(get_cell_by_position(document, 0, 6, 5).getValue() , 32.5) + self.assertEqual(get_cell_by_position(document, 0, 6, 6).getValue() , 51.5) + self.assertEqual(round(get_cell_by_position(document, 0, 6, 7).getValue(),11) , 139.49090909091) + self.assertEqual(round(get_cell_by_position(document, 0, 6, 8).getValue(),12) , 11.810626955878) + self.assertEqual(round(get_cell_by_position(document, 0, 6, 9).getValue(),13) , -1.4621677980825) + self.assertEqual(round(get_cell_by_position(document, 0, 6, 10).getValue(),14) , 0.01524095329036) + self.assertEqual(get_cell_by_position(document, 0, 6, 11).getValue() , 31) + self.assertEqual(get_cell_by_position(document, 0, 6, 12).getValue() , 26) + self.assertEqual(get_cell_by_position(document, 0, 6, 13).getValue() , 57) + self.assertEqual(get_cell_by_position(document, 0, 6, 14).getValue() , 461) + self.assertEqual(get_cell_by_position(document, 0, 6, 15).getValue() , 11) + + self.assertEqual(get_cell_by_position(document, 0, 7, 0).getString() , "Column 2") + self.assertEqual(round(get_cell_by_position(document, 0, 7, 1).getValue(),1) , 59.7) + self.assertEqual(round(get_cell_by_position(document, 0, 7, 2).getValue(),14) , 5.35837869343164) + self.assertEqual(get_cell_by_position(document, 0, 7, 3).getValue() , 49) + self.assertEqual(get_cell_by_position(document, 0, 7, 4).getValue() , 64.5) + self.assertEqual(get_cell_by_position(document, 0, 7, 5).getValue() , 49) + self.assertEqual(get_cell_by_position(document, 0, 7, 6).getValue() , 67.75) + self.assertEqual(round(get_cell_by_position(document, 0, 7, 7).getValue(),11) , 287.12222222222) + self.assertEqual(round(get_cell_by_position(document, 0, 7, 8).getValue(),12) , 16.944681236961) + self.assertEqual(round(get_cell_by_position(document, 0, 7, 9).getValue(),14) , -0.94159887458526) + self.assertEqual(round(get_cell_by_position(document, 0, 7, 10).getValue(),13) , -0.2226426904338) + self.assertEqual(get_cell_by_position(document, 0, 7, 11).getValue() , 51) + self.assertEqual(get_cell_by_position(document, 0, 7, 12).getValue() , 33) + self.assertEqual(get_cell_by_position(document, 0, 7, 13).getValue() , 84) + self.assertEqual(get_cell_by_position(document, 0, 7, 14).getValue() , 597) + self.assertEqual(get_cell_by_position(document, 0, 7, 15).getValue() , 10) + + self.assertEqual(get_cell_by_position(document, 0, 8, 0).getString() , "Column 3") + self.assertEqual(get_cell_by_position(document, 0, 8, 1).getValue() , 44.7) + self.assertEqual(round(get_cell_by_position(document, 0, 8, 2).getValue(),13) , 4.7680650629416) + self.assertEqual(get_cell_by_position(document, 0, 8, 3).getValue() , 60) + self.assertEqual(get_cell_by_position(document, 0, 8, 4).getValue() , 43.5) + self.assertEqual(get_cell_by_position(document, 0, 8, 5).getValue() , 40.5) + self.assertEqual(get_cell_by_position(document, 0, 8, 6).getValue() , 57.75) + self.assertEqual(round(get_cell_by_position(document, 0, 8, 7).getValue(),11) , 227.34444444444) + self.assertEqual(round(get_cell_by_position(document, 0, 8, 8).getValue(),11) , 15.07794563077) + self.assertEqual(round(get_cell_by_position(document, 0, 8, 9).getValue(),12) , 1.418052718986) + self.assertEqual(round(get_cell_by_position(document, 0, 8, 10).getValue(),14) , -0.97668033725691) + self.assertEqual(get_cell_by_position(document, 0, 8, 11).getValue() , 50) + self.assertEqual(get_cell_by_position(document, 0, 8, 12).getValue() , 12) + self.assertEqual(get_cell_by_position(document, 0, 8, 13).getValue() , 62) + self.assertEqual(get_cell_by_position(document, 0, 8, 14).getValue() , 447) + self.assertEqual(get_cell_by_position(document, 0, 8, 15).getValue() , 10) + #undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "") + + # test cancel button + self.ui_test.execute_modeless_dialog_through_command(".uno:DescriptiveStatisticsDialog") + xDialog = self.xUITest.getTopFocusWindow() + xCancelBtn = xDialog.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/statistics/exponentialSmoothing.py b/sc/qa/uitest/statistics/exponentialSmoothing.py new file mode 100644 index 000000000..7ea2c23ec --- /dev/null +++ b/sc/qa/uitest/statistics/exponentialSmoothing.py @@ -0,0 +1,189 @@ +# -*- 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 + +class exponentialSmoothing(UITestCase): + def test_exponential_smoothing_column(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() + #fill data + enter_text_to_cell(gridwin, "A1", "1") + enter_text_to_cell(gridwin, "A2", "0") + enter_text_to_cell(gridwin, "A3", "0") + enter_text_to_cell(gridwin, "A4", "0") + enter_text_to_cell(gridwin, "A5", "0") + enter_text_to_cell(gridwin, "A7", "0") + enter_text_to_cell(gridwin, "A8", "0") + enter_text_to_cell(gridwin, "A9", "0") + enter_text_to_cell(gridwin, "A10", "0") + enter_text_to_cell(gridwin, "A11", "0") + enter_text_to_cell(gridwin, "A12", "0") + enter_text_to_cell(gridwin, "A13", "0") + + enter_text_to_cell(gridwin, "B1", "0") + enter_text_to_cell(gridwin, "B2", "0") + enter_text_to_cell(gridwin, "B3", "1") + enter_text_to_cell(gridwin, "B4", "0") + enter_text_to_cell(gridwin, "B5", "0") + enter_text_to_cell(gridwin, "B6", "0") + enter_text_to_cell(gridwin, "B7", "0") + enter_text_to_cell(gridwin, "B8", "0") + enter_text_to_cell(gridwin, "B9", "0") + enter_text_to_cell(gridwin, "B10", "0") + enter_text_to_cell(gridwin, "B11", "0") + enter_text_to_cell(gridwin, "B12", "0") + enter_text_to_cell(gridwin, "B13", "0") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B13"})) + self.ui_test.execute_modeless_dialog_through_command(".uno:ExponentialSmoothingDialog") + xDialog = self.xUITest.getTopFocusWindow() + xinputrangeedit = xDialog.getChild("input-range-edit") + xoutputrangeedit = xDialog.getChild("output-range-edit") + xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") + xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") + xmoothingfactorspin = xDialog.getChild("smoothing-factor-spin") + + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$B$13"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$F$1"})) + xmoothingfactorspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xmoothingfactorspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xmoothingfactorspin.executeAction("TYPE", mkPropertyValues({"TEXT":"0.5"})) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #Verify + self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "Alpha") + self.assertEqual(get_cell_by_position(document, 0, 5, 1).getValue(), 0.5) + self.assertEqual(get_cell_by_position(document, 0, 5, 2).getString(), "Column 1") + self.assertEqual(get_cell_by_position(document, 0, 5, 3).getValue(), 1) + self.assertEqual(get_cell_by_position(document, 0, 5, 4).getValue(), 1) + self.assertEqual(get_cell_by_position(document, 0, 5, 5).getValue(), 0.5) + self.assertEqual(get_cell_by_position(document, 0, 5, 6).getValue(), 0.25) + self.assertEqual(get_cell_by_position(document, 0, 5, 7).getValue(), 0.125) + self.assertEqual(get_cell_by_position(document, 0, 5, 8).getValue(), 0.0625) + self.assertEqual(get_cell_by_position(document, 0, 5, 9).getValue(), 0.03125) + self.assertEqual(get_cell_by_position(document, 0, 5, 10).getValue(), 0.015625) + self.assertEqual(get_cell_by_position(document, 0, 5, 11).getValue(), 0.0078125) + self.assertEqual(get_cell_by_position(document, 0, 5, 12).getValue(), 0.00390625) + self.assertEqual(get_cell_by_position(document, 0, 5, 13).getValue(), 0.001953125) + self.assertEqual(get_cell_by_position(document, 0, 5, 14).getValue(), 0.0009765625) + self.assertEqual(get_cell_by_position(document, 0, 5, 15).getValue(), 0.00048828125) + self.assertEqual(get_cell_by_position(document, 0, 5, 16).getValue(), 0.000244140625) + + self.assertEqual(get_cell_by_position(document, 0, 6, 2).getString(), "Column 2") + self.assertEqual(get_cell_by_position(document, 0, 6, 3).getValue(), 0) + self.assertEqual(get_cell_by_position(document, 0, 6, 4).getValue(), 0) + self.assertEqual(get_cell_by_position(document, 0, 6, 5).getValue(), 0) + self.assertEqual(get_cell_by_position(document, 0, 6, 6).getValue(), 0.5) + self.assertEqual(get_cell_by_position(document, 0, 6, 7).getValue(), 0.25) + self.assertEqual(get_cell_by_position(document, 0, 6, 8).getValue(), 0.125) + self.assertEqual(get_cell_by_position(document, 0, 6, 9).getValue(), 0.0625) + self.assertEqual(get_cell_by_position(document, 0, 6, 10).getValue(), 0.03125) + self.assertEqual(get_cell_by_position(document, 0, 6, 11).getValue(), 0.015625) + self.assertEqual(get_cell_by_position(document, 0, 6, 12).getValue(), 0.0078125) + self.assertEqual(get_cell_by_position(document, 0, 6, 13).getValue(), 0.00390625) + self.assertEqual(get_cell_by_position(document, 0, 6, 14).getValue(), 0.001953125) + self.assertEqual(get_cell_by_position(document, 0, 6, 15).getValue(), 0.0009765625) + self.assertEqual(get_cell_by_position(document, 0, 6, 16).getValue(), 0.00048828125) + + #undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "") + + # test cancel button + self.ui_test.execute_modeless_dialog_through_command(".uno:ExponentialSmoothingDialog") + xDialog = self.xUITest.getTopFocusWindow() + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + + self.ui_test.close_doc() + + def test_exponential_smoothing_row(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() + #fill data + enter_text_to_cell(gridwin, "A1", "1") + enter_text_to_cell(gridwin, "A2", "0") + enter_text_to_cell(gridwin, "A3", "0") + enter_text_to_cell(gridwin, "A4", "0") + enter_text_to_cell(gridwin, "A5", "0") + enter_text_to_cell(gridwin, "A7", "0") + enter_text_to_cell(gridwin, "A8", "0") + enter_text_to_cell(gridwin, "A9", "0") + enter_text_to_cell(gridwin, "A10", "0") + enter_text_to_cell(gridwin, "A11", "0") + enter_text_to_cell(gridwin, "A12", "0") + enter_text_to_cell(gridwin, "A13", "0") + + enter_text_to_cell(gridwin, "B1", "0") + enter_text_to_cell(gridwin, "B2", "0") + enter_text_to_cell(gridwin, "B3", "1") + enter_text_to_cell(gridwin, "B4", "0") + enter_text_to_cell(gridwin, "B5", "0") + enter_text_to_cell(gridwin, "B6", "0") + enter_text_to_cell(gridwin, "B7", "0") + enter_text_to_cell(gridwin, "B8", "0") + enter_text_to_cell(gridwin, "B9", "0") + enter_text_to_cell(gridwin, "B10", "0") + enter_text_to_cell(gridwin, "B11", "0") + enter_text_to_cell(gridwin, "B12", "0") + enter_text_to_cell(gridwin, "B13", "0") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B13"})) + self.ui_test.execute_modeless_dialog_through_command(".uno:ExponentialSmoothingDialog") + xDialog = self.xUITest.getTopFocusWindow() + xinputrangeedit = xDialog.getChild("input-range-edit") + xoutputrangeedit = xDialog.getChild("output-range-edit") + xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") + xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") + xmoothingfactorspin = xDialog.getChild("smoothing-factor-spin") + + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$B$13"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$F$1"})) + xmoothingfactorspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xmoothingfactorspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xmoothingfactorspin.executeAction("TYPE", mkPropertyValues({"TEXT":"0.5"})) + xgroupedbyrowsradio.executeAction("CLICK", tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #Verify + self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "Alpha") + self.assertEqual(get_cell_by_position(document, 0, 5, 1).getValue(), 0.5) + self.assertEqual(get_cell_by_position(document, 0, 5, 2).getString(), "Row 1") + self.assertEqual(get_cell_by_position(document, 0, 5, 3).getValue(), 1) + self.assertEqual(get_cell_by_position(document, 0, 5, 4).getValue(), 1) + self.assertEqual(get_cell_by_position(document, 0, 5, 5).getValue(), 0.5) + + self.assertEqual(get_cell_by_position(document, 0, 6, 2).getString(), "Row 2") + self.assertEqual(get_cell_by_position(document, 0, 6, 3).getValue(), 0) + self.assertEqual(get_cell_by_position(document, 0, 6, 4).getValue(), 0) + self.assertEqual(get_cell_by_position(document, 0, 6, 5).getValue(), 0) + #undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "") + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/statistics/fTest.py b/sc/qa/uitest/statistics/fTest.py new file mode 100644 index 000000000..1f2762c4f --- /dev/null +++ b/sc/qa/uitest/statistics/fTest.py @@ -0,0 +1,121 @@ +# -*- 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 + +class tTest(UITestCase): + def test_fTest_column(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() + #fill data + enter_text_to_cell(gridwin, "A1", "28") + enter_text_to_cell(gridwin, "A2", "26") + enter_text_to_cell(gridwin, "A3", "31") + enter_text_to_cell(gridwin, "A4", "23") + enter_text_to_cell(gridwin, "A5", "20") + enter_text_to_cell(gridwin, "A6", "27") + enter_text_to_cell(gridwin, "A7", "28") + enter_text_to_cell(gridwin, "A8", "14") + enter_text_to_cell(gridwin, "A9", "4") + enter_text_to_cell(gridwin, "A10", "0") + enter_text_to_cell(gridwin, "A11", "2") + enter_text_to_cell(gridwin, "A12", "8") + enter_text_to_cell(gridwin, "A13", "9") + + enter_text_to_cell(gridwin, "B1", "19") + enter_text_to_cell(gridwin, "B2", "13") + enter_text_to_cell(gridwin, "B3", "12") + enter_text_to_cell(gridwin, "B4", "5") + enter_text_to_cell(gridwin, "B5", "34") + enter_text_to_cell(gridwin, "B6", "31") + enter_text_to_cell(gridwin, "B7", "31") + enter_text_to_cell(gridwin, "B8", "12") + enter_text_to_cell(gridwin, "B9", "24") + enter_text_to_cell(gridwin, "B10", "23") + enter_text_to_cell(gridwin, "B11", "19") + enter_text_to_cell(gridwin, "B12", "10") + enter_text_to_cell(gridwin, "B13", "33") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B13"})) + self.ui_test.execute_modeless_dialog_through_command(".uno:FTestDialog") + xDialog = self.xUITest.getTopFocusWindow() + xvariable1rangeedit = xDialog.getChild("variable1-range-edit") + xvariable2rangeedit = xDialog.getChild("variable2-range-edit") + xoutputrangeedit = xDialog.getChild("output-range-edit") + xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") + xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") + + xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$A$13"})) + xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$B$1:$B$13"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"F1"})) + xgroupedbycolumnsradio.executeAction("CLICK", tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #Verify + self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "F-test") + self.assertEqual(get_cell_by_position(document, 0, 5, 1).getString(), "Alpha") + + self.assertEqual(get_cell_by_position(document, 0, 5, 3).getString(), "Mean") + self.assertEqual(get_cell_by_position(document, 0, 5, 4).getString(), "Variance") + self.assertEqual(get_cell_by_position(document, 0, 5, 5).getString(), "Observations") + self.assertEqual(get_cell_by_position(document, 0, 5, 6).getString(), "df") + self.assertEqual(get_cell_by_position(document, 0, 5, 7).getString(), "F") + self.assertEqual(get_cell_by_position(document, 0, 5, 8).getString(), "P (F<=f) right-tail") + self.assertEqual(get_cell_by_position(document, 0, 5, 9).getString(), "F Critical right-tail") + self.assertEqual(get_cell_by_position(document, 0, 5, 10).getString(), "P (F<=f) left-tail") + self.assertEqual(get_cell_by_position(document, 0, 5, 11).getString(), "F Critical left-tail") + self.assertEqual(get_cell_by_position(document, 0, 5, 12).getString(), "P two-tail") + self.assertEqual(get_cell_by_position(document, 0, 5, 13).getString(), "F Critical two-tail") + + + self.assertEqual(get_cell_by_position(document, 0, 6, 1).getValue(), 0.05) + self.assertEqual(get_cell_by_position(document, 0, 6, 2).getString(), "Variable 1") + self.assertEqual(round(get_cell_by_position(document, 0, 6, 3).getValue(),12), 16.923076923077) + self.assertEqual(round(get_cell_by_position(document, 0, 6, 4).getValue(),12), 125.076923076923) + self.assertEqual(get_cell_by_position(document, 0, 6, 5).getValue(), 13) + self.assertEqual(get_cell_by_position(document, 0, 6, 6).getValue(), 12) + self.assertEqual(round(get_cell_by_position(document, 0, 6, 7).getValue(),12), 1.324463752376) + self.assertEqual(round(get_cell_by_position(document, 0, 6, 8).getValue(),12), 0.317061414639) + self.assertEqual(round(get_cell_by_position(document, 0, 6, 9).getValue(),12), 2.686637112496) + self.assertEqual(round(get_cell_by_position(document, 0, 6, 10).getValue(),12), 0.682938585361) + self.assertEqual(round(get_cell_by_position(document, 0, 6, 12).getValue(),12), 0.634122829279) + self.assertEqual(round(get_cell_by_position(document, 0, 6, 13).getValue(),12), 0.305131354874) + + self.assertEqual(get_cell_by_position(document, 0, 7, 2).getString(), "Variable 2") + self.assertEqual(round(get_cell_by_position(document, 0, 7, 3).getValue(),12), 20.461538461538) + self.assertEqual(round(get_cell_by_position(document, 0, 7, 4).getValue(),12), 94.435897435897) + self.assertEqual(get_cell_by_position(document, 0, 7, 5).getValue(), 13) + self.assertEqual(get_cell_by_position(document, 0, 7, 6).getValue(), 12) + self.assertEqual(round(get_cell_by_position(document, 0, 7, 13).getValue(),12), 3.277277094033) + #undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "") + + # test cancel button + self.ui_test.execute_modeless_dialog_through_command(".uno:FTestDialog") + xDialog = self.xUITest.getTopFocusWindow() + xCancelBtn = xDialog.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/statistics/movingAverage.py b/sc/qa/uitest/statistics/movingAverage.py new file mode 100644 index 000000000..9f94aaf29 --- /dev/null +++ b/sc/qa/uitest/statistics/movingAverage.py @@ -0,0 +1,182 @@ +# -*- 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 + +class movingAverage(UITestCase): + def test_moving_average_column(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() + #fill data + enter_text_to_cell(gridwin, "A1", "1") + enter_text_to_cell(gridwin, "A2", "0") + enter_text_to_cell(gridwin, "A3", "0") + enter_text_to_cell(gridwin, "A4", "0") + enter_text_to_cell(gridwin, "A5", "0") + enter_text_to_cell(gridwin, "A7", "0") + enter_text_to_cell(gridwin, "A8", "0") + enter_text_to_cell(gridwin, "A9", "0") + enter_text_to_cell(gridwin, "A10", "0") + enter_text_to_cell(gridwin, "A11", "0") + enter_text_to_cell(gridwin, "A12", "0") + enter_text_to_cell(gridwin, "A13", "0") + + enter_text_to_cell(gridwin, "B1", "0") + enter_text_to_cell(gridwin, "B2", "0") + enter_text_to_cell(gridwin, "B3", "1") + enter_text_to_cell(gridwin, "B4", "0") + enter_text_to_cell(gridwin, "B5", "0") + enter_text_to_cell(gridwin, "B6", "0") + enter_text_to_cell(gridwin, "B7", "0") + enter_text_to_cell(gridwin, "B8", "0") + enter_text_to_cell(gridwin, "B9", "0") + enter_text_to_cell(gridwin, "B10", "0") + enter_text_to_cell(gridwin, "B11", "0") + enter_text_to_cell(gridwin, "B12", "0") + enter_text_to_cell(gridwin, "B13", "0") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B13"})) + self.ui_test.execute_modeless_dialog_through_command(".uno:MovingAverageDialog") + xDialog = self.xUITest.getTopFocusWindow() + xinputrangeedit = xDialog.getChild("input-range-edit") + xoutputrangeedit = xDialog.getChild("output-range-edit") + xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") + xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") + xintervalspin = xDialog.getChild("interval-spin") + + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$B$13"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$F$1"})) + xintervalspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xintervalspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xintervalspin.executeAction("TYPE", mkPropertyValues({"TEXT":"3"})) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #Verify + self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "Column 1") + self.assertEqual(get_cell_by_position(document, 0, 5, 1).getString(), "#N/A") + self.assertEqual(round(get_cell_by_position(document, 0, 5, 2).getValue(),8), 0.33333333) + self.assertEqual(get_cell_by_position(document, 0, 5, 3).getValue(), 0) + self.assertEqual(get_cell_by_position(document, 0, 5, 4).getValue(), 0) + self.assertEqual(get_cell_by_position(document, 0, 5, 5).getValue(), 0) + self.assertEqual(get_cell_by_position(document, 0, 5, 6).getValue(), 0) + self.assertEqual(get_cell_by_position(document, 0, 5, 7).getValue(), 0) + self.assertEqual(get_cell_by_position(document, 0, 5, 8).getValue(), 0) + self.assertEqual(get_cell_by_position(document, 0, 5, 9).getValue(), 0) + self.assertEqual(get_cell_by_position(document, 0, 5, 10).getValue(), 0) + self.assertEqual(get_cell_by_position(document, 0, 5, 11).getValue(), 0) + self.assertEqual(get_cell_by_position(document, 0, 5, 12).getValue(), 0) + self.assertEqual(get_cell_by_position(document, 0, 5, 13).getString(), "#N/A") + + + self.assertEqual(get_cell_by_position(document, 0, 6, 0).getString(), "Column 2") + self.assertEqual(get_cell_by_position(document, 0, 6, 1).getString(), "#N/A") + self.assertEqual(round(get_cell_by_position(document, 0, 6, 2).getValue(),8), 0.33333333) + self.assertEqual(round(get_cell_by_position(document, 0, 6, 3).getValue(),8), 0.33333333) + self.assertEqual(round(get_cell_by_position(document, 0, 6, 4).getValue(),8), 0.33333333) + self.assertEqual(get_cell_by_position(document, 0, 6, 5).getValue(), 0) + self.assertEqual(get_cell_by_position(document, 0, 6, 6).getValue(), 0) + self.assertEqual(get_cell_by_position(document, 0, 6, 7).getValue(), 0) + self.assertEqual(get_cell_by_position(document, 0, 6, 9).getValue(), 0) + self.assertEqual(get_cell_by_position(document, 0, 6, 10).getValue(), 0) + self.assertEqual(get_cell_by_position(document, 0, 6, 11).getValue(), 0) + self.assertEqual(get_cell_by_position(document, 0, 6, 12).getValue(), 0) + self.assertEqual(get_cell_by_position(document, 0, 6, 13).getString(), "#N/A") + + #undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "") + + # test cancel button + self.ui_test.execute_modeless_dialog_through_command(".uno:MovingAverageDialog") + xDialog = self.xUITest.getTopFocusWindow() + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + + self.ui_test.close_doc() + + def test_moving_average_row(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() + #fill data + enter_text_to_cell(gridwin, "A1", "1") + enter_text_to_cell(gridwin, "A2", "0") + enter_text_to_cell(gridwin, "A3", "0") + enter_text_to_cell(gridwin, "A4", "0") + enter_text_to_cell(gridwin, "A5", "0") + enter_text_to_cell(gridwin, "A7", "0") + enter_text_to_cell(gridwin, "A8", "0") + enter_text_to_cell(gridwin, "A9", "0") + enter_text_to_cell(gridwin, "A10", "0") + enter_text_to_cell(gridwin, "A11", "0") + enter_text_to_cell(gridwin, "A12", "0") + enter_text_to_cell(gridwin, "A13", "0") + + enter_text_to_cell(gridwin, "B1", "0") + enter_text_to_cell(gridwin, "B2", "0") + enter_text_to_cell(gridwin, "B3", "1") + enter_text_to_cell(gridwin, "B4", "0") + enter_text_to_cell(gridwin, "B5", "0") + enter_text_to_cell(gridwin, "B6", "0") + enter_text_to_cell(gridwin, "B7", "0") + enter_text_to_cell(gridwin, "B8", "0") + enter_text_to_cell(gridwin, "B9", "0") + enter_text_to_cell(gridwin, "B10", "0") + enter_text_to_cell(gridwin, "B11", "0") + enter_text_to_cell(gridwin, "B12", "0") + enter_text_to_cell(gridwin, "B13", "0") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B13"})) + self.ui_test.execute_modeless_dialog_through_command(".uno:MovingAverageDialog") + xDialog = self.xUITest.getTopFocusWindow() + xinputrangeedit = xDialog.getChild("input-range-edit") + xoutputrangeedit = xDialog.getChild("output-range-edit") + xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") + xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") + xintervalspin = xDialog.getChild("interval-spin") + + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$B$13"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$F$1"})) + xintervalspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xintervalspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xintervalspin.executeAction("TYPE", mkPropertyValues({"TEXT":"3"})) + xgroupedbyrowsradio.executeAction("CLICK", tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #Verify + self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "Row 1") + self.assertEqual(get_cell_by_position(document, 0, 5, 1).getString(), "#N/A") + self.assertEqual(get_cell_by_position(document, 0, 5, 2).getString(), "#N/A") + + self.assertEqual(get_cell_by_position(document, 0, 6, 0).getString(), "Row 2") + self.assertEqual(get_cell_by_position(document, 0, 6, 1).getString(), "#N/A") + self.assertEqual(get_cell_by_position(document, 0, 6, 2).getString(), "#N/A") + #undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "") + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/statistics/regression.py b/sc/qa/uitest/statistics/regression.py new file mode 100644 index 000000000..db9c3a08c --- /dev/null +++ b/sc/qa/uitest/statistics/regression.py @@ -0,0 +1,121 @@ +# -*- 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 uitest.debug import sleep +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +import org.libreoffice.unotest +import pathlib + +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +class regression(UITestCase): + def test_regression_row(self): + self._regression_check(data_groupedby_column = False) + + def test_regression_column(self): + self._regression_check(data_groupedby_column = True) + + def _regression_check(self, data_groupedby_column = True): + calc_doc = self.ui_test.load_file(get_url_for_data_file("regression.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + # Initially the final check status is "FALSE" (failed). + self.assertEqual(get_cell_by_position(document, 14, 1, 6).getString(), "FALSE", + "Check status must be FALSE before the test") + self._do_regression(regression_type = "LINEAR", data_groupedby_column = data_groupedby_column, calc_intercept = True) + self._do_regression(regression_type = "LINEAR", data_groupedby_column = data_groupedby_column, calc_intercept = False) + self._do_regression(regression_type = "LOG", data_groupedby_column = data_groupedby_column) + self._do_regression(regression_type = "POWER", data_groupedby_column = data_groupedby_column) + self.assertEqual(get_cell_by_position(document, 14, 1, 6).getString(), "TRUE", + "One of more of the checks failed for data_groupedby_column = {}, manually try with the document". + format(data_groupedby_column)) + self.ui_test.close_doc() + + def _do_regression(self, regression_type, data_groupedby_column = True, calc_intercept = True): + assert(regression_type == "LINEAR" or regression_type == "LOG" or regression_type == "POWER") + self.ui_test.execute_modeless_dialog_through_command(".uno:RegressionDialog") + xDialog = self.xUITest.getTopFocusWindow() + xvariable1rangeedit = xDialog.getChild("variable1-range-edit") + xvariable2rangeedit = xDialog.getChild("variable2-range-edit") + xoutputrangeedit = xDialog.getChild("output-range-edit") + xwithlabelscheck = xDialog.getChild("withlabels-check") + xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") + xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") + xlinearradio = xDialog.getChild("linear-radio") + xlogarithmicradio = xDialog.getChild("logarithmic-radio") + xpowerradio = xDialog.getChild("power-radio") + xnointerceptcheck = xDialog.getChild("nointercept-check") + + ## Set the X, Y and output ranges + xvariable1rangeedit.executeAction("FOCUS", tuple()) # Without this the range parser does not kick in somehow + xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + if data_groupedby_column: + xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$DataInColumns.$A$1:$C$11"})) + else: + xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$DataInRows.$A$1:$K$3"})) + + xvariable2rangeedit.executeAction("FOCUS", tuple()) # Without this the range parser does not kick in somehow + xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + if data_groupedby_column: + xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$DataInColumns.$D$1:$D$11"})) + else: + xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$DataInRows.$A$4:$K$4"})) + # The data ranges have labels in them + if (get_state_as_dict(xwithlabelscheck)["Selected"]) == "false": + xwithlabelscheck.executeAction("CLICK", tuple()) + + xoutputrangeedit.executeAction("FOCUS", tuple()) # Without this the range parser does not kick in somehow + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + if regression_type == "LINEAR": + if calc_intercept: + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$ActualLinear.$A$1"})) + else: + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$ActualLinearNoIntercept.$A$1"})) + elif regression_type == "LOG": + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$ActualLog.$A$1"})) + else: + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$ActualPower.$A$1"})) + + if data_groupedby_column: + xgroupedbycolumnsradio.executeAction("CLICK", tuple()) + else: + xgroupedbyrowsradio.executeAction("CLICK", tuple()) + + if regression_type == "LINEAR": + xlinearradio.executeAction("CLICK", tuple()) + elif regression_type == "LOG": + xlogarithmicradio.executeAction("CLICK", tuple()) + else: + xpowerradio.executeAction("CLICK", tuple()) + + if not calc_intercept: + xnointerceptcheck.executeAction("CLICK", tuple()) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + def test_regression_cancel(self): + calc_doc = self.ui_test.create_doc_in_start_center("calc") + self.ui_test.execute_modeless_dialog_through_command(".uno:RegressionDialog") + xDialog = self.xUITest.getTopFocusWindow() + xCancelBtn = xDialog.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/statistics/sampling.py b/sc/qa/uitest/statistics/sampling.py new file mode 100644 index 000000000..dd3fd2698 --- /dev/null +++ b/sc/qa/uitest/statistics/sampling.py @@ -0,0 +1,115 @@ +# -*- 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 + +class sampling(UITestCase): + def test_statistic_sampling(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() + #fill data + enter_text_to_cell(gridwin, "A1", "11") + enter_text_to_cell(gridwin, "A2", "12") + enter_text_to_cell(gridwin, "A3", "13") + enter_text_to_cell(gridwin, "A4", "14") + enter_text_to_cell(gridwin, "A5", "15") + enter_text_to_cell(gridwin, "A6", "16") + enter_text_to_cell(gridwin, "A7", "17") + enter_text_to_cell(gridwin, "A8", "18") + enter_text_to_cell(gridwin, "A9", "19") + + enter_text_to_cell(gridwin, "B1", "21") + enter_text_to_cell(gridwin, "B2", "22") + enter_text_to_cell(gridwin, "B3", "23") + enter_text_to_cell(gridwin, "B4", "24") + enter_text_to_cell(gridwin, "B5", "25") + enter_text_to_cell(gridwin, "B6", "26") + enter_text_to_cell(gridwin, "B7", "27") + enter_text_to_cell(gridwin, "B8", "28") + enter_text_to_cell(gridwin, "B9", "29") + + enter_text_to_cell(gridwin, "C1", "31") + enter_text_to_cell(gridwin, "C2", "32") + enter_text_to_cell(gridwin, "C3", "33") + enter_text_to_cell(gridwin, "C4", "34") + enter_text_to_cell(gridwin, "C5", "35") + enter_text_to_cell(gridwin, "C6", "36") + enter_text_to_cell(gridwin, "C7", "37") + enter_text_to_cell(gridwin, "C8", "38") + enter_text_to_cell(gridwin, "C9", "39") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C9"})) + self.ui_test.execute_modeless_dialog_through_command(".uno:SamplingDialog") + xDialog = self.xUITest.getTopFocusWindow() + xinputrangeedit = xDialog.getChild("input-range-edit") + xoutputrangeedit = xDialog.getChild("output-range-edit") + xrandommethodradio = xDialog.getChild("random-method-radio") + xsamplesizespin = xDialog.getChild("sample-size-spin") + xperiodicmethodradio = xDialog.getChild("periodic-method-radio") + xperiodspin = xDialog.getChild("period-spin") + + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xinputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$C$9"})) + + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$F$1"})) + + xperiodicmethodradio.executeAction("CLICK", tuple()) + + xperiodspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xperiodspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xperiodspin.executeAction("TYPE", mkPropertyValues({"TEXT":"2"})) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #Verify + self.assertEqual(get_cell_by_position(document, 0, 5, 0).getValue(), 12) + self.assertEqual(get_cell_by_position(document, 0, 5, 1).getValue() , 14) + self.assertEqual(get_cell_by_position(document, 0, 5, 2).getValue() , 16) + self.assertEqual(get_cell_by_position(document, 0, 5, 3).getValue() , 18) + + self.assertEqual(get_cell_by_position(document, 0, 6, 0).getValue(), 22) + self.assertEqual(get_cell_by_position(document, 0, 6, 1).getValue() , 24) + self.assertEqual(get_cell_by_position(document, 0, 6, 2).getValue() , 26) + self.assertEqual(get_cell_by_position(document, 0, 6, 3).getValue() , 28) + + self.assertEqual(get_cell_by_position(document, 0, 7, 0).getValue(), 32) + self.assertEqual(get_cell_by_position(document, 0, 7, 1).getValue() , 34) + self.assertEqual(get_cell_by_position(document, 0, 7, 2).getValue() , 36) + self.assertEqual(get_cell_by_position(document, 0, 7, 3).getValue() , 38) + #undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 5, 0).getValue(), 0) + self.assertEqual(get_cell_by_position(document, 0, 5, 1).getValue() , 0) + self.assertEqual(get_cell_by_position(document, 0, 5, 2).getValue() , 0) + self.assertEqual(get_cell_by_position(document, 0, 5, 3).getValue() , 0) + + self.assertEqual(get_cell_by_position(document, 0, 6, 0).getValue(), 0) + 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, 7, 0).getValue(), 0) + self.assertEqual(get_cell_by_position(document, 0, 7, 1).getValue() , 0) + self.assertEqual(get_cell_by_position(document, 0, 7, 2).getValue() , 0) + self.assertEqual(get_cell_by_position(document, 0, 7, 3).getValue() , 0) + + # test cancel button + self.ui_test.execute_modeless_dialog_through_command(".uno:SamplingDialog") + xDialog = self.xUITest.getTopFocusWindow() + xCancelBtn = xDialog.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/statistics/tTest.py b/sc/qa/uitest/statistics/tTest.py new file mode 100644 index 000000000..035bb4ef6 --- /dev/null +++ b/sc/qa/uitest/statistics/tTest.py @@ -0,0 +1,122 @@ +# -*- 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 + +class tTest(UITestCase): + def test_tTest_column(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() + #fill data + enter_text_to_cell(gridwin, "A1", "28") + enter_text_to_cell(gridwin, "A2", "26") + enter_text_to_cell(gridwin, "A3", "31") + enter_text_to_cell(gridwin, "A4", "23") + enter_text_to_cell(gridwin, "A5", "20") + enter_text_to_cell(gridwin, "A6", "27") + enter_text_to_cell(gridwin, "A7", "28") + enter_text_to_cell(gridwin, "A8", "14") + enter_text_to_cell(gridwin, "A9", "4") + enter_text_to_cell(gridwin, "A10", "0") + enter_text_to_cell(gridwin, "A11", "2") + enter_text_to_cell(gridwin, "A12", "8") + enter_text_to_cell(gridwin, "A13", "9") + + enter_text_to_cell(gridwin, "B1", "19") + enter_text_to_cell(gridwin, "B2", "13") + enter_text_to_cell(gridwin, "B3", "12") + enter_text_to_cell(gridwin, "B4", "5") + enter_text_to_cell(gridwin, "B5", "34") + enter_text_to_cell(gridwin, "B6", "31") + enter_text_to_cell(gridwin, "B7", "31") + enter_text_to_cell(gridwin, "B8", "12") + enter_text_to_cell(gridwin, "B9", "24") + enter_text_to_cell(gridwin, "B10", "23") + enter_text_to_cell(gridwin, "B11", "19") + enter_text_to_cell(gridwin, "B12", "10") + enter_text_to_cell(gridwin, "B13", "33") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B13"})) + self.ui_test.execute_modeless_dialog_through_command(".uno:TTestDialog") + xDialog = self.xUITest.getTopFocusWindow() + xvariable1rangeedit = xDialog.getChild("variable1-range-edit") + xvariable2rangeedit = xDialog.getChild("variable2-range-edit") + xoutputrangeedit = xDialog.getChild("output-range-edit") + xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") + xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") + + xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$A$13"})) + xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$B$1:$B$13"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"F1"})) + xgroupedbycolumnsradio.executeAction("CLICK", tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #Verify + self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "Paired t-test") + self.assertEqual(get_cell_by_position(document, 0, 5, 1).getString(), "Alpha") + self.assertEqual(get_cell_by_position(document, 0, 5, 2).getString(), "Hypothesized Mean Difference") + self.assertEqual(get_cell_by_position(document, 0, 5, 4).getString(), "Mean") + self.assertEqual(get_cell_by_position(document, 0, 5, 5).getString(), "Variance") + self.assertEqual(get_cell_by_position(document, 0, 5, 6).getString(), "Observations") + self.assertEqual(get_cell_by_position(document, 0, 5, 7).getString(), "Pearson Correlation") + self.assertEqual(get_cell_by_position(document, 0, 5, 8).getString(), "Observed Mean Difference") + self.assertEqual(get_cell_by_position(document, 0, 5, 9).getString(), "Variance of the Differences") + self.assertEqual(get_cell_by_position(document, 0, 5, 10).getString(), "df") + self.assertEqual(get_cell_by_position(document, 0, 5, 11).getString(), "t Stat") + self.assertEqual(get_cell_by_position(document, 0, 5, 12).getString(), "P (T<=t) one-tail") + self.assertEqual(get_cell_by_position(document, 0, 5, 13).getString(), "t Critical one-tail") + self.assertEqual(get_cell_by_position(document, 0, 5, 14).getString(), "P (T<=t) two-tail") + self.assertEqual(get_cell_by_position(document, 0, 5, 15).getString(), "t Critical two-tail") + + self.assertEqual(get_cell_by_position(document, 0, 6, 1).getValue(), 0.05) + self.assertEqual(get_cell_by_position(document, 0, 6, 2).getValue(), 0) + self.assertEqual(get_cell_by_position(document, 0, 6, 3).getString(), "Variable 1") + self.assertEqual(round(get_cell_by_position(document, 0, 6, 4).getValue(),12), 16.923076923077) + self.assertEqual(round(get_cell_by_position(document, 0, 6, 5).getValue(),12), 125.076923076923) + self.assertEqual(get_cell_by_position(document, 0, 6, 6).getValue(), 13) + self.assertEqual(round(get_cell_by_position(document, 0, 6, 7).getValue(),12), -0.061753977175) + self.assertEqual(round(get_cell_by_position(document, 0, 6, 8).getValue(),12), -3.538461538462) + self.assertEqual(round(get_cell_by_position(document, 0, 6, 9).getValue(),12), 232.935897435897) + self.assertEqual(get_cell_by_position(document, 0, 6, 10).getValue(), 12) + self.assertEqual(round(get_cell_by_position(document, 0, 6, 11).getValue(),12), -0.835926213674) + self.assertEqual(round(get_cell_by_position(document, 0, 6, 12).getValue(),12), 0.209765144211) + self.assertEqual(round(get_cell_by_position(document, 0, 6, 13).getValue(),12), 1.782287555649) + self.assertEqual(round(get_cell_by_position(document, 0, 6, 14).getValue(),12), 0.419530288422) + self.assertEqual(round(get_cell_by_position(document, 0, 6, 15).getValue(),12), 2.178812829667) + + self.assertEqual(get_cell_by_position(document, 0, 7, 3).getString(), "Variable 2") + self.assertEqual(round(get_cell_by_position(document, 0, 7, 4).getValue(),12), 20.461538461538) + self.assertEqual(round(get_cell_by_position(document, 0, 7, 5).getValue(),12), 94.435897435897) + self.assertEqual(get_cell_by_position(document, 0, 7, 6).getValue(), 13) + #undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "") + + # test cancel button + self.ui_test.execute_modeless_dialog_through_command(".uno:TTestDialog") + xDialog = self.xUITest.getTopFocusWindow() + xCancelBtn = xDialog.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/statistics/tdf76731.py b/sc/qa/uitest/statistics/tdf76731.py new file mode 100644 index 000000000..0dc1f86cb --- /dev/null +++ b/sc/qa/uitest/statistics/tdf76731.py @@ -0,0 +1,73 @@ +# -*- 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 +#Bug 76731 - ANOVA: F critical is not shown + +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +class anova(UITestCase): + def test_tdf76731_anova(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf76731.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #1. Open the attached sample document in Calc. + #2. Select the data range, i.e. A1:C5. + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C5"})) + #3. Choose Data - Analysis of Variance (ANOVA). + #4. Choose an arbitrary output cell and click OK. + self.ui_test.execute_modeless_dialog_through_command(".uno:AnalysisOfVarianceDialog") + xDialog = self.xUITest.getTopFocusWindow() + xinputrangeedit = xDialog.getChild("input-range-edit") + xoutputrangeedit = xDialog.getChild("output-range-edit") + xradiotwofactor = xDialog.getChild("radio-two-factor") + xradiosinglefactor = xDialog.getChild("radio-single-factor") + xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") + xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") + xalphaspin = xDialog.getChild("alpha-spin") + + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$F$1"})) + xradiosinglefactor.executeAction("CLICK", tuple()) + xalphaspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xalphaspin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xalphaspin.executeAction("TYPE", mkPropertyValues({"TEXT":"0.05"})) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #Verify, Table of results is shown, "F critical" cell has "#NAME?" error value. + self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "ANOVA - Single Factor") + self.assertEqual(get_cell_by_position(document, 0, 5, 1).getString(), "Alpha") + self.assertEqual(get_cell_by_position(document, 0, 5, 3).getString(), "Groups") + self.assertEqual(get_cell_by_position(document, 0, 5, 4).getString(), "Column 1") + self.assertEqual(get_cell_by_position(document, 0, 5, 5).getString(), "Column 2") + self.assertEqual(get_cell_by_position(document, 0, 5, 6).getString(), "Column 3") + self.assertEqual(get_cell_by_position(document, 0, 5, 8).getString(), "Source of Variation") + self.assertEqual(get_cell_by_position(document, 0, 5, 9).getString(), "Between Groups") + self.assertEqual(get_cell_by_position(document, 0, 5, 10).getString(), "Within Groups") + self.assertEqual(get_cell_by_position(document, 0, 5, 11).getString(), "Total") + + self.assertEqual(get_cell_by_position(document, 0, 11, 8).getString(), "F critical") + self.assertEqual(round(get_cell_by_position(document, 0, 11, 9).getValue(),9), 3.885293835) + + #undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "") + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab:
\ No newline at end of file diff --git a/sc/qa/uitest/statistics/zTest.py b/sc/qa/uitest/statistics/zTest.py new file mode 100644 index 000000000..a7f791e1a --- /dev/null +++ b/sc/qa/uitest/statistics/zTest.py @@ -0,0 +1,112 @@ +# -*- 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 + +class zTest(UITestCase): + def test_zTest_column(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() + #fill data + enter_text_to_cell(gridwin, "A1", "28") + enter_text_to_cell(gridwin, "A2", "26") + enter_text_to_cell(gridwin, "A3", "31") + enter_text_to_cell(gridwin, "A4", "23") + enter_text_to_cell(gridwin, "A5", "20") + enter_text_to_cell(gridwin, "A6", "27") + enter_text_to_cell(gridwin, "A7", "28") + enter_text_to_cell(gridwin, "A8", "14") + enter_text_to_cell(gridwin, "A9", "4") + enter_text_to_cell(gridwin, "A10", "0") + enter_text_to_cell(gridwin, "A11", "2") + enter_text_to_cell(gridwin, "A12", "8") + enter_text_to_cell(gridwin, "A13", "9") + + enter_text_to_cell(gridwin, "B1", "19") + enter_text_to_cell(gridwin, "B2", "13") + enter_text_to_cell(gridwin, "B3", "12") + enter_text_to_cell(gridwin, "B4", "5") + enter_text_to_cell(gridwin, "B5", "34") + enter_text_to_cell(gridwin, "B6", "31") + enter_text_to_cell(gridwin, "B7", "31") + enter_text_to_cell(gridwin, "B8", "12") + enter_text_to_cell(gridwin, "B9", "24") + enter_text_to_cell(gridwin, "B10", "23") + enter_text_to_cell(gridwin, "B11", "19") + enter_text_to_cell(gridwin, "B12", "10") + enter_text_to_cell(gridwin, "B13", "33") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B13"})) + self.ui_test.execute_modeless_dialog_through_command(".uno:ZTestDialog") + xDialog = self.xUITest.getTopFocusWindow() + xvariable1rangeedit = xDialog.getChild("variable1-range-edit") + xvariable2rangeedit = xDialog.getChild("variable2-range-edit") + xoutputrangeedit = xDialog.getChild("output-range-edit") + xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-radio") + xgroupedbycolumnsradio = xDialog.getChild("groupedby-columns-radio") + + xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xvariable1rangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$A$13"})) + xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xvariable2rangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$B$1:$B$13"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xoutputrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"F1"})) + xgroupedbycolumnsradio.executeAction("CLICK", tuple()) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #Verify + self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "z-test") + self.assertEqual(get_cell_by_position(document, 0, 5, 1).getString(), "Alpha") + + self.assertEqual(get_cell_by_position(document, 0, 5, 2).getString(), "Hypothesized Mean Difference") + self.assertEqual(get_cell_by_position(document, 0, 5, 4).getString(), "Known Variance") + self.assertEqual(get_cell_by_position(document, 0, 5, 5).getString(), "Mean") + self.assertEqual(get_cell_by_position(document, 0, 5, 6).getString(), "Observations") + self.assertEqual(get_cell_by_position(document, 0, 5, 7).getString(), "Observed Mean Difference") + self.assertEqual(get_cell_by_position(document, 0, 5, 8).getString(), "z") + self.assertEqual(get_cell_by_position(document, 0, 5, 9).getString(), "P (Z<=z) one-tail") + self.assertEqual(get_cell_by_position(document, 0, 5, 10).getString(), "z Critical one-tail") + self.assertEqual(get_cell_by_position(document, 0, 5, 11).getString(), "P (Z<=z) two-tail") + self.assertEqual(get_cell_by_position(document, 0, 5, 12).getString(), "z Critical two-tail") + + self.assertEqual(get_cell_by_position(document, 0, 6, 1).getValue(), 0.05) + self.assertEqual(get_cell_by_position(document, 0, 6, 2).getValue(), 0) + self.assertEqual(get_cell_by_position(document, 0, 6, 3).getString(), "Variable 1") + self.assertEqual(get_cell_by_position(document, 0, 6, 4).getValue(), 0) + self.assertEqual(round(get_cell_by_position(document, 0, 6, 5).getValue(),12), 16.923076923077) + self.assertEqual(round(get_cell_by_position(document, 0, 6, 10).getValue(),12), 1.644853626951) + self.assertEqual(round(get_cell_by_position(document, 0, 6, 12).getValue(),12), 1.959963984540) + + self.assertEqual(get_cell_by_position(document, 0, 7, 3).getString(), "Variable 2") + self.assertEqual(get_cell_by_position(document, 0, 7, 4).getValue(), 0) + self.assertEqual(round(get_cell_by_position(document, 0, 7, 5).getValue(),12), 20.461538461538) + self.assertEqual(get_cell_by_position(document, 0, 7, 6).getValue(), 13) + #undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "") + + # test cancel button + self.ui_test.execute_modeless_dialog_through_command(".uno:ZTestDialog") + xDialog = self.xUITest.getTopFocusWindow() + xCancelBtn = xDialog.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/textCase/textCase.py b/sc/qa/uitest/textCase/textCase.py new file mode 100644 index 000000000..afa98857e --- /dev/null +++ b/sc/qa/uitest/textCase/textCase.py @@ -0,0 +1,165 @@ +# -*- 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() + +class textCase(UITestCase): + def test_text_case_switch(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", "hello world") + enter_text_to_cell(gridwin, "A2", "libre office") + enter_text_to_cell(gridwin, "A4", "free suite") + #select + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"})) + #Capitalize every word - CommandSent Name:.uno:ChangeCaseToTitleCase + self.xUITest.executeCommand(".uno:ChangeCaseToTitleCase") + #Verify + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Hello World") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "Libre Office") + self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "") + self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "Free Suite") + + #Sentence case - CommandSent Name:.uno:ChangeCaseToSentenceCase + self.xUITest.executeCommand(".uno:ChangeCaseToSentenceCase") + + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Hello world") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "Libre office") + self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "") + self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "Free suite") + + #toggle case - CommandSent Name:.uno:ChangeCaseToToggleCase + self.xUITest.executeCommand(".uno:ChangeCaseToToggleCase") + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "hELLO WORLD") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "lIBRE OFFICE") + self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "") + self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "fREE SUITE") + + #uppercase = CommandSent Name:.uno:ChangeCaseToUpper + self.xUITest.executeCommand(".uno:ChangeCaseToUpper") + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "HELLO WORLD") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "LIBRE OFFICE") + self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "") + self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "FREE SUITE") + + #lowercase - CommandSent Name:.uno:ChangeCaseToLower + self.xUITest.executeCommand(".uno:ChangeCaseToLower") + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "hello world") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "libre office") + self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "") + self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "free suite") + + #cycle case = CommandSent Name:.uno:ChangeCaseRotateCase + self.xUITest.executeCommand(".uno:ChangeCaseRotateCase") + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Hello World") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "Libre Office") + self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "") + self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "Free Suite") + + #select non continuous range + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "B1:B2"})) + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"})) + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A4:A5", "EXTEND":"1"})) + + #lowercase - CommandSent Name:.uno:ChangeCaseToLower + self.xUITest.executeCommand(".uno:ChangeCaseToLower") + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "hello world") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "libre office") + self.assertEqual(get_cell_by_position(document, 0, 0, 4).getString(), "") + self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "free suite") + + #Capitalize every word - CommandSent Name:.uno:ChangeCaseToTitleCase + self.xUITest.executeCommand(".uno:ChangeCaseToTitleCase") + #Verify + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Hello World") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "Libre Office") + self.assertEqual(get_cell_by_position(document, 0, 0, 4).getString(), "") + self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "Free Suite") + + #Sentence case - CommandSent Name:.uno:ChangeCaseToSentenceCase + self.xUITest.executeCommand(".uno:ChangeCaseToSentenceCase") + + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Hello world") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "Libre office") + self.assertEqual(get_cell_by_position(document, 0, 0, 4).getString(), "") + self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "Free suite") + + #toggle case - CommandSent Name:.uno:ChangeCaseToToggleCase + self.xUITest.executeCommand(".uno:ChangeCaseToToggleCase") + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "hELLO WORLD") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "lIBRE OFFICE") + self.assertEqual(get_cell_by_position(document, 0, 0, 4).getString(), "") + self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "fREE SUITE") + + #uppercase = CommandSent Name:.uno:ChangeCaseToUpper + self.xUITest.executeCommand(".uno:ChangeCaseToUpper") + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "HELLO WORLD") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "LIBRE OFFICE") + self.assertEqual(get_cell_by_position(document, 0, 0, 4).getString(), "") + self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "FREE SUITE") + + #lowercase - CommandSent Name:.uno:ChangeCaseToLower + self.xUITest.executeCommand(".uno:ChangeCaseToLower") + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "hello world") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "libre office") + self.assertEqual(get_cell_by_position(document, 0, 0, 4).getString(), "") + self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "free suite") + + #cycle case = CommandSent Name:.uno:ChangeCaseRotateCase + self.xUITest.executeCommand(".uno:ChangeCaseRotateCase") + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Hello world") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "Libre office") + self.assertEqual(get_cell_by_position(document, 0, 0, 4).getString(), "") + self.assertEqual(get_cell_by_position(document, 0, 0, 3).getString(), "Free suite") + self.ui_test.close_doc() + + def test_tdf119155_Capitalize_Every_Word(self): + #Bug 119155 - Freeze after command format->text->Capitalize Every Word + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf119155.xlsx")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #1. Open attached file + #2. Select cells from C2 to C14 + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "C2:C14"})) + #3. Go to menu: Format->Text->Capitalize Every Word + self.xUITest.executeCommand(".uno:ChangeCaseToTitleCase") + #Actual Results:Freezes LibreOffice + self.assertEqual(get_cell_by_position(document, 0, 2, 1).getString(), "Collagene Expert Targeted Wrinkle Corrector Unboxed 10 Ml") + self.assertEqual(get_cell_by_position(document, 0, 2, 13).getString(), "Vitamina Suractivee Hand Cream 400 Ml") + + self.ui_test.close_doc() + + def test_tdf119162_Cycle_Case(self): + #Bug 119162 - Format > Text > Cycle Case on attached example file hangs Calc reproducibly + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf119162.xls")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #1.Open the attached .xls file + #2. Select column A + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #3. Select [Format] > [Text] > [Cycle Case] + self.xUITest.executeCommand(".uno:ChangeCaseRotateCase") + self.xUITest.executeCommand(".uno:ChangeCaseToLower") + #Actual Results:Freezes LibreOffice + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "test\n") + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/validity/tdf53920.py b/sc/qa/uitest/validity/tdf53920.py new file mode 100644 index 000000000..221922d4b --- /dev/null +++ b/sc/qa/uitest/validity/tdf53920.py @@ -0,0 +1,78 @@ +# -*- 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 53920 - EDITING: Data Validity Cell Range not being applied to multiple selected cells +class tdf53920(UITestCase): + def test_tdf53920_validity_multiple_cells(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() + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #. Provide the desired values in a range of cells + enter_text_to_cell(gridwin, "C1", "A") + enter_text_to_cell(gridwin, "C2", "B") + enter_text_to_cell(gridwin, "C3", "C") + #Select the cells to be validated + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3", "EXTEND":"1"})) + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A5", "EXTEND":"1"})) + #Apply Data > Validity ... > Cell Range + self.ui_test.execute_dialog_through_command(".uno:Validation") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + xallow = xDialog.getChild("allow") + xmin = xDialog.getChild("min") + + props = {"TEXT": "Cell range"} + actionProps = mkPropertyValues(props) + xallow.executeAction("SELECT", actionProps) + xmin.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$C$1:$C$3"})) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #Expected behavior: All selected cells validate data. + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + self.ui_test.execute_dialog_through_command(".uno:Validation") + xDialog = self.xUITest.getTopFocusWindow() + xallow = xDialog.getChild("allow") + xmin = xDialog.getChild("min") + self.assertEqual(get_state_as_dict(xallow)["SelectEntryText"], "Cell range") + self.assertEqual(get_state_as_dict(xmin)["Text"], "$Sheet1.$C$1:$C$3") + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) + self.ui_test.execute_dialog_through_command(".uno:Validation") + xDialog = self.xUITest.getTopFocusWindow() + xallow = xDialog.getChild("allow") + xmin = xDialog.getChild("min") + self.assertEqual(get_state_as_dict(xallow)["SelectEntryText"], "Cell range") + self.assertEqual(get_state_as_dict(xmin)["Text"], "$Sheet1.$C$1:$C$3") + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A5"})) + self.ui_test.execute_dialog_through_command(".uno:Validation") + xDialog = self.xUITest.getTopFocusWindow() + xallow = xDialog.getChild("allow") + xmin = xDialog.getChild("min") + self.assertEqual(get_state_as_dict(xallow)["SelectEntryText"], "Cell range") + self.assertEqual(get_state_as_dict(xmin)["Text"], "$Sheet1.$C$1:$C$3") + 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/validity/tdf65686.py b/sc/qa/uitest/validity/tdf65686.py new file mode 100644 index 000000000..e2bc037c3 --- /dev/null +++ b/sc/qa/uitest/validity/tdf65686.py @@ -0,0 +1,59 @@ +# -*- 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 65686 - EDITING Data > Validity broken (for list entries at least) +class tdf65686(UITestCase): + def test_tdf65686_validity_list(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() + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #- Data > Validity + #- Select Allow List + #- Enter Entries Aap Noot Mies + #- OK + self.ui_test.execute_dialog_through_command(".uno:Validation") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + xallow = xDialog.getChild("allow") + xallowempty = xDialog.getChild("allowempty") + minlist = xDialog.getChild("minlist") + + props = {"TEXT": "List"} + actionProps = mkPropertyValues(props) + xallow.executeAction("SELECT", actionProps) + minlist.executeAction("TYPE", mkPropertyValues({"TEXT":"Aap"})) + minlist.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + minlist.executeAction("TYPE", mkPropertyValues({"TEXT":"Noot"})) + minlist.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + minlist.executeAction("TYPE", mkPropertyValues({"TEXT":"Mies"})) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #- again open Data > Validity + #> there are empty lines in the list Entries + self.ui_test.execute_dialog_through_command(".uno:Validation") + xDialog = self.xUITest.getTopFocusWindow() + xallow = xDialog.getChild("allow") + xallowempty = xDialog.getChild("allowempty") + minlist = xDialog.getChild("minlist") + + self.assertEqual(get_state_as_dict(xallow)["SelectEntryText"], "List") + self.assertEqual(get_state_as_dict(minlist)["Text"], "Aap\nNoot\nMies") + + 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/validity/tdf96698.py b/sc/qa/uitest/validity/tdf96698.py new file mode 100644 index 000000000..c219e0444 --- /dev/null +++ b/sc/qa/uitest/validity/tdf96698.py @@ -0,0 +1,137 @@ +# -*- 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 96698 - Data => Validity => Custom (like Excel) is missing +class tdf96698(UITestCase): + def test_tdf96698_validity_custom_formula(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() + + #A general validity check for the entered new content of the active cell - especially for text + #with a custom formula like in Excel is not possible. + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A2"})) + self.ui_test.execute_dialog_through_command(".uno:Validation") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + xallow = xDialog.getChild("allow") + xallowempty = xDialog.getChild("allowempty") + xmin = xDialog.getChild("min") + + props = {"TEXT": "Custom"} + actionProps = mkPropertyValues(props) + xallow.executeAction("SELECT", actionProps) + xmin.executeAction("TYPE", mkPropertyValues({"TEXT":"ISERROR(FIND(\",\",B2))"})) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #verify + self.ui_test.execute_dialog_through_command(".uno:Validation") + xDialog = self.xUITest.getTopFocusWindow() + xallow = xDialog.getChild("allow") + xallowempty = xDialog.getChild("allowempty") + xmin = xDialog.getChild("min") + + self.assertEqual(get_state_as_dict(xallow)["SelectEntryText"], "Custom") + self.assertEqual(get_state_as_dict(xmin)["Text"], "ISERROR(FIND(\",\",B2))") + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) + self.ui_test.execute_dialog_through_command(".uno:Validation") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + xallow = xDialog.getChild("allow") + xallowempty = xDialog.getChild("allowempty") + xmin = xDialog.getChild("min") + + props = {"TEXT": "Custom"} + actionProps = mkPropertyValues(props) + xallow.executeAction("SELECT", actionProps) + xmin.executeAction("TYPE", mkPropertyValues({"TEXT":"NOT(ISERROR(B3))"})) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #verify + self.ui_test.execute_dialog_through_command(".uno:Validation") + xDialog = self.xUITest.getTopFocusWindow() + xallow = xDialog.getChild("allow") + xallowempty = xDialog.getChild("allowempty") + xmin = xDialog.getChild("min") + + self.assertEqual(get_state_as_dict(xallow)["SelectEntryText"], "Custom") + self.assertEqual(get_state_as_dict(xmin)["Text"], "NOT(ISERROR(B3))") + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A7"})) + self.ui_test.execute_dialog_through_command(".uno:Validation") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + xallow = xDialog.getChild("allow") + xallowempty = xDialog.getChild("allowempty") + xmin = xDialog.getChild("min") + + props = {"TEXT": "Custom"} + actionProps = mkPropertyValues(props) + xallow.executeAction("SELECT", actionProps) + xmin.executeAction("TYPE", mkPropertyValues({"TEXT":"ISERROR(FIND(\",\",A7))"})) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #verify + self.ui_test.execute_dialog_through_command(".uno:Validation") + xDialog = self.xUITest.getTopFocusWindow() + xallow = xDialog.getChild("allow") + xallowempty = xDialog.getChild("allowempty") + xmin = xDialog.getChild("min") + + self.assertEqual(get_state_as_dict(xallow)["SelectEntryText"], "Custom") + self.assertEqual(get_state_as_dict(xmin)["Text"], "ISERROR(FIND(\",\",A7))") + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A8"})) + self.ui_test.execute_dialog_through_command(".uno:Validation") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + xallow = xDialog.getChild("allow") + xallowempty = xDialog.getChild("allowempty") + xmin = xDialog.getChild("min") + + props = {"TEXT": "Custom"} + actionProps = mkPropertyValues(props) + xallow.executeAction("SELECT", actionProps) + xmin.executeAction("TYPE", mkPropertyValues({"TEXT":"NOT(ISERROR(A8))"})) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #verify + self.ui_test.execute_dialog_through_command(".uno:Validation") + xDialog = self.xUITest.getTopFocusWindow() + xallow = xDialog.getChild("allow") + xallowempty = xDialog.getChild("allowempty") + xmin = xDialog.getChild("min") + + self.assertEqual(get_state_as_dict(xallow)["SelectEntryText"], "Custom") + self.assertEqual(get_state_as_dict(xmin)["Text"], "NOT(ISERROR(A8))") + + 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/validity/validity.py b/sc/qa/uitest/validity/validity.py new file mode 100644 index 000000000..93cd2461e --- /dev/null +++ b/sc/qa/uitest/validity/validity.py @@ -0,0 +1,143 @@ +# -*- 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 + +class validity(UITestCase): + def test_validity_tab_criteria(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() + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + + self.ui_test.execute_dialog_through_command(".uno:Validation") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + xallow = xDialog.getChild("allow") + xallowempty = xDialog.getChild("allowempty") + xdata = xDialog.getChild("data") + xmin = xDialog.getChild("min") + xmax = xDialog.getChild("max") + + props = {"TEXT": "Whole Numbers"} + actionProps = mkPropertyValues(props) + xallow.executeAction("SELECT", actionProps) + xallowempty.executeAction("CLICK", tuple()) + propsA = {"TEXT": "valid range"} + actionPropsA = mkPropertyValues(propsA) + xdata.executeAction("SELECT", actionPropsA) + xmin.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) + xmax.executeAction("TYPE", mkPropertyValues({"TEXT":"2"})) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #reopen and verify + self.ui_test.execute_dialog_through_command(".uno:Validation") + xDialog = self.xUITest.getTopFocusWindow() + xallow = xDialog.getChild("allow") + xallowempty = xDialog.getChild("allowempty") + xdata = xDialog.getChild("data") + xmin = xDialog.getChild("min") + xmax = xDialog.getChild("max") + + self.assertEqual(get_state_as_dict(xallow)["SelectEntryText"], "Whole Numbers") + self.assertEqual(get_state_as_dict(xallowempty)["Selected"], "false") + self.assertEqual(get_state_as_dict(xdata)["SelectEntryText"], "valid range") + self.assertEqual(get_state_as_dict(xmin)["Text"], "1") + self.assertEqual(get_state_as_dict(xmax)["Text"], "2") + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + + self.ui_test.close_doc() + + def test_validity_tab_inputHelp(self): + #validationhelptabpage.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() + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + + self.ui_test.execute_dialog_through_command(".uno:Validation") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") + xtsbhelp = xDialog.getChild("tsbhelp") + xtitle = xDialog.getChild("title") + xinputhelp = xDialog.getChild("inputhelp") + + xtsbhelp.executeAction("CLICK", tuple()) + xtitle.executeAction("TYPE", mkPropertyValues({"TEXT":"A"})) + xinputhelp.executeAction("TYPE", mkPropertyValues({"TEXT":"B"})) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #reopen and verify + self.ui_test.execute_dialog_through_command(".uno:Validation") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + xtsbhelp = xDialog.getChild("tsbhelp") + xtitle = xDialog.getChild("title") + xinputhelp = xDialog.getChild("inputhelp") + # print(get_state_as_dict(xtsbhelp)) + select_pos(xTabs, "1") + self.assertEqual(get_state_as_dict(xtsbhelp)["Selected"], "true") + self.assertEqual(get_state_as_dict(xtitle)["Text"], "A") + self.assertEqual(get_state_as_dict(xinputhelp)["Text"], "B") + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.ui_test.close_doc() + + def test_validity_tab_errorAlert(self): + # erroralerttabpage.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() + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + + self.ui_test.execute_dialog_through_command(".uno:Validation") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "2") + + xactionCB = xDialog.getChild("actionCB") + xerroralerttitle = xDialog.getChild("erroralert_title") + xerrorMsg = xDialog.getChild("errorMsg") + + props = {"TEXT": "Warning"} + actionProps = mkPropertyValues(props) + xactionCB.executeAction("SELECT", actionProps) + xerroralerttitle.executeAction("TYPE", mkPropertyValues({"TEXT":"Warn"})) + xerrorMsg.executeAction("TYPE", mkPropertyValues({"TEXT":"Warn2"})) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #reopen and verify + self.ui_test.execute_dialog_through_command(".uno:Validation") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "2") + + xactionCB = xDialog.getChild("actionCB") + xerroralerttitle = xDialog.getChild("erroralert_title") + xerrorMsg = xDialog.getChild("errorMsg") + + self.assertEqual(get_state_as_dict(xactionCB)["SelectEntryText"], "Warning") + self.assertEqual(get_state_as_dict(xerroralerttitle)["Text"], "Warn") + self.assertEqual(get_state_as_dict(xerrorMsg)["Text"], "Warn2") + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: |