diff options
Diffstat (limited to 'sc/qa/uitest')
451 files changed, 23245 insertions, 0 deletions
diff --git a/sc/qa/uitest/__init__.py b/sc/qa/uitest/__init__.py new file mode 100644 index 0000000000..e69de29bb2 --- /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 0000000000..fbf46cc5d3 --- /dev/null +++ b/sc/qa/uitest/autofilter/autofilter.py @@ -0,0 +1,588 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file, select_by_text +from libreoffice.uno.propertyvalue import mkPropertyValues +from libreoffice.calc.document import is_row_hidden +from uitest.uihelper.calc import enter_text_to_cell + +class AutofilterTest(UITestCase): + + def test_tdf106214(self): + with self.ui_test.load_file(get_url_for_data_file("autofilter.ods")) as doc: + + xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") + xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + + xFloatWindow = self.xUITest.getFloatWindow() + xCheckListMenu = xFloatWindow.getChild("FilterDropDown") + + xTreeList = xCheckListMenu.getChild("check_tree_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)) + + def test_filter_multiple_rows(self): + with self.ui_test.load_file(get_url_for_data_file("autofilter.ods")) as doc: + + xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") + xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "2", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xCheckListMenu = xFloatWindow.getChild("FilterDropDown") + + 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_tdf133160(self): + with self.ui_test.load_file(get_url_for_data_file("tdf133160.ods")): + + xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") + xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "3"})) + xFloatWindow = self.xUITest.getFloatWindow() + xCheckListMenu = xFloatWindow.getChild("FilterDropDown") + xTreeList = xCheckListMenu.getChild("check_list_box") + size1 = int(get_state_as_dict(xTreeList)["Size"].split('x')[0]) + xOkBtn = xFloatWindow.getChild("cancel") + xOkBtn.executeAction("CLICK", tuple()) + + xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "2", "ROW": "3"})) + xFloatWindow = self.xUITest.getFloatWindow() + xCheckListMenu = xFloatWindow.getChild("FilterDropDown") + xTreeList = xCheckListMenu.getChild("check_list_box") + size2 = int(get_state_as_dict(xTreeList)["Size"].split('x')[0]) + xOkBtn = xFloatWindow.getChild("cancel") + xOkBtn.executeAction("CLICK", tuple()) + + xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "3", "ROW": "3"})) + xFloatWindow = self.xUITest.getFloatWindow() + xCheckListMenu = xFloatWindow.getChild("FilterDropDown") + xTreeList = xCheckListMenu.getChild("check_list_box") + size3 = int(get_state_as_dict(xTreeList)["Size"].split('x')[0]) + xOkBtn = xFloatWindow.getChild("cancel") + xOkBtn.executeAction("CLICK", tuple()) + + xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "4", "ROW": "3"})) + xFloatWindow = self.xUITest.getFloatWindow() + xCheckListMenu = xFloatWindow.getChild("FilterDropDown") + xTreeList = xCheckListMenu.getChild("check_list_box") + size4 = int(get_state_as_dict(xTreeList)["Size"].split('x')[0]) + + xOkBtn = xFloatWindow.getChild("cancel") + xOkBtn.executeAction("CLICK", tuple()) + + self.assertTrue(size1 < size2) # for me they were size1=176 size2=212 size3=459 size4=1012 + self.assertTrue(size2 < size3) # size1 is the minimum window width, size2 based on its column width + self.assertTrue(size3 < size4) # size3 is a long text width + self.assertTrue(size4 < 1500) # size4 is the maximum window width with a really long text + + def test_tdf134351(self): + with self.ui_test.load_file(get_url_for_data_file("autofilter.ods")) as doc: + + xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") + xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + + xFloatWindow = self.xUITest.getFloatWindow() + xCheckListMenu = xFloatWindow.getChild("FilterDropDown") + + xTreeList = xCheckListMenu.getChild("check_tree_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)) + + def test_differentSearches(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + calcDoc = self.xUITest.getTopFocusWindow() + + xGridWindow = calcDoc.getChild("grid_window") + enter_text_to_cell(xGridWindow, "A1", "X") + enter_text_to_cell(xGridWindow, "A2", "11") + enter_text_to_cell(xGridWindow, "A3", "22") + xGridWindow.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A3"})) + + self.xUITest.executeCommand(".uno:DataFilterAutoFilter") + + xGridWindow.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + + xFloatWindow = self.xUITest.getFloatWindow() + + xCheckListMenu = xFloatWindow.getChild("FilterDropDown") + + xList = xCheckListMenu.getChild("check_list_box") + + self.assertEqual(2, len(xList.getChildren())) + self.assertEqual("11", get_state_as_dict(xList.getChild('0'))['Text']) + self.assertEqual("22", get_state_as_dict(xList.getChild('1'))['Text']) + + xSearchEdit = xFloatWindow.getChild("search_edit") + xSearchEdit.executeAction("TYPE", mkPropertyValues({"TEXT" : "11"})) + + self.ui_test.wait_until_property_is_updated(xList, "Children", str(1)) + self.assertEqual(1, len(xList.getChildren())) + self.assertEqual("11", get_state_as_dict(xList.getChild('0'))['Text']) + + xOkBtn = xFloatWindow.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) + + self.assertFalse(is_row_hidden(document, 0)) + self.assertFalse(is_row_hidden(document, 1)) + self.assertTrue(is_row_hidden(document, 2)) + + xGridWindow.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + + xFloatWindow = self.xUITest.getFloatWindow() + + xCheckListMenu = xFloatWindow.getChild("FilterDropDown") + + xList = xCheckListMenu.getChild("check_list_box") + + self.assertEqual(2, len(xList.getChildren())) + self.assertEqual("11", get_state_as_dict(xList.getChild('0'))['Text']) + self.assertEqual("22", get_state_as_dict(xList.getChild('1'))['Text']) + + xSearchEdit = xFloatWindow.getChild("search_edit") + xSearchEdit.executeAction("TYPE", mkPropertyValues({"TEXT" : "22"})) + + self.ui_test.wait_until_property_is_updated(xList, "Children", str(1)) + self.assertEqual(1, len(xList.getChildren())) + self.assertEqual("22", get_state_as_dict(xList.getChild('0'))['Text']) + + xOkBtn = xFloatWindow.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) + + + self.assertFalse(is_row_hidden(document, 0)) + self.assertTrue(is_row_hidden(document, 1)) + self.assertFalse(is_row_hidden(document, 2)) + + + def test_tdf89244(self): + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + enter_text_to_cell(gridwin, "A1", "AAA") + enter_text_to_cell(gridwin, "A3", "BBB") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"})) + + self.xUITest.executeCommand(".uno:MergeCells") + + self.xUITest.executeCommand(".uno:DataFilterAutoFilter") + + gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + + xFloatWindow = self.xUITest.getFloatWindow() + + xCheckListMenu = xFloatWindow.getChild("FilterDropDown") + + xList = xCheckListMenu.getChild("check_list_box") + + self.assertEqual(2, len(xList.getChildren())) + self.assertEqual("(empty)", get_state_as_dict(xList.getChild('0'))['Text']) + self.assertEqual("BBB", get_state_as_dict(xList.getChild('1'))['Text']) + + xOkBtn = xFloatWindow.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) + + + def test_tdf116818(self): + with self.ui_test.load_file(get_url_for_data_file("tdf116818.xlsx")): + + xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") + + xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xCheckListMenu = xFloatWindow.getChild("FilterDropDown") + xTreeList = xCheckListMenu.getChild("check_tree_box") + self.assertEqual(3, len(xTreeList.getChildren())) + xOkBtn = xFloatWindow.getChild("cancel") + xOkBtn.executeAction("CLICK", tuple()) + + xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xCheckListMenu = xFloatWindow.getChild("FilterDropDown") + xTreeList = xCheckListMenu.getChild("check_list_box") + # since tdf#117267, we are showing the hidden filter rows as inactive elements (5 active + 3 inactive) + self.assertEqual(8, len(xTreeList.getChildren())) + xOkBtn = xFloatWindow.getChild("cancel") + xOkBtn.executeAction("CLICK", tuple()) + + xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "2", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xCheckListMenu = xFloatWindow.getChild("FilterDropDown") + xTreeList = xCheckListMenu.getChild("check_list_box") + # since tdf#117267, we are showing the hidden filter rows as inactive elements (3 active + 9 inactive) + self.assertEqual(12, len(xTreeList.getChildren())) + xOkBtn = xFloatWindow.getChild("cancel") + xOkBtn.executeAction("CLICK", tuple()) + + def test_tdf140469(self): + with self.ui_test.load_file(get_url_for_data_file("tdf140469.xlsx")): + + xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") + + xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xCheckListMenu = xFloatWindow.getChild("FilterDropDown") + xTreeList = xCheckListMenu.getChild("check_list_box") + # since tdf#117267, we are showing the hidden filter rows as inactive elements (9 active + 3 inactive) + self.assertEqual(12, len(xTreeList.getChildren())) + xOkBtn = xFloatWindow.getChild("cancel") + xOkBtn.executeAction("CLICK", tuple()) + + def test_tdf140462(self): + with self.ui_test.load_file(get_url_for_data_file("tdf140462.ods")): + + xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") + + xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xCheckListMenu = xFloatWindow.getChild("FilterDropDown") + xTreeList = xCheckListMenu.getChild("check_tree_box") + self.assertEqual(3, len(xTreeList.getChildren())) + xOkBtn = xFloatWindow.getChild("cancel") + xOkBtn.executeAction("CLICK", tuple()) + + xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xCheckListMenu = xFloatWindow.getChild("FilterDropDown") + xTreeList = xCheckListMenu.getChild("check_list_box") + # since tdf#117267, we are showing the hidden filter rows as inactive elements (3 active + 5 inactive) + self.assertEqual(8, len(xTreeList.getChildren())) + xOkBtn = xFloatWindow.getChild("cancel") + xOkBtn.executeAction("CLICK", tuple()) + + xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "2", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xCheckListMenu = xFloatWindow.getChild("FilterDropDown") + xTreeList = xCheckListMenu.getChild("check_list_box") + # since tdf#117267, we are showing the hidden filter rows as inactive elements (4 active + 8 inactive) + self.assertEqual(12, len(xTreeList.getChildren())) + xOkBtn = xFloatWindow.getChild("cancel") + xOkBtn.executeAction("CLICK", tuple()) + + def test_tdf137626(self): + with self.ui_test.load_file(get_url_for_data_file("tdf137626.xlsx")): + + xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") + + xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xCheckListMenu = xFloatWindow.getChild("FilterDropDown") + xTreeList = xCheckListMenu.getChild("check_list_box") + # since tdf#117267, we are showing the hidden filter rows as inactive elements (3 active + 1 inactive) + self.assertEqual(4, len(xTreeList.getChildren())) + xOkBtn = xFloatWindow.getChild("cancel") + xOkBtn.executeAction("CLICK", tuple()) + + def test_time_value(self): + with self.ui_test.load_file(get_url_for_data_file("time_value.xlsx")): + + xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") + + xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xCheckListMenu = xFloatWindow.getChild("FilterDropDown") + xTreeList = xCheckListMenu.getChild("check_list_box") + self.assertEqual(5, len(xTreeList.getChildren())) + self.assertEqual('true', get_state_as_dict(xTreeList.getChild('0'))['IsChecked']) + self.assertEqual('false', get_state_as_dict(xTreeList.getChild('1'))['IsChecked']) + self.assertEqual('true', get_state_as_dict(xTreeList.getChild('2'))['IsChecked']) + self.assertEqual('false', get_state_as_dict(xTreeList.getChild('3'))['IsChecked']) + self.assertEqual('true', get_state_as_dict(xTreeList.getChild('4'))['IsChecked']) + xOkBtn = xFloatWindow.getChild("cancel") + xOkBtn.executeAction("CLICK", tuple()) + + xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xCheckListMenu = xFloatWindow.getChild("FilterDropDown") + xTreeList = xCheckListMenu.getChild("check_list_box") + # since tdf#117267, we are showing the hidden filter rows as inactive elements (2 active + 1 inactive) + self.assertEqual(3, len(xTreeList.getChildren())) + xOkBtn = xFloatWindow.getChild("cancel") + xOkBtn.executeAction("CLICK", tuple()) + + def test_tdf140968(self): + with self.ui_test.load_file(get_url_for_data_file("tdf140968.xlsx")) as doc: + + xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") + + xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xCheckListMenu = xFloatWindow.getChild("FilterDropDown") + xTreeList = xCheckListMenu.getChild("check_list_box") + self.assertEqual(5, len(xTreeList.getChildren())) + self.assertEqual("0.000", get_state_as_dict(xTreeList.getChild('0'))['Text']) + self.assertEqual("0.046", get_state_as_dict(xTreeList.getChild('1'))['Text']) + self.assertEqual("0.365", get_state_as_dict(xTreeList.getChild('2'))['Text']) + self.assertEqual("0.500", get_state_as_dict(xTreeList.getChild('3'))['Text']) + self.assertEqual("0.516", get_state_as_dict(xTreeList.getChild('4'))['Text']) + + self.assertEqual('false', get_state_as_dict(xTreeList.getChild('0'))['IsChecked']) + self.assertEqual('true', get_state_as_dict(xTreeList.getChild('1'))['IsChecked']) + self.assertEqual('false', get_state_as_dict(xTreeList.getChild('2'))['IsChecked']) + self.assertEqual('true', get_state_as_dict(xTreeList.getChild('3'))['IsChecked']) + self.assertEqual('true', get_state_as_dict(xTreeList.getChild('4'))['IsChecked']) + + xFirstEntry = xTreeList.getChild("0") + xFirstEntry.executeAction("CLICK", tuple()) + xFirstEntry = xTreeList.getChild("1") + xFirstEntry.executeAction("CLICK", tuple()) + + xOkBtn = xFloatWindow.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) + + self.assertFalse(is_row_hidden(doc, 0)) + self.assertTrue(is_row_hidden(doc, 1)) + self.assertTrue(is_row_hidden(doc, 2)) + self.assertTrue(is_row_hidden(doc, 3)) + self.assertTrue(is_row_hidden(doc, 4)) + self.assertFalse(is_row_hidden(doc, 5)) + self.assertFalse(is_row_hidden(doc, 6)) + self.assertFalse(is_row_hidden(doc, 7)) + + def test_tdf36383_row_height(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + calcDoc = self.xUITest.getTopFocusWindow() + gridwin = calcDoc.getChild("grid_window") + + enter_text_to_cell(gridwin, "A1", "A") + enter_text_to_cell(gridwin, "A2", "1") + enter_text_to_cell(gridwin, "A3", "2") + enter_text_to_cell(gridwin, "A4", "3") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"})) + + self.xUITest.executeCommand(".uno:DataFilterAutoFilter") + gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xCheckListMenu = xFloatWindow.getChild("FilterDropDown") + xTreeList = xCheckListMenu.getChild("check_list_box") + xEntry = xTreeList.getChild("1") + xEntry.executeAction("CLICK", tuple()) + + xOkButton = xFloatWindow.getChild("ok") + xOkButton.executeAction("CLICK", tuple()) + + self.assertTrue(is_row_hidden(document, 2)) + + # row height + with self.ui_test.execute_dialog_through_command(".uno:RowHeight") as xDialog: + xvalue = xDialog.getChild("value") + xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xvalue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xvalue.executeAction("TYPE", mkPropertyValues({"TEXT":"1 cm"})) + + self.assertTrue(is_row_hidden(document, 2)) + + # optimal row height + with self.ui_test.execute_dialog_through_command(".uno:SetOptimalRowHeight"): + pass + + self.assertTrue(is_row_hidden(document, 2)) + + def test_tdf142350(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + calcDoc = self.xUITest.getTopFocusWindow() + gridwin = calcDoc.getChild("grid_window") + + enter_text_to_cell(gridwin, "A1", "A") + enter_text_to_cell(gridwin, "A2", "0") + enter_text_to_cell(gridwin, "A3", "") + enter_text_to_cell(gridwin, "A4", "1") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"})) + + self.xUITest.executeCommand(".uno:DataFilterAutoFilter") + + gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xCheckListMenu = xFloatWindow.getChild("FilterDropDown") + xList = xCheckListMenu.getChild("check_list_box") + + # tdf140745 show (empty) entry on top of the checkbox list + self.assertEqual(3, len(xList.getChildren())) + self.assertEqual("(empty)", get_state_as_dict(xList.getChild('0'))['Text']) + self.assertEqual("0", get_state_as_dict(xList.getChild('1'))['Text']) + self.assertEqual("1", get_state_as_dict(xList.getChild('2'))['Text']) + + xEntry = xList.getChild("0") + xEntry.executeAction("CLICK", tuple()) + + xOkButton = xFloatWindow.getChild("ok") + xOkButton.executeAction("CLICK", tuple()) + + self.assertFalse(is_row_hidden(document, 1)) + self.assertTrue(is_row_hidden(document, 2)) + self.assertFalse(is_row_hidden(document, 3)) + + gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xCheckListMenu = xFloatWindow.getChild("FilterDropDown") + xList = xCheckListMenu.getChild("check_list_box") + self.assertEqual(3, len(xList.getChildren())) + self.assertEqual('false', get_state_as_dict(xList.getChild('0'))['IsChecked']) + self.assertEqual('true', get_state_as_dict(xList.getChild('1'))['IsChecked']) + self.assertEqual('true', get_state_as_dict(xList.getChild('2'))['IsChecked']) + xCloseButton = xFloatWindow.getChild("cancel") + xCloseButton.executeAction("CLICK", tuple()) + + + def test_tdf138438(self): + with self.ui_test.load_file(get_url_for_data_file("tdf138438.ods")) as doc: + + xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") + + # Top 10 filter + xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xMenu = xFloatWindow.getChild("menu") + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) + xSubFloatWindow = self.xUITest.getFloatWindow() + xSubMenu = xSubFloatWindow.getChild("menu") + xSubMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xSubMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xSubMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) + + self.assertFalse(is_row_hidden(doc, 0)) + self.assertTrue(is_row_hidden(doc, 1)) + self.assertTrue(is_row_hidden(doc, 2)) + self.assertFalse(is_row_hidden(doc, 3)) + self.assertFalse(is_row_hidden(doc, 4)) + self.assertFalse(is_row_hidden(doc, 5)) + self.assertFalse(is_row_hidden(doc, 6)) + self.assertTrue(is_row_hidden(doc, 7)) + self.assertFalse(is_row_hidden(doc, 8)) + + def test_tdf142402(self): + with self.ui_test.load_file(get_url_for_data_file("tdf140968.xlsx")) as doc: + + xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") + + xGridWin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B8"})) + with self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") as xDialog: + xval1 = xDialog.getChild("val1") + + select_by_text(xval1, "0.365") + + + 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.assertTrue(is_row_hidden(doc, 4)) + self.assertTrue(is_row_hidden(doc, 5)) + self.assertTrue(is_row_hidden(doc, 6)) + + def test_tdf142910(self): + with self.ui_test.load_file(get_url_for_data_file("tdf140968.xlsx")) as doc: + + xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") + + #Test '<' condition + xGridWin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B8"})) + with self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") as xDialog: + + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xcond1 = xDialog.getChild("cond1") + + select_by_text(xfield1, "Values") + select_by_text(xcond1, "<") + select_by_text(xval1, "0.365") + + + self.assertFalse(is_row_hidden(doc, 0)) + self.assertTrue(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.assertFalse(is_row_hidden(doc, 5)) + self.assertTrue(is_row_hidden(doc, 6)) + self.assertTrue(is_row_hidden(doc, 7)) + + #Test '>=' condition + xGridWin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B8"})) + with self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xcond1 = xDialog.getChild("cond1") + + select_by_text(xfield1, "Values") + select_by_text(xcond1, ">=") + select_by_text(xval1, "0.046") + + + self.assertFalse(is_row_hidden(doc, 0)) + 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.assertTrue(is_row_hidden(doc, 5)) + self.assertFalse(is_row_hidden(doc, 6)) + self.assertFalse(is_row_hidden(doc, 7)) + + def test_tdf144253(self): + with self.ui_test.load_file(get_url_for_data_file("tdf144253.ods")) as doc: + + xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") + + xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "4", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xCheckListMenu = xFloatWindow.getChild("FilterDropDown") + xTreeList = xCheckListMenu.getChild("check_list_box") + self.assertEqual(2, len(xTreeList.getChildren())) + self.assertEqual("65.43", get_state_as_dict(xTreeList.getChild('0'))['Text']) + self.assertEqual("83.33", get_state_as_dict(xTreeList.getChild('1'))['Text']) + + xFirstEntry = xTreeList.getChild("1") + xFirstEntry.executeAction("CLICK", tuple()) + + xOkBtn = xFloatWindow.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) + + self.assertFalse(is_row_hidden(doc, 0)) + self.assertTrue(is_row_hidden(doc, 1)) + self.assertFalse(is_row_hidden(doc, 2)) + +# 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 0000000000..6fa029985f --- /dev/null +++ b/sc/qa/uitest/autofilter/autofilterBugs.py @@ -0,0 +1,273 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file +from uitest.uihelper.calc import enter_text_to_cell + +class autofilter(UITestCase): + + def test_tdf115046(self): + with self.ui_test.load_file(get_url_for_data_file("tdf115046.ods")) as calc_doc: + #autofilter exist + self.assertEqual(calc_doc.getPropertyValue("UnnamedDatabaseRanges").getByTable(0).AutoFilter, True) + + with self.ui_test.execute_dialog_through_command(".uno:DataSort", close_button="cancel"): + pass + + #autofilter still exist + self.assertEqual(calc_doc.getPropertyValue("UnnamedDatabaseRanges").getByTable(0).AutoFilter, True) + + def test_tdf123095(self): + with self.ui_test.create_doc_in_start_center("calc"): + calcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = calcDoc.getChild("grid_window") + enter_text_to_cell(xGridWindow, "A1", "乙二醇(è¿›å£æ–™ä»¶)") + enter_text_to_cell(xGridWindow, "A2", "乙二醇(进å£æ–™ä»¶ï¼‰") + xGridWindow.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"})) + + with self.ui_test.execute_dialog_through_command(".uno:DataFilterAutoFilter", close_button="no"): + pass + + xGridWindow.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xTreeList = xFloatWindow.getChild("check_list_box") + + # Without the fix in place, the second entry would not exist + self.assertEqual(2, len(xTreeList.getChildren())) + self.assertEqual(get_state_as_dict(xTreeList.getChild("0"))["Text"], "乙二醇(è¿›å£æ–™ä»¶)") + self.assertEqual(get_state_as_dict(xTreeList.getChild("1"))["Text"], "乙二醇(进å£æ–™ä»¶ï¼‰") + + def test_tdf125363(self): + with self.ui_test.create_doc_in_start_center("calc"): + calcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = calcDoc.getChild("grid_window") + enter_text_to_cell(xGridWindow, "A1", "guet") + enter_text_to_cell(xGridWindow, "A2", "guͤt") + enter_text_to_cell(xGridWindow, "A3", "tuon") + enter_text_to_cell(xGridWindow, "A4", "tuͦn") + enter_text_to_cell(xGridWindow, "A5", "vröude") + enter_text_to_cell(xGridWindow, "A6", "vröudᵉ") + xGridWindow.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A6"})) + + with self.ui_test.execute_dialog_through_command(".uno:DataFilterAutoFilter", close_button="no"): + pass + + xGridWindow.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xTreeList = xFloatWindow.getChild("check_list_box") + + # Without the fix in place, the entries with superscript/modifier letters would not exist + self.assertEqual(6, len(xTreeList.getChildren())) + self.assertEqual(get_state_as_dict(xTreeList.getChild("0"))["Text"], "guet") + self.assertEqual(get_state_as_dict(xTreeList.getChild("1"))["Text"], "guͤt") + self.assertEqual(get_state_as_dict(xTreeList.getChild("2"))["Text"], "tuon") + self.assertEqual(get_state_as_dict(xTreeList.getChild("3"))["Text"], "tuͦn") + self.assertEqual(get_state_as_dict(xTreeList.getChild("4"))["Text"], "vröude") + self.assertEqual(get_state_as_dict(xTreeList.getChild("5"))["Text"], "vröudᵉ") + + def test_tdf94055(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + 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"})) + + with self.ui_test.execute_dialog_through_command(".uno:DataFilterAutoFilter", close_button="yes"): + pass + + xGridWindow.executeAction("SELECT", mkPropertyValues({"RANGE": "A2:A3"})) + self.xUITest.executeCommand(".uno:SelectRow") #select two rows + + with self.ui_test.execute_dialog_through_command(".uno:DataSort"): + pass + + #autofilter still exist + self.assertEqual(document.getPropertyValue("UnnamedDatabaseRanges").getByTable(0).AutoFilter, True) + + + #tdf77479.ods + def test_tdf77479(self): + with self.ui_test.load_file(get_url_for_data_file("tdf77479.ods")) as calc_doc: + calcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = calcDoc.getChild("grid_window") + #autofilter exist + self.assertEqual(calc_doc.getPropertyValue("UnnamedDatabaseRanges").getByTable(0).AutoFilter, True) + + xGridWindow.executeAction("SELECT", mkPropertyValues({"RANGE": "A2:E6"})) + + with self.ui_test.execute_dialog_through_command(".uno:DataSort"): + pass + + #autofilter still exist + self.assertEqual(calc_doc.getPropertyValue("UnnamedDatabaseRanges").getByTable(0).AutoFilter, True) + + #112656 + def test_tdf112656(self): + with self.ui_test.load_file(get_url_for_data_file("tdf112656.ods")): + 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") + + #tdf81124 + def test_tdf81124(self): + with self.ui_test.load_file(get_url_for_data_file("tdf81124.ods")): + 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()) + +#tdf73565 + def test_tdf73565(self): + with self.ui_test.load_file(get_url_for_data_file("tdf73565.ods")): + 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_tree_box") + xFirstEntry = xTreeList.getChild("0") + self.assertEqual(get_state_as_dict(xFirstEntry)["Text"], "2014") + + xCancel = xFloatWindow.getChild("cancel") + xCancel.executeAction("CLICK", tuple()) + + #tdf65505 + def test_tdf65505(self): + with self.ui_test.load_file(get_url_for_data_file("tdf81124.ods")): + 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()) + +#tdf74857 + def test_tdf74857(self): + with self.ui_test.load_file(get_url_for_data_file("tdf74857.ods")): + 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") + + #tdf35294 + def test_tdf35294(self): + with self.ui_test.load_file(get_url_for_data_file("tdf35294.ods")): + 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()) + + #tdf55712 + def test_tdf55712(self): + with self.ui_test.load_file(get_url_for_data_file("tdf55712.ods")): + 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"], "(empty)") + self.assertEqual(get_state_as_dict(x2Entry)["Text"], "0") + self.assertEqual(get_state_as_dict(x3Entry)["Text"], "0.1") + self.assertEqual(get_state_as_dict(x4Entry)["Text"], "0.2") + self.assertEqual(get_state_as_dict(x5Entry)["Text"], "0.3") + self.assertEqual(get_state_as_dict(x6Entry)["Text"], "0.5") + self.assertEqual(get_state_as_dict(x7Entry)["Text"], "0.8") + self.assertEqual(get_state_as_dict(x8Entry)["Text"], "0.9") + self.assertEqual(get_state_as_dict(x9Entry)["Text"], "1") + self.assertEqual(get_state_as_dict(xTreeList)["Children"], "9") + + xCancel = xFloatWindow.getChild("cancel") + xCancel.executeAction("CLICK", tuple()) + + #tdf152082 + def test_tdf152082(self): + with self.ui_test.load_file(get_url_for_data_file("tdf152082.ods")): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xCheckListMenu = xFloatWindow.getChild("FilterDropDown") + xTreeList = xCheckListMenu.getChild("check_list_box") + self.assertEqual(4, len(xTreeList.getChildren())) + self.assertEqual('true', get_state_as_dict(xTreeList.getChild('0'))['IsChecked']) + self.assertEqual('true', get_state_as_dict(xTreeList.getChild('1'))['IsChecked']) + self.assertEqual('true', get_state_as_dict(xTreeList.getChild('2'))['IsChecked']) + self.assertEqual('false', get_state_as_dict(xTreeList.getChild('3'))['IsChecked']) + xCancelBtn = xFloatWindow.getChild("cancel") + xCancelBtn.executeAction("CLICK", tuple()) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/autofilter/colorfilter.py b/sc/qa/uitest/autofilter/colorfilter.py new file mode 100644 index 0000000000..bc66c54118 --- /dev/null +++ b/sc/qa/uitest/autofilter/colorfilter.py @@ -0,0 +1,237 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file, select_pos, select_by_text +from libreoffice.uno.propertyvalue import mkPropertyValues +from libreoffice.calc.document import is_row_hidden + +class ColorFilterTest(UITestCase): + + def test_tdf142580(self): + with self.ui_test.load_file(get_url_for_data_file("tdf142580.xlsx")) as doc: + + xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") + xGridWin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A9"})) + + # Green Text Color rows are displayed + self.assertFalse(is_row_hidden(doc, 0)) + self.assertFalse(is_row_hidden(doc, 1)) + self.assertFalse(is_row_hidden(doc, 2)) + self.assertFalse(is_row_hidden(doc, 3)) + self.assertTrue(is_row_hidden(doc, 4)) + self.assertTrue(is_row_hidden(doc, 5)) + self.assertTrue(is_row_hidden(doc, 6)) + self.assertTrue(is_row_hidden(doc, 7)) + self.assertTrue(is_row_hidden(doc, 8)) + + with self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") as xDialog: + xField1 = xDialog.getChild("field1") + xCond1 = xDialog.getChild("cond1") + + # tdf#143103: Without the fix in place, this test would have failed with + # AssertionError: 'Font color' != '' + self.assertEqual("Text color", get_state_as_dict(xField1)['DisplayText']) + self.assertEqual("Font color", get_state_as_dict(xCond1)['DisplayText']) + + xColor1 = xDialog.getChild("color1") + + # tdf#142580: Without the fix in place, this test would have failed with + # AssertionError: '3' != '1' + self.assertEqual('3', get_state_as_dict(xColor1)["EntryCount"]) + + # Select Orange Text Color + select_pos(xColor1, "2") + + self.assertFalse(is_row_hidden(doc, 0)) + self.assertTrue(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)) + self.assertFalse(is_row_hidden(doc, 5)) + self.assertFalse(is_row_hidden(doc, 6)) + self.assertTrue(is_row_hidden(doc, 7)) + self.assertTrue(is_row_hidden(doc, 8)) + + def test_tdf142579(self): + with self.ui_test.load_file(get_url_for_data_file("tdf142579.xlsx")) as doc: + + xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") + xGridWin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A8"})) + + # Blue Background Color rows are displayed + 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.assertTrue(is_row_hidden(doc, 4)) + self.assertTrue(is_row_hidden(doc, 5)) + self.assertTrue(is_row_hidden(doc, 6)) + self.assertTrue(is_row_hidden(doc, 7)) + + with self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") as xDialog: + xField1 = xDialog.getChild("field1") + xCond1 = xDialog.getChild("cond1") + + # tdf#143103: Without the fix in place, this test would have failed with + # AssertionError: 'aaa' != '' + self.assertEqual("aaa", get_state_as_dict(xField1)['DisplayText']) + self.assertEqual("Background color", get_state_as_dict(xCond1)['DisplayText']) + + xColor1 = xDialog.getChild("color1") + + # tdf#142579: Without the fix in place, this test would have failed with + # AssertionError: '7' != '3' + self.assertEqual('7', get_state_as_dict(xColor1)["EntryCount"]) + + # Select Red Background Color + select_pos(xColor1, "3") + + self.assertFalse(is_row_hidden(doc, 0)) + self.assertTrue(is_row_hidden(doc, 1)) + self.assertTrue(is_row_hidden(doc, 2)) + self.assertTrue(is_row_hidden(doc, 3)) + self.assertTrue(is_row_hidden(doc, 4)) + self.assertTrue(is_row_hidden(doc, 5)) + self.assertTrue(is_row_hidden(doc, 6)) + self.assertFalse(is_row_hidden(doc, 7)) + + def test_tdf144549(self): + with self.ui_test.load_file(get_url_for_data_file("tdf144549.ods")) as doc: + + xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") + xGridWin.executeAction("SELECT", mkPropertyValues({"CELL": "B1"})) + + for i in range(12): + self.assertFalse(is_row_hidden(doc, i)) + + with self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") as xDialog: + xField1 = xDialog.getChild("field1") + xCond1 = xDialog.getChild("cond1") + + self.assertEqual("Value", get_state_as_dict(xField1)['DisplayText']) + + select_by_text(xCond1, "Font color") + self.assertEqual("Font color", get_state_as_dict(xCond1)['DisplayText']) + + xColor1 = xDialog.getChild("color1") + + # Without the fix in place, this test would have failed with + # AssertionError: '3' != '1' + self.assertEqual('3', get_state_as_dict(xColor1)["EntryCount"]) + + select_pos(xColor1, "0") + + self.assertFalse(is_row_hidden(doc, 0)) + self.assertTrue(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)) + self.assertFalse(is_row_hidden(doc, 5)) + self.assertTrue(is_row_hidden(doc, 6)) + self.assertTrue(is_row_hidden(doc, 7)) + self.assertTrue(is_row_hidden(doc, 8)) + self.assertTrue(is_row_hidden(doc, 9)) + self.assertFalse(is_row_hidden(doc, 10)) + self.assertTrue(is_row_hidden(doc, 11)) + self.assertTrue(is_row_hidden(doc, 12)) + + def test_tdf142579_conditional_format(self): + with self.ui_test.load_file(get_url_for_data_file("tdf142579_cond_format.ods")) as doc: + + xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") + xGridWin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A9"})) + + for i in range(8): + self.assertFalse(is_row_hidden(doc, i)) + + with self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") as xDialog: + xField1 = xDialog.getChild("field1") + xCond1 = xDialog.getChild("cond1") + + self.assertEqual("Another", get_state_as_dict(xField1)['DisplayText']) + + select_by_text(xCond1, "Background color") + self.assertEqual("Background color", get_state_as_dict(xCond1)['DisplayText']) + + xColor1 = xDialog.getChild("color1") + + # tdf#142579: Without the fix in place, this test would have failed with + # AssertionError: '2' != '1' + self.assertEqual('2', get_state_as_dict(xColor1)["EntryCount"]) + + select_pos(xColor1, "0") + + self.assertFalse(is_row_hidden(doc, 0)) + self.assertFalse(is_row_hidden(doc, 1)) + self.assertTrue(is_row_hidden(doc, 2)) + self.assertFalse(is_row_hidden(doc, 3)) + self.assertTrue(is_row_hidden(doc, 4)) + self.assertTrue(is_row_hidden(doc, 5)) + self.assertFalse(is_row_hidden(doc, 6)) + self.assertFalse(is_row_hidden(doc, 7)) + + def test_tdf76258(self): + # Reuse existing document + with self.ui_test.load_file(get_url_for_data_file("tdf142579.xlsx")) as doc: + calcDoc = self.xUITest.getTopFocusWindow() + xGridWin = calcDoc.getChild("grid_window") + + # Blue Background Color rows are displayed + 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.assertTrue(is_row_hidden(doc, 4)) + self.assertTrue(is_row_hidden(doc, 5)) + self.assertTrue(is_row_hidden(doc, 6)) + self.assertTrue(is_row_hidden(doc, 7)) + + xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xMenu = xFloatWindow.getChild("menu") + + # Filter by Color + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) + + xSubFloatWindow = self.xUITest.getFloatWindow() + xSubMenu = xSubFloatWindow.getChild("background") + self.assertEqual(7, len(xSubMenu.getChildren())) + self.assertEqual('true', get_state_as_dict(xSubMenu.getChild('0'))['IsChecked']) + self.assertEqual('#5A8AC6', get_state_as_dict(xSubMenu.getChild('0'))['Text']) + self.assertEqual('false', get_state_as_dict(xSubMenu.getChild('1'))['IsChecked']) + self.assertEqual('#90B0D9', get_state_as_dict(xSubMenu.getChild('1'))['Text']) + self.assertEqual('false', get_state_as_dict(xSubMenu.getChild('2'))['IsChecked']) + self.assertEqual('#C6D6EC', get_state_as_dict(xSubMenu.getChild('2'))['Text']) + self.assertEqual('false', get_state_as_dict(xSubMenu.getChild('3'))['IsChecked']) + self.assertEqual('#F8696B', get_state_as_dict(xSubMenu.getChild('3'))['Text']) + self.assertEqual('false', get_state_as_dict(xSubMenu.getChild('4'))['IsChecked']) + self.assertEqual('#FA9A9D', get_state_as_dict(xSubMenu.getChild('4'))['Text']) + self.assertEqual('false', get_state_as_dict(xSubMenu.getChild('5'))['IsChecked']) + self.assertEqual('#FBCBCE', get_state_as_dict(xSubMenu.getChild('5'))['Text']) + self.assertEqual('false', get_state_as_dict(xSubMenu.getChild('6'))['IsChecked']) + self.assertEqual('#FCFCFF', get_state_as_dict(xSubMenu.getChild('6'))['Text']) + + # Choose another one + xSubMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xSubMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) + + self.assertFalse(is_row_hidden(doc, 0)) + self.assertTrue(is_row_hidden(doc, 1)) + self.assertFalse(is_row_hidden(doc, 2)) + self.assertTrue(is_row_hidden(doc, 3)) + self.assertTrue(is_row_hidden(doc, 4)) + self.assertTrue(is_row_hidden(doc, 5)) + self.assertTrue(is_row_hidden(doc, 6)) + self.assertTrue(is_row_hidden(doc, 7)) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/autofilter2/tdf101165.py b/sc/qa/uitest/autofilter2/tdf101165.py new file mode 100644 index 0000000000..65a1060a53 --- /dev/null +++ b/sc/qa/uitest/autofilter2/tdf101165.py @@ -0,0 +1,49 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_url_for_data_file +from uitest.uihelper.common import get_state_as_dict + +#Bug 101165 - Crashing on a filter selection, every time + +class tdf101165(UITestCase): + def test_tdf101165_autofilter(self): + with self.ui_test.load_file(get_url_for_data_file("tdf101165.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xAll = xFloatWindow.getChild("toggle_all") + xAll.executeAction("CLICK", tuple()) + + xCheckListMenu = xFloatWindow.getChild("FilterDropDown") + xTreeList = xCheckListMenu.getChild("check_tree_box") + self.assertEqual(3, len(xTreeList.getChildren())) + for i in range(3): + xChild = xTreeList.getChild(str(i)) + self.assertEqual("false", get_state_as_dict(xChild)["IsChecked"]) + + if i == 0 : + self.assertEqual(2, len(xChild.getChildren())) + for j in range(2): + self.assertEqual("false", get_state_as_dict(xChild.getChild(str(j)))["IsChecked"]) + elif i == 1: + self.assertEqual(6, len(xChild.getChildren())) + for j in range(6): + self.assertEqual("false", get_state_as_dict(xChild.getChild(str(j)))["IsChecked"]) + else: + self.assertEqual(0, len(xChild.getChildren())) + + + self.assertEqual(get_cell_by_position(calc_doc, 1, 0, 1).getValue(), 6494) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/autofilter2/tdf117276.py b/sc/qa/uitest/autofilter2/tdf117276.py new file mode 100644 index 0000000000..e702025b72 --- /dev/null +++ b/sc/qa/uitest/autofilter2/tdf117276.py @@ -0,0 +1,97 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues +from libreoffice.calc.document import is_row_hidden +from uitest.uihelper.common import get_url_for_data_file + +#Bug 117276 - Autofilter settings being reset in some cases + +class tdf117276(UITestCase): + def test_tdf117276_autofilter(self): + with self.ui_test.load_file(get_url_for_data_file("tdf117276.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + # 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("FilterDropDown") + 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("FilterDropDown") + 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("FilterDropDown") + 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("FilterDropDown") + 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)) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/autofilter2/tdf117276_autofilter_reset.py b/sc/qa/uitest/autofilter2/tdf117276_autofilter_reset.py new file mode 100644 index 0000000000..66279d1821 --- /dev/null +++ b/sc/qa/uitest/autofilter2/tdf117276_autofilter_reset.py @@ -0,0 +1,179 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.uno.propertyvalue import mkPropertyValues +from libreoffice.calc.document import is_row_hidden +#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("FilterDropDown") + 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)) + + # since tdf#117267, we are showing the hidden filter rows as inactive elements (1 active + 4 inactive) + self.assertEqual(5, self.get_values_count_in_AutoFilter(xGridWindow, "0")) + # since tdf#117267, we are showing the hidden filter rows as inactive elements (2 active + 1 inactive) + self.assertEqual(3, self.get_values_count_in_AutoFilter(xGridWindow, "1")) + + def test_run(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + 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 + with self.ui_test.execute_dialog_through_command(".uno:DataFilterAutoFilter", close_button="yes"): + pass + + # 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("FilterDropDown") + 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")) + # since tdf#117267, we are showing the hidden filter rows as inactive elements (2 active + 1 inactive) + self.assertEqual(3, 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("FilterDropDown") + 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 + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/autofilter2/tdf122260.py b/sc/qa/uitest/autofilter2/tdf122260.py new file mode 100644 index 0000000000..878e7bce4d --- /dev/null +++ b/sc/qa/uitest/autofilter2/tdf122260.py @@ -0,0 +1,87 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues +from libreoffice.calc.document import is_row_hidden +from uitest.uihelper.common import get_url_for_data_file + +#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("FilterDropDown") + 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("FilterDropDown") + 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): + with self.ui_test.load_file(get_url_for_data_file("tdf122260.ods")) as calc_doc: + 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")) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/autofilter2/tdf126306.py b/sc/qa/uitest/autofilter2/tdf126306.py new file mode 100644 index 0000000000..2ebb3789bf --- /dev/null +++ b/sc/qa/uitest/autofilter2/tdf126306.py @@ -0,0 +1,152 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.uno.propertyvalue import mkPropertyValues +from libreoffice.calc.document import get_cell_by_position +from libreoffice.calc.document import is_row_hidden + +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): + bVisible = not is_row_hidden(document, i) + self.assertEqual(bVisible, value) + + def test_run(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + 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] + + 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"})) + + with self.ui_test.execute_dialog_through_command(".uno:DataFilterAutoFilter", close_button="yes"): + pass + + 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() + xMenu = xFloatWindow.getChild("menu") + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"SPACE"})) + xMenu.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() + xMenu = xFloatWindow.getChild("menu") + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.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() + xMenu = xFloatWindow.getChild("menu") + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) + xSubFloatWindow = self.xUITest.getFloatWindow() + xSubMenu = xSubFloatWindow.getChild("menu") + xSubMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xSubMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xSubMenu.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() + xMenu = xFloatWindow.getChild("menu") + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) + xSubFloatWindow = self.xUITest.getFloatWindow() + xSubMenu = xSubFloatWindow.getChild("menu") + xSubMenu.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() + xMenu = xFloatWindow.getChild("menu") + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) + xSubFloatWindow = self.xUITest.getFloatWindow() + xSubMenu = xSubFloatWindow.getChild("menu") + xSubMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xSubMenu.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 + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/autofilter2/tdf130070.py b/sc/qa/uitest/autofilter2/tdf130070.py new file mode 100644 index 0000000000..91558e4b5d --- /dev/null +++ b/sc/qa/uitest/autofilter2/tdf130070.py @@ -0,0 +1,55 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues +from libreoffice.calc.document import is_row_hidden +from uitest.uihelper.common import get_url_for_data_file + +#Bug 130770 - Autofilter not updated on data change (automatically or manually) + +class tdf130770(UITestCase): + def test_tdf130770_autofilter(self): + with self.ui_test.load_file(get_url_for_data_file("tdf130770.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + # 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 + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/autofilter2/tdf140754.py b/sc/qa/uitest/autofilter2/tdf140754.py new file mode 100644 index 0000000000..1d298f832e --- /dev/null +++ b/sc/qa/uitest/autofilter2/tdf140754.py @@ -0,0 +1,95 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file +from libreoffice.uno.propertyvalue import mkPropertyValues +from libreoffice.calc.document import get_cell_by_position + +class tdf140754(UITestCase): + + def test_tdf140754(self): + + with self.ui_test.load_file(get_url_for_data_file("tdf140754.ods")) as calc_doc: + + #Make sure 'multi-threaded calculation' is enabled + with self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") as xDialogOpt: + + xPages = xDialogOpt.getChild("pages") + xCalcEntry = xPages.getChild('3') + xCalcEntry.executeAction("EXPAND", tuple()) + xCalcCalculateEntry = xCalcEntry.getChild('3') + xCalcCalculateEntry.executeAction("SELECT", tuple()) + + self.assertEqual('true', get_state_as_dict(xDialogOpt.getChild('threadingenabled'))["Selected"]) + + + + self.assertEqual(0, get_cell_by_position(calc_doc, 0, 0, 30).getValue()) + self.assertEqual(0, get_cell_by_position(calc_doc, 0, 0, 82).getValue()) + self.assertEqual(1, get_cell_by_position(calc_doc, 0, 0, 238).getValue()) + self.assertEqual(28, get_cell_by_position(calc_doc, 0, 0, 265).getValue()) + self.assertEqual(28, get_cell_by_position(calc_doc, 0, 0, 1370).getValue()) + + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "2", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xAll = xFloatWindow.getChild("toggle_all") + xAll.executeAction("CLICK", tuple()) + + xCheckListMenu = xFloatWindow.getChild("FilterDropDown") + xList = xCheckListMenu.getChild("check_list_box") + # since tdf#117267, we are showing the hidden filter rows as inactive elements (25 active + 140 inactive) + self.assertEqual(165, len(xList.getChildren())) + + for i in range(165): + xChild = xList.getChild(str(i)) + if i < 25: + self.assertEqual("true", get_state_as_dict(xChild)["IsChecked"]) + else: + self.assertEqual("false", get_state_as_dict(xChild)["IsChecked"]) + + # Without the fix in place, this test would have crashed here + xOkBtn = xFloatWindow.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) + + self.assertEqual(0, get_cell_by_position(calc_doc, 0, 0, 30).getValue()) + self.assertEqual(1, get_cell_by_position(calc_doc, 0, 0, 82).getValue()) + self.assertEqual(39, get_cell_by_position(calc_doc, 0, 0, 238).getValue()) + self.assertEqual(66, get_cell_by_position(calc_doc, 0, 0, 265).getValue()) + self.assertEqual(282, get_cell_by_position(calc_doc, 0, 0, 1370).getValue()) + + gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "6", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xAll = xFloatWindow.getChild("toggle_all") + xAll.executeAction("CLICK", tuple()) + + xCheckListMenu = xFloatWindow.getChild("FilterDropDown") + xList = xCheckListMenu.getChild("check_list_box") + # since tdf#117267, we are showing the hidden filter rows as inactive elements (10 active + 35 inactive) + self.assertEqual(45, len(xList.getChildren())) + + for i in range(45): + xChild = xList.getChild(str(i)) + if i < 10: + self.assertEqual("true", get_state_as_dict(xChild)["IsChecked"]) + else: + self.assertEqual("false", get_state_as_dict(xChild)["IsChecked"]) + + xOkBtn = xFloatWindow.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) + + self.assertEqual(1, get_cell_by_position(calc_doc, 0, 0, 30).getValue()) + self.assertEqual(11, get_cell_by_position(calc_doc, 0, 0, 82).getValue()) + self.assertEqual(69, get_cell_by_position(calc_doc, 0, 0, 238).getValue()) + self.assertEqual(96, get_cell_by_position(calc_doc, 0, 0, 265).getValue()) + self.assertEqual(411, get_cell_by_position(calc_doc, 0, 0, 1370).getValue()) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/autofilter2/tdf141559.py b/sc/qa/uitest/autofilter2/tdf141559.py new file mode 100644 index 0000000000..37068ccec0 --- /dev/null +++ b/sc/qa/uitest/autofilter2/tdf141559.py @@ -0,0 +1,95 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.calc import enter_text_to_cell +from uitest.uihelper.common import select_by_text +from libreoffice.uno.propertyvalue import mkPropertyValues +from libreoffice.calc.document import get_row +from uitest.uihelper.common import get_state_as_dict + +#Bug 141559 - Add Clear Standard Filter to Autofilter widget + +class tdf141559(UITestCase): + def test_tdf141559_clear_filter(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + calcDoc = self.xUITest.getTopFocusWindow() + gridwin = calcDoc.getChild("grid_window") + + enter_text_to_cell(gridwin, "A1", "A") + enter_text_to_cell(gridwin, "A2", "1") + enter_text_to_cell(gridwin, "A3", "2") + enter_text_to_cell(gridwin, "A4", "3") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"})) + + self.xUITest.executeCommand(".uno:DataFilterAutoFilter") + + gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + #Choose Standard Filter... button + xMenu = xFloatWindow.getChild("menu") + + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) + xSubFloatWindow = self.xUITest.getFloatWindow() + xSubMenu = xSubFloatWindow.getChild("menu") + + nLastIdx = int(get_state_as_dict(xSubMenu)['Children']) - 1 + self.assertEqual(5, nLastIdx) + + # check last item: 'Standard Filter...' (new menu item 'Clear Filter' is optional) + self.assertEqual('Standard Filter...', get_state_as_dict(xSubMenu.getChild(str(nLastIdx)))['Text']) + + xSubMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xSubMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xSubMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xSubMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + self.assertEqual("Standard Filter...", get_state_as_dict(xSubMenu)['SelectEntryText']) + xSubMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) + + xDialog = self.xUITest.getTopFocusWindow() + xfield1 = xDialog.getChild("field1") + xcond1 = xDialog.getChild("cond1") + xval1 = xDialog.getChild("val1") + + select_by_text(xfield1, "A") + select_by_text(xcond1, ">") + xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + row = get_row(document, 1) + self.assertFalse(row.getPropertyValue("IsVisible")) + + gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + #Choose Clear Filter button + xMenu = xFloatWindow.getChild("menu") + + # check last item: 'Clear Filter' + nLastIdx = int(get_state_as_dict(xMenu)['Children']) - 1 + self.assertEqual(6, nLastIdx) + self.assertEqual('Clear Filter', get_state_as_dict(xMenu.getChild(str(nLastIdx)))['Text']) + + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + # Use new menu item "Clear Filter" to remove the standard filter condition + self.assertEqual("Clear Filter", get_state_as_dict(xMenu)['SelectEntryText']) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) + + self.assertTrue(row.getPropertyValue("IsVisible")) + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/autofilter2/tdf141946.py b/sc/qa/uitest/autofilter2/tdf141946.py new file mode 100644 index 0000000000..0a934f9dee --- /dev/null +++ b/sc/qa/uitest/autofilter2/tdf141946.py @@ -0,0 +1,75 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.uno.propertyvalue import mkPropertyValues + +#Bug 141946 - EDITING Inserting column before autofiltered column empties autofilter + +class tdf141946(UITestCase): + def test_tdf141946_inserted_column(self): + with self.ui_test.create_doc_in_start_center("calc"): + calcDoc = self.xUITest.getTopFocusWindow() + gridwin = calcDoc.getChild("grid_window") + + enter_text_to_cell(gridwin, "A1", "A") + enter_text_to_cell(gridwin, "A2", "1") + enter_text_to_cell(gridwin, "A3", "2") + enter_text_to_cell(gridwin, "A4", "3") + + enter_text_to_cell(gridwin, "B1", "B") + 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.xUITest.executeCommand(".uno:DataFilterAutoFilter") + + gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xCheckListMenu = xFloatWindow.getChild("FilterDropDown") + xList = xCheckListMenu.getChild("check_list_box") + xEntry = xList.getChild("1") + xEntry.executeAction("CLICK", tuple()) + + xOkButton = xFloatWindow.getChild("ok") + xOkButton.executeAction("CLICK", tuple()) + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B1"})) + + self.xUITest.executeCommand(".uno:InsertColumnsBefore") + + gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xCheckListMenu = xFloatWindow.getChild("FilterDropDown") + xList = xCheckListMenu.getChild("check_list_box") + # since tdf#117267, we are showing the hidden filter rows as inactive elements (2 active + 1 inactive) + self.assertEqual(3, len(xList.getChildren())) + xCloseBtn = xFloatWindow.getChild("cancel") + xCloseBtn.executeAction("CLICK", tuple()) + + gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xCheckListMenu = xFloatWindow.getChild("FilterDropDown") + xList = xCheckListMenu.getChild("check_list_box") + self.assertEqual(1, len(xList.getChildren())) + xCloseBtn = xFloatWindow.getChild("cancel") + xCloseBtn.executeAction("CLICK", tuple()) + + gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "2", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xCheckListMenu = xFloatWindow.getChild("FilterDropDown") + xList = xCheckListMenu.getChild("check_list_box") + self.assertEqual(3, len(xList.getChildren())) + xCloseBtn = xFloatWindow.getChild("cancel") + xCloseBtn.executeAction("CLICK", tuple()) + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/autofilter2/tdf151152.py b/sc/qa/uitest/autofilter2/tdf151152.py new file mode 100644 index 0000000000..6971096e98 --- /dev/null +++ b/sc/qa/uitest/autofilter2/tdf151152.py @@ -0,0 +1,52 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.calc import enter_text_to_cell +from uitest.uihelper.common import get_state_as_dict +from libreoffice.uno.propertyvalue import mkPropertyValues + +#Bug 151152 - Autofilter checkbox status is wrong when I deselect one item, click OK, then click on the dropdown again (2nd case) + +class tdf151152(UITestCase): + def test_tdf151152(self): + with self.ui_test.create_doc_in_start_center("calc"): + calcDoc = self.xUITest.getTopFocusWindow() + gridwin = calcDoc.getChild("grid_window") + + enter_text_to_cell(gridwin, "A1", "A") + enter_text_to_cell(gridwin, "A2", "0") + enter_text_to_cell(gridwin, "A3", "a") + enter_text_to_cell(gridwin, "A4", "b") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"})) + + self.xUITest.executeCommand(".uno:DataFilterAutoFilter") + + gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xCheckListMenu = xFloatWindow.getChild("FilterDropDown") + xList = xCheckListMenu.getChild("check_list_box") + xEntry = xList.getChild("1") + xEntry.executeAction("CLICK", tuple()) + + xOkButton = xFloatWindow.getChild("ok") + xOkButton.executeAction("CLICK", tuple()) + + gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xCheckListMenu = xFloatWindow.getChild("FilterDropDown") + xList = xCheckListMenu.getChild("check_list_box") + self.assertEqual(3, len(xList.getChildren())) + self.assertEqual('true', get_state_as_dict(xList.getChild('0'))['IsChecked']) + self.assertEqual('false', get_state_as_dict(xList.getChild('1'))['IsChecked']) + self.assertEqual('true', get_state_as_dict(xList.getChild('2'))['IsChecked']) + xCloseBtn = xFloatWindow.getChild("cancel") + xCloseBtn.executeAction("CLICK", tuple()) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/autofilter2/tdf153972.py b/sc/qa/uitest/autofilter2/tdf153972.py new file mode 100644 index 0000000000..fe994ea905 --- /dev/null +++ b/sc/qa/uitest/autofilter2/tdf153972.py @@ -0,0 +1,60 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_url_for_data_file, get_state_as_dict +from libreoffice.uno.propertyvalue import mkPropertyValues +from libreoffice.calc.document import is_row_hidden + +class tdf153972(UITestCase): + def test_tdf153972(self): + + with self.ui_test.load_file(get_url_for_data_file("tdf153972.ods")) as doc: + calcDoc = self.xUITest.getTopFocusWindow() + xGridWin = calcDoc.getChild("grid_window") + + xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xMenu = xFloatWindow.getChild("menu") + + # Filter by Color + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) + + xSubFloatWindow = self.xUITest.getFloatWindow() + xSubMenu = xSubFloatWindow.getChild("background") + + # Without the fix in place, this test would have failed with + # AssertionError: 4 != 0 + self.assertEqual(4, len(xSubMenu.getChildren())) + self.assertEqual('#7FD41A', get_state_as_dict(xSubMenu.getChild('0'))['Text']) + self.assertEqual('#FE0000', get_state_as_dict(xSubMenu.getChild('1'))['Text']) + self.assertEqual('#FEFF00', get_state_as_dict(xSubMenu.getChild('2'))['Text']) + self.assertEqual('No Fill', get_state_as_dict(xSubMenu.getChild('3'))['Text']) + + # Choose Red + xSubMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xSubMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) + + self.assertTrue(is_row_hidden(doc, 1)) + self.assertTrue(is_row_hidden(doc, 2)) + self.assertTrue(is_row_hidden(doc, 3)) + self.assertTrue(is_row_hidden(doc, 4)) + self.assertTrue(is_row_hidden(doc, 5)) + self.assertFalse(is_row_hidden(doc, 6)) + self.assertTrue(is_row_hidden(doc, 7)) + self.assertTrue(is_row_hidden(doc, 8)) + self.assertFalse(is_row_hidden(doc, 9)) + self.assertTrue(is_row_hidden(doc, 10)) + self.assertFalse(is_row_hidden(doc, 11)) + self.assertTrue(is_row_hidden(doc, 12)) + self.assertFalse(is_row_hidden(doc, 13)) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/autofilter2/tdf46062.py b/sc/qa/uitest/autofilter2/tdf46062.py new file mode 100644 index 0000000000..f5cd82d2d1 --- /dev/null +++ b/sc/qa/uitest/autofilter2/tdf46062.py @@ -0,0 +1,48 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict + +class tdf46062(UITestCase): + + def test_tdf46062(self): + + with self.ui_test.create_doc_in_start_center("calc"): + calcDoc = self.xUITest.getTopFocusWindow() + gridwin = calcDoc.getChild("grid_window") + + enter_text_to_cell(gridwin, "A1", "spaces") + enter_text_to_cell(gridwin, "A2", " ") + enter_text_to_cell(gridwin, "A3", " ") + enter_text_to_cell(gridwin, "A4", " ") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"})) + + with self.ui_test.execute_dialog_through_command(".uno:DataFilterAutoFilter", close_button="yes"): + pass + + gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xCheckListMenu = xFloatWindow.getChild("FilterDropDown") + xList = xCheckListMenu.getChild("check_list_box") + self.assertEqual(3, len(xList.getChildren())) + + # Without the fix in place, this test would have failed with + # AssertionError: '" "' != ' ' + self.assertEqual('" "', get_state_as_dict(xList.getChild("0"))['Text']) + self.assertEqual('" "', get_state_as_dict(xList.getChild("1"))['Text']) + self.assertEqual('" "', get_state_as_dict(xList.getChild("2"))['Text']) + + xOkButton = xFloatWindow.getChild("ok") + xOkButton.executeAction("CLICK", tuple()) + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/autofilter2/tdf46184.py b/sc/qa/uitest/autofilter2/tdf46184.py new file mode 100755 index 0000000000..508346321e --- /dev/null +++ b/sc/qa/uitest/autofilter2/tdf46184.py @@ -0,0 +1,90 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.calc import enter_text_to_cell +from uitest.uihelper.common import select_by_text, get_state_as_dict +from libreoffice.uno.propertyvalue import mkPropertyValues +from libreoffice.calc.document import get_row + +#Bug 46184 - [Calc] [AutoFilter] Option "Copy results to ..." remains activated in AutoFilter + +class tdf46184(UITestCase): + def test_tdf46184_copy_results_to(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + calcDoc = self.xUITest.getTopFocusWindow() + gridwin = calcDoc.getChild("grid_window") + + enter_text_to_cell(gridwin, "A1", "A") + enter_text_to_cell(gridwin, "A2", "1") + enter_text_to_cell(gridwin, "A3", "2") + enter_text_to_cell(gridwin, "A4", "3") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"})) + + self.xUITest.executeCommand(".uno:DataFilterAutoFilter") + + gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + #Choose Standard Filter... button + xMenu = xFloatWindow.getChild("menu") + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) + xSubFloatWindow = self.xUITest.getFloatWindow() + xSubMenu = xSubFloatWindow.getChild("menu") + xSubMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xSubMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xSubMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xSubMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + self.assertEqual("Standard Filter...", get_state_as_dict(xSubMenu)['SelectEntryText']) + xSubMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) + + xDialog = self.xUITest.getTopFocusWindow() + xfield1 = xDialog.getChild("field1") + xcond1 = xDialog.getChild("cond1") + xval1 = xDialog.getChild("val1") + xcopyresult = xDialog.getChild("copyresult") + xedcopyarea = xDialog.getChild("edcopyarea") + xdestpers = xDialog.getChild("destpers") + + select_by_text(xfield1, "A") + select_by_text(xcond1, ">") + xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) + xcopyresult.executeAction("CLICK", tuple()) + xedcopyarea.executeAction("TYPE", mkPropertyValues({"TEXT":"A6"})) + if get_state_as_dict(xdestpers)['Selected'] == 'false': + xdestpers.executeAction("CLICK", tuple()) + self.assertEqual('true', get_state_as_dict(xcopyresult)['Selected']) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + + row1 = get_row(document, 1) + row2 = get_row(document, 2) + row3 = get_row(document, 3) + self.assertTrue(row1.getPropertyValue("IsVisible")) + self.assertTrue(row2.getPropertyValue("IsVisible")) + self.assertTrue(row3.getPropertyValue("IsVisible")) + + gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xCheckListMenu = xFloatWindow.getChild("FilterDropDown") + xTreeList = xCheckListMenu.getChild("check_list_box") + xEntry = xTreeList.getChild("1") + xEntry.executeAction("CLICK", tuple()) + xOkBtn = xFloatWindow.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) + + self.assertTrue(row1.getPropertyValue("IsVisible")) + self.assertFalse(row2.getPropertyValue("IsVisible")) + self.assertTrue(row3.getPropertyValue("IsVisible")) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/autofilter2/tdf48025.py b/sc/qa/uitest/autofilter2/tdf48025.py new file mode 100644 index 0000000000..e87b7c31b5 --- /dev/null +++ b/sc/qa/uitest/autofilter2/tdf48025.py @@ -0,0 +1,72 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.uno.propertyvalue import mkPropertyValues + +#Bug 48025 - EDITING AUTOFILTER: Autofilter settings stay with the column number when deleting columns + +class tdf48025(UITestCase): + def test_tdf48025_deleted_columns(self): + with self.ui_test.create_doc_in_start_center("calc"): + calcDoc = self.xUITest.getTopFocusWindow() + gridwin = calcDoc.getChild("grid_window") + + enter_text_to_cell(gridwin, "A1", "A") + enter_text_to_cell(gridwin, "A2", "1") + enter_text_to_cell(gridwin, "A3", "2") + enter_text_to_cell(gridwin, "A4", "3") + + enter_text_to_cell(gridwin, "B1", "B") + enter_text_to_cell(gridwin, "B2", "4") + enter_text_to_cell(gridwin, "B3", "5") + enter_text_to_cell(gridwin, "B4", "6") + + enter_text_to_cell(gridwin, "C1", "C") + enter_text_to_cell(gridwin, "C2", "7") + enter_text_to_cell(gridwin, "C3", "8") + enter_text_to_cell(gridwin, "C4", "9") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C4"})) + + self.xUITest.executeCommand(".uno:DataFilterAutoFilter") + + gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xCheckListMenu = xFloatWindow.getChild("FilterDropDown") + xList = xCheckListMenu.getChild("check_list_box") + xEntry = xList.getChild("1") + xEntry.executeAction("CLICK", tuple()) + + xOkButton = xFloatWindow.getChild("ok") + xOkButton.executeAction("CLICK", tuple()) + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + + self.xUITest.executeCommand(".uno:DeleteColumns") + + gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xCheckListMenu = xFloatWindow.getChild("FilterDropDown") + xList = xCheckListMenu.getChild("check_list_box") + self.assertEqual(3, len(xList.getChildren())) + xCloseBtn = xFloatWindow.getChild("cancel") + xCloseBtn.executeAction("CLICK", tuple()) + + gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xCheckListMenu = xFloatWindow.getChild("FilterDropDown") + xList = xCheckListMenu.getChild("check_list_box") + # since tdf#117267, we are showing the hidden filter rows as inactive elements (2 active + 1 inactive) + self.assertEqual(3, len(xList.getChildren())) + xCloseBtn = xFloatWindow.getChild("cancel") + xCloseBtn.executeAction("CLICK", tuple()) + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/autofilter2/tdf68113.py b/sc/qa/uitest/autofilter2/tdf68113.py new file mode 100644 index 0000000000..2f10d16ad7 --- /dev/null +++ b/sc/qa/uitest/autofilter2/tdf68113.py @@ -0,0 +1,84 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.calc import enter_text_to_cell +from uitest.uihelper.common import get_state_as_dict +from libreoffice.uno.propertyvalue import mkPropertyValues + +#Bug 68113 - UI Selecting "Not empty" unchecks all entries + +class tdf68113(UITestCase): + def test_tdf68113_empty_notempty_button(self): + with self.ui_test.create_doc_in_start_center("calc"): + calcDoc = self.xUITest.getTopFocusWindow() + xGridWin = calcDoc.getChild("grid_window") + + enter_text_to_cell(xGridWin, "A1", "A") + enter_text_to_cell(xGridWin, "A2", "1") + enter_text_to_cell(xGridWin, "A3", "2") + enter_text_to_cell(xGridWin, "A5", "4") + enter_text_to_cell(xGridWin, "A7", "6") + + xGridWin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A7"})) + + self.xUITest.executeCommand(".uno:DataFilterAutoFilter") + + # Empty button + xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xMenu = xFloatWindow.getChild("menu") + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) + xSubFloatWindow = self.xUITest.getFloatWindow() + xSubMenu = xSubFloatWindow.getChild("menu") + xSubMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) + + # Checkbox elements + xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xCheckListMenu = xFloatWindow.getChild("FilterDropDown") + xTreeList = xCheckListMenu.getChild("check_list_box") + self.assertEqual(5, len(xTreeList.getChildren())) + self.assertEqual('true', get_state_as_dict(xTreeList.getChild('0'))['IsChecked']) + self.assertEqual('false', get_state_as_dict(xTreeList.getChild('2'))['IsChecked']) + self.assertEqual('false', get_state_as_dict(xTreeList.getChild('4'))['IsChecked']) + xCancelBtn = xFloatWindow.getChild("cancel") + xCancelBtn.executeAction("CLICK", tuple()) + + # Not Empty button + xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xMenu = xFloatWindow.getChild("menu") + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) + xSubFloatWindow = self.xUITest.getFloatWindow() + xSubMenu = xSubFloatWindow.getChild("menu") + xSubMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xSubMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) + + # Checkbox elements + xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xCheckListMenu = xFloatWindow.getChild("FilterDropDown") + xTreeList = xCheckListMenu.getChild("check_list_box") + self.assertEqual(5, len(xTreeList.getChildren())) + self.assertEqual('false', get_state_as_dict(xTreeList.getChild('0'))['IsChecked']) + self.assertEqual('true', get_state_as_dict(xTreeList.getChild('2'))['IsChecked']) + self.assertEqual('true', get_state_as_dict(xTreeList.getChild('4'))['IsChecked']) + xCancelBtn = xFloatWindow.getChild("cancel") + xCancelBtn.executeAction("CLICK", tuple()) + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/autofilter2/tdf92767.py b/sc/qa/uitest/autofilter2/tdf92767.py new file mode 100644 index 0000000000..e3a0908d42 --- /dev/null +++ b/sc/qa/uitest/autofilter2/tdf92767.py @@ -0,0 +1,52 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues +from libreoffice.calc.document import is_row_hidden +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file + +class tdf92767(UITestCase): + + def test_tdf92767(self): + with self.ui_test.load_file(get_url_for_data_file("tdf92767.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + for i in range(0,25): + self.assertFalse(is_row_hidden(calc_doc, i)) + + gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xTreeList = xFloatWindow.getChild("check_tree_box") + xFirstEntry = xTreeList.getChild("0") + self.assertEqual('2015', get_state_as_dict(xFirstEntry)["Text"]) + self.assertEqual('7', get_state_as_dict(xFirstEntry)["Children"]) + + # Deselect all the options but the last one + for i in range(6): + xChild = xFirstEntry.getChild(str(i)) + xChild.executeAction("CLICK", tuple()) + self.assertEqual('false', get_state_as_dict(xChild)['IsChecked']) + + xLastChild = xFirstEntry.getChild('6') + self.assertEqual('true', get_state_as_dict(xLastChild)['IsChecked']) + self.assertEqual('July', get_state_as_dict(xLastChild)['Text']) + + xOkBtn = xFloatWindow.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) + + for i in range(1,22): + self.assertTrue(is_row_hidden(calc_doc, i)) + + # Without the fix in place, this test would have failed here + self.assertFalse(is_row_hidden(calc_doc, 23)) + self.assertFalse(is_row_hidden(calc_doc, 24)) + self.assertFalse(is_row_hidden(calc_doc, 25)) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/autofilter2/tdf95520.py b/sc/qa/uitest/autofilter2/tdf95520.py new file mode 100644 index 0000000000..c5339c3f8d --- /dev/null +++ b/sc/qa/uitest/autofilter2/tdf95520.py @@ -0,0 +1,55 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_url_for_data_file, get_state_as_dict +from libreoffice.uno.propertyvalue import mkPropertyValues +from libreoffice.calc.document import get_cell_by_position + +class tdf95520(UITestCase): + def test_tdf95520(self): + # Reuse existing document + with self.ui_test.load_file(get_url_for_data_file("tdf144549.ods")) as doc: + calcDoc = self.xUITest.getTopFocusWindow() + xGridWin = calcDoc.getChild("grid_window") + + xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xMenu = xFloatWindow.getChild("menu") + + # Sort by Color + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) + + xSubFloatWindow = self.xUITest.getFloatWindow() + xSubMenu = xSubFloatWindow.getChild("textcolor") + self.assertEqual(3, len(xSubMenu.getChildren())) + self.assertEqual('false', get_state_as_dict(xSubMenu.getChild('0'))['IsChecked']) + self.assertEqual('#00FF00', get_state_as_dict(xSubMenu.getChild('0'))['Text']) + self.assertEqual('false', get_state_as_dict(xSubMenu.getChild('1'))['IsChecked']) + self.assertEqual('false', get_state_as_dict(xSubMenu.getChild('2'))['IsChecked']) + + # Choose Red + xSubMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xSubMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) + + self.assertEqual("Jan", get_cell_by_position(doc, 0, 0, 1).getString()) + self.assertEqual("Dez", get_cell_by_position(doc, 0, 0, 2).getString()) + self.assertEqual("Aug", get_cell_by_position(doc, 0, 0, 3).getString()) + self.assertEqual("Nov", get_cell_by_position(doc, 0, 0, 4).getString()) + self.assertEqual("Jun", get_cell_by_position(doc, 0, 0, 5).getString()) + self.assertEqual("Apr", get_cell_by_position(doc, 0, 0, 6).getString()) + self.assertEqual("Mai", get_cell_by_position(doc, 0, 0, 7).getString()) + self.assertEqual("Okt", get_cell_by_position(doc, 0, 0, 8).getString()) + self.assertEqual("Feb", get_cell_by_position(doc, 0, 0, 9).getString()) + self.assertEqual("Mär", get_cell_by_position(doc, 0, 0, 10).getString()) + self.assertEqual("Jul", get_cell_by_position(doc, 0, 0, 11).getString()) + self.assertEqual("Sep", get_cell_by_position(doc, 0, 0, 12).getString()) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/autofilter2/tdf97340.py b/sc/qa/uitest/autofilter2/tdf97340.py new file mode 100644 index 0000000000..884caa00a5 --- /dev/null +++ b/sc/qa/uitest/autofilter2/tdf97340.py @@ -0,0 +1,44 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file +from libreoffice.uno.propertyvalue import mkPropertyValues + +#Bug 97340 - Calc crashes on filtering with select checkbox with space bar + +class tdf97340(UITestCase): + def test_tdf97340_autofilter(self): + with self.ui_test.load_file(get_url_for_data_file("autofilter.ods")): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + + xCheckListMenu = xFloatWindow.getChild("FilterDropDown") + xTreeList = xCheckListMenu.getChild("check_tree_box") + self.assertEqual(2, len(xTreeList.getChildren())) + self.assertEqual("2016", get_state_as_dict(xTreeList.getChild('0'))['Text']) + self.assertEqual("2017", get_state_as_dict(xTreeList.getChild('1'))['Text']) + + xsearchEdit = xFloatWindow.getChild("search_edit") + xsearchEdit.executeAction("TYPE", mkPropertyValues({"TEXT":" "})) + self.ui_test.wait_until_property_is_updated(xTreeList, "Children", str(0)) + self.assertEqual(0, len(xTreeList.getChildren())) + + xsearchEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"})) + + #tdf#133785, without the fix in place, it would have been 0 + self.ui_test.wait_until_property_is_updated(xTreeList, "Children", str(8)) + # Number of children differs due to xTreeList.getChildren() returns only direct descendants + self.assertEqual(2, len(xTreeList.getChildren())) + self.assertEqual("2016", get_state_as_dict(xTreeList.getChild('0'))['Text']) + self.assertEqual("2017", get_state_as_dict(xTreeList.getChild('1'))['Text']) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_dialogs/openDialogs.py b/sc/qa/uitest/calc_dialogs/openDialogs.py new file mode 100644 index 0000000000..f559ceec6a --- /dev/null +++ b/sc/qa/uitest/calc_dialogs/openDialogs.py @@ -0,0 +1,192 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +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}, + # tested in sc/qa/uitest/calc_tests4/exportToPDF.py + {"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}, + # tested in sc/qa/uitest/calc_tests8/tdf137726.py + # {"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"}, + # tested in sc/qa/uitest/range_name/create_range_name.py + {"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"}, + # tested in sc/qa/uitest/calc_tests9/tdf126673.py + # {"command": ".uno:ColumnWidth", "closeButton": "cancel"}, + # tested in sc/qa/uitest/calc_tests/columns.py + # {"command": ".uno:SetOptimalColumnWidth", "closeButton": "cancel"}, + # tested in sc/qa/uitest/textToColumns/tdf89907.py + # {"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"}, + # tested in sc/qa/uitest/range_name/tdf148072.py + # {"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}, + # tested in sc/qa/uitest/range_name/tdf137617.py + # 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}, + # tested in sc/qa/uitest/calc_tests6/tdf147830.py + # {"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"}, + # tested in sc/qa/uitest/calc_tests6/tdf104378.py + # {"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", "skipTestOK": True}, + # {"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 0000000000..6a24d6df9c --- /dev/null +++ b/sc/qa/uitest/calc_tests/CalcPasteOnly.py @@ -0,0 +1,41 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.framework import UITestCase +from libreoffice.calc.document import get_cell_by_position +from uitest.uihelper.calc import enter_text_to_cell + +class CalcPasteOnly(UITestCase): + + def test_paste_only(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xTopWindow = self.xUITest.getTopFocusWindow() + 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)") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests/CellDropDownItems.py b/sc/qa/uitest/calc_tests/CellDropDownItems.py new file mode 100644 index 0000000000..86fceeca2f --- /dev/null +++ b/sc/qa/uitest/calc_tests/CellDropDownItems.py @@ -0,0 +1,84 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import select_pos + +class CellDropDownItems(UITestCase): + + def test_dropdownitems(self): + + #This is to test Dropdown items in grid window + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + #select cell C10 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C10"})) + + #Open Validation Dialog + with self.ui_test.execute_dialog_through_command(".uno:Validation") as xDialog: + + #Select List option + xallow = xDialog.getChild("allow") + select_pos(xallow, "6") + + #Add items to the List + xminlist = xDialog.getChild("minlist") + xminlist.executeAction("TYPE", mkPropertyValues({"TEXT": "Item1"})) + xminlist.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + xminlist.executeAction("TYPE", mkPropertyValues({"TEXT": "Item2"})) + xminlist.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + xminlist.executeAction("TYPE", mkPropertyValues({"TEXT": "Item3"})) + xminlist.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + xminlist.executeAction("TYPE", mkPropertyValues({"TEXT": "Item4"})) + xminlist.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + xminlist.executeAction("TYPE", mkPropertyValues({"TEXT": "Item5"})) + + #Close the dialog + + #Launch the Select Menu to view the list ans select first item in the list + gridwin = xCalcDoc.getChild("grid_window") + gridwin.executeAction("LAUNCH", mkPropertyValues({"SELECTMENU": "", "COL": "2", "ROW": "9"})) + + #Select the TreeList UI Object + xWin = self.xUITest.getTopFocusWindow() + xlist = xWin.getChild("list") + + xListItem = xlist.getChild('0') + xListItem.executeAction("DOUBLECLICK" , mkPropertyValues({}) ) + self.assertEqual(get_cell_by_position(document, 0, 2, 9).getString(), "Item1") + + #Launch the Select Menu to view the list ans select Third item in the list + gridwin = xCalcDoc.getChild("grid_window") + gridwin.executeAction("LAUNCH", mkPropertyValues({"SELECTMENU": "", "COL": "2", "ROW": "9"})) + + #Select the TreeList UI Object + xWin = self.xUITest.getTopFocusWindow() + xlist = xWin.getChild("list") + + xListItem = xlist.getChild('2') + xListItem.executeAction("DOUBLECLICK" , mkPropertyValues({}) ) + self.assertEqual(get_cell_by_position(document, 0, 2, 9).getString(), "Item3") + + #Launch the Select Menu to view the list ans select Fifth item in the list + gridwin = xCalcDoc.getChild("grid_window") + gridwin.executeAction("LAUNCH", mkPropertyValues({"SELECTMENU": "", "COL": "2", "ROW": "9"})) + + #Select the TreeList UI Object + xWin = self.xUITest.getTopFocusWindow() + xlist = xWin.getChild("list") + + xListItem = xlist.getChild('4') + xListItem.executeAction("DOUBLECLICK" , mkPropertyValues({}) ) + self.assertEqual(get_cell_by_position(document, 0, 2, 9).getString(), "Item5") + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests/Comments.py b/sc/qa/uitest/calc_tests/Comments.py new file mode 100644 index 0000000000..b52437a484 --- /dev/null +++ b/sc/qa/uitest/calc_tests/Comments.py @@ -0,0 +1,48 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict +from libreoffice.uno.propertyvalue import mkPropertyValues + +class Comments(UITestCase): + def test_comment(self): + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + # Select Cell D8 + gridwin.executeAction("SELECT", mkPropertyValues({"TABLE": "0"})) + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D8"})) + + # Create comment and open it's window + gridwin.executeAction("COMMENT", mkPropertyValues({"OPEN": ""})) + + # Write text in the Comment Window + gridwin.executeAction("TYPE", mkPropertyValues({"TEXT": "First Comment"})) + + # Close Comment Window + gridwin.executeAction("COMMENT", mkPropertyValues({"CLOSE":""})) + + # Check on the comment text + self.assertEqual(get_state_as_dict(gridwin)["CurrentCellCommentText"], "First Comment") + + # Check on comment in another cell + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + gridwin.executeAction("COMMENT", mkPropertyValues({"OPEN": ""})) + gridwin.executeAction("TYPE", mkPropertyValues({"TEXT": "Second Comment"})) + gridwin.executeAction("COMMENT", mkPropertyValues({"CLOSE":""})) + self.assertEqual(get_state_as_dict(gridwin)["CurrentCellCommentText"], "Second Comment") + + # Write Comment without opening Comment window + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B5"})) + gridwin.executeAction("COMMENT", mkPropertyValues({"SETTEXT": "Third Comment"})) + self.assertEqual(get_state_as_dict(gridwin)["CurrentCellCommentText"], "Third Comment") + + +# 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 0000000000..db3334c367 --- /dev/null +++ b/sc/qa/uitest/calc_tests/autosum.py @@ -0,0 +1,36 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_url_for_data_file +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + +#AutoSum feature test + +class calcAutosum(UITestCase): + + def test_autosum_test8(self): + #8.Autosum on rows without selected empty cell for result + with self.ui_test.load_file(get_url_for_data_file("autosum.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + 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(calc_doc, 0, 4, 125).getValue(), 30) + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 125).getFormula(), "=SUM(B126:D126)") + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 127).getValue(), 90) + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 127).getFormula(), "=SUM(B128:D128)") + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 129).getValue(), 150) + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 129).getFormula(), "=SUM(B130:D130)") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests/calcSheetDelete.py b/sc/qa/uitest/calc_tests/calcSheetDelete.py new file mode 100644 index 0000000000..380d676694 --- /dev/null +++ b/sc/qa/uitest/calc_tests/calcSheetDelete.py @@ -0,0 +1,124 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.calc import enter_text_to_cell + +class calcSheetDelete(UITestCase): + + def test_tdf114228_insert_and_delete_sheet(self): + + with self.ui_test.create_doc_in_start_center("calc") as document: + + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = xCalcDoc.getChild("grid_window") + + xGridWindow.executeAction("SELECT", mkPropertyValues({"CELL": "L12"})) + nrSheets = document.Sheets.getCount() #default number + + with self.ui_test.execute_dialog_through_command(".uno:Insert"): + pass + + self.assertEqual(document.Sheets.getCount(), nrSheets + 1) + + self.xUITest.executeCommand(".uno:Remove") + xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit') + xToolkit.processEventsToIdle() + + 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) + + + def test_tdf43078_insert_and_delete_sheet_insert_text(self): + + with self.ui_test.create_doc_in_start_center("calc") as document: + + nrSheets = document.Sheets.getCount() #default number of sheets + + with self.ui_test.execute_dialog_through_command(".uno:Insert"): + pass + + with self.ui_test.execute_dialog_through_command(".uno:Insert"): + pass + xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit') + xToolkit.processEventsToIdle() + + self.assertEqual(document.Sheets.getCount(), nrSheets + 2) + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = xCalcDoc.getChild("grid_window") + enter_text_to_cell(xGridWindow, "B2", "abcd") + + with self.ui_test.execute_dialog_through_command(".uno:Remove", close_button="yes"): + pass + + 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) + + + def test_delete_more_sheets_at_once(self): + + with self.ui_test.create_doc_in_start_center("calc") as document: + nrSheets = document.Sheets.getCount() #default number + i = 0 + while i < 6: + with self.ui_test.execute_dialog_through_command(".uno:Insert"): + pass + 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.xUITest.executeCommand(".uno:Remove") + + xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit') + xToolkit.processEventsToIdle() + 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) + + + def test_tdf105105_delete_lots_of_sheets_at_once(self): + + with self.ui_test.create_doc_in_start_center("calc") as document: + nrSheets = document.Sheets.getCount() #default number + i = 0 + while i < 100: + with self.ui_test.execute_dialog_through_command(".uno:Insert"): + pass + i = i + 1 + xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit') + xToolkit.processEventsToIdle() + self.assertEqual(document.Sheets.getCount(), nrSheets + 100) + + i = 0 + while i < 99: + self.xUITest.executeCommand(".uno:JumpToNextTableSel") #select next sheet + i = i + 1 + + self.xUITest.executeCommand(".uno:Remove") + + 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) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests/cellBackgroundColorSelector.py b/sc/qa/uitest/calc_tests/cellBackgroundColorSelector.py new file mode 100644 index 0000000000..dcd7c75c0f --- /dev/null +++ b/sc/qa/uitest/calc_tests/cellBackgroundColorSelector.py @@ -0,0 +1,198 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import select_pos +from uitest.uihelper.common import select_by_text +from libreoffice.uno.propertyvalue import mkPropertyValues + +class CalcCellBackgroundColorSelector(UITestCase): + + def test_color_selector(self): + + #This is to test color selection + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #select cell A1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #format - cell + with self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "6") #tab Numbers + # click on color btn + xbtncolor = xDialog.getChild("btncolor") + xbtncolor.executeAction("CLICK",tuple()) + xpaletteselector = xDialog.getChild("paletteselector") + + # Now we have the ColorPage that we can get the color selector from it + xColorpage = xDialog.getChild("ColorPage") + color_selector = xColorpage.getChild("colorset") + + # For chart-palettes colors + select_by_text(xpaletteselector, "chart-palettes") + # Select Color with id 2 + color_selector.executeAction("CHOOSE", mkPropertyValues({"POS": "2"})) + self.assertEqual(get_state_as_dict(color_selector)["CurrColorId"], "2") + self.assertEqual(get_state_as_dict(color_selector)["CurrColorPos"], "1") + self.assertEqual(get_state_as_dict(color_selector)["ColorsCount"], "12") + self.assertEqual(get_state_as_dict(color_selector)["ColCount"], "12") + self.assertEqual(get_state_as_dict(color_selector)["ColorText"], "Chart 2") + self.assertEqual(get_state_as_dict(color_selector)["RGB"], "(255,66,14)") + + # Select Color with id 5 + color_selector.executeAction("CHOOSE", mkPropertyValues({"POS": "5"})) + self.assertEqual(get_state_as_dict(color_selector)["CurrColorId"], "5") + self.assertEqual(get_state_as_dict(color_selector)["CurrColorPos"], "4") + self.assertEqual(get_state_as_dict(color_selector)["ColorText"], "Chart 5") + self.assertEqual(get_state_as_dict(color_selector)["RGB"], "(126,0,33)") + + # For libreoffice colors + select_by_text(xpaletteselector, "libreoffice") + # Select Color with id 6 + color_selector.executeAction("CHOOSE", mkPropertyValues({"POS": "6"})) + self.assertEqual(get_state_as_dict(color_selector)["CurrColorId"], "6") + self.assertEqual(get_state_as_dict(color_selector)["CurrColorPos"], "5") + self.assertEqual(get_state_as_dict(color_selector)["ColorsCount"], "32") + self.assertEqual(get_state_as_dict(color_selector)["ColCount"], "12") + self.assertEqual(get_state_as_dict(color_selector)["ColorText"], "Green Accent") + self.assertEqual(get_state_as_dict(color_selector)["RGB"], "(44,238,14)") + + # Select Color with id 30 + color_selector.executeAction("CHOOSE", mkPropertyValues({"POS": "30"})) + self.assertEqual(get_state_as_dict(color_selector)["CurrColorId"], "30") + self.assertEqual(get_state_as_dict(color_selector)["CurrColorPos"], "29") + self.assertEqual(get_state_as_dict(color_selector)["ColorText"], "Yellow Accent") + self.assertEqual(get_state_as_dict(color_selector)["RGB"], "(255,215,76)") + + # For html colors + select_by_text(xpaletteselector, "html") + # Select Color with id 1 + color_selector.executeAction("CHOOSE", mkPropertyValues({"POS": "1"})) + self.assertEqual(get_state_as_dict(color_selector)["CurrColorId"], "1") + self.assertEqual(get_state_as_dict(color_selector)["CurrColorPos"], "0") + self.assertEqual(get_state_as_dict(color_selector)["ColorsCount"], "139") + self.assertEqual(get_state_as_dict(color_selector)["ColCount"], "12") + self.assertEqual(get_state_as_dict(color_selector)["ColorText"], "White") + # Select Color with id 120 + color_selector.executeAction("CHOOSE", mkPropertyValues({"POS": "120"})) + self.assertEqual(get_state_as_dict(color_selector)["CurrColorId"], "120") + self.assertEqual(get_state_as_dict(color_selector)["CurrColorPos"], "119") + self.assertEqual(get_state_as_dict(color_selector)["ColorText"], "Navy") + + # For freecolour-hlc colors + select_by_text(xpaletteselector, "freecolour-hlc") + # Select Color with id 988 + color_selector.executeAction("CHOOSE", mkPropertyValues({"POS": "988"})) + self.assertEqual(get_state_as_dict(color_selector)["CurrColorId"], "988") + self.assertEqual(get_state_as_dict(color_selector)["CurrColorPos"], "987") + self.assertEqual(get_state_as_dict(color_selector)["ColorsCount"], "1032") + self.assertEqual(get_state_as_dict(color_selector)["ColCount"], "12") + self.assertEqual(get_state_as_dict(color_selector)["ColorText"], "HLC 350 60 10") + # Select Color with id 575 + color_selector.executeAction("CHOOSE", mkPropertyValues({"POS": "575"})) + self.assertEqual(get_state_as_dict(color_selector)["CurrColorId"], "575") + self.assertEqual(get_state_as_dict(color_selector)["CurrColorPos"], "574") + self.assertEqual(get_state_as_dict(color_selector)["ColorText"], "HLC 190 50 20") + + # For tonal colors + select_by_text(xpaletteselector, "tonal") + # Select Color with id 17 + color_selector.executeAction("CHOOSE", mkPropertyValues({"POS": "17"})) + self.assertEqual(get_state_as_dict(color_selector)["CurrColorId"], "17") + self.assertEqual(get_state_as_dict(color_selector)["CurrColorPos"], "16") + self.assertEqual(get_state_as_dict(color_selector)["ColorsCount"], "120") + self.assertEqual(get_state_as_dict(color_selector)["ColCount"], "12") + self.assertEqual(get_state_as_dict(color_selector)["ColorText"], "Cyan 82%") + # Select Color with id 13 + color_selector.executeAction("CHOOSE", mkPropertyValues({"POS": "13"})) + self.assertEqual(get_state_as_dict(color_selector)["CurrColorId"], "13") + self.assertEqual(get_state_as_dict(color_selector)["CurrColorPos"], "12") + self.assertEqual(get_state_as_dict(color_selector)["ColorText"], "Magenta 82%") + + # For material colors + select_by_text(xpaletteselector, "material") + # Select Color with id 9 + color_selector.executeAction("CHOOSE", mkPropertyValues({"POS": "9"})) + self.assertEqual(get_state_as_dict(color_selector)["CurrColorId"], "9") + self.assertEqual(get_state_as_dict(color_selector)["CurrColorPos"], "8") + self.assertEqual(get_state_as_dict(color_selector)["ColorsCount"], "228") + self.assertEqual(get_state_as_dict(color_selector)["ColCount"], "12") + self.assertEqual(get_state_as_dict(color_selector)["ColorText"], "Gray 800") + + # For standard colors + select_by_text(xpaletteselector, "standard") + # Select Color with id 3 + color_selector.executeAction("CHOOSE", mkPropertyValues({"POS": "3"})) + self.assertEqual(get_state_as_dict(color_selector)["CurrColorId"], "3") + self.assertEqual(get_state_as_dict(color_selector)["CurrColorPos"], "2") + self.assertEqual(get_state_as_dict(color_selector)["ColorsCount"], "120") + self.assertEqual(get_state_as_dict(color_selector)["ColCount"], "12") + self.assertEqual(get_state_as_dict(color_selector)["ColorText"], "Dark Gray 3") + + + + def test_recent_color_selector(self): + + #This is to test recent color selection + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #select cell A5 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A5"})) + #format - cell + with self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "6") #tab Numbers + # click on color btn + xbtncolor = xDialog.getChild("btncolor") + xbtncolor.executeAction("CLICK",tuple()) + + # we will select color for cell A5 to be able to predict the latest color in + # recent color selector + xpaletteselector = xDialog.getChild("paletteselector") + xColorpage = xDialog.getChild("ColorPage") + color_selector = xColorpage.getChild("colorset") + + # For chart-palettes colors + select_by_text(xpaletteselector, "chart-palettes") + # Select Color with id 2 + color_selector.executeAction("CHOOSE", mkPropertyValues({"POS": "2"})) + self.assertEqual(get_state_as_dict(color_selector)["CurrColorId"], "2") + self.assertEqual(get_state_as_dict(color_selector)["CurrColorPos"], "1") + self.assertEqual(get_state_as_dict(color_selector)["ColorsCount"], "12") + self.assertEqual(get_state_as_dict(color_selector)["ColCount"], "12") + self.assertEqual(get_state_as_dict(color_selector)["ColorText"], "Chart 2") + xrgb = get_state_as_dict(color_selector)["RGB"] + + # close the dialog after selection of the color + + #select cell D3 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D3"})) + #format - cell + with self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "6") #tab Numbers + # click on color btn + xbtncolor = xDialog.getChild("btncolor") + xbtncolor.executeAction("CLICK",tuple()) + + xColorpage = xDialog.getChild("ColorPage") + recent_color_selector = xColorpage.getChild("recentcolorset") + + # Select Color with id 1 + recent_color_selector.executeAction("CHOOSE", mkPropertyValues({"POS": "1"})) + self.assertEqual(get_state_as_dict(recent_color_selector)["CurrColorId"], "1") + self.assertEqual(get_state_as_dict(recent_color_selector)["CurrColorPos"], "0") + self.assertEqual(get_state_as_dict(recent_color_selector)["ColorText"], "Chart 2") + self.assertEqual(get_state_as_dict(recent_color_selector)["RGB"], xrgb) + + + +# 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 0000000000..ed594510f1 --- /dev/null +++ b/sc/qa/uitest/calc_tests/columns.py @@ -0,0 +1,227 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import change_measurement_unit +from libreoffice.uno.propertyvalue import mkPropertyValues + +class CalcColumns(UITestCase): + def test_column_width(self): + with self.ui_test.create_doc_in_start_center("calc"): + + with change_measurement_unit(self, "Centimeter"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + #select A1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #column width + with self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") as xDialog: + xvalue = xDialog.getChild("value") + xdefault = xDialog.getChild("default") + self.assertEqual(get_state_as_dict(xdefault)["Selected"], "true") #default selected + + # tdf#144247: Without the fix in place, this test would have failed with + # AssertionError: '2.26 cm' != '2.2578 cm' + self.assertEqual("2.26 cm", get_state_as_dict(xvalue)["Text"]) + xvalue.executeAction("UP", tuple()) + self.assertEqual("2.30 cm", get_state_as_dict(xvalue)["Text"]) + self.assertEqual(get_state_as_dict(xdefault)["Selected"], "false") #default not selected + xdefault.executeAction("CLICK", tuple()) #click default + self.assertEqual("2.26 cm", get_state_as_dict(xvalue)["Text"]) + + #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 + #verify + with self.ui_test.execute_dialog_through_command(".uno:ColumnWidth", close_button="cancel") as xDialog: + xvalue = xDialog.getChild("value") + self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.00 cm") + + + def test_column_width_two_columns(self): + with self.ui_test.create_doc_in_start_center("calc"): + + with change_measurement_unit(self, "Centimeter"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1", "EXTEND":"1"})) + + with self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") as xDialog: + xvalue = xDialog.getChild("value") + #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 + #verify + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + with self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") as xDialog: + xvalue = xDialog.getChild("value") + self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.00 cm") + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1"})) + with self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") as xDialog: + xvalue = xDialog.getChild("value") + self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.00 cm") + + + def test_column_width_copy(self): + with self.ui_test.create_doc_in_start_center("calc"): + + with change_measurement_unit(self, "Centimeter"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + #select A1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #column width + with self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") as xDialog: + 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 + #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"})) + with self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") as xDialog: + xvalue = xDialog.getChild("value") + self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.00 cm") + + + def test_column_hide_show(self): + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #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") + + + def test_column_test_move(self): + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #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") + + + def test_tdf117522_column_width_insert_left(self): + with self.ui_test.create_doc_in_start_center("calc"): + + with change_measurement_unit(self, "Centimeter"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + #select C1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1"})) + #column width + with self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") as xDialog: + 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 + #select D1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D1"})) + #column width + with self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") as xDialog: + 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 + #select E1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "E1"})) + #column width + with self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") as xDialog: + 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 + #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"})) + with self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") as xDialog: + xvalue = xDialog.getChild("value") + self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.00 cm") + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D1"})) + with self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") as xDialog: + xvalue = xDialog.getChild("value") + self.assertEqual(get_state_as_dict(xvalue)["Text"], "2.00 cm") + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "E1"})) + with self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") as xDialog: + xvalue = xDialog.getChild("value") + self.assertEqual(get_state_as_dict(xvalue)["Text"], "3.00 cm") + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "F1"})) + with self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") as xDialog: + xvalue = xDialog.getChild("value") + self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.00 cm") + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "G1"})) + with self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") as xDialog: + xvalue = xDialog.getChild("value") + self.assertEqual(get_state_as_dict(xvalue)["Text"], "2.00 cm") + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "H1"})) + with self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") as xDialog: + xvalue = xDialog.getChild("value") + self.assertEqual(get_state_as_dict(xvalue)["Text"], "3.00 cm") + + +# 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 0000000000..da40859232 --- /dev/null +++ b/sc/qa/uitest/calc_tests/fillRandomNumber.py @@ -0,0 +1,54 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import select_by_text +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + +#randomnumbergenerator.ui +class fillRandomNumber(UITestCase): + def test_fill_random_number(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"})) + with self.ui_test.execute_modeless_dialog_through_command(".uno:RandomNumberGeneratorDialog") as xDialog: + xcellrangeedit = xDialog.getChild("cell-range-edit") + xdistributioncombo = xDialog.getChild("distribution-combo") + 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"})) + select_by_text(xdistributioncombo, "Uniform Integer") + + xparameter1spin.executeAction("UP", tuple()) + xparameter2spin.executeAction("UP", tuple()) + xenableseedcheck.executeAction("CLICK", tuple()) + xseedspin.executeAction("UP", tuple()) + xenableroundingcheck.executeAction("CLICK", tuple()) + xdecimalplacesspin.executeAction("UP", tuple()) + + #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 + with self.ui_test.execute_modeless_dialog_through_command(".uno:RandomNumberGeneratorDialog", close_button="close"): + pass + + self.assertEqual(bool(get_cell_by_position(document, 0, 0, 0).getString() ), False) + self.assertEqual(bool(get_cell_by_position(document, 0, 0, 1).getString() ), False) +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests/formatCells.py b/sc/qa/uitest/calc_tests/formatCells.py new file mode 100644 index 0000000000..e00f6d0fe0 --- /dev/null +++ b/sc/qa/uitest/calc_tests/formatCells.py @@ -0,0 +1,468 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import select_pos +from uitest.uihelper.common import select_by_text +from uitest.uihelper.common import change_measurement_unit +from libreoffice.uno.propertyvalue import mkPropertyValues + +class formatCell(UITestCase): + def test_format_cell_numbers_tab(self): + #numberingformatpage.ui + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #select cell A1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #format - cell + with self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") #tab Numbers + 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 + select_by_text(xlanguagelb, "English (USA)") + #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 + #verify + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #format - cell + with self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") #tab Numbers + xliststore1 = xDialog.getChild("categorylb") #1st list / Category + 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") + + + def test_format_cell_font_tab(self): + #numberingformatpage.ui + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #select cell A1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #format - cell + with self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") #tab Font + + # xNoteBook = xDialog.getChild("nbWestern") //western notebook is always active + xSizeFont = xDialog.getChild("cbWestSize") + xSizeFont.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xSizeFont.executeAction("TYPE", mkPropertyValues({"TEXT":"18"})) #set font size 18 + xLangFont = xDialog.getChild("cbWestLanguage") + select_pos(xLangFont, "0") + + xNoteBook = xDialog.getChild("nbCJKCTL") + select_pos(xNoteBook, "0") + xSizeFontEast = xDialog.getChild("cbCJKSize") + xSizeFontEast.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xSizeFontEast.executeAction("TYPE", mkPropertyValues({"TEXT":"18"})) #set font size 18 + xLangFontEast = xDialog.getChild("cbCJKLanguage") + select_pos(xLangFontEast, "0") + + select_pos(xNoteBook, "1") + xSizeFontCTL = xDialog.getChild("cbCTLSize") + xSizeFontCTL.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xSizeFontCTL.executeAction("TYPE", mkPropertyValues({"TEXT":"18"})) #set font size 18 + xLangFontCTL = xDialog.getChild("cbCTLLanguage") + select_pos(xLangFontCTL, "0") + + #Verify - select cell A1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #format - cell + with self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog", close_button="cancel") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") #tab Font + xSizeFont = xDialog.getChild("cbWestSize") + self.assertEqual(get_state_as_dict(xSizeFont)["Text"], "18 pt") + xLangFont = xDialog.getChild("cbWestLanguage") + self.assertEqual(get_state_as_dict(xLangFont)["Text"], "[None]") + + xNoteBook = xDialog.getChild("nbCJKCTL") + select_pos(xNoteBook, "0") + xSizeFontEast = xDialog.getChild("cbCJKSize") + self.assertEqual(get_state_as_dict(xSizeFontEast)["Text"], "18 pt") + xLangFontEast = xDialog.getChild("cbCJKLanguage") + self.assertEqual(get_state_as_dict(xLangFontEast)["Text"], "[None]") + + select_pos(xNoteBook, "1") + xSizeFontCTL = xDialog.getChild("cbCTLSize") + self.assertEqual(get_state_as_dict(xSizeFontCTL)["Text"], "18 pt") #check font size + xLangFontCTL = xDialog.getChild("cbCTLLanguage") + self.assertEqual(get_state_as_dict(xLangFontCTL)["Text"], "[None]") + + + + def test_format_cell_font_effects_tab(self): + #numberingformatpage.ui + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #select cell A1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #format - cell + with self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") as xDialog: + 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") + + #Verify- select cell A1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #format - cell + with self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog", close_button="cancel") as xDialog: + 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") + + + + def test_format_cell_alignment_tab(self): + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #select cell A1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #format - cell + with self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") as xDialog: + 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") + + select_by_text(comboboxHorzAlign, "Left") + xspinIndentFrom.executeAction("UP", tuple()) + indentVal = get_state_as_dict(xspinIndentFrom)["Text"] + select_by_text(xcomboboxVertAlign, "Top") + xcheckVertStack.executeAction("CLICK", tuple()) + xcheckWrapTextAuto.executeAction("CLICK", tuple()) + xcheckHyphActive.executeAction("CLICK", tuple()) + select_by_text(xcomboTextDirBox, "Left-to-right (LTR)") + #Verify- select cell A1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #format - cell + with self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") as xDialog: + 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)") + + + def test_format_cell_asian_typography_tab(self): + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #select cell A1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #format - cell + with self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "4") #tab Asian typography + xcheckForbidList = xDialog.getChild("checkForbidList") + xcheckForbidList.executeAction("CLICK", tuple()) + #Verify- select cell A1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #format - cell + with self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "4") + xcheckForbidList = xDialog.getChild("checkForbidList") + self.assertEqual(get_state_as_dict(xcheckForbidList)["Selected"], "true") + + + def test_minimal_border_width(self): + #borderpage.ui, tdf#137790 + with self.ui_test.create_doc_in_start_center("calc"): + + #set points pt measurement + with change_measurement_unit(self, "Point"): + + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + #select cell A1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #format - cell + with self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "5") #tab Borders + + linewidthmf = xDialog.getChild("linewidthmf") + xLineSet = xDialog.getChild('lineset') + + # check line-width for default solid line + self.assertEqual('0', get_state_as_dict(xLineSet)['SelectedItemPos']) + widthVal = get_state_as_dict(linewidthmf)["Text"] + self.assertEqual(widthVal, '0.75 pt') + + # set line style to "double" (minimal width is taken) + xLineSet.executeAction("CHOOSE", mkPropertyValues({"POS": '16'})) + widthVal = get_state_as_dict(linewidthmf)["Text"] + # minimum predefined width is Medium (1.50 pt) + self.assertEqual(widthVal, '1.50 pt') + + # set line style to "solid" + xLineSet.executeAction("CHOOSE", mkPropertyValues({"POS": "1"})) + widthVal = get_state_as_dict(linewidthmf)["Text"] + self.assertEqual(widthVal, '1.50 pt') + + # make custom line width + linewidthmf.executeAction("UP", tuple()) + linewidthmf.executeAction("UP", tuple()) + linewidthmf.executeAction("UP", tuple()) + widthVal = get_state_as_dict(linewidthmf)["Text"] + self.assertEqual(widthVal, '2.25 pt') + + # set line style to "double" (minimal width is not taken) + xLineSet.executeAction("CHOOSE", mkPropertyValues({"POS": "8"})) + widthVal = get_state_as_dict(linewidthmf)["Text"] + self.assertEqual(widthVal, '2.25 pt') + + + + def test_format_cell_borders_tab(self): + #borderpage.ui + with self.ui_test.create_doc_in_start_center("calc"): + + #set points pt measurement + with change_measurement_unit(self, "Point"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + #select cell A1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #format - cell + with self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") as xDialog: + 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"] + + + # Verify select cell A1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #format - cell + with self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") as xDialog: + 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) + + + + def test_format_cell_cell_protection_tab(self): + #cellprotectionpage.ui + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #select cell A1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #format - cell + with self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") as xDialog: + 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()) + + # Verify select cell A1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #format - cell + with self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") as xDialog: + 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") + + + + def test_tdf130762(self): + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #select cell A1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #format - cell + with self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") as xDialog: + 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") + + def test_format_cell_spell_out_numbering(self): + #numberingformatpage.ui + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #select cell A1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #format - cell + with self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") #tab Numbers + + formatlb = xDialog.getChild("formatlb") + xformatted = xDialog.getChild("formatted") + + # NatNum12 number formats + + entry = formatlb.getChild("11") + self.assertEqual(get_state_as_dict(entry)["Text"], "ONE HUNDRED") + entry.executeAction("SELECT", tuple()) + self.assertEqual(get_state_as_dict(xformatted)["Text"], "[NatNum12 upper cardinal]0") + + entry = formatlb.getChild("10") + self.assertEqual(get_state_as_dict(entry)["Text"], "One Hundred") + entry.executeAction("SELECT", tuple()) + self.assertEqual(get_state_as_dict(xformatted)["Text"], "[NatNum12 title cardinal]0") + + entry = formatlb.getChild("9") + self.assertEqual(get_state_as_dict(entry)["Text"], "One hundred") + entry.executeAction("SELECT", tuple()) + self.assertEqual(get_state_as_dict(xformatted)["Text"], "[NatNum12 capitalize cardinal]0") + + entry = formatlb.getChild("8") + self.assertEqual(get_state_as_dict(entry)["Text"], "one hundred") + entry.executeAction("SELECT", tuple()) + self.assertEqual(get_state_as_dict(xformatted)["Text"], "[NatNum12 cardinal]0") + + # NatNum12 en_US currency formats + + categorylb = xDialog.getChild("categorylb") + entry = categorylb.getChild("4") # Currency + entry.executeAction("SELECT", tuple()) + + currencies = ["ONE U.S. DOLLAR AND TWENTY CENTS", "ONE U.S. DOLLAR", "One U.S. Dollar and Twenty Cents", "One U.S. Dollar"] + formats = ["[NatNum12 upper USD]0.00", "[NatNum12 upper USD]0", "[NatNum12 title USD]0.00", "[NatNum12 title USD]0"] + + # handle different order of the items + numCurrency = 0 + numFormat = 0 + for i in formatlb.getChildren(): + entry = formatlb.getChild(i) + if get_state_as_dict(entry)["Text"] in currencies: + numCurrency = numCurrency + 1 + entry.executeAction("SELECT", tuple()) + xformatted = xDialog.getChild("formatted") + if get_state_as_dict(xformatted)["Text"] in formats: + numFormat = numFormat + 1 + + self.assertEqual(4, numCurrency) + self.assertEqual(4, numFormat) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests/goToSheet.py b/sc/qa/uitest/calc_tests/goToSheet.py new file mode 100644 index 0000000000..f77fb24e88 --- /dev/null +++ b/sc/qa/uitest/calc_tests/goToSheet.py @@ -0,0 +1,64 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict +from libreoffice.uno.propertyvalue import mkPropertyValues + +class goToSheet(UITestCase): + def test_go_to_sheet(self): + with self.ui_test.create_doc_in_start_center("calc"): + + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = xCalcDoc.getChild("grid_window") + + for i in range(3): + with self.ui_test.execute_dialog_through_command(".uno:Insert"): + pass + + with self.ui_test.execute_dialog_through_command(".uno:RenameTable") as xDialogRename: + xname_entry = xDialogRename.getChild("name_entry") + xname_entry.executeAction("TYPE", mkPropertyValues({"TEXT":"NewName"})) + + with self.ui_test.execute_dialog_through_command(".uno:JumpToTable") as xDialogGoToSheet: + xentry_mask = xDialogGoToSheet.getChild("entry-mask") + xtree_view = xDialogGoToSheet.getChild("treeview") + + # Empty mask lists all sheets + self.assertEqual(get_state_as_dict(xtree_view)["Children"], "4") + + # None sheet contains 'E': Search entry is case sensitive + xentry_mask.executeAction("TYPE", mkPropertyValues({"TEXT":"E"})) + self.assertEqual(get_state_as_dict(xtree_view)["Children"], "0") + + xentry_mask.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + self.assertEqual(get_state_as_dict(xtree_view)["Children"], "4") + + # All sheets contains 'e' + xentry_mask.executeAction("TYPE", mkPropertyValues({"TEXT":"e"})) + self.assertEqual(get_state_as_dict(xtree_view)["Children"], "4") + + # List Sheet3, Sheet2 and Sheet1 + xentry_mask.executeAction("TYPE", mkPropertyValues({"TEXT":"e"})) + self.assertEqual(get_state_as_dict(xtree_view)["Children"], "3") + + #if no name selected, active sheet remains unchanged + self.assertEqual(get_state_as_dict(xGridWindow)["SelectedTable"], "0") + + with self.ui_test.execute_dialog_through_command(".uno:JumpToTable") as xDialogGoToSheet: + xentry_mask = xDialogGoToSheet.getChild("entry-mask") + xtree_view = xDialogGoToSheet.getChild("treeview") + # List Sheet3, Sheet2 and Sheet1 + xentry_mask.executeAction("TYPE", mkPropertyValues({"TEXT":"ee"})) + self.assertEqual(get_state_as_dict(xtree_view)["Children"], "3") + # Select Sheet2 + xtree_view.getChild('1').executeAction("SELECT", tuple()) + + self.assertEqual(get_state_as_dict(xGridWindow)["SelectedTable"], "2") + +# 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 0000000000..8399d8b767 --- /dev/null +++ b/sc/qa/uitest/calc_tests/mergedRowsColumns.py @@ -0,0 +1,167 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.framework import UITestCase +from libreoffice.calc.document import get_cell_by_position +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file + +class mergedRowsColumns(UITestCase): + + def test_merged_row_delete_tdf105412(self): + with self.ui_test.load_file(get_url_for_data_file("tdf105412.ods")) as calc_doc: + 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") + + def test_merged_columns_delete(self): + with self.ui_test.load_file(get_url_for_data_file("tdf105412.ods")) as calc_doc: + 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") + + def test_undo_not_available_merged_cells_tdf37901(self): + with self.ui_test.load_file(get_url_for_data_file("tdf105412.ods")) as calc_doc: + 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") + + def test_calculations_in_merged_cells_tdf51368(self): + with self.ui_test.load_file(get_url_for_data_file("tdf51368.ods")) as calc_doc: + 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"})) + with self.ui_test.execute_dialog_through_command(".uno:ToggleMergeCells") as xDialog: + xMoveCells = xDialog.getChild("move-cells-radio") + xMoveCells.executeAction("CLICK", tuple()) + 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"})) + with self.ui_test.execute_dialog_through_command(".uno:ToggleMergeCells") as xDialog: + xMoveCells = xDialog.getChild("keep-content-radio") + xMoveCells.executeAction("CLICK", tuple()) + 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"})) + with self.ui_test.execute_dialog_through_command(".uno:ToggleMergeCells") as xDialog: + xMoveCells = xDialog.getChild("move-cells-radio") + xMoveCells.executeAction("CLICK", tuple()) + 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"})) + with self.ui_test.execute_dialog_through_command(".uno:ToggleMergeCells") as xDialog: + xMoveCells = xDialog.getChild("keep-content-radio") + xMoveCells.executeAction("CLICK", tuple()) + 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"})) + with self.ui_test.execute_dialog_through_command(".uno:ToggleMergeCells") as xDialog: + xMoveCells = xDialog.getChild("keep-content-radio") + xMoveCells.executeAction("CLICK", tuple()) + 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"})) + with self.ui_test.execute_dialog_through_command(".uno:ToggleMergeCells") as xDialog: + + xMoveCells = xDialog.getChild("keep-content-radio") + xMoveCells.executeAction("CLICK", tuple()) + 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"})) + with self.ui_test.execute_dialog_through_command(".uno:ToggleMergeCells") as xDialog: + xMoveCells = xDialog.getChild("keep-content-radio") + xMoveCells.executeAction("CLICK", tuple()) + 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") + + def test_move_merged_cells(self): + with 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 + +# 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 0000000000..b2253055c1 --- /dev/null +++ b/sc/qa/uitest/calc_tests/printRange.py @@ -0,0 +1,95 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict +from libreoffice.uno.propertyvalue import mkPropertyValues + +class printRange(UITestCase): + def test_printRange(self): + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:F20"})) + #Set print range + self.xUITest.executeCommand(".uno:DefinePrintArea") + # Print Range dialog + with self.ui_test.execute_modeless_dialog_through_command(".uno:EditPrintArea") as xDialog: + 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 + + #Verify Print Range dialog + with self.ui_test.execute_modeless_dialog_through_command(".uno:EditPrintArea", close_button="cancel") as xDialog: + 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") + + #delete print ranges + self.xUITest.executeCommand(".uno:DeletePrintArea") + #Verify Print Range dialog + with self.ui_test.execute_modeless_dialog_through_command(".uno:EditPrintArea") as xDialog: + 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") + + def test_tdf33341_copy_sheet_with_print_range(self): + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:F20"})) + #Set print range + self.xUITest.executeCommand(".uno:DefinePrintArea") + # Print Range dialog + with self.ui_test.execute_modeless_dialog_through_command(".uno:EditPrintArea") as xDialog: + 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 + + #Copy sheet + with self.ui_test.execute_dialog_through_command(".uno:Move"): + pass + #Verify Print Range dialog on new sheet + with self.ui_test.execute_modeless_dialog_through_command(".uno:EditPrintArea") as xDialog: + 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") + + +# 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 0000000000..a9e34c6734 --- /dev/null +++ b/sc/qa/uitest/calc_tests/rows.py @@ -0,0 +1,194 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import change_measurement_unit +from libreoffice.uno.propertyvalue import mkPropertyValues + +class CalcRows(UITestCase): + def test_row_height(self): + with self.ui_test.create_doc_in_start_center("calc"): + + with change_measurement_unit(self, "Centimeter"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + #select A1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #row height + with self.ui_test.execute_dialog_through_command(".uno:RowHeight") as xDialog: + xvalue = xDialog.getChild("value") + xdefault = xDialog.getChild("default") + self.assertEqual(get_state_as_dict(xdefault)["Selected"], "true") #default selected + + # tdf#144247: Without the fix in place, this test would have failed with + # AssertionError: '0.45 cm' != '0.4516 cm' + self.assertEqual("0.45 cm", get_state_as_dict(xvalue)["Text"]) + xvalue.executeAction("UP", tuple()) + self.assertEqual("0.50 cm", get_state_as_dict(xvalue)["Text"]) + + self.assertEqual(get_state_as_dict(xdefault)["Selected"], "false") #default not selected + xdefault.executeAction("CLICK", tuple()) #click default + self.assertEqual("0.45 cm", get_state_as_dict(xvalue)["Text"]) + + #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 + #verify + with self.ui_test.execute_dialog_through_command(".uno:RowHeight", close_button="cancel") as xDialog: + xvalue = xDialog.getChild("value") + self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.00 cm") + + + def test_row_height_two_rows(self): + with self.ui_test.create_doc_in_start_center("calc"): + + with change_measurement_unit(self, "Centimeter"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3", "EXTEND":"1"})) + + with self.ui_test.execute_dialog_through_command(".uno:RowHeight") as xDialog: + xvalue = xDialog.getChild("value") + #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 + #verify + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + with self.ui_test.execute_dialog_through_command(".uno:RowHeight") as xDialog: + xvalue = xDialog.getChild("value") + self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.00 cm") + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) + with self.ui_test.execute_dialog_through_command(".uno:RowHeight") as xDialog: + xvalue = xDialog.getChild("value") + self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.00 cm") + + + def test_tdf89140_row_height_copy(self): + #Bug 89140 - Calc row paste doesn't keep row height + with self.ui_test.create_doc_in_start_center("calc"): + + with change_measurement_unit(self, "Centimeter"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + + #select A1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #row height + with self.ui_test.execute_dialog_through_command(".uno:RowHeight") as xDialog: + 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 + #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"})) + with self.ui_test.execute_dialog_through_command(".uno:RowHeight") as xDialog: + xvalue = xDialog.getChild("value") + self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.00 cm") + + + def test_row_hide_show(self): + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #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") + + + def test_row_test_move(self): + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #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") + + + def test_row_height_insert_below(self): + with self.ui_test.create_doc_in_start_center("calc"): + + with change_measurement_unit(self, "Centimeter"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + #select A3 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) + #row height + with self.ui_test.execute_dialog_through_command(".uno:RowHeight") as xDialog: + 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 + #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"})) + with self.ui_test.execute_dialog_through_command(".uno:RowHeight") as xDialog: + xvalue = xDialog.getChild("value") + self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.00 cm") + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A4"})) + with self.ui_test.execute_dialog_through_command(".uno:RowHeight") as xDialog: + xvalue = xDialog.getChild("value") + self.assertEqual(get_state_as_dict(xvalue)["Text"], "1.00 cm") + + +# 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 0000000000..95317a1112 --- /dev/null +++ b/sc/qa/uitest/calc_tests/sheetRename.py @@ -0,0 +1,86 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict +from libreoffice.uno.propertyvalue import mkPropertyValues + +class sheetRename(UITestCase): + def test_sheet_rename(self): + with self.ui_test.create_doc_in_start_center("calc"): + with self.ui_test.execute_dialog_through_command(".uno:RenameTable") as xDialog: + xname_entry = xDialog.getChild("name_entry") + xname_entry.executeAction("TYPE", mkPropertyValues({"TEXT":"NewName"})) + #Verify + with self.ui_test.execute_dialog_through_command(".uno:RenameTable", close_button="cancel") as xDialog: + xname_entry = xDialog.getChild("name_entry") + self.assertEqual(get_state_as_dict(xname_entry)["Text"], "NewName") + + + def test_sheet_rename_invalid_sheet_name(self): + with self.ui_test.create_doc_in_start_center("calc"): + with self.ui_test.execute_dialog_through_command(".uno:RenameTable", close_button="") as xDialog: + 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") + + with self.ui_test.execute_blocking_action(xOKBtn.executeAction, args=('CLICK', ())): + pass + + xCancelBtn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + + #Verify + with self.ui_test.execute_dialog_through_command(".uno:RenameTable") as xDialog: + xname_entry = xDialog.getChild("name_entry") + self.assertEqual(get_state_as_dict(xname_entry)["Text"], nameVal) + + +# 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/tdf133855.py b/sc/qa/uitest/calc_tests/tdf133855.py new file mode 100644 index 0000000000..1db7b2eee0 --- /dev/null +++ b/sc/qa/uitest/calc_tests/tdf133855.py @@ -0,0 +1,49 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_url_for_data_file + +class tdf133855(UITestCase): + + def test_tdf133855(self): + + with self.ui_test.load_file(get_url_for_data_file("tdf133855.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + + results = ['A', 'B', 'C', 'D', 'E', 'F'] + + # Conditional formatted dropdown list + for i in range(len(results)): + gridwin = xCalcDoc.getChild("grid_window") + gridwin.executeAction("LAUNCH", mkPropertyValues({"SELECTMENU": "", "COL": "6", "ROW": "5"})) + + #Select the TreeList UI Object + xWin = self.xUITest.getTopFocusWindow() + xlist = xWin.getChild("list") + + xListItem = xlist.getChild( str(i) ) + xListItem.executeAction("DOUBLECLICK" , mkPropertyValues({}) ) + self.assertEqual(get_cell_by_position(calc_doc, 0, 6, 5).getString(), results[i]) + + # normal dropdown list + for i in range(len(results)): + gridwin = xCalcDoc.getChild("grid_window") + gridwin.executeAction("LAUNCH", mkPropertyValues({"SELECTMENU": "", "COL": "6", "ROW": "6"})) + + #Select the TreeList UI Object + xWin = self.xUITest.getTopFocusWindow() + xlist = xWin.getChild("list") + + xListItem = xlist.getChild( str(i) ) + xListItem.executeAction("DOUBLECLICK" , mkPropertyValues({}) ) + self.assertEqual(get_cell_by_position(calc_doc, 0, 6, 6).getString(), results[i]) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests/tdf153622.py b/sc/qa/uitest/calc_tests/tdf153622.py new file mode 100644 index 0000000000..547ab58e59 --- /dev/null +++ b/sc/qa/uitest/calc_tests/tdf153622.py @@ -0,0 +1,56 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_url_for_data_file + +class tdf153622(UITestCase): + + def test_tdf153622(self): + + with self.ui_test.load_file(get_url_for_data_file("tdf153622.xlsx")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + + A1DropDown = ['apple', 'banana'] + for i in range(len(A1DropDown)): + gridwin = xCalcDoc.getChild("grid_window") + + # Without the fix in place, this test would have crashed here + gridwin.executeAction("LAUNCH", mkPropertyValues({"SELECTMENU": "", "COL": "0", "ROW": "1"})) + + #Select the TreeList UI Object + xWin = self.xUITest.getTopFocusWindow() + xlist = xWin.getChild("list") + + xListItem = xlist.getChild( str(i) ) + xListItem.executeAction("DOUBLECLICK" , mkPropertyValues({}) ) + + # tdf#151794: Without the fix in place, this test would have failed with + # AssertionError: '' != 'apple' + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 1).getString(), A1DropDown[i]) + + A2DropDown = ['', 'apple', 'banana'] + for i in range(len(A2DropDown)): + gridwin = xCalcDoc.getChild("grid_window") + + gridwin.executeAction("LAUNCH", mkPropertyValues({"SELECTMENU": "", "COL": "0", "ROW": "2"})) + + #Select the TreeList UI Object + xWin = self.xUITest.getTopFocusWindow() + xlist = xWin.getChild("list") + + xListItem = xlist.getChild( str(i) ) + xListItem.executeAction("DOUBLECLICK" , mkPropertyValues({}) ) + + # tdf#79571: Without the fix in place, this test would have failed with + # AssertionError: 'banana' != '' + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 2).getString(), A2DropDown[i]) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests/zoom.py b/sc/qa/uitest/calc_tests/zoom.py new file mode 100644 index 0000000000..b1cbe021c1 --- /dev/null +++ b/sc/qa/uitest/calc_tests/zoom.py @@ -0,0 +1,58 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict +#uitest sc / View-Zoom + +class calcZoom(UITestCase): + def test_zoom_calc(self): + with self.ui_test.create_doc_in_start_center("calc"): + MainWindow = self.xUITest.getTopFocusWindow() + gridwin = MainWindow.getChild("grid_window") + gridwin.executeAction("SELECT", mkPropertyValues({"TABLE": "0"})) + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + + #Set the Zoom to be 100% + gridwin.executeAction("SET", mkPropertyValues({"ZOOM": "100"})) + self.assertEqual(get_state_as_dict(gridwin)["Zoom"], "100") + + #dialog View-Zoom-Zoom + with self.ui_test.execute_dialog_through_command(".uno:Zoom") as xDialog: + + #select fit weight & height - OK - open and verify + fitwandh = xDialog.getChild("fitwandh") + fitwandh.executeAction("CLICK",tuple()) + + with self.ui_test.execute_dialog_through_command(".uno:Zoom") as xDialog: + #select fit weight - OK - open and verify + fitw = xDialog.getChild("fitw") + fitw.executeAction("CLICK",tuple()) + + with self.ui_test.execute_dialog_through_command(".uno:Zoom") as xDialog: + #select 100% & Automatic - OK - open and verify + x100pc = xDialog.getChild("100pc") + x100pc.executeAction("CLICK", tuple()) + self.assertEqual(get_state_as_dict(gridwin)["Zoom"], "100") + + #Set the Zoom to be 103% + gridwin.executeAction("SET", mkPropertyValues({"ZOOM": "103"})) + self.assertEqual(get_state_as_dict(gridwin)["Zoom"], "103") + + with self.ui_test.execute_dialog_through_command(".uno:Zoom") as xDialog: + #select variable option and make zoom 100% again - OK - open and verify + zoomsb = xDialog.getChild("zoomsb") + self.assertEqual(get_state_as_dict(zoomsb)["Text"], "103%") + zoomsb.executeAction("DOWN",tuple()) + zoomsb.executeAction("DOWN",tuple()) + zoomsb.executeAction("DOWN",tuple()) + self.assertEqual(get_state_as_dict(gridwin)["Zoom"], "100") + + +# 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 0000000000..19da793c08 --- /dev/null +++ b/sc/qa/uitest/calc_tests2/consolidate.py @@ -0,0 +1,106 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file +from uitest.uihelper.common import select_by_text +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + +class consolidate(UITestCase): + def test_consolidate(self): + with self.ui_test.load_file(get_url_for_data_file("consolidate.ods")) as calc_doc: + with self.ui_test.execute_modeless_dialog_through_command(".uno:DataConsolidate") as xDialog: + xfunc = xDialog.getChild("func") + xlbdataarea = xDialog.getChild("lbdataarea") + xadd = xDialog.getChild("add") + xbyrow = xDialog.getChild("byrow") + xbycol = xDialog.getChild("bycol") + xeddestarea = xDialog.getChild("eddestarea") + + select_by_text(xfunc, "Sum") + + select_by_text(xlbdataarea, "range1") + xadd.executeAction("CLICK", tuple()) + select_by_text(xlbdataarea, "range2") + xadd.executeAction("CLICK", tuple()) + propsC = {"TEXT": "range3"} + actionPropsC = mkPropertyValues(propsC) + xlbdataarea.executeAction("SELECT", actionPropsC) + xadd.executeAction("CLICK", tuple()) + xbyrow.executeAction("CLICK", tuple()) + xbycol.executeAction("CLICK", tuple()) + xeddestarea.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xeddestarea.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xeddestarea.executeAction("TYPE", mkPropertyValues({"TEXT":"$Total.$A$2"})) + + #verify + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 2).getValue(), 300) + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 3).getValue(), 303) + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 4).getValue(), 306) + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 5).getValue(), 309) + + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 2).getValue(), 303) + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 3).getValue(), 306) + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 4).getValue(), 309) + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 5).getValue(), 312) + + self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 2).getValue(), 306) + self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 3).getValue(), 309) + self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 4).getValue(), 312) + self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 5).getValue(), 315) + + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 2).getValue(), 309) + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 3).getValue(), 312) + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 4).getValue(), 315) + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 5).getValue(), 318) + #verify dialog + with self.ui_test.execute_modeless_dialog_through_command(".uno:DataConsolidate") as xDialog: + xfunc = xDialog.getChild("func") + xlbdataarea = xDialog.getChild("lbdataarea") + xdelete = xDialog.getChild("delete") + xbyrow = xDialog.getChild("byrow") + xbycol = xDialog.getChild("bycol") + xeddestarea = xDialog.getChild("eddestarea") + xconsareas = xDialog.getChild("consareas") + self.assertEqual(get_state_as_dict(xfunc)["SelectEntryText"], "Sum") + self.assertEqual(get_state_as_dict(xconsareas)["Children"], "3") + self.assertEqual(get_state_as_dict(xeddestarea)["Text"], "$Total.$A$2") + self.assertEqual(get_state_as_dict(xbyrow)["Selected"], "true") + self.assertEqual(get_state_as_dict(xbycol)["Selected"], "true") + #delete first range + xFirstEntry = xconsareas.getChild("0") + xFirstEntry.executeAction("SELECT", tuple()) + xdelete.executeAction("CLICK", tuple()) + self.assertEqual(get_state_as_dict(xconsareas)["Children"], "2") + + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 2).getValue(), 200) + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 3).getValue(), 202) + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 4).getValue(), 204) + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 5).getValue(), 206) + + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 2).getValue(), 202) + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 3).getValue(), 204) + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 4).getValue(), 206) + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 5).getValue(), 208) + + self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 2).getValue(), 204) + self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 3).getValue(), 206) + self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 4).getValue(), 208) + self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 5).getValue(), 210) + + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 2).getValue(), 206) + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 3).getValue(), 208) + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 4).getValue(), 210) + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 5).getValue(), 212) + + # test cancel button + with self.ui_test.execute_modeless_dialog_through_command(".uno:DataConsolidate", close_button="cancel"): + pass + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests2/dataform.py b/sc/qa/uitest/calc_tests2/dataform.py new file mode 100644 index 0000000000..a42d3d342e --- /dev/null +++ b/sc/qa/uitest/calc_tests2/dataform.py @@ -0,0 +1,24 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues + +class dataform(UITestCase): + def test_dataform(self): + with self.ui_test.create_doc_in_start_center("calc"): + + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A10"})) + + with self.ui_test.execute_dialog_through_command(".uno:DataForm", close_button="close"): + pass + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests2/standardFilter.py b/sc/qa/uitest/calc_tests2/standardFilter.py new file mode 100644 index 0000000000..76d89a3cd3 --- /dev/null +++ b/sc/qa/uitest/calc_tests2/standardFilter.py @@ -0,0 +1,604 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file +from uitest.uihelper.common import select_by_text +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + +#Bug 113979 - Paste unformatted text does not ignore empty cells + +class standardFilter(UITestCase): + def test_standard_filter(self): + with self.ui_test.load_file(get_url_for_data_file("standardFilter.ods")): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C8"})) + + with self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xconnect2 = xDialog.getChild("connect2") + xfield2 = xDialog.getChild("field2") + xval2 = xDialog.getChild("val2") + + select_by_text(xfield1, "a") + xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) + select_by_text(xconnect2, "OR") + select_by_text(xfield2, "b") + xval2.executeAction("TYPE", mkPropertyValues({"TEXT":"3"})) + #3x down - should be on row 9 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "8") + #reopen filter and verify + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + with self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xconnect2 = xDialog.getChild("connect2") + xfield2 = xDialog.getChild("field2") + xval2 = xDialog.getChild("val2") + + self.assertEqual(get_state_as_dict(xfield1)["SelectEntryText"], "a") + self.assertEqual(get_state_as_dict(xfield2)["SelectEntryText"], "b") + self.assertEqual(get_state_as_dict(xconnect2)["SelectEntryText"], "OR") + self.assertEqual(get_state_as_dict(xval1)["Text"], "1") + self.assertEqual(get_state_as_dict(xval2)["Text"], "3") + + def test_standard_filter_copy_result(self): + with self.ui_test.load_file(get_url_for_data_file("standardFilter.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C8"})) + + with self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xconnect2 = xDialog.getChild("connect2") + xfield2 = xDialog.getChild("field2") + xval2 = xDialog.getChild("val2") + xcopyresult = xDialog.getChild("copyresult") + xedcopyarea = xDialog.getChild("edcopyarea") + select_by_text(xfield1, "a") + xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) + select_by_text(xconnect2, "OR") + select_by_text(xfield2, "b") + xval2.executeAction("TYPE", mkPropertyValues({"TEXT":"3"})) + xcopyresult.executeAction("CLICK", tuple()) + xedcopyarea.executeAction("TYPE", mkPropertyValues({"TEXT":"F1"})) + #verify + self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 0).getString(), "a") + self.assertEqual(get_cell_by_position(calc_doc, 0, 6, 0).getString(), "b") + self.assertEqual(get_cell_by_position(calc_doc, 0, 7, 0).getString(), "c") + self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 1).getValue(), 1) + self.assertEqual(get_cell_by_position(calc_doc, 0, 6, 1).getValue(), 2) + self.assertEqual(get_cell_by_position(calc_doc, 0, 7, 1).getValue(), 3) + self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 2).getValue(), 2) + self.assertEqual(get_cell_by_position(calc_doc, 0, 6, 2).getValue(), 3) + self.assertEqual(get_cell_by_position(calc_doc, 0, 7, 2).getValue(), 4) + + def test_standard_filter_copy_result_next_sheet(self): + with self.ui_test.load_file(get_url_for_data_file("standardFilter.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C8"})) + + with self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xconnect2 = xDialog.getChild("connect2") + xfield2 = xDialog.getChild("field2") + xval2 = xDialog.getChild("val2") + xcopyresult = xDialog.getChild("copyresult") + xedcopyarea = xDialog.getChild("edcopyarea") + select_by_text(xfield1, "a") + xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) + select_by_text(xconnect2, "OR") + select_by_text(xfield2, "b") + xval2.executeAction("TYPE", mkPropertyValues({"TEXT":"3"})) + xcopyresult.executeAction("CLICK", tuple()) + xedcopyarea.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet2.$F$1"})) + #verify + self.assertEqual(get_cell_by_position(calc_doc, 1, 5, 0).getString(), "a") + self.assertEqual(get_cell_by_position(calc_doc, 1, 6, 0).getString(), "b") + self.assertEqual(get_cell_by_position(calc_doc, 1, 7, 0).getString(), "c") + self.assertEqual(get_cell_by_position(calc_doc, 1, 5, 1).getValue(), 1) + self.assertEqual(get_cell_by_position(calc_doc, 1, 6, 1).getValue(), 2) + self.assertEqual(get_cell_by_position(calc_doc, 1, 7, 1).getValue(), 3) + self.assertEqual(get_cell_by_position(calc_doc, 1, 5, 2).getValue(), 2) + self.assertEqual(get_cell_by_position(calc_doc, 1, 6, 2).getValue(), 3) + self.assertEqual(get_cell_by_position(calc_doc, 1, 7, 2).getValue(), 4) + + def test_standard_filter_case_sensitive(self): + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + enter_text_to_cell(gridwin, "A1", "first") + enter_text_to_cell(gridwin, "B1", "second") + enter_text_to_cell(gridwin, "A2", "a1") + enter_text_to_cell(gridwin, "A3", "A1") + enter_text_to_cell(gridwin, "A4", "A1") + enter_text_to_cell(gridwin, "B2", "4") + enter_text_to_cell(gridwin, "B3", "5") + enter_text_to_cell(gridwin, "B4", "6") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B4"})) + with self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xcase = xDialog.getChild("case") + + select_by_text(xfield1, "first") + xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"a1"})) + xcase.executeAction("CLICK", tuple()) + #2x down - should be on row 5 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "4") + #reopen filter and verify + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + with self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xcase = xDialog.getChild("case") + + self.assertEqual(get_state_as_dict(xfield1)["SelectEntryText"], "first") + self.assertEqual(get_state_as_dict(xval1)["Text"], "a1") + self.assertEqual(get_state_as_dict(xcase)["Selected"], "true") + + def test_standard_filter_regular_expression(self): + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + enter_text_to_cell(gridwin, "A1", "first") + enter_text_to_cell(gridwin, "B1", "second") + enter_text_to_cell(gridwin, "A2", "aa") + enter_text_to_cell(gridwin, "A3", "aaa") + enter_text_to_cell(gridwin, "A4", "abbb") + enter_text_to_cell(gridwin, "A5", "accc") + enter_text_to_cell(gridwin, "A6", "a*") + enter_text_to_cell(gridwin, "B2", "1") + enter_text_to_cell(gridwin, "B3", "2") + enter_text_to_cell(gridwin, "B4", "3") + enter_text_to_cell(gridwin, "B5", "4") + enter_text_to_cell(gridwin, "B6", "5") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B6"})) + with self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xregexp = xDialog.getChild("regexp") + + select_by_text(xfield1, "first") + xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"a*"})) + xregexp.executeAction("CLICK", tuple()) + #3x down - should be on row 7 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "6") + #reopen filter and verify + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + with self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xregexp = xDialog.getChild("regexp") + + self.assertEqual(get_state_as_dict(xfield1)["SelectEntryText"], "first") + self.assertEqual(get_state_as_dict(xval1)["Text"], "a*") + self.assertEqual(get_state_as_dict(xregexp)["Selected"], "true") + + def test_standard_filter_condition_contains(self): + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + enter_text_to_cell(gridwin, "A1", "first") + enter_text_to_cell(gridwin, "B1", "second") + enter_text_to_cell(gridwin, "A2", "aa") + enter_text_to_cell(gridwin, "A3", "aaa") + enter_text_to_cell(gridwin, "A4", "abbb") + enter_text_to_cell(gridwin, "A5", "accc") + enter_text_to_cell(gridwin, "A6", "a*") + enter_text_to_cell(gridwin, "B2", "1") + enter_text_to_cell(gridwin, "B3", "2") + enter_text_to_cell(gridwin, "B4", "3") + enter_text_to_cell(gridwin, "B5", "4") + enter_text_to_cell(gridwin, "B6", "5") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B6"})) + with self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xregexp = xDialog.getChild("regexp") + + select_by_text(xfield1, "first") + xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"a*"})) + xregexp.executeAction("CLICK", tuple()) + #3x down - should be on row 7 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "6") + #reopen filter and verify + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + with self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xregexp = xDialog.getChild("regexp") + + self.assertEqual(get_state_as_dict(xfield1)["SelectEntryText"], "first") + self.assertEqual(get_state_as_dict(xval1)["Text"], "a*") + self.assertEqual(get_state_as_dict(xregexp)["Selected"], "true") + + #from testcasespecification OOo + def test_standard_filter_condition_contains2(self): + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + enter_text_to_cell(gridwin, "A1", "A") + enter_text_to_cell(gridwin, "B1", "B") + enter_text_to_cell(gridwin, "C1", "C") + enter_text_to_cell(gridwin, "D1", "D") + enter_text_to_cell(gridwin, "A2", "economics") + enter_text_to_cell(gridwin, "B2", "34") + enter_text_to_cell(gridwin, "C2", "67") + enter_text_to_cell(gridwin, "D2", "122") + enter_text_to_cell(gridwin, "A3", "socioeconomic") + enter_text_to_cell(gridwin, "B3", "45") + enter_text_to_cell(gridwin, "C3", "77") + enter_text_to_cell(gridwin, "D3", "333") + enter_text_to_cell(gridwin, "A4", "sociology") + enter_text_to_cell(gridwin, "B4", "78") + enter_text_to_cell(gridwin, "C4", "89") + enter_text_to_cell(gridwin, "D4", "56") + enter_text_to_cell(gridwin, "A5", "humanities") + enter_text_to_cell(gridwin, "B5", "45") + enter_text_to_cell(gridwin, "C5", "67") + enter_text_to_cell(gridwin, "D5", "89") + #Select + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:D5"})) + #Choose DATA-FILTER-STANDARDFILTER + #Choose field name "A"/ Choose condition "Contains"/Enter value "cio"/Press OK button + with self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xcond1 = xDialog.getChild("cond1") + + select_by_text(xfield1, "A") + select_by_text(xcond1, "Contains") + xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"cio"})) + + #Verify that row 1,3, 4 are visible (2 and 5 are hidden) + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "2") + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "3") + #reopen filter and verify + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + with self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter", close_button="cancel") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xcond1 = xDialog.getChild("cond1") + self.assertEqual(get_state_as_dict(xfield1)["SelectEntryText"], "A") + self.assertEqual(get_state_as_dict(xval1)["Text"], "cio") + self.assertEqual(get_state_as_dict(xcond1)["SelectEntryText"], "Contains") + + def test_standard_filter_condition_does_not_contains(self): + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + enter_text_to_cell(gridwin, "A1", "A") + enter_text_to_cell(gridwin, "B1", "B") + enter_text_to_cell(gridwin, "C1", "C") + enter_text_to_cell(gridwin, "D1", "D") + enter_text_to_cell(gridwin, "A2", "economics") + enter_text_to_cell(gridwin, "B2", "34") + enter_text_to_cell(gridwin, "C2", "67") + enter_text_to_cell(gridwin, "D2", "122") + enter_text_to_cell(gridwin, "A3", "socioeconomic") + enter_text_to_cell(gridwin, "B3", "45") + enter_text_to_cell(gridwin, "C3", "77") + enter_text_to_cell(gridwin, "D3", "333") + enter_text_to_cell(gridwin, "A4", "sociology") + enter_text_to_cell(gridwin, "B4", "78") + enter_text_to_cell(gridwin, "C4", "89") + enter_text_to_cell(gridwin, "D4", "56") + enter_text_to_cell(gridwin, "A5", "humanities") + enter_text_to_cell(gridwin, "B5", "45") + enter_text_to_cell(gridwin, "C5", "67") + enter_text_to_cell(gridwin, "D5", "89") + #Select + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:D5"})) + #Choose DATA-FILTER-STANDARDFILTER + #Choose field name "A"/ Choose condition "Does not contain"/Enter value "cio"/Press OK button + with self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xcond1 = xDialog.getChild("cond1") + + select_by_text(xfield1, "A") + select_by_text(xcond1, "Does not contain") + xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"cio"})) + + #Verify that row 1,2, 5 are visible (3 and 4 are hidden) + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "1") + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "4") + #reopen filter and verify + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + with self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter", close_button="cancel") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xcond1 = xDialog.getChild("cond1") + self.assertEqual(get_state_as_dict(xfield1)["SelectEntryText"], "A") + self.assertEqual(get_state_as_dict(xval1)["Text"], "cio") + self.assertEqual(get_state_as_dict(xcond1)["SelectEntryText"], "Does not contain") + + + def test_standard_filter_condition_Begins_with(self): + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + enter_text_to_cell(gridwin, "A1", "A") + enter_text_to_cell(gridwin, "B1", "B") + enter_text_to_cell(gridwin, "C1", "C") + enter_text_to_cell(gridwin, "D1", "D") + enter_text_to_cell(gridwin, "A2", "economics") + enter_text_to_cell(gridwin, "B2", "34") + enter_text_to_cell(gridwin, "C2", "67") + enter_text_to_cell(gridwin, "D2", "122") + enter_text_to_cell(gridwin, "A3", "socioeconomic") + enter_text_to_cell(gridwin, "B3", "45") + enter_text_to_cell(gridwin, "C3", "77") + enter_text_to_cell(gridwin, "D3", "333") + enter_text_to_cell(gridwin, "A4", "sociology") + enter_text_to_cell(gridwin, "B4", "78") + enter_text_to_cell(gridwin, "C4", "89") + enter_text_to_cell(gridwin, "D4", "56") + enter_text_to_cell(gridwin, "A5", "humanities") + enter_text_to_cell(gridwin, "B5", "45") + enter_text_to_cell(gridwin, "C5", "67") + enter_text_to_cell(gridwin, "D5", "89") + #Select + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:D5"})) + #Choose DATA-FILTER-STANDARDFILTER + #Choose field name "A"/ Choose condition "Begins with"/Enter value "si"/Press OK button + with self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xcond1 = xDialog.getChild("cond1") + + select_by_text(xfield1, "A") + select_by_text(xcond1, "Begins with") + xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"so"})) + + #Verify that row 1,3, 4 are visible (2 and 5 are hidden) + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "2") + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "3") + #reopen filter and verify + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + with self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter", close_button="cancel") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xcond1 = xDialog.getChild("cond1") + self.assertEqual(get_state_as_dict(xfield1)["SelectEntryText"], "A") + self.assertEqual(get_state_as_dict(xval1)["Text"], "so") + self.assertEqual(get_state_as_dict(xcond1)["SelectEntryText"], "Begins with") + + + def test_standard_filter_condition_Does_not_begin_with(self): + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + enter_text_to_cell(gridwin, "A1", "A") + enter_text_to_cell(gridwin, "B1", "B") + enter_text_to_cell(gridwin, "C1", "C") + enter_text_to_cell(gridwin, "D1", "D") + enter_text_to_cell(gridwin, "A2", "economics") + enter_text_to_cell(gridwin, "B2", "34") + enter_text_to_cell(gridwin, "C2", "67") + enter_text_to_cell(gridwin, "D2", "122") + enter_text_to_cell(gridwin, "A3", "socioeconomic") + enter_text_to_cell(gridwin, "B3", "45") + enter_text_to_cell(gridwin, "C3", "77") + enter_text_to_cell(gridwin, "D3", "333") + enter_text_to_cell(gridwin, "A4", "sociology") + enter_text_to_cell(gridwin, "B4", "78") + enter_text_to_cell(gridwin, "C4", "89") + enter_text_to_cell(gridwin, "D4", "56") + enter_text_to_cell(gridwin, "A5", "humanities") + enter_text_to_cell(gridwin, "B5", "45") + enter_text_to_cell(gridwin, "C5", "67") + enter_text_to_cell(gridwin, "D5", "89") + #Select + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:D5"})) + #Choose DATA-FILTER-STANDARDFILTER + #Choose field name "A"/ Choose condition "Does not contain"/Enter value "cio"/Press OK button + with self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xcond1 = xDialog.getChild("cond1") + + select_by_text(xfield1, "A") + select_by_text(xcond1, "Does not begin with") + xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"so"})) + + #Verify that row 1,2, 5 are visible (3 and 4 are hidden) + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "1") + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "4") + #reopen filter and verify + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + with self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter", close_button="cancel") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xcond1 = xDialog.getChild("cond1") + self.assertEqual(get_state_as_dict(xfield1)["SelectEntryText"], "A") + self.assertEqual(get_state_as_dict(xval1)["Text"], "so") + self.assertEqual(get_state_as_dict(xcond1)["SelectEntryText"], "Does not begin with") + + + def test_standard_filter_condition_Ends_with(self): + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + enter_text_to_cell(gridwin, "A1", "A") + enter_text_to_cell(gridwin, "B1", "B") + enter_text_to_cell(gridwin, "C1", "C") + enter_text_to_cell(gridwin, "D1", "D") + enter_text_to_cell(gridwin, "A2", "economics") + enter_text_to_cell(gridwin, "B2", "34") + enter_text_to_cell(gridwin, "C2", "67") + enter_text_to_cell(gridwin, "D2", "122") + enter_text_to_cell(gridwin, "A3", "socioeconomic") + enter_text_to_cell(gridwin, "B3", "45") + enter_text_to_cell(gridwin, "C3", "77") + enter_text_to_cell(gridwin, "D3", "333") + enter_text_to_cell(gridwin, "A4", "sociology") + enter_text_to_cell(gridwin, "B4", "78") + enter_text_to_cell(gridwin, "C4", "89") + enter_text_to_cell(gridwin, "D4", "56") + enter_text_to_cell(gridwin, "A5", "humanities") + enter_text_to_cell(gridwin, "B5", "45") + enter_text_to_cell(gridwin, "C5", "67") + enter_text_to_cell(gridwin, "D5", "89") + #Select + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:D5"})) + #Choose DATA-FILTER-STANDARDFILTER + #Choose field name "A"/ Choose condition "Does not contain"/Enter value "cio"/Press OK button + with self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xcond1 = xDialog.getChild("cond1") + + select_by_text(xfield1, "A") + select_by_text(xcond1, "Ends with") + xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"s"})) + + #Verify that row 1,2, 5 are visible (3 and 4 are hidden) + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "1") + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "4") + #reopen filter and verify + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + with self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter", close_button="cancel") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xcond1 = xDialog.getChild("cond1") + self.assertEqual(get_state_as_dict(xfield1)["SelectEntryText"], "A") + self.assertEqual(get_state_as_dict(xval1)["Text"], "s") + self.assertEqual(get_state_as_dict(xcond1)["SelectEntryText"], "Ends with") + + + def test_standard_filter_condition_Does_not_end_with(self): + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + enter_text_to_cell(gridwin, "A1", "A") + enter_text_to_cell(gridwin, "B1", "B") + enter_text_to_cell(gridwin, "C1", "C") + enter_text_to_cell(gridwin, "D1", "D") + enter_text_to_cell(gridwin, "A2", "economics") + enter_text_to_cell(gridwin, "B2", "34") + enter_text_to_cell(gridwin, "C2", "67") + enter_text_to_cell(gridwin, "D2", "122") + enter_text_to_cell(gridwin, "A3", "socioeconomic") + enter_text_to_cell(gridwin, "B3", "45") + enter_text_to_cell(gridwin, "C3", "77") + enter_text_to_cell(gridwin, "D3", "333") + enter_text_to_cell(gridwin, "A4", "sociology") + enter_text_to_cell(gridwin, "B4", "78") + enter_text_to_cell(gridwin, "C4", "89") + enter_text_to_cell(gridwin, "D4", "56") + enter_text_to_cell(gridwin, "A5", "humanities") + enter_text_to_cell(gridwin, "B5", "45") + enter_text_to_cell(gridwin, "C5", "67") + enter_text_to_cell(gridwin, "D5", "89") + #Select + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:D5"})) + #Choose DATA-FILTER-STANDARDFILTER + #Choose field name "A"/ Choose condition "Begins with"/Enter value "si"/Press OK button + with self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xcond1 = xDialog.getChild("cond1") + + select_by_text(xfield1, "A") + select_by_text(xcond1, "Does not end with") + xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"s"})) + + #Verify that row 1,3, 4 are visible (2 and 5 are hidden) + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "2") + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + gridWinState = get_state_as_dict(gridwin) + self.assertEqual(gridWinState["CurrentRow"], "3") + #reopen filter and verify + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + with self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter", close_button="cancel") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xcond1 = xDialog.getChild("cond1") + self.assertEqual(get_state_as_dict(xfield1)["SelectEntryText"], "A") + self.assertEqual(get_state_as_dict(xval1)["Text"], "s") + self.assertEqual(get_state_as_dict(xcond1)["SelectEntryText"], "Does not end with") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests2/tdf104117.py b/sc/qa/uitest/calc_tests2/tdf104117.py new file mode 100644 index 0000000000..8287be14e6 --- /dev/null +++ b/sc/qa/uitest/calc_tests2/tdf104117.py @@ -0,0 +1,39 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import select_by_text +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + +#Bug 104117 - Crash in Calc when selecting "Uniform Integer" with an max value "100000000000000" in "Random Number Generator +class tdf104117(UITestCase): + def test_tdf104117(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"})) + with self.ui_test.execute_modeless_dialog_through_command(".uno:RandomNumberGeneratorDialog") as xDialog: + xcellrangeedit = xDialog.getChild("cell-range-edit") + xdistributioncombo = xDialog.getChild("distribution-combo") + xparameter2spin = xDialog.getChild("parameter2-spin") + + xcellrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$A$2"})) + select_by_text(xdistributioncombo, "Uniform Integer") + xparameter2spin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xparameter2spin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xparameter2spin.executeAction("TYPE", mkPropertyValues({"TEXT":"1000000000000000000000000000000000000000000000"})) + + #Verify + self.assertEqual(bool(get_cell_by_position(document, 0, 0, 0).getString() ), True) + self.assertEqual(bool(get_cell_by_position(document, 0, 0, 1).getString() ), True) + #undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(bool(get_cell_by_position(document, 0, 0, 0).getString() ), False) + self.assertEqual(bool(get_cell_by_position(document, 0, 0, 1).getString() ), False) +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests2/tdf114992.py b/sc/qa/uitest/calc_tests2/tdf114992.py new file mode 100644 index 0000000000..6f1b888d61 --- /dev/null +++ b/sc/qa/uitest/calc_tests2/tdf114992.py @@ -0,0 +1,23 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_url_for_data_file + +#Bug: Delete a sheet in a calc document and LO crashes + +class tdf114992(UITestCase): + def test_tdf114992_delete_sheet_crash(self): + with self.ui_test.load_file(get_url_for_data_file("tdf114992.ods")) as calc_doc: + self.xUITest.executeCommand(".uno:Remove") + + self.assertEqual(calc_doc.Sheets.getCount(), 1) + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(calc_doc.Sheets.getCount(), 2) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests2/tdf117367.py b/sc/qa/uitest/calc_tests2/tdf117367.py new file mode 100644 index 0000000000..382873a3cc --- /dev/null +++ b/sc/qa/uitest/calc_tests2/tdf117367.py @@ -0,0 +1,49 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.uno.propertyvalue import mkPropertyValues +#Bug 117367 - FORMATTING Merge cells dialog radio buttons cannot be unselected + +class tdf117367(UITestCase): + def test_tdf117367_merge_cells_radio_buttons(self): + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + enter_text_to_cell(gridwin, "A1", "AAA") + enter_text_to_cell(gridwin, "A2", "BBB") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B4"})) + + #Right-click - Merge cells /Select all three options + with self.ui_test.execute_dialog_through_command(".uno:MergeCells") as xDialog: + xmoveCellsRadio = xDialog.getChild("move-cells-radio") + xemptyCellsRadio = xDialog.getChild("empty-cells-radio") + xkeepContentRadio = xDialog.getChild("keep-content-radio") + xmoveCellsRadio.executeAction("CLICK", tuple()) + xmoveCellsRadio.executeAction("CLICK", tuple()) + #Issue: I think these should be exclusive, not possible to select more than one. It is also impossible to uncheck any of the buttons. + self.assertEqual(get_state_as_dict(xmoveCellsRadio)["Checked"], "true") + self.assertEqual(get_state_as_dict(xemptyCellsRadio)["Checked"], "false") + self.assertEqual(get_state_as_dict(xkeepContentRadio)["Checked"], "false") + + xemptyCellsRadio.executeAction("CLICK", tuple()) + self.assertEqual(get_state_as_dict(xmoveCellsRadio)["Checked"], "false") + self.assertEqual(get_state_as_dict(xemptyCellsRadio)["Checked"], "true") + self.assertEqual(get_state_as_dict(xkeepContentRadio)["Checked"], "false") + + xkeepContentRadio.executeAction("CLICK", tuple()) + self.assertEqual(get_state_as_dict(xmoveCellsRadio)["Checked"], "false") + self.assertEqual(get_state_as_dict(xemptyCellsRadio)["Checked"], "false") + self.assertEqual(get_state_as_dict(xkeepContentRadio)["Checked"], "true") + + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests2/tdf120174.py b/sc/qa/uitest/calc_tests2/tdf120174.py new file mode 100644 index 0000000000..31a9f61674 --- /dev/null +++ b/sc/qa/uitest/calc_tests2/tdf120174.py @@ -0,0 +1,30 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.calc import enter_text_to_cell + +class tdf120174(UITestCase): + def test_tdf120174(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + enter_text_to_cell(gridwin, "A1", "121") + enter_text_to_cell(gridwin, "B1", "=A1") + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getValue(), 121) # B1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + # Delete contents of A1 + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DELETE"})) + # Before the fix the result would be still 121. + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getValue(), 0) # B1 + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getValue(), 121) # B1 + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests2/tdf127113.py b/sc/qa/uitest/calc_tests2/tdf127113.py new file mode 100644 index 0000000000..daab2f5212 --- /dev/null +++ b/sc/qa/uitest/calc_tests2/tdf127113.py @@ -0,0 +1,58 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + +class tdf127113(UITestCase): + + def launch_dialog(self, direction): + with self.ui_test.execute_dialog_through_command(".uno:FillSeries") as xDialog: + xDirection = xDialog.getChild(direction) + xDirection.executeAction("CLICK", tuple()) + + xStart = xDialog.getChild("startValue") + xStart.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) + self.assertEqual("1", get_state_as_dict(xStart)["Text"]) + + xEnd = xDialog.getChild("endValue") + xEnd.executeAction("TYPE", mkPropertyValues({"TEXT":"5"})) + self.assertEqual("5", get_state_as_dict(xEnd)["Text"]) + + # Without the fix in place, this test would have failed because the increment child + # couldn't be empty and a warning dialog would be displayed + xIncrement = xDialog.getChild("increment") + xIncrement.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xIncrement.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + self.assertEqual("", get_state_as_dict(xIncrement)["Text"]) + + def test_tdf127113(self): + with self.ui_test.create_doc_in_start_center("calc") as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A9"})) + + self.launch_dialog("down") + + value = 1.0 + for i in range(9): + self.assertEqual(value, get_cell_by_position(calc_doc, 0, 0, i).getValue()) + value += 0.5 + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "B1:B9"})) + + self.launch_dialog("up") + + for i in range(9): + value -= 0.5 + self.assertEqual(value, get_cell_by_position(calc_doc, 0, 1, i).getValue()) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests2/tdf46138.py b/sc/qa/uitest/calc_tests2/tdf46138.py new file mode 100644 index 0000000000..1a07bf9169 --- /dev/null +++ b/sc/qa/uitest/calc_tests2/tdf46138.py @@ -0,0 +1,31 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +#Bug 46138 - Calc Frozen after "undo" "Filling Series Number in a Column" + +class tdf46138(UITestCase): + def test_tdf46138(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #Choose a column, + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + self.xUITest.executeCommand(".uno:SelectColumn") + #select 'edit'>'fill'>'series'>Starting Value '1' then "OK", + with self.ui_test.execute_dialog_through_command(".uno:FillSeries") as xDialog: + xStart = xDialog.getChild("startValue") + xStart.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "1") + #then "Ctrl+Z"/ undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests2/xmlSource.py b/sc/qa/uitest/calc_tests2/xmlSource.py new file mode 100644 index 0000000000..26ca9ce2cd --- /dev/null +++ b/sc/qa/uitest/calc_tests2/xmlSource.py @@ -0,0 +1,127 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file +from libreoffice.calc.document import get_cell_by_position + +class xmlSource(UITestCase): + + def test_importXml(self): + + with self.ui_test.create_doc_in_start_center("calc") as calc_doc: + + # Create a new tab + with self.ui_test.execute_dialog_through_command(".uno:Insert") as xDialog: + xAfter = xDialog.getChild('after') + xAfter.executeAction("CLICK", tuple()) + + with self.ui_test.execute_modeless_dialog_through_command(".uno:ManageXMLSource") as xDialog: + + xSource = xDialog.getChild("selectsource") + + with self.ui_test.execute_blocking_action(xSource.executeAction, args=('CLICK', ()), close_button="open") as xOpenDialog: + xFileName = xOpenDialog.getChild("file_name") + xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": get_url_for_data_file("xmlSource.xml")})) + + xTree = xDialog.getChild("tree") + self.assertEqual('13', get_state_as_dict(xTree)["Children"]) + + xTree.getChild('0').executeAction("SELECT", tuple()) + xTree.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + xTree.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + + self.assertEqual("entry", get_state_as_dict(xTree)["SelectEntryText"]) + self.assertEqual("11", get_state_as_dict(xTree)["SelectionCount"]) + + xEdit = xDialog.getChild("edit") + xEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "$A$1"})) + + # tdf#126565: Without the fix in place, this test would have failed with + # AssertionError: '' != 'name' + for i in range(8): + self.assertEqual("", get_cell_by_position(calc_doc, 0, i, 0).getString()) + + # Check the headers + self.assertEqual("name", get_cell_by_position(calc_doc, 1, 0, 0).getString()) + self.assertEqual("translated-address", get_cell_by_position(calc_doc, 1, 1, 0).getString()) + self.assertEqual("to", get_cell_by_position(calc_doc, 1, 2, 0).getString()) + self.assertEqual("from", get_cell_by_position(calc_doc, 1, 3, 0).getString()) + self.assertEqual("source", get_cell_by_position(calc_doc, 1, 4, 0).getString()) + self.assertEqual("destination", get_cell_by_position(calc_doc, 1, 5, 0).getString()) + self.assertEqual("service", get_cell_by_position(calc_doc, 1, 6, 0).getString()) + self.assertEqual("disabled", get_cell_by_position(calc_doc, 1, 7, 0).getString()) + + def test_tdf153604(self): + + with self.ui_test.create_doc_in_start_center("calc") as calc_doc: + + with self.ui_test.execute_modeless_dialog_through_command(".uno:ManageXMLSource") as xDialog: + + xSource = xDialog.getChild("selectsource") + + with self.ui_test.execute_blocking_action(xSource.executeAction, args=('CLICK', ()), close_button="open") as xOpenDialog: + xFileName = xOpenDialog.getChild("file_name") + xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": get_url_for_data_file("tdf153604.xml")})) + + xTree = xDialog.getChild("tree") + self.assertEqual('2', get_state_as_dict(xTree)["Children"]) + + xTree.getChild('0').executeAction("SELECT", tuple()) + xTree.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + + self.assertEqual("data", get_state_as_dict(xTree)["SelectEntryText"]) + + xEdit = xDialog.getChild("edit") + xEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "$A$1"})) + + # Without the fix in place, this test would have failed with + # AssertionError: 'data' != '' + self.assertEqual("data", get_cell_by_position(calc_doc, 0, 0, 0).getString()) + self.assertEqual("v1", get_cell_by_position(calc_doc, 0, 0, 1).getString()) + self.assertEqual("v2", get_cell_by_position(calc_doc, 0, 0, 2).getString()) + self.assertEqual("v3", get_cell_by_position(calc_doc, 0, 0, 3).getString()) + + def test_tdf146260(self): + + with self.ui_test.create_doc_in_start_center("calc") as calc_doc: + + with self.ui_test.execute_modeless_dialog_through_command(".uno:ManageXMLSource") as xDialog: + + xSource = xDialog.getChild("selectsource") + + with self.ui_test.execute_blocking_action(xSource.executeAction, args=('CLICK', ()), close_button="open") as xOpenDialog: + xFileName = xOpenDialog.getChild("file_name") + xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": get_url_for_data_file("tdf146260.xml")})) + + xTree = xDialog.getChild("tree") + self.assertEqual('43', get_state_as_dict(xTree)["Children"]) + + xTree.getChild('0').executeAction("SELECT", tuple()) + for i in range(5): + xTree.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + + self.assertEqual("Fp", get_state_as_dict(xTree)["SelectEntryText"]) + self.assertEqual("38", get_state_as_dict(xTree)["SelectionCount"]) + + xEdit = xDialog.getChild("edit") + xEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "$A$1"})) + + # Without the fix in place, this test would have failed with + # AssertionError: 'data' != '' + self.assertEqual("Djh", get_cell_by_position(calc_doc, 0, 0, 0).getString()) + self.assertEqual("Fpzl", get_cell_by_position(calc_doc, 0, 1, 0).getString()) + + for i in range(1, 5): + # Without the fix in place, this test would have failed with + # AssertionError: '专用å‘票' != 'ר�÷�Ʊ' + self.assertEqual("专用å‘票", get_cell_by_position(calc_doc, 0, 1, i).getString()) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests3/clearCells.py b/sc/qa/uitest/calc_tests3/clearCells.py new file mode 100644 index 0000000000..a94f2c174f --- /dev/null +++ b/sc/qa/uitest/calc_tests3/clearCells.py @@ -0,0 +1,260 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.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 +#deletecontents.ui +#+ Bug 101904 - Delete Contents dialog -- won't delete cell content "Date & time" +class clearCells(UITestCase): + def test_clear_cells_text(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + enter_text_to_cell(gridwin, "A1", "aa") + enter_text_to_cell(gridwin, "A2", "1") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"})) + with self.ui_test.execute_dialog_through_command(".uno:Delete") as xDialog: + 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()) + + #Verify + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString() , "") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue() , 1) + + + def test_clear_cells_date_tdf101904(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + enter_text_to_cell(gridwin, "A1", "01/01/2000") + enter_text_to_cell(gridwin, "A2", "1") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"})) + with self.ui_test.execute_dialog_through_command(".uno:Delete") as xDialog: + 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()) + + #Verify + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString() , "") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue() , 1) + + + def test_clear_cells_number(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + enter_text_to_cell(gridwin, "A1", "aa") + enter_text_to_cell(gridwin, "A2", "1") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"})) + with self.ui_test.execute_dialog_through_command(".uno:Delete") as xDialog: + 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()) + + #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) + + def test_clear_cells_formulas(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + enter_text_to_cell(gridwin, "A1", "1") + enter_text_to_cell(gridwin, "A2", "=A1+1") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"})) + with self.ui_test.execute_dialog_through_command(".uno:Delete") as xDialog: + 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()) + + #Verify + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString() , "1") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString() , "") + + + def test_clear_cells_formats(self): + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + enter_text_to_cell(gridwin, "A1", "aa") + enter_text_to_cell(gridwin, "A2", "1") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"})) + self.xUITest.executeCommand(".uno:Bold") + with self.ui_test.execute_dialog_through_command(".uno:Delete") as xDialog: + 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()) + + #Verify + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + with self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") #tab Font + + xstylelb = xDialog.getChild("cbWestStyle") + self.assertEqual(get_state_as_dict(xstylelb)["Text"], "Regular") + + def test_clear_cells_all(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + enter_text_to_cell(gridwin, "A1", "aa") + enter_text_to_cell(gridwin, "A2", "1") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"})) + self.xUITest.executeCommand(".uno:Bold") + with self.ui_test.execute_dialog_through_command(".uno:Delete") as xDialog: + xdeleteall = xDialog.getChild("deleteall") + + if (get_state_as_dict(xdeleteall)["Selected"]) == "false": + xdeleteall.executeAction("CLICK", tuple()) + + #Verify + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString() , "") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString() , "") + + + def test_cancel_clear_cells_all(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + enter_text_to_cell(gridwin, "A1", "aa") + enter_text_to_cell(gridwin, "A2", "1") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"})) + with self.ui_test.execute_dialog_through_command(".uno:Delete", close_button="cancel") as xDialog: + xdeleteall = xDialog.getChild("deleteall") + + if (get_state_as_dict(xdeleteall)["Selected"]) == "false": + xdeleteall.executeAction("CLICK", tuple()) + + #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") + +# 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 0000000000..a707d9918e --- /dev/null +++ b/sc/qa/uitest/calc_tests3/insertQrCodeGen.py @@ -0,0 +1,35 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from uitest.uihelper.common import type_text + +class insertQrCode(UITestCase): + + def test_insert_qr_code_gen(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + with self.ui_test.execute_dialog_through_command(".uno:InsertQrCode") as xDialog: + + # 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_margin") + + type_text(xURL, "www.libreoffice.org") #set the QR code + xECC_Low.executeAction("CLICK", tuple()) + xBorder.executeAction("UP", tuple()) + xBorder.executeAction("DOWN", tuple()) + + # check the QR code in the document + element = document.Sheets[0].DrawPage[0] + self.assertEqual(element.BarCodeProperties.Payload, "www.libreoffice.org") + self.assertEqual(element.BarCodeProperties.ErrorCorrection, 1) + self.assertEqual(element.BarCodeProperties.Border, 1) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests3/tdf102506.py b/sc/qa/uitest/calc_tests3/tdf102506.py new file mode 100644 index 0000000000..cd2fb8ba0d --- /dev/null +++ b/sc/qa/uitest/calc_tests3/tdf102506.py @@ -0,0 +1,46 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.calc import enter_text_to_cell + +class tdf102506(UITestCase): + + def test_tdf102506(self): + + with self.ui_test.create_doc_in_start_center("calc"): + + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + enter_text_to_cell(gridwin, "A1", "=2+3") + + # Go to a different cell + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C10"})) + + self.xUITest.executeCommand("vnd.sun.star.findbar:FocusToFindbar") + + xfind = xCalcDoc.getChild("find") + xfind.executeAction("TYPE", mkPropertyValues({"TEXT": "5"})) + + self.assertEqual("5", get_state_as_dict(xfind)['Text']) + + xfind_bar = xCalcDoc.getChild("FindBar") + + # Search Next + xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "3"})) + + # Without the fix in place, this test would have failed with + # AssertionError: '0' != '2' + self.assertEqual("0", get_state_as_dict(gridwin)["CurrentColumn"]) + self.assertEqual("0", get_state_as_dict(gridwin)["CurrentRow"]) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests3/tdf139974.py b/sc/qa/uitest/calc_tests3/tdf139974.py new file mode 100644 index 0000000000..c30a05f90c --- /dev/null +++ b/sc/qa/uitest/calc_tests3/tdf139974.py @@ -0,0 +1,49 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_url_for_data_file + + +class tdf139974(UITestCase): + + def test_tdf139974(self): + + with self.ui_test.load_file(get_url_for_data_file("tdf139974.ods")) as document: + + self.assertEqual(1930864179960.0, get_cell_by_position(document, 0, 0, 0).getValue()) + self.assertEqual(17204.0, get_cell_by_position(document, 0, 1, 0).getValue()) + + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"F2"})) + + self.xUITest.executeCommand(".uno:SelectAll") + self.xUITest.executeCommand(".uno:Copy") + + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ESC"})) + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A2"})) + + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"F2"})) + + self.xUITest.executeCommand(".uno:Paste") + + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) + + # Without the fix in place, this test would have failed with + # AssertionError: 17205 != 17204 + self.assertEqual(17205.0, get_cell_by_position(document, 0, 1, 1).getValue()) + + self.assertEqual(1930864179960.0, get_cell_by_position(document, 0, 0, 1).getValue()) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests3/tdf77509.py b/sc/qa/uitest/calc_tests3/tdf77509.py new file mode 100644 index 0000000000..fe263599f1 --- /dev/null +++ b/sc/qa/uitest/calc_tests3/tdf77509.py @@ -0,0 +1,72 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import select_by_text +from uitest.uihelper.common import get_url_for_data_file +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + +class tdf77509(UITestCase): + def test_tdf77509_consolidate(self): + with self.ui_test.load_file(get_url_for_data_file("tdf77509.xls")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #1. Open attachment: Consolidate-test.xls + #2. Select any empty cell, eg. cell D1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D1"})) + #3. Tab: Data > Consolidate + with self.ui_test.execute_modeless_dialog_through_command(".uno:DataConsolidate") as xDialog: + + xfunc = xDialog.getChild("func") + xeddataarea = xDialog.getChild("eddataarea") + xadd = xDialog.getChild("add") + xbyrow = xDialog.getChild("byrow") + + select_by_text(xfunc, "Sum") + #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()) + + xConsAreas = xDialog.getChild("consareas") + self.assertEqual(1, len(xConsAreas.getChildren())) + self.assertEqual("$Sheet1.$A$1:$B$7", get_state_as_dict(xConsAreas.getChild("0"))['Text']) + + #6. Click 'Options' > check 'Row labels' > click OK + xbyrow.executeAction("CLICK", tuple()) + + #verify + self.assertEqual("A 1", get_cell_by_position(calc_doc, 0, 3, 0).getString()) + self.assertEqual("AB 1", get_cell_by_position(calc_doc, 0, 3, 1).getString()) + self.assertEqual("AB 12", get_cell_by_position(calc_doc, 0, 3, 2).getString()) + self.assertEqual("AB 123", get_cell_by_position(calc_doc, 0, 3, 3).getString()) + self.assertEqual("ABC 1", get_cell_by_position(calc_doc, 0, 3, 4).getString()) + + self.assertEqual(1, get_cell_by_position(calc_doc, 0, 4, 0).getValue()) + self.assertEqual(2, get_cell_by_position(calc_doc, 0, 4, 1).getValue()) + self.assertEqual(2, get_cell_by_position(calc_doc, 0, 4, 2).getValue()) + self.assertEqual(1, get_cell_by_position(calc_doc, 0, 4, 3).getValue()) + self.assertEqual(1, get_cell_by_position(calc_doc, 0, 4, 4).getValue()) + + self.xUITest.executeCommand(".uno:Undo") + + self.assertEqual("", get_cell_by_position(calc_doc, 0, 3, 0).getString()) + self.assertEqual("", get_cell_by_position(calc_doc, 0, 3, 1).getString()) + self.assertEqual("", get_cell_by_position(calc_doc, 0, 3, 2).getString()) + self.assertEqual("", get_cell_by_position(calc_doc, 0, 3, 3).getString()) + self.assertEqual("", get_cell_by_position(calc_doc, 0, 3, 4).getString()) + + self.assertEqual(0, get_cell_by_position(calc_doc, 0, 4, 0).getValue()) + self.assertEqual(0, get_cell_by_position(calc_doc, 0, 4, 1).getValue()) + self.assertEqual(0, get_cell_by_position(calc_doc, 0, 4, 2).getValue()) + self.assertEqual(0, get_cell_by_position(calc_doc, 0, 4, 3).getValue()) + self.assertEqual(0, get_cell_by_position(calc_doc, 0, 4, 4).getValue()) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests3/tdf79983.py b/sc/qa/uitest/calc_tests3/tdf79983.py new file mode 100644 index 0000000000..6625f049e9 --- /dev/null +++ b/sc/qa/uitest/calc_tests3/tdf79983.py @@ -0,0 +1,66 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +#Bug 79983 - Calc sort lists aren't case sensitive + +class tdf79983(UITestCase): + def test_tdf79983_sort_list_case_sensitive(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + enter_text_to_cell(gridwin, "A1", "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 + with self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") as xDialogOpt: + + 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()) + + self.assertEqual("AAA\nBBB\nCCC\nDDD", get_state_as_dict(xDialogOpt.getChild("entries"))['Text']) + + + 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 + with self.ui_test.execute_dialog_through_command(".uno:FillSeries") as xDialog: + xautofill = xDialog.getChild("autofill") + xautofill.executeAction("CLICK", tuple()) + #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(), "") + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests3/tdf80693.py b/sc/qa/uitest/calc_tests3/tdf80693.py new file mode 100644 index 0000000000..951c886fc9 --- /dev/null +++ b/sc/qa/uitest/calc_tests3/tdf80693.py @@ -0,0 +1,44 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import select_by_text +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + +#Bug 80693 - EDITING: fill cell with random numbers with min = max +class tdf80693(UITestCase): + def test_tdf80693_random_numbers_min_max(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"})) + with self.ui_test.execute_modeless_dialog_through_command(".uno:RandomNumberGeneratorDialog") as xDialog: + xcellrangeedit = xDialog.getChild("cell-range-edit") + xdistributioncombo = xDialog.getChild("distribution-combo") + xparameter1spin = xDialog.getChild("parameter1-spin") + xparameter2spin = xDialog.getChild("parameter2-spin") + + xcellrangeedit.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$A$1:$A$2"})) + select_by_text(xdistributioncombo, "Uniform") + + 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"})) + + #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) +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests4/exportToPDF.py b/sc/qa/uitest/calc_tests4/exportToPDF.py new file mode 100644 index 0000000000..a635ee60a5 --- /dev/null +++ b/sc/qa/uitest/calc_tests4/exportToPDF.py @@ -0,0 +1,79 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +import os.path +from tempfile import TemporaryDirectory + +from uitest.framework import UITestCase +from uitest.uihelper.calc import enter_text_to_cell +from uitest.uihelper.common import get_state_as_dict +from libreoffice.uno.propertyvalue import mkPropertyValues +from org.libreoffice.unotest import systemPathToFileUrl + + +class exportToPDF(UITestCase): + + def test_checkDefaultValues(self): + + with TemporaryDirectory() as tempdir: + xFilePath = os.path.join(tempdir, 'exportToPDFFromCalc-tmp.pdf') + + with self.ui_test.create_doc_in_start_center("calc"): + + calcDoc = self.xUITest.getTopFocusWindow() + gridwin = calcDoc.getChild("grid_window") + + enter_text_to_cell(gridwin, "A1", "Hello World") + + # Export as PDF + with self.ui_test.execute_dialog_through_command('.uno:ExportToPDF', close_button="") as xDialog: + + selectedChildren = ['bookmarks', 'display', 'effects', 'enablea11y', + 'enablecopy', 'exporturl', 'forms', 'reduceresolution', 'tagged'] + + for child in selectedChildren: + self.assertEqual("true", get_state_as_dict(xDialog.getChild(child))['Selected']) + + nonSelectedChildren = ['allowdups', 'center', 'comments', 'convert', 'embed', 'emptypages', 'export', 'exportplaceholders', + 'firstonleft', 'hiddenpages', 'menubar', 'notes', 'onlynotes', 'open', 'pdfa', 'pdfua', 'resize', 'singlepagesheets', + 'toolbar', 'usereferencexobject', 'viewpdf', 'watermark', 'window'] + + for child in nonSelectedChildren: + self.assertEqual("false", get_state_as_dict(xDialog.getChild(child))['Selected']) + + checkedChildren = ['allbookmarks', 'changeany', 'default', 'defaultlayout', 'fitdefault', 'jpegcompress', 'outline', 'printhigh', 'selection'] + + for child in checkedChildren: + self.assertEqual("true", get_state_as_dict(xDialog.getChild(child))['Checked']) + + nonCheckedChildren = ['all', 'changecomment', 'changeform', 'changeinsdel', 'changenone', 'contfacinglayout', 'contlayout', 'fitvis', 'fitwidth', + 'fitwin', 'fitzoom', 'losslesscompress', 'openinternet', 'openpdf', 'pageonly', 'printlow', 'printnone', 'range', + 'singlelayout', 'thumbs', 'visiblebookmark'] + + for child in nonCheckedChildren: + self.assertEqual("false", get_state_as_dict(xDialog.getChild(child))['Checked']) + + self.assertEqual("300 DPI", get_state_as_dict(xDialog.getChild("resolution"))['Text']) + self.assertEqual("90", get_state_as_dict(xDialog.getChild("quality"))['Value']) + self.assertEqual("FDF", get_state_as_dict(xDialog.getChild("format"))['DisplayText']) + + xOk = xDialog.getChild("ok") + with self.ui_test.execute_dialog_through_action(xOk, "CLICK", close_button="open") as xSaveDialog: + xFileName = xSaveDialog.getChild('file_name') + xFileName.executeAction('TYPE', mkPropertyValues({'KEYCODE':'CTRL+A'})) + xFileName.executeAction('TYPE', mkPropertyValues({'KEYCODE':'BACKSPACE'})) + xFileName.executeAction('TYPE', mkPropertyValues({'TEXT': xFilePath})) + + with self.ui_test.load_file(systemPathToFileUrl(xFilePath)) as document: + + self.assertEqual("Sheet1", document.DrawPages[0][0].String) + self.assertEqual("Page 1", document.DrawPages[0][1].String) + self.assertEqual("Hello World", document.DrawPages[0][2].String) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests4/saveToCSV.py b/sc/qa/uitest/calc_tests4/saveToCSV.py new file mode 100644 index 0000000000..09949b7d71 --- /dev/null +++ b/sc/qa/uitest/calc_tests4/saveToCSV.py @@ -0,0 +1,70 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +import os.path +from tempfile import TemporaryDirectory + +from uitest.framework import UITestCase +from uitest.uihelper.calc import enter_text_to_cell +from uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import select_by_text +from libreoffice.uno.propertyvalue import mkPropertyValues + + +class saveToCSV(UITestCase): + + def test_saveToCSVDialog(self): + + with TemporaryDirectory() as tempdir: + xFilePath = os.path.join(tempdir, 'exportToCSV-tmp.csv') + + with self.ui_test.create_doc_in_start_center("calc"): + + calcDoc = self.xUITest.getTopFocusWindow() + gridwin = calcDoc.getChild("grid_window") + + 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, "A4", "=SUM(A1:A3)") + + # Save the document + with self.ui_test.execute_dialog_through_command(".uno:Save", close_button="") as xSaveDialog: + xFileName = xSaveDialog.getChild("file_name") + xFileName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xFileName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": xFilePath})) + xFileTypeCombo = xSaveDialog.getChild("file_type") + select_by_text(xFileTypeCombo, "Text CSV (.csv)") + xOpen = xSaveDialog.getChild("open") + + with self.ui_test.execute_dialog_through_action(xOpen, "CLICK", close_button="") as xWarnDialog: + # CSV confirmation dialog is displayed + xSave = xWarnDialog.getChild("save") + + with self.ui_test.execute_dialog_through_action(xSave, "CLICK") as xCsvDialog: + xFormulas = xCsvDialog.getChild("formulas") + xAsShown = xCsvDialog.getChild("asshown") + xFixedWidth = xCsvDialog.getChild("fixedwidth") + xQuoteAll = xCsvDialog.getChild("quoteall") + self.assertEqual("false", get_state_as_dict(xFormulas)['Selected']) + self.assertEqual("false", get_state_as_dict(xQuoteAll)['Selected']) + self.assertEqual("false", get_state_as_dict(xFixedWidth)['Selected']) + self.assertEqual("true", get_state_as_dict(xAsShown)['Selected']) + + xFormulas.executeAction("CLICK", tuple()) + + with open(xFilePath, "r") as f: + lines = f.readlines() + self.assertEqual("1", lines[0].strip()) + self.assertEqual("2", lines[1].strip()) + self.assertEqual("3", lines[2].strip()) + self.assertEqual("=SUM(A1:A3)", lines[3].strip()) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests4/tdf131170.py b/sc/qa/uitest/calc_tests4/tdf131170.py new file mode 100644 index 0000000000..65bddc4fd6 --- /dev/null +++ b/sc/qa/uitest/calc_tests4/tdf131170.py @@ -0,0 +1,45 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file + +class tdf131170(UITestCase): + def test_DefineLabelRange(self): + with self.ui_test.load_file(get_url_for_data_file("tdf131170.ods")): + + with self.ui_test.execute_dialog_through_command(".uno:DefineLabelRange") as xDialog: + + 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]") + + xDeleteBtn = xDialog.getChild("delete") + + xRange.getChild('1').executeAction("SELECT", tuple()) + with self.ui_test.execute_blocking_action(xDeleteBtn.executeAction, args=('CLICK', ()), close_button="yes"): + pass + + 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()) + with self.ui_test.execute_blocking_action(xDeleteBtn.executeAction, args=('CLICK', ()), close_button="yes"): + pass + + 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 ---") + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests4/tdf138089.py b/sc/qa/uitest/calc_tests4/tdf138089.py new file mode 100644 index 0000000000..7ea3afd09e --- /dev/null +++ b/sc/qa/uitest/calc_tests4/tdf138089.py @@ -0,0 +1,45 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file +from libreoffice.uno.propertyvalue import mkPropertyValues +from libreoffice.calc.document import is_row_hidden + +class tdf138089(UITestCase): + + def test_tdf138089(self): + + with self.ui_test.load_file(get_url_for_data_file("tdf138089.xlsx")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + + self.assertFalse(is_row_hidden(calc_doc, 0)) + self.assertTrue(is_row_hidden(calc_doc, 1)) + self.assertTrue(is_row_hidden(calc_doc, 2)) + self.assertTrue(is_row_hidden(calc_doc, 3)) + self.assertFalse(is_row_hidden(calc_doc, 4)) + self.assertFalse(is_row_hidden(calc_doc, 5)) + self.assertFalse(is_row_hidden(calc_doc, 6)) + + # Without the fix in place, this test would have crashed here + with self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") as xDialog: + self.assertEqual("2017-12-01", get_state_as_dict(xDialog.getChild("val1"))['Text']) + self.assertEqual("过å¸æ—¥æœŸ", get_state_as_dict(xDialog.getChild("field1"))["DisplayText"]) + + + self.assertFalse(is_row_hidden(calc_doc, 0)) + self.assertTrue(is_row_hidden(calc_doc, 1)) + self.assertTrue(is_row_hidden(calc_doc, 2)) + self.assertTrue(is_row_hidden(calc_doc, 3)) + self.assertFalse(is_row_hidden(calc_doc, 4)) + self.assertFalse(is_row_hidden(calc_doc, 5)) + self.assertTrue(is_row_hidden(calc_doc, 6)) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests4/tdf141547.py b/sc/qa/uitest/calc_tests4/tdf141547.py new file mode 100644 index 0000000000..2cccba3321 --- /dev/null +++ b/sc/qa/uitest/calc_tests4/tdf141547.py @@ -0,0 +1,39 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file +from libreoffice.uno.propertyvalue import mkPropertyValues +from libreoffice.calc.document import is_row_hidden + +class tdf141547(UITestCase): + + def test_tdf141547(self): + + with self.ui_test.load_file(get_url_for_data_file("tdf141547.xlsx")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + + self.assertFalse(is_row_hidden(calc_doc, 0)) + for i in range(1, 7): + self.assertTrue(is_row_hidden(calc_doc, i)) + + # Without the fix in place, this test would have crashed here + with self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") as xDialog: + self.assertEqual("0", get_state_as_dict(xDialog.getChild("val1"))['Text']) + self.assertEqual("过å¸æ—¥æœŸ", get_state_as_dict(xDialog.getChild("field1"))["DisplayText"]) + self.assertEqual("Empty", get_state_as_dict(xDialog.getChild("val2"))['Text']) + self.assertEqual("过å¸æ—¥æœŸ", get_state_as_dict(xDialog.getChild("field2"))["DisplayText"]) + + + self.assertFalse(is_row_hidden(calc_doc, 0)) + for i in range(1, 7): + self.assertTrue(is_row_hidden(calc_doc, i)) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests4/tdf152722_AddDecimalPlacesToNatNum.py b/sc/qa/uitest/calc_tests4/tdf152722_AddDecimalPlacesToNatNum.py new file mode 100644 index 0000000000..d30430fe79 --- /dev/null +++ b/sc/qa/uitest/calc_tests4/tdf152722_AddDecimalPlacesToNatNum.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 libreoffice.uno.propertyvalue import mkPropertyValues +#Bug 152722 - NatNum12 number format (spell out): add/delete decimal places is losing format + +class tdf152722(UITestCase): + def test_tdf152722_NatNum_modifier_decimal_value(self): + #numberingformatpage.ui + with self.ui_test.create_doc_in_start_center("calc"): + #format - cell + with self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") #tab Numbers + xdecimalsed = xDialog.getChild( "decimalsed" ) + xleadzerosed = xDialog.getChild( "leadzerosed" ) + xnegnumred = xDialog.getChild( "negnumred" ) + xthousands = xDialog.getChild( "thousands" ) + xformatted = xDialog.getChild( "formatted" ) + + xformatted.executeAction( "CLEAR", tuple() ) #clear textbox + xformatted.executeAction( "TYPE", mkPropertyValues({"TEXT":"[NatNum12 cardinal]0"}) ) + xdecimalsed.executeAction( "UP", tuple() ) + self.assertEqual( get_state_as_dict(xformatted)["Text"], "[NatNum12 cardinal]0.0" ) + xnegnumred.executeAction( "CLICK", tuple() ) + self.assertEqual( get_state_as_dict(xformatted)["Text"], "[NatNum12 cardinal]0.0;[RED][NatNum12 cardinal]-0.0" ) + #Bug 153023: disable Thousand separator for NatNum12 modifier + self.assertEqual(get_state_as_dict(xthousands)["Enabled"], "false") + #Leading zeroes can be 0 or 1 + self.assertEqual(get_state_as_dict(xleadzerosed)["Enabled"], "true") + +# 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 0000000000..466a8559ab --- /dev/null +++ b/sc/qa/uitest/calc_tests4/tdf88999.py @@ -0,0 +1,42 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import select_pos +from uitest.uihelper.calc import enter_text_to_cell +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 + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + enter_text_to_cell(gridwin, "A1", "1e-2") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B1"})) + #select cell A1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #format - cell + with self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") #tab Numbers + xliststore1 = xDialog.getChild("categorylb") #1st list / Category + xdecimalsed = xDialog.getChild("decimalsed") + xleadzerosed = xDialog.getChild("leadzerosed") + 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") + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests4/tdf89958.py b/sc/qa/uitest/calc_tests4/tdf89958.py new file mode 100644 index 0000000000..6f31939fb8 --- /dev/null +++ b/sc/qa/uitest/calc_tests4/tdf89958.py @@ -0,0 +1,58 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file +from uitest.uihelper.common import select_by_text +from libreoffice.uno.propertyvalue import mkPropertyValues + +#Bug 89958 - Data->Filter->Standard Filter, condition "does not end with" does filter too much + +class tdf89958(UITestCase): + def test_td89958_standard_filter(self): + with self.ui_test.load_file(get_url_for_data_file("tdf89958.ods")): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #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" + with self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xcond1 = xDialog.getChild("cond1") + + select_by_text(xfield1, "Column A") + select_by_text(xcond1, "Does not end with") + xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"CTORS"})) + + #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) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests4/trackedChanges.py b/sc/qa/uitest/calc_tests4/trackedChanges.py new file mode 100644 index 0000000000..0f38f9f304 --- /dev/null +++ b/sc/qa/uitest/calc_tests4/trackedChanges.py @@ -0,0 +1,387 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +# tests for tracked changes ; tdf912270 + +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 +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file +import datetime + +class CalcTrackedChanges(UITestCase): + + def test_tdf131907(self): + with self.ui_test.load_file(get_url_for_data_file("tdf131907.ods")): + with self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptChanges", close_button="close") as xTrackDlg: + + 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") + + + def test_tdf66263_Protect_Records(self): + with self.ui_test.create_doc_in_start_center("calc"): + self.ui_test.wait_until_child_is_available("grid_window") + self.xUITest.executeCommand(".uno:TraceChangeMode") + #protect dialog + with self.ui_test.execute_dialog_through_command(".uno:ProtectTraceChangeMode") as xDialog: + xpass = xDialog.getChild("pass1ed") + xpass.executeAction("TYPE", mkPropertyValues({"TEXT":"a"})) + xconfirm = xDialog.getChild("confirm1ed") + xconfirm.executeAction("TYPE", mkPropertyValues({"TEXT":"a"})) + #verify password + with self.ui_test.execute_dialog_through_command(".uno:ProtectTraceChangeMode") as xDialog: + xpass = xDialog.getChild("pass1ed") + xpass.executeAction("TYPE", mkPropertyValues({"TEXT":"a"})) + + def test_ContentChange(self): + + with self.ui_test.create_doc_in_start_center("calc") as document: + self.ui_test.wait_until_child_is_available("grid_window") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #track changes; enter text to cell + self.xUITest.executeCommand(".uno:TraceChangeMode") + enter_text_to_cell(gridwin, "A1", "Hello") + enter_text_to_cell(gridwin, "A1", "There") + + with self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptChanges", close_button="close") as xTrackDlg: + + xChangesList = xTrackDlg.getChild("calcchanges") + self.assertEqual(1, len(xChangesList.getChildren())) + + textStart = "Changed contents\tSheet1.A1\tUnknown Author\t" + datetime.datetime.now().strftime("%m/%d/%Y") + + xChild = xChangesList.getChild('0') + self.assertTrue(get_state_as_dict(xChild)["Text"].startswith(textStart)) + + xChild.executeAction("EXPAND", tuple()) + + self.assertEqual(3, len(xChild.getChildren())) + textStartChild1 = "<empty>\tSheet1.A1\tUnknown Author\t" + datetime.datetime.now().strftime("%m/%d/%Y") + textEndChild1 = "(Original: <empty>)" + textStartChild2 = "'Hello'\tSheet1.A1\tUnknown Author\t" + datetime.datetime.now().strftime("%m/%d/%Y") + textEndChild2 = "(Changed to 'Hello')" + textStartChild3 = "'There'\tSheet1.A1\tUnknown Author\t" + datetime.datetime.now().strftime("%m/%d/%Y") + textEndChild3 = "(Changed to 'There')" + + self.assertTrue(get_state_as_dict(xChild.getChild('0'))["Text"].startswith(textStartChild1)) + self.assertTrue(get_state_as_dict(xChild.getChild('0'))["Text"].endswith(textEndChild1)) + self.assertTrue(get_state_as_dict(xChild.getChild('1'))["Text"].startswith(textStartChild2)) + self.assertTrue(get_state_as_dict(xChild.getChild('1'))["Text"].endswith(textEndChild2)) + self.assertTrue(get_state_as_dict(xChild.getChild('2'))["Text"].startswith(textStartChild3)) + self.assertTrue(get_state_as_dict(xChild.getChild('2'))["Text"].endswith(textEndChild3)) + + self.assertEqual("There", get_cell_by_position(document, 0, 0, 0).getString()) + + def test_Tdf153096(self): + + with self.ui_test.create_doc_in_start_center("calc") as document: + self.ui_test.wait_until_child_is_available("grid_window") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #track changes; enter text to cell + self.xUITest.executeCommand(".uno:TraceChangeMode") + enter_text_to_cell(gridwin, "A1", "Hello") + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + + self.xUITest.executeCommand(".uno:DeleteRows") + + with self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptChanges", close_button="close") as xTrackDlg: + + xChangesList = xTrackDlg.getChild("calcchanges") + self.assertEqual(1, len(xChangesList.getChildren())) + + textStart = "Row deleted\t(Sheet1.1:1)\tUnknown Author\t" + datetime.datetime.now().strftime("%m/%d/%Y") + textEnd = "(Row 1:1 deleted)" + + xChild = xChangesList.getChild('0') + + # Without the fix in place, this test would have failed here + self.assertTrue(get_state_as_dict(xChild)["Text"].startswith(textStart)) + self.assertTrue(get_state_as_dict(xChild)["Text"].endswith(textEnd)) + + xChild.executeAction("EXPAND", tuple()) + + self.assertEqual(1, len(xChild.getChildren())) + textStartChild1 = "Changed contents\t(Sheet1.A1)\tUnknown Author\t" + datetime.datetime.now().strftime("%m/%d/%Y") + textEndChild1 = "(Cell (A1) changed from '<empty>' to 'Hello')" + + self.assertTrue(get_state_as_dict(xChild.getChild('0'))["Text"].startswith(textStartChild1)) + self.assertTrue(get_state_as_dict(xChild.getChild('0'))["Text"].endswith(textEndChild1)) + + def test_tracked_changes_accept(self): + + with self.ui_test.create_doc_in_start_center("calc") as document: + self.ui_test.wait_until_child_is_available("grid_window") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #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 + with self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptChanges", close_button="close") as xTrackDlg: + + xChangesList = xTrackDlg.getChild("calcchanges") + self.assertEqual(2, len(xChangesList.getChildren())) + + textStart = "Changed contents\tSheet1.A1\tUnknown Author\t" + datetime.datetime.now().strftime("%m/%d/%Y") + textEnd = "(Cell A1 changed from '<empty>' to 'Test LibreOffice')" + textStart2 = "Changed contents\tSheet1.A2\tUnknown Author\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)) + + + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Test LibreOffice") + + def test_tracked_changes_acceptall(self): + + with self.ui_test.create_doc_in_start_center("calc") as document: + self.ui_test.wait_until_child_is_available("grid_window") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #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 + with self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptChanges", close_button="close") as xTrackDlg: + + xChangesList = xTrackDlg.getChild("calcchanges") + self.assertEqual(2, len(xChangesList.getChildren())) + + textStart = "Changed contents\tSheet1.A1\tUnknown Author\t" + datetime.datetime.now().strftime("%m/%d/%Y") + textEnd = "(Cell A1 changed from '<empty>' to 'Test LibreOffice')" + textStart2 = "Changed contents\tSheet1.A2\tUnknown Author\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)) + + + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "Test LibreOffice") + + def test_tracked_changes_reject(self): + + with self.ui_test.create_doc_in_start_center("calc") as document: + self.ui_test.wait_until_child_is_available("grid_window") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #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 + with self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptChanges", close_button="close") as xTrackDlg: + + xChangesList = xTrackDlg.getChild("calcchanges") + self.assertEqual(2, len(xChangesList.getChildren())) + + textStart = "Changed contents\tSheet1.A1\tUnknown Author\t" + datetime.datetime.now().strftime("%m/%d/%Y") + textEnd = "(Cell A1 changed from '<empty>' to 'Test LibreOffice')" + textStart2 = "Changed contents\tSheet1.A2\tUnknown Author\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)) + + + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "") + + def test_tracked_changes_rejectall(self): + + with self.ui_test.create_doc_in_start_center("calc") as document: + self.ui_test.wait_until_child_is_available("grid_window") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #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 + with self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptChanges", close_button="close") as xTrackDlg: + + xChangesList = xTrackDlg.getChild("calcchanges") + self.assertEqual(2, len(xChangesList.getChildren())) + + textStart = "Changed contents\tSheet1.A1\tUnknown Author\t" + datetime.datetime.now().strftime("%m/%d/%Y") + textEnd = "(Cell A1 changed from '<empty>' to 'Test LibreOffice')" + textStart2 = "Changed contents\tSheet1.A2\tUnknown Author\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)) + + + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "") + + def test_tdf136062(self): + + with self.ui_test.load_file(get_url_for_data_file("tdf136062.ods")): + + self.xUITest.getTopFocusWindow() + + with self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptChanges", close_button="close") as xTrackDlg: + + xChangesList = xTrackDlg.getChild("calcchanges") + self.assertEqual(1, len(xChangesList.getChildren())) + + xRejectAllBtn = xTrackDlg.getChild("rejectall") + xRejectBtn = xTrackDlg.getChild("reject") + xAcceptAllBtn = xTrackDlg.getChild("acceptall") + xAcceptBtn = xTrackDlg.getChild("accept") + + # Without the fix in place, it would have failed with + # AssertionError: 'R~eject All' != 'R~eject All/Clear formatting' + self.assertEqual('R~eject All', get_state_as_dict(xRejectAllBtn)['Text']) + self.assertEqual('~Reject', get_state_as_dict(xRejectBtn)['Text']) + self.assertEqual('A~ccept All', get_state_as_dict(xAcceptAllBtn)['Text']) + self.assertEqual('~Accept', get_state_as_dict(xAcceptBtn)['Text']) + + def test_tdf85353(self): + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + enter_text_to_cell(gridwin, "A1", "15") + enter_text_to_cell(gridwin, "D1", "0") + enter_text_to_cell(gridwin, "E1", "0") + + with self.ui_test.execute_dialog_through_command(".uno:CompareDocuments", close_button="") as xOpenDialog: + xFileName = xOpenDialog.getChild("file_name") + xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": get_url_for_data_file("tdf85353.ods")})) + xOpenBtn = xOpenDialog.getChild("open") + + with self.ui_test.execute_dialog_through_action(xOpenBtn, 'CLICK', close_button="close") as xTrackDlg: + changesList = xTrackDlg.getChild("calcchanges") + + # Without the fix in place, this test would have failed with + # AssertionError: 1 != 0 + self.assertEqual(1, len(changesList.getChildren())) + self.assertTrue(get_state_as_dict(changesList.getChild('0'))['Text'].startswith("Changed contents\tSheet1.E1")) + self.assertTrue(get_state_as_dict(changesList.getChild('0'))['Text'].endswith("(Cell E1 changed from '5' to '0')")) + +# 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 0000000000..e5ff72f073 --- /dev/null +++ b/sc/qa/uitest/calc_tests6/autoFormat.py @@ -0,0 +1,69 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict +from libreoffice.uno.propertyvalue import mkPropertyValues +#uitest sc / AutoFormat Styles + +class autoFormat(UITestCase): + def test_autoformat_styles(self): + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #select A1:C5 + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C5"})) + #AutoFormat Styles + with self.ui_test.execute_dialog_through_command(".uno:AutoFormat") as xDialog: + + formatlb = xDialog.getChild("formatlb") + numformatcb = xDialog.getChild("numformatcb") + bordercb = xDialog.getChild("bordercb") + fontcb = xDialog.getChild("fontcb") + patterncb = xDialog.getChild("patterncb") + alignmentcb = xDialog.getChild("alignmentcb") + autofitcb = xDialog.getChild("autofitcb") + + entry = formatlb.getChild("7") #Financial + entry.executeAction("SELECT", tuple()) + numformatcb.executeAction("CLICK", tuple()) + bordercb.executeAction("CLICK", tuple()) + fontcb.executeAction("CLICK", tuple()) + patterncb.executeAction("CLICK", tuple()) + alignmentcb.executeAction("CLICK", tuple()) + autofitcb.executeAction("CLICK", tuple()) + + + #verify + with self.ui_test.execute_dialog_through_command(".uno:AutoFormat") as xDialog: + + formatlb = xDialog.getChild("formatlb") + numformatcb = xDialog.getChild("numformatcb") + bordercb = xDialog.getChild("bordercb") + fontcb = xDialog.getChild("fontcb") + patterncb = xDialog.getChild("patterncb") + alignmentcb = xDialog.getChild("alignmentcb") + autofitcb = xDialog.getChild("autofitcb") + + entry = formatlb.getChild("7") #Financial + entry.executeAction("SELECT", tuple()) + self.assertEqual(get_state_as_dict(numformatcb)["Selected"], "false") + self.assertEqual(get_state_as_dict(bordercb)["Selected"], "false") + self.assertEqual(get_state_as_dict(fontcb)["Selected"], "false") + self.assertEqual(get_state_as_dict(patterncb)["Selected"], "false") + self.assertEqual(get_state_as_dict(alignmentcb)["Selected"], "false") + self.assertEqual(get_state_as_dict(autofitcb)["Selected"], "false") + numformatcb.executeAction("CLICK", tuple()) + bordercb.executeAction("CLICK", tuple()) + fontcb.executeAction("CLICK", tuple()) + patterncb.executeAction("CLICK", tuple()) + alignmentcb.executeAction("CLICK", tuple()) + autofitcb.executeAction("CLICK", tuple()) + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests6/autocorrectOptions.py b/sc/qa/uitest/calc_tests6/autocorrectOptions.py new file mode 100644 index 0000000000..e626ad93f4 --- /dev/null +++ b/sc/qa/uitest/calc_tests6/autocorrectOptions.py @@ -0,0 +1,95 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import select_pos + +class autocorrectOptions(UITestCase): + + def test_autocorrect_options_calc(self): + with self.ui_test.create_doc_in_start_center("calc"): + with self.ui_test.execute_dialog_through_command(".uno:AutoCorrectDlg", close_button="cancel") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") #tab replace + origtext = xDialog.getChild("origtext") + newtext = xDialog.getChild("newtext") + xnew = xDialog.getChild("new") + xdelete = xDialog.getChild("delete") + xtabview = xDialog.getChild("tabview") + nrRows = get_state_as_dict(xtabview)["VisibleCount"] + + self.assertTrue(int(nrRows) > 0) + + #add new rule + origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + origtext.executeAction("TYPE", mkPropertyValues({"TEXT":"::::"})) + newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + newtext.executeAction("TYPE", mkPropertyValues({"TEXT":"dvojtecky"})) + xnew.executeAction("CLICK", tuple()) + nrRowsNew = get_state_as_dict(xtabview)["VisibleCount"] + nrRowsDiff = int(nrRowsNew) - int(nrRows) + self.assertEqual(nrRowsDiff, 1) #we have +1 rule + #delete rule + origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + origtext.executeAction("TYPE", mkPropertyValues({"TEXT":"::::"})) + newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + newtext.executeAction("TYPE", mkPropertyValues({"TEXT":"dvojtecky"})) + xdelete.executeAction("CLICK", tuple()) + self.assertEqual(get_state_as_dict(xtabview)["VisibleCount"], nrRows) #we have default nr of rules + + select_pos(xTabs, "1") #tab Exceptions + #abbreviations + abbrev = xDialog.getChild("abbrev") + newabbrev = xDialog.getChild("newabbrev") + delabbrev = xDialog.getChild("delabbrev") + abbrevlist = xDialog.getChild("abbrevlist") + + nrRowsAbb = get_state_as_dict(abbrevlist)["VisibleCount"] + + self.assertTrue(int(nrRowsAbb) > 0) + + abbrev.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + abbrev.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + abbrev.executeAction("TYPE", mkPropertyValues({"TEXT":"qqqqq"})) + newabbrev.executeAction("CLICK", tuple()) + nrRowsAbbNew = get_state_as_dict(abbrevlist)["VisibleCount"] + nrRowsAbbDiff = int(nrRowsAbbNew) - int(nrRowsAbb) + self.assertEqual(nrRowsAbbDiff, 1) #we have +1 rule + delabbrev.executeAction("CLICK", tuple()) + self.assertEqual(get_state_as_dict(abbrevlist)["VisibleCount"], nrRowsAbb) #we have default nr of rules + + #words with two initial capitals + double = xDialog.getChild("double") + newdouble = xDialog.getChild("newdouble") + deldouble = xDialog.getChild("deldouble") + doublelist = xDialog.getChild("doublelist") + + nrRowsDouble = get_state_as_dict(doublelist)["VisibleCount"] + + self.assertTrue(int(nrRowsDouble) > 0) + + double.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + double.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + double.executeAction("TYPE", mkPropertyValues({"TEXT":"QQqqq"})) + newdouble.executeAction("CLICK", tuple()) + nrRowsDoubleNew = get_state_as_dict(doublelist)["VisibleCount"] + nrRowsDoubleDiff = int(nrRowsDoubleNew) - int(nrRowsDouble) #convert string and + self.assertEqual(nrRowsDoubleDiff, 1) #we have +1 rule + deldouble.executeAction("CLICK", tuple()) + self.assertEqual(get_state_as_dict(doublelist)["VisibleCount"], nrRowsDouble) #we have default nr of rules + + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests6/hideShowSheet.py b/sc/qa/uitest/calc_tests6/hideShowSheet.py new file mode 100644 index 0000000000..3f34fca1a1 --- /dev/null +++ b/sc/qa/uitest/calc_tests6/hideShowSheet.py @@ -0,0 +1,45 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict +from libreoffice.uno.propertyvalue import mkPropertyValues +#uitest sc / Show sheet dialog + +class hideShowSheet(UITestCase): + def test_hide_show_sheet(self): + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #insert sheet + with self.ui_test.execute_dialog_through_command(".uno:Insert"): + pass + #select sheet + gridwin.executeAction("SELECT", mkPropertyValues({"TABLE":"1"})) + self.assertEqual(get_state_as_dict(gridwin)["SelectedTable"], "1") + #hide sheet + self.xUITest.executeCommand(".uno:Hide") + #show sheet Dialog + with self.ui_test.execute_dialog_through_command(".uno:Show", close_button="cancel") as xDialog: + treeview = xDialog.getChild("treeview") + self.assertEqual(get_state_as_dict(treeview)["Children"], "1") + #insert 2nd sheet + with self.ui_test.execute_dialog_through_command(".uno:Insert"): + pass + #select sheet + gridwin.executeAction("SELECT", mkPropertyValues({"TABLE":"2"})) + self.assertEqual(get_state_as_dict(gridwin)["SelectedTable"], "1") + #hide sheet + self.xUITest.executeCommand(".uno:Hide") + #show sheet Dialog + with self.ui_test.execute_dialog_through_command(".uno:Show", close_button="cancel") as xDialog: + treeview = xDialog.getChild("treeview") + self.assertEqual(get_state_as_dict(treeview)["Children"], "2") + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests6/moveCopySheet.py b/sc/qa/uitest/calc_tests6/moveCopySheet.py new file mode 100644 index 0000000000..5b21e6e86c --- /dev/null +++ b/sc/qa/uitest/calc_tests6/moveCopySheet.py @@ -0,0 +1,121 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict +from libreoffice.uno.propertyvalue import mkPropertyValues +#uitest sc - move/copy sheet dialog + +class moveCopySheet(UITestCase): + def test_copy_move_sheet(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + #default - 1 sheet; select the sheet (is selected), dialog move/copy sheet + with self.ui_test.execute_dialog_through_command(".uno:Move") as xDialog: + #new name = newName + newName = xDialog.getChild("newName") + newName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + newName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + newName.executeAction("TYPE", mkPropertyValues({"TEXT":"newName"})) + #verify, the file has 2 sheets; first one "newName" is selected + self.assertEqual(document.Sheets.getCount(), 2) + # dialog move/copy sheet ; Copy is selected; Select move and -move to end position - ; New Name = moveName + with self.ui_test.execute_dialog_through_command(".uno:Move") as xDialog: + xMoveButton = xDialog.getChild("move") + xMoveButton.executeAction("CLICK", tuple()) + insertBefore = xDialog.getChild("insertBefore") + + xTreeEntry = insertBefore.getChild('2') + xTreeEntry.executeAction("SELECT", tuple()) + + newName = xDialog.getChild("newName") + self.assertEqual(get_state_as_dict(newName)["Text"], "newName") + newName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + newName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + newName.executeAction("TYPE", mkPropertyValues({"TEXT":"moveName"})) + # Verify, the file has 2 sheets; first one is "Sheet1" ; second one is "moveName" + self.assertEqual(document.Sheets.getCount(), 2) + + self.assertEqual(document.Sheets[0].Name, "Sheet1") + self.assertEqual(document.Sheets[1].Name, "moveName") + + # Verify that the cancel button does not do anything + with self.ui_test.execute_dialog_through_command(".uno:Move", close_button="cancel"): + pass + + self.assertEqual(document.Sheets.getCount(), 2) + self.assertEqual(document.Sheets[0].Name, "Sheet1") + self.assertEqual(document.Sheets[1].Name, "moveName") + + #Check copy option + with self.ui_test.execute_dialog_through_command(".uno:Move") as xDialog: + xCopy = xDialog.getChild("copy") + xCopy.executeAction("CLICK", tuple()) + sheetName = "moveName_2" + newName = xDialog.getChild("newName") + self.assertEqual(get_state_as_dict(newName)["Text"], sheetName) + + + self.assertEqual(document.Sheets.getCount(), 3) + self.assertEqual(document.Sheets[0].Name, sheetName) + self.assertEqual(document.Sheets[1].Name, "Sheet1") + self.assertEqual(document.Sheets[2].Name, "moveName") + + # tdf#56973 - copy/paste (single) sheet is checked but not enabled + def test_tdf56973_copy_paste_inactive(self): + with self.ui_test.create_doc_in_start_center("calc"): + with self.ui_test.execute_dialog_through_command(".uno:Move") as xDialog: + # A single sheet can only be copied + xCopyButton = xDialog.getChild("copy") + self.assertEqual(get_state_as_dict(xCopyButton)["Checked"], "true") + self.assertEqual(get_state_as_dict(xCopyButton)["Enabled"], "true") + # A single sheet can not be moved + xMoveButton = xDialog.getChild("move") + self.assertEqual(get_state_as_dict(xMoveButton)["Checked"], "false") + self.assertEqual(get_state_as_dict(xMoveButton)["Enabled"], "false") + + # tdf#96854 - remember last used option for copy/move sheet + def test_tdf96854_remember_copy_move_option(self): + with self.ui_test.create_doc_in_start_center("calc"): + # Add a second sheet to the calc document + with self.ui_test.execute_dialog_through_command(".uno:Move") as xDialog: + pass + + # Check if the copy option was remembered + with self.ui_test.execute_dialog_through_command(".uno:Move") as xDialog: + xCopyButton = xDialog.getChild("copy") + self.assertEqual(get_state_as_dict(xCopyButton)["Checked"], "true") + xMoveButton = xDialog.getChild("move") + self.assertEqual(get_state_as_dict(xMoveButton)["Checked"], "false") + # Move selected sheet and check if option was remembered + xMoveButton.executeAction("CLICK", tuple()) + + # Check if move option was remembered + with self.ui_test.execute_dialog_through_command(".uno:Move") as xDialog: + xCopyButton = xDialog.getChild("copy") + self.assertEqual(get_state_as_dict(xCopyButton)["Checked"], "false") + xMoveButton = xDialog.getChild("move") + self.assertEqual(get_state_as_dict(xMoveButton)["Checked"], "true") + + #tdf#139464 Set OK button label to selected action: Move or Copy + def test_tdf139464_move_sheet(self): + with self.ui_test.create_doc_in_start_center("calc"): + with self.ui_test.execute_dialog_through_command(".uno:Move") as xDialog: + xOkButton = xDialog.getChild("ok") + xCopyButton = xDialog.getChild("copy") + self.assertEqual(get_state_as_dict(xCopyButton)['Text'], get_state_as_dict(xOkButton)['Text']) + with self.ui_test.execute_dialog_through_command(".uno:Move") as xDialog: + xOkButton = xDialog.getChild("ok") + xCopyButton = xDialog.getChild("copy") + xMoveButton = xDialog.getChild("move") + self.assertEqual(get_state_as_dict(xCopyButton)['Text'], get_state_as_dict(xOkButton)['Text']) + xMoveButton.executeAction("CLICK", tuple()) + self.assertEqual(get_state_as_dict(xMoveButton)['Text'], get_state_as_dict(xOkButton)['Text']) + xCopyButton.executeAction("CLICK", tuple()) + self.assertEqual(get_state_as_dict(xCopyButton)['Text'], get_state_as_dict(xOkButton)['Text']) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests6/multipleOperations.py b/sc/qa/uitest/calc_tests6/multipleOperations.py new file mode 100644 index 0000000000..a796016a83 --- /dev/null +++ b/sc/qa/uitest/calc_tests6/multipleOperations.py @@ -0,0 +1,118 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues +from libreoffice.calc.document import get_cell_by_position +from uitest.uihelper.calc import enter_text_to_cell + +#https://www.linuxtopia.org/online_books/office_guides/openoffice_3_calc_user_guide/openoffice_calc_Multiple_operations_Multiple_operations_in_columns_or_rows.html + +class multipleOperations(UITestCase): + + def test_multiple_operations_one_variable(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = xCalcDoc.getChild("grid_window") + + #enter data + enter_text_to_cell(xGridWindow, "B1", "10") + enter_text_to_cell(xGridWindow, "B2", "2") + enter_text_to_cell(xGridWindow, "B3", "10000") + enter_text_to_cell(xGridWindow, "B4", "2000") + enter_text_to_cell(xGridWindow, "B5", "=B4*(B1-B2)-B3") + + enter_text_to_cell(xGridWindow, "D2", "500") + enter_text_to_cell(xGridWindow, "D3", "1000") + enter_text_to_cell(xGridWindow, "D4", "1500") + enter_text_to_cell(xGridWindow, "D5", "2000") + enter_text_to_cell(xGridWindow, "D6", "2500") + enter_text_to_cell(xGridWindow, "D7", "3000") + enter_text_to_cell(xGridWindow, "D8", "3500") + enter_text_to_cell(xGridWindow, "D9", "4000") + enter_text_to_cell(xGridWindow, "D10", "4500") + enter_text_to_cell(xGridWindow, "D11", "5000") + #Select the range D2:E11 + xGridWindow.executeAction("SELECT", mkPropertyValues({"RANGE": "D2:E11"})) + #Choose Data > Multiple Operations. + with self.ui_test.execute_modeless_dialog_through_command(".uno:TableOperationDialog") as xDialog: + #Formulas = B5 ; Column input cell = B4 + formulas = xDialog.getChild("formulas") + col = xDialog.getChild("col") + formulas.executeAction("TYPE", mkPropertyValues({"TEXT":"$B$5"})) + col.executeAction("TYPE", mkPropertyValues({"TEXT":"$B$4"})) + #verify + self.assertEqual(get_cell_by_position(document, 0, 4, 1).getValue(), -6000) + self.assertEqual(get_cell_by_position(document, 0, 4, 2).getValue(), -2000) + self.assertEqual(get_cell_by_position(document, 0, 4, 3).getValue(), 2000) + self.assertEqual(get_cell_by_position(document, 0, 4, 4).getValue(), 6000) + self.assertEqual(get_cell_by_position(document, 0, 4, 5).getValue(), 10000) + self.assertEqual(get_cell_by_position(document, 0, 4, 6).getValue(), 14000) + self.assertEqual(get_cell_by_position(document, 0, 4, 7).getValue(), 18000) + self.assertEqual(get_cell_by_position(document, 0, 4, 8).getValue(), 22000) + self.assertEqual(get_cell_by_position(document, 0, 4, 9).getValue(), 26000) + self.assertEqual(get_cell_by_position(document, 0, 4, 10).getValue(), 30000) + + def test_multiple_operations_several_formulas(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = xCalcDoc.getChild("grid_window") + + #enter data + enter_text_to_cell(xGridWindow, "B1", "10") + enter_text_to_cell(xGridWindow, "B2", "2") + enter_text_to_cell(xGridWindow, "B3", "10000") + enter_text_to_cell(xGridWindow, "B4", "2000") + enter_text_to_cell(xGridWindow, "B5", "=B4*(B1-B2)-B3") + enter_text_to_cell(xGridWindow, "C5", "=B5/B4") + + enter_text_to_cell(xGridWindow, "D2", "500") + enter_text_to_cell(xGridWindow, "D3", "1000") + enter_text_to_cell(xGridWindow, "D4", "1500") + enter_text_to_cell(xGridWindow, "D5", "2000") + enter_text_to_cell(xGridWindow, "D6", "2500") + enter_text_to_cell(xGridWindow, "D7", "3000") + enter_text_to_cell(xGridWindow, "D8", "3500") + enter_text_to_cell(xGridWindow, "D9", "4000") + enter_text_to_cell(xGridWindow, "D10", "4500") + enter_text_to_cell(xGridWindow, "D11", "5000") + #Select the range D2:F11 + xGridWindow.executeAction("SELECT", mkPropertyValues({"RANGE": "D2:F11"})) + #Choose Data > Multiple Operations. + with self.ui_test.execute_modeless_dialog_through_command(".uno:TableOperationDialog") as xDialog: + #Formulas = B5 ; Column input cell = B4 + formulas = xDialog.getChild("formulas") + col = xDialog.getChild("col") + formulas.executeAction("TYPE", mkPropertyValues({"TEXT":"$B$5:$C$5"})) + col.executeAction("TYPE", mkPropertyValues({"TEXT":"$B$4"})) + #verify + self.assertEqual(get_cell_by_position(document, 0, 4, 1).getValue(), -6000) + self.assertEqual(get_cell_by_position(document, 0, 4, 2).getValue(), -2000) + self.assertEqual(get_cell_by_position(document, 0, 4, 3).getValue(), 2000) + self.assertEqual(get_cell_by_position(document, 0, 4, 4).getValue(), 6000) + self.assertEqual(get_cell_by_position(document, 0, 4, 5).getValue(), 10000) + self.assertEqual(get_cell_by_position(document, 0, 4, 6).getValue(), 14000) + self.assertEqual(get_cell_by_position(document, 0, 4, 7).getValue(), 18000) + self.assertEqual(get_cell_by_position(document, 0, 4, 8).getValue(), 22000) + self.assertEqual(get_cell_by_position(document, 0, 4, 9).getValue(), 26000) + self.assertEqual(get_cell_by_position(document, 0, 4, 10).getValue(), 30000) + + self.assertEqual(get_cell_by_position(document, 0, 5, 1).getValue(), -12) + self.assertEqual(get_cell_by_position(document, 0, 5, 2).getValue(), -2) + self.assertEqual(round(get_cell_by_position(document, 0, 5, 3).getValue(),2), 1.33) + self.assertEqual(get_cell_by_position(document, 0, 5, 4).getValue(), 3) + self.assertEqual(get_cell_by_position(document, 0, 5, 5).getValue(), 4) + self.assertEqual(round(get_cell_by_position(document, 0, 5, 6).getValue(),2), 4.67) + self.assertEqual(round(get_cell_by_position(document, 0, 5, 7).getValue(),2), 5.14) + self.assertEqual(get_cell_by_position(document, 0, 5, 8).getValue(), 5.5) + self.assertEqual(round(get_cell_by_position(document, 0, 5, 9).getValue(),2), 5.78) + self.assertEqual(get_cell_by_position(document, 0, 5, 10).getValue(), 6) + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests6/scenarios.py b/sc/qa/uitest/calc_tests6/scenarios.py new file mode 100644 index 0000000000..583c0b1ce5 --- /dev/null +++ b/sc/qa/uitest/calc_tests6/scenarios.py @@ -0,0 +1,45 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.calc import enter_text_to_cell + +# uitest Tools - Scenarios + +class scenarios(UITestCase): + + def test_scenarios(self): + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = xCalcDoc.getChild("grid_window") + + #fill B1:B4 with 1, select B1:B4; + enter_text_to_cell(xGridWindow, "B1", "1") + enter_text_to_cell(xGridWindow, "B2", "1") + enter_text_to_cell(xGridWindow, "B3", "1") + enter_text_to_cell(xGridWindow, "B4", "1") + xGridWindow.executeAction("SELECT", mkPropertyValues({"RANGE": "B1:B4"})) + #scenarios - scenario A1 + with self.ui_test.execute_dialog_through_command(".uno:ScenarioManager") as xDialog: + + name = xDialog.getChild("name") + name.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + name.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + name.executeAction("TYPE", mkPropertyValues({"TEXT":"A1"})) + + #next scenarios - scenario B1 + with self.ui_test.execute_dialog_through_command(".uno:ScenarioManager") as xDialog: + + name = xDialog.getChild("name") + name.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + name.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + name.executeAction("TYPE", mkPropertyValues({"TEXT":"B1"})) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests6/shareSpreadsheet.py b/sc/qa/uitest/calc_tests6/shareSpreadsheet.py new file mode 100644 index 0000000000..265d4a2d14 --- /dev/null +++ b/sc/qa/uitest/calc_tests6/shareSpreadsheet.py @@ -0,0 +1,27 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict + +#just open dialog, select Share, check name and cancel [save not allowed in uitest] + +class shareSpreadsheet(UITestCase): + + def test_share_spreadsheet(self): + with self.ui_test.create_doc_in_start_center("calc"): + #dialog shareSpreadsheet + with self.ui_test.execute_dialog_through_command(".uno:ShareDocument", close_button="cancel") as xDialog: + + share = xDialog.getChild("share") + share.executeAction("CLICK", tuple()) + users = xDialog.getChild("users") + self.assertEqual(get_state_as_dict(users)["Children"], "1") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests6/tdf104378.py b/sc/qa/uitest/calc_tests6/tdf104378.py new file mode 100644 index 0000000000..3f1eaa8190 --- /dev/null +++ b/sc/qa/uitest/calc_tests6/tdf104378.py @@ -0,0 +1,33 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.document import get_cell_by_position + +class tdf104378(UITestCase): + + def test_tdf104378(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + enter_text_to_cell(gridwin, "A1", "é 程MySQL連接é 程MySQL連接é 程MySQL連接") + + with self.ui_test.execute_dialog_through_command(".uno:ChineseConversion"): + pass + + + # Without the fix in place, this test would have failed with + # - 远程MySQL連接é 程MySQL連接é 程MySQL連接 + # + 远程MySQL连接远程MySQL连接远程MySQL连接 + self.assertEqual(get_cell_by_position( + document, 0, 0, 0).getString(), "远程MySQL连接远程MySQL连接远程MySQL连接") + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests6/tdf107267.py b/sc/qa/uitest/calc_tests6/tdf107267.py new file mode 100644 index 0000000000..8ff9a19baa --- /dev/null +++ b/sc/qa/uitest/calc_tests6/tdf107267.py @@ -0,0 +1,60 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.framework import UITestCase +from libreoffice.calc.document import get_cell_by_position +from uitest.uihelper.common import select_pos +from uitest.uihelper.common import get_url_for_data_file, get_state_as_dict + +#Bug 107267 - During a sub-total calculation or sum, the data set is not computed well. +class Subtotals(UITestCase): + + + def test_tdf107267(self): + with self.ui_test.load_file(get_url_for_data_file("tdf107267.ods")) as calc_doc: + XcalcDoc = self.xUITest.getTopFocusWindow() + gridwin = XcalcDoc.getChild("grid_window") + # 1. Open the test file + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:F123"})) + # 2. Data->Subtotals + with self.ui_test.execute_dialog_through_command(".uno:DataSubTotals") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + + select_pos(xTabs, "0") + xGroupBy1 = xDialog.getChild("group_by1") + self.assertEqual("Person Number", get_state_as_dict(xGroupBy1)["SelectEntryText"]) + + xColumns1 = xDialog.getChild("columns1") + self.assertEqual("shipping time", get_state_as_dict(xColumns1)["SelectEntryText"]) + + select_pos(xTabs, "1") + xGroupBy2 = xDialog.getChild("group_by2") + self.assertEqual("Person Number", get_state_as_dict(xGroupBy2)["SelectEntryText"]) + + xColumns2 = xDialog.getChild("columns2") + self.assertEqual("shipping time", get_state_as_dict(xColumns2)["SelectEntryText"]) + + select_pos(xTabs, "2") + xGroupBy3 = xDialog.getChild("group_by3") + self.assertEqual("Person Number", get_state_as_dict(xGroupBy3)["SelectEntryText"]) + + xColumns3 = xDialog.getChild("columns3") + self.assertEqual("shipping time", get_state_as_dict(xColumns3)["SelectEntryText"]) + + #verify + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 141).getString(), "Grand Average") + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 142).getString(), "Grand Min") + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 143).getString(), "Grand Max") + + self.assertEqual(round(get_cell_by_position(calc_doc, 0, 5, 141).getValue(), 13), 3.3852459016393) + self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 142).getValue(), 0) + self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 143).getValue(), 26) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests6/tdf116996.py b/sc/qa/uitest/calc_tests6/tdf116996.py new file mode 100644 index 0000000000..d6b21115c5 --- /dev/null +++ b/sc/qa/uitest/calc_tests6/tdf116996.py @@ -0,0 +1,41 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict + +#Bug 116996 - Crash recover on selecting Tools -> Options -> Advanced: Enable experimental features + +class tdf116996(UITestCase): + + def change_experimental_features(self, enabled): + with self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog", close_button="") as xDialogOpt: + xPages = xDialogOpt.getChild("pages") + xLOEntry = xPages.getChild('0') # Libreoffice + xLOEntry.executeAction("EXPAND", tuple()) + xAdvancedEntry = xLOEntry.getChild('10') + xAdvancedEntry.executeAction("SELECT", tuple()) #Libreoffice / Advanced + xexperimental = xDialogOpt.getChild("experimental") + if get_state_as_dict(xexperimental)['Selected'] != enabled: + xexperimental.executeAction("CLICK", tuple()) #enable experimental features + + self.assertEqual(get_state_as_dict(xexperimental)["Selected"], enabled) + + xOKBtn = xDialogOpt.getChild("ok") + + with self.ui_test.execute_blocking_action(xOKBtn.executeAction, args=('CLICK', ()), close_button="no"): + pass + + def test_tdf116996_enable_experimental_feature(self): + with self.ui_test.create_doc_in_start_center("calc"): + try: + self.change_experimental_features("true") + finally: + self.change_experimental_features("false") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests6/tdf118638.py b/sc/qa/uitest/calc_tests6/tdf118638.py new file mode 100644 index 0000000000..c928aa3884 --- /dev/null +++ b/sc/qa/uitest/calc_tests6/tdf118638.py @@ -0,0 +1,54 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.framework import UITestCase +from libreoffice.calc.document import get_cell_by_position +from uitest.uihelper.common import select_pos +from uitest.uihelper.common import select_by_text +from uitest.uihelper.common import get_url_for_data_file +#Bug 118638 - subtotal option loses doesn't contain existing format for column +class Subtotals(UITestCase): + + + def test_tdf118638_subtotal_format(self): + with self.ui_test.load_file(get_url_for_data_file("tdf118638.ods")) as calc_doc: + XcalcDoc = self.xUITest.getTopFocusWindow() + gridwin = XcalcDoc.getChild("grid_window") + # Open the test file + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B15"})) + #Data->Subtotals + with self.ui_test.execute_dialog_through_command(".uno:DataSubTotals") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + xGroupBy = xDialog.getChild("group_by1") + select_by_text(xGroupBy, "Store Name") + xCheckListMenu = xDialog.getChild("grid1") + xTreeList = xCheckListMenu.getChild("columns1") + xEntry = xTreeList.getChild("1") + xEntry.executeAction("CLICK", tuple()) + + #use the SUM function + # xfunctions = xDialog.getChild("functions") + # propsF = {"TEXT": "Sum"} + # actionPropsF = mkPropertyValues(propsF) + # xfunctions.executeAction("SELECT", actionPropsF) + + + #verify + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 15).getString(), "5408 Sum") + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 16).getString(), "Grand Sum") + + self.assertEqual(round(get_cell_by_position(calc_doc, 0, 1, 15).getValue(),12), 238.89) + self.assertEqual(round(get_cell_by_position(calc_doc, 0, 1, 16).getValue(),12), 238.89) + + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 15).getString(), "$238.89") + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 16).getString(), "$238.89") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests6/tdf121263.py b/sc/qa/uitest/calc_tests6/tdf121263.py new file mode 100644 index 0000000000..3b663c4ddf --- /dev/null +++ b/sc/qa/uitest/calc_tests6/tdf121263.py @@ -0,0 +1,39 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from libreoffice.uno.propertyvalue import mkPropertyValues + +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict + +class tdf121263(UITestCase): + + def test_tdf121263_hide_more_sheets(self): + with self.ui_test.create_doc_in_start_center("calc"): + xTopWindow = self.xUITest.getTopFocusWindow() + gridwin = xTopWindow.getChild("grid_window") + + with self.ui_test.execute_dialog_through_command(".uno:Insert"): + pass + with self.ui_test.execute_dialog_through_command(".uno:Insert"): + pass + + gridwin.executeAction("SELECT", mkPropertyValues({"TABLE": "2"})) + #select previous sheet + self.xUITest.executeCommand(".uno:JumpToPrevTableSel") + + #hide sheet + self.xUITest.executeCommand(".uno:Hide") + + #show sheet Dialog + with self.ui_test.execute_dialog_through_command(".uno:Show", close_button="cancel") as xDialog: + treeview = xDialog.getChild("treeview") + self.assertEqual(get_state_as_dict(treeview)["Children"], "2") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests6/tdf147830.py b/sc/qa/uitest/calc_tests6/tdf147830.py new file mode 100644 index 0000000000..521cca6595 --- /dev/null +++ b/sc/qa/uitest/calc_tests6/tdf147830.py @@ -0,0 +1,52 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_url_for_data_file, get_state_as_dict, select_by_text +from libreoffice.calc.document import is_row_hidden + +class tdf147830(UITestCase): + + def test_tdf147830(self): + + with self.ui_test.load_file(get_url_for_data_file("tdf147830.ods")) as calc_doc: + + with self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterSpecialFilter") as xDialog: + xFilterArea = xDialog.getChild("lbfilterarea") + self.assertEqual("- undefined -", get_state_as_dict(xFilterArea)["SelectEntryText"]) + self.assertEqual("5", get_state_as_dict(xFilterArea)["EntryCount"]) + + select_by_text(xFilterArea, "Irgendwo") + + xEditFilterArea = xDialog.getChild("edfilterarea") + self.assertEqual("$Filterkriterien.$A$40:$AMF$60", get_state_as_dict(xEditFilterArea)["Text"]) + + # Without the fix in place, this test would have crashed here + + self.assertFalse(is_row_hidden(calc_doc, 0)) + for i in range(1, 17): + self.assertTrue(is_row_hidden(calc_doc, i)) + + self.assertFalse(is_row_hidden(calc_doc, 17)) + self.assertTrue(is_row_hidden(calc_doc, 18)) + self.assertTrue(is_row_hidden(calc_doc, 19)) + self.assertTrue(is_row_hidden(calc_doc, 20)) + + for i in range(21, 26): + self.assertFalse(is_row_hidden(calc_doc, i)) + + self.assertTrue(is_row_hidden(calc_doc, 27)) + self.assertFalse(is_row_hidden(calc_doc, 28)) + self.assertFalse(is_row_hidden(calc_doc, 29)) + + self.xUITest.executeCommand(".uno:Undo") + + for i in range(30): + self.assertFalse(is_row_hidden(calc_doc, i)) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests6/tdf91726.py b/sc/qa/uitest/calc_tests6/tdf91726.py new file mode 100644 index 0000000000..4c6ff5b0f0 --- /dev/null +++ b/sc/qa/uitest/calc_tests6/tdf91726.py @@ -0,0 +1,50 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict +from libreoffice.uno.propertyvalue import mkPropertyValues +#Bug 91726 - AutoFormat: Crash when using an existing name for a new preset + +class tdf91726(UITestCase): + def test_tdf91726_new_style(self): + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #select A1:E9 + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:E9"})) + #AutoFormat Styles + with self.ui_test.execute_dialog_through_command(".uno:AutoFormat", close_button="") as xDialog: + #add new style "Default" + xadd = xDialog.getChild("add") + + # Use empty close_button to open consecutive dialogs + with self.ui_test.execute_blocking_action( + xadd.executeAction, args=('CLICK', ()), close_button="") as dialog: + nameEntry = dialog.getChild("name_entry") + nameEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"Default"})) + xOKBtn = dialog.getChild("ok") + + with self.ui_test.execute_blocking_action( + xOKBtn.executeAction, args=('CLICK', ()), close_button="") as dialog2: + #Error message: You have entered an invalid name. + #AutoFormat could not be created. + #Try again using a different name. + xOKBtn2 = dialog2.getChild("ok") + + with self.ui_test.execute_blocking_action( + xOKBtn2.executeAction, args=('CLICK', ()), close_button="cancel") as dialog3: + nameEntry = dialog3.getChild("name_entry") + #back to name dialog, LO should not crash + self.assertEqual(get_state_as_dict(nameEntry)["Text"], "Default") + + xCanceltn = xDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCanceltn) + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests7/save_readonly_with_password.py b/sc/qa/uitest/calc_tests7/save_readonly_with_password.py new file mode 100644 index 0000000000..c7d2f829e3 --- /dev/null +++ b/sc/qa/uitest/calc_tests7/save_readonly_with_password.py @@ -0,0 +1,93 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues +from com.sun.star.beans import PropertyValue +from org.libreoffice.unotest import systemPathToFileUrl +from uitest.uihelper.common import select_by_text +from tempfile import TemporaryDirectory +import os.path + +class save_readonly_with_password(UITestCase): + + def test_save_to_xlsx(self): + + with TemporaryDirectory() as tempdir: + xFilePath = os.path.join(tempdir, "readonly_with_password_tmp.xlsx") + + with self.ui_test.create_doc_in_start_center("calc"): + # Save the document + with self.ui_test.execute_dialog_through_command(".uno:Save", close_button="") as xSaveDialog: + xFileName = xSaveDialog.getChild("file_name") + xFileName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xFileName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": xFilePath})) + xFileTypeCombo = xSaveDialog.getChild("file_type") + select_by_text(xFileTypeCombo, "Excel 2007–365 (.xlsx)") + xPasswordCheckButton = xSaveDialog.getChild("password") + xPasswordCheckButton.executeAction("CLICK", tuple()) + xOpen = xSaveDialog.getChild("open") + + with self.ui_test.execute_dialog_through_action(xOpen, "CLICK", close_button="") as xPasswordDialog: + xReadonly = xPasswordDialog.getChild("readonly") + xReadonly.executeAction("CLICK", tuple()) + xNewPassword = xPasswordDialog.getChild("newpassroEntry") + xNewPassword.executeAction("TYPE", mkPropertyValues({"TEXT": "password"})) + xConfirmPassword = xPasswordDialog.getChild("confirmropassEntry") + xConfirmPassword.executeAction("TYPE", mkPropertyValues({"TEXT": "password"})) + + xOk = xPasswordDialog.getChild("ok") + # XLSX confirmation dialog is displayed + with self.ui_test.execute_dialog_through_action(xOk, "CLICK", close_button="save"): + pass + + with self.ui_test.load_file(systemPathToFileUrl(xFilePath), [PropertyValue(Name="Silent", Value=True)]) as document: + self.assertTrue(document.isReadonly()) + + with self.ui_test.execute_dialog_through_command(".uno:EditDoc") as xDialog: + xPassword = xDialog.getChild("newpassEntry") + xPassword.executeAction("TYPE", mkPropertyValues({"TEXT": "password"})) + + self.assertFalse(document.isReadonly()) + + def test_save_to_ods(self): + + with TemporaryDirectory() as tempdir: + xFilePath = os.path.join(tempdir, "readonly_with_password_tmp.ods") + + with self.ui_test.create_doc_in_start_center("calc"): + # Save the document + with self.ui_test.execute_dialog_through_command(".uno:Save", close_button="") as xSaveDialog: + xFileName = xSaveDialog.getChild("file_name") + xFileName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xFileName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": xFilePath})) + xPasswordCheckButton = xSaveDialog.getChild("password") + xPasswordCheckButton.executeAction("CLICK", tuple()) + xOpen = xSaveDialog.getChild("open") + + with self.ui_test.execute_dialog_through_action(xOpen, "CLICK") as xPasswordDialog: + xReadonly = xPasswordDialog.getChild("readonly") + xReadonly.executeAction("CLICK", tuple()) + xNewPassword = xPasswordDialog.getChild("newpassroEntry") + xNewPassword.executeAction("TYPE", mkPropertyValues({"TEXT": "password"})) + xConfirmPassword = xPasswordDialog.getChild("confirmropassEntry") + xConfirmPassword.executeAction("TYPE", mkPropertyValues({"TEXT": "password"})) + + with self.ui_test.load_file(systemPathToFileUrl(xFilePath), [PropertyValue(Name="Silent", Value=True)]) as document: + + self.assertTrue(document.isReadonly()) + + with self.ui_test.execute_dialog_through_command(".uno:EditDoc") as xDialog: + xPassword = xDialog.getChild("newpassEntry") + xPassword.executeAction("TYPE", mkPropertyValues({"TEXT": "password"})) + + self.assertFalse(document.isReadonly()) + +# 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 0000000000..8d3c4599ce --- /dev/null +++ b/sc/qa/uitest/calc_tests7/tdf106667.py @@ -0,0 +1,34 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.uno.propertyvalue import mkPropertyValues +from libreoffice.calc.document import get_cell_by_position + +class tdf106667(UITestCase): + + def test_tdf106667_about_dlg_all(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + enter_text_to_cell(gridwin, "A1", "A") + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A1000"})) + + self.xUITest.executeCommand(".uno:FillDown") + + self.xUITest.executeCommand(".uno:SelectAll") + + with self.ui_test.execute_dialog_through_command(".uno:About", close_button="btnClose"): + pass + + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "A") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests7/tdf117987.py b/sc/qa/uitest/calc_tests7/tdf117987.py new file mode 100644 index 0000000000..2a15dedcb8 --- /dev/null +++ b/sc/qa/uitest/calc_tests7/tdf117987.py @@ -0,0 +1,29 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues +from libreoffice.calc.document import get_cell_by_position + +class tdf117987(UITestCase): + + def test_highlight_cell_after_moving_cursor(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + colorProperty = mkPropertyValues({"BackgroundColor": 16776960}) + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + self.xUITest.executeCommandWithParameters(".uno:BackgroundColor", colorProperty) + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + self.xUITest.executeCommandWithParameters(".uno:BackgroundColor", colorProperty) + + self.assertEqual(get_cell_by_position(document, 0, 0, 1).CellBackColor, 16776960) + +# 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 0000000000..c0d9f5a2a9 --- /dev/null +++ b/sc/qa/uitest/calc_tests7/tdf122509.py @@ -0,0 +1,43 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file +from uitest.uihelper.common import select_pos +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + +#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 + with self.ui_test.load_file(get_url_for_data_file("tdf122509.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #select cell A1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #format - cell + with self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") #tab Numbers + xnegnumred = xDialog.getChild("negnumred") + 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 + #verify; no crashes + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 0).getValue(), 2) + +# 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 0000000000..8d1d6daebc --- /dev/null +++ b/sc/qa/uitest/calc_tests7/tdf123122.py @@ -0,0 +1,48 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import select_pos +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 + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #select cell A1 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #format - cell + with self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") #tab Numbers + 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 + + #verify + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #format - cell + with self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") #tab Numbers + xliststore1 = xDialog.getChild("categorylb") #1st list / Category + 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") + +# 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 0000000000..44c6ba4b28 --- /dev/null +++ b/sc/qa/uitest/calc_tests7/tdf124896.py @@ -0,0 +1,24 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_url_for_data_file + +# Bug 124896 - CRASH: deleting sheet + +class tdf124896(UITestCase): + def test_tdf124896_crash_delete_sheet(self): + with self.ui_test.load_file(get_url_for_data_file("tdf124896.ods")) as calc_doc: + # Remove X Bar R Chart (2) sheet + with self.ui_test.execute_dialog_through_command(".uno:Remove", close_button="yes"): + pass + + #verify; no crashes + self.assertEqual(calc_doc.Sheets.getCount(), 2) + +# 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 0000000000..cc49edd210 --- /dev/null +++ b/sc/qa/uitest/calc_tests7/tdf125030.py @@ -0,0 +1,33 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from 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): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #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") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests7/tdf137397.py b/sc/qa/uitest/calc_tests7/tdf137397.py new file mode 100644 index 0000000000..f1d84bf37a --- /dev/null +++ b/sc/qa/uitest/calc_tests7/tdf137397.py @@ -0,0 +1,41 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import change_measurement_unit + +class tdf137397(UITestCase): + + def test_tdf137397(self): + + with self.ui_test.load_file(get_url_for_data_file("tdf137397.ods")): + + with change_measurement_unit(self, 'Centimeter'): + + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWin = xCalcDoc.getChild("grid_window") + + xGridWin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Shape"})) + + self.xUITest.executeCommand(".uno:Sidebar") + xGridWin.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "TextPropertyPanel"})) + + xChild = self.ui_test.wait_until_child_is_available('selectwidth') + self.assertEqual(get_state_as_dict(xChild)['Text'], '6.00 cm') + + # Without the fix in place, this test would have failed with + # AssertionError: '-14,585,309.84 cm' != '2.00 cm' + xChild = self.ui_test.wait_until_child_is_available('selectheight') + self.assertEqual(get_state_as_dict(xChild)['Text'], '2.00 cm') + + + self.xUITest.executeCommand(".uno:Sidebar") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests7/tdf150044.py b/sc/qa/uitest/calc_tests7/tdf150044.py new file mode 100644 index 0000000000..ffa0077879 --- /dev/null +++ b/sc/qa/uitest/calc_tests7/tdf150044.py @@ -0,0 +1,65 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues +from tempfile import TemporaryDirectory +import os.path + +class save_shared_readonly_with_password(UITestCase): + + def test_save_to_shared_ods(self): + + with TemporaryDirectory() as tempdir: + xFilePath = os.path.join(tempdir, "shared_readonly_with_password_tmp.ods") + + with self.ui_test.create_doc_in_start_center("calc"): + with self.ui_test.execute_dialog_through_command(".uno:ShareDocument", close_button="") as xShareDocumentDialog: + xShareCheckButton = xShareDocumentDialog.getChild("share") + xShareCheckButton.executeAction("CLICK", tuple()) + xOk = xShareDocumentDialog.getChild("ok") + # Save the document + with self.ui_test.execute_dialog_through_action(xOk, "CLICK", close_button="") as xSaveDialog: + xFileName = xSaveDialog.getChild("file_name") + xFileName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xFileName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": xFilePath})) + xPasswordCheckButton = xSaveDialog.getChild("password") + xPasswordCheckButton.executeAction("CLICK", tuple()) + xOpen = xSaveDialog.getChild("open") + + with self.ui_test.execute_dialog_through_action(xOpen, "CLICK") as xPasswordDialog: + xReadonly = xPasswordDialog.getChild("readonly") + xReadonly.executeAction("CLICK", tuple()) + xNewPassword = xPasswordDialog.getChild("newpassroEntry") + xNewPassword.executeAction("TYPE", mkPropertyValues({"TEXT": "password"})) + xConfirmPassword = xPasswordDialog.getChild("confirmropassEntry") + xConfirmPassword.executeAction("TYPE", mkPropertyValues({"TEXT": "password"})) + + with self.ui_test.execute_dialog_through_command(".uno:Open", close_button="") as xOpenDialog: + # Open document + xFileName = xOpenDialog.getChild("file_name") + xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": xFilePath})) + xOpenBtn = xOpenDialog.getChild("open") + xOpenBtn.executeAction("CLICK", tuple()) + + xDialog = self.ui_test.wait_for_top_focus_window('SharedWarningDialog') + xOk = xDialog.getChild("ok") + xOk.executeAction("CLICK", tuple()) + + document = self.ui_test.get_component() + self.assertTrue(document.isReadonly()) + + with self.ui_test.execute_dialog_through_command(".uno:EditDoc") as xDialog: + # check that we have a password dialog for editing the shared document + xPassword = xDialog.getChild("newpassEntry") + xPassword.executeAction("TYPE", mkPropertyValues({"TEXT": "password"})) + + self.assertFalse(document.isReadonly()) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests7/tdf150288.py b/sc/qa/uitest/calc_tests7/tdf150288.py new file mode 100644 index 0000000000..c7078089cd --- /dev/null +++ b/sc/qa/uitest/calc_tests7/tdf150288.py @@ -0,0 +1,57 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.uno.propertyvalue import mkPropertyValues +from libreoffice.calc.document import get_cell_by_position +from uitest.uihelper.common import select_by_text + +class tdf150288(UITestCase): + + def change_date_pattern(self, pattern): + with self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") as xDialog: + xPages = xDialog.getChild("pages") + xLanguageEntry = xPages.getChild('2') + xLanguageEntry.executeAction("EXPAND", tuple()) + xxLanguageEntryGeneralEntry = xLanguageEntry.getChild('0') + xxLanguageEntryGeneralEntry.executeAction("SELECT", tuple()) + + xDatePatterns = xDialog.getChild("datepatterns") + xLocaleSetting = xDialog.getChild("localesetting") + + select_by_text(xLocaleSetting, "English (USA)") + + xDatePatterns.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xDatePatterns.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xDatePatterns.executeAction("TYPE", mkPropertyValues({"TEXT": pattern})) + + def test_tdf150288(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + + try: + self.change_date_pattern("D/M/Y;D/M") + + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWin = xCalcDoc.getChild("grid_window") + + enter_text_to_cell(xGridWin, "A1", "31/8/22") + enter_text_to_cell(xGridWin, "A2", "1/8/22") + + self.assertEqual("08/31/22", get_cell_by_position(document, 0, 0, 0).getString()) + + # Without the fix in place, this test would have failed with + # AssertionError: '08/01/22' != '01/08/22' + self.assertEqual("08/01/22", get_cell_by_position(document, 0, 0, 1).getString()) + + finally: + # reset date pattern to default + self.change_date_pattern("M/D/Y;M/D") + +# 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 0000000000..81d15200fd --- /dev/null +++ b/sc/qa/uitest/calc_tests7/tdf31805.py @@ -0,0 +1,41 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_url_for_data_file +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + +#Bug 31805 - Deleting a column or row from merged cells + +class tdf31805(UITestCase): + def test_tdf31805_delete_column_merged(self): + with self.ui_test.load_file(get_url_for_data_file("tdf31805.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #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(calc_doc, 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(calc_doc, 0, 2, 4).getIsMerged(), True) #C5 + self.assertEqual(get_cell_by_position(calc_doc, 0, 6, 4).getIsMerged(), False) #G5 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A11"})) + self.xUITest.executeCommand(".uno:DeleteRows") + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 4).getIsMerged(), True) #C5 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D1"})) + self.xUITest.executeCommand(".uno:DeleteColumns") + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 4).getIsMerged(), True) #C5 + +# 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 0000000000..d8acdd8c16 --- /dev/null +++ b/sc/qa/uitest/calc_tests7/tdf91425.py @@ -0,0 +1,36 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_url_for_data_file +from libreoffice.calc.document import get_cell_by_position + +#Bug 91425 - CRASH - Calc Insert Columns Left + +class tdf91425(UITestCase): + def test_tdf91425_insert_columns_left(self): + with self.ui_test.load_file(get_url_for_data_file("tdf91425.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #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(calc_doc, 0, 3, 0).getString(), "C") + #undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 0).getString(), "C") + #redo + self.xUITest.executeCommand(".uno:Redo") + self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 0).getString(), "C") + +# 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 0000000000..ec8fa2ae9a --- /dev/null +++ b/sc/qa/uitest/calc_tests8/navigator.py @@ -0,0 +1,184 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file + +class navigator(UITestCase): + + def test_rename_sheet(self): + with 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("NavigatorPanel") + 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') + + with self.ui_test.execute_dialog_through_command(".uno:RenameTable") as xDialog: + xname_entry = xDialog.getChild("name_entry") + xname_entry.executeAction("TYPE", mkPropertyValues({"TEXT": "S1"})) + + xCalcDoc = self.xUITest.getTopFocusWindow() + xNavigatorPanel = xCalcDoc.getChild("NavigatorPanel") + 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("NavigatorPanel") + 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") + + def test_tdf98493(self): + + with 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("NavigatorPanel") + xToolBar = xNavigatorPanel.getChild("toolbox2") + xToolBar.executeAction("CLICK", mkPropertyValues({"POS": "0"})) # 'toggle' button + + 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") + + + def test_tdf134390(self): + with self.ui_test.create_doc_in_start_center("calc"): + 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("NavigatorPanel") + xToolBar = xNavigatorPanel.getChild("toolbox2") + xToolBar.executeAction("CLICK", mkPropertyValues({"POS": "0"})) # 'toggle' button + + xRow = xNavigatorPanel.getChild('row') + xColumn = xNavigatorPanel.getChild('column') + + self.assertEqual(get_state_as_dict(xColumn)['Value'], '1') + self.assertEqual(get_state_as_dict(xRow)['Value'], '1') + self.assertEqual(get_state_as_dict(xGridWin)["CurrentRow"], "0") + self.assertEqual(get_state_as_dict(xGridWin)["CurrentColumn"], "0") + + xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit') + + xColumn.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xColumn.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xColumn.executeAction("TYPE", mkPropertyValues({"TEXT":"B"})) + xColumn.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) + xToolkit.processEventsToIdle() +# disable flakey UITest +# self.assertEqual(get_state_as_dict(xColumn)['Value'], '2') + + xRow.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xRow.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xRow.executeAction("TYPE", mkPropertyValues({"TEXT":"2"})) + xRow.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) + xToolkit.processEventsToIdle() + self.assertEqual(get_state_as_dict(xRow)['Value'], '2') + + # Without the fix in place, this test would have failed with + # AssertionError: '0' != '1' + self.assertEqual(get_state_as_dict(xGridWin)["CurrentRow"], "1") +# disable flaky test +# self.assertEqual(get_state_as_dict(xGridWin)["CurrentColumn"], "1") + + self.xUITest.executeCommand(".uno:Sidebar") + + + def test_tdf141973(self): + with self.ui_test.load_file(get_url_for_data_file("tdf141973.ods")): + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWin = xCalcDoc.getChild("grid_window") + + self.xUITest.executeCommand(".uno:Sidebar") + + # Without the fix in place, this test would have crashed here + xGridWin.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "ScNavigatorPanel"})) + + xCalcDoc = self.xUITest.getTopFocusWindow() + xNavigatorPanel = xCalcDoc.getChild("NavigatorPanel") + xContentBox = xNavigatorPanel.getChild('contentbox') + xDrawings = xContentBox.getChild("7") + self.assertEqual('Drawing objects', get_state_as_dict(xDrawings)['Text']) + self.assertEqual(len(xDrawings.getChildren()), 1) + self.assertEqual('withname', get_state_as_dict(xDrawings.getChild('0'))['Text']) + + self.xUITest.executeCommand(".uno:Sidebar") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests8/tdf119343.py b/sc/qa/uitest/calc_tests8/tdf119343.py new file mode 100644 index 0000000000..0d4581f18b --- /dev/null +++ b/sc/qa/uitest/calc_tests8/tdf119343.py @@ -0,0 +1,33 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_url_for_data_file + +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + + +# 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 + with self.ui_test.load_file(get_url_for_data_file("tdf119343.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + 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(calc_doc, 0, 12, 295).getString(), "Q11005355") + self.assertEqual(get_cell_by_position(calc_doc, 0, 12, 294).getString(), "Q1099565") + self.assertEqual(get_cell_by_position(calc_doc, 0, 12, 293).getString(), "Q108420") + +# 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 0000000000..f515b265f9 --- /dev/null +++ b/sc/qa/uitest/calc_tests8/tdf124829.py @@ -0,0 +1,26 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_url_for_data_file + + +# Bug 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 + with self.ui_test.load_file(get_url_for_data_file("tdf124829.ods")) as calc_doc: + 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(calc_doc.Sheets.getCount(), 6) + +# 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 0000000000..89314b2690 --- /dev/null +++ b/sc/qa/uitest/calc_tests8/tdf125051.py @@ -0,0 +1,40 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.calc import enter_text_to_cell + +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + + +# Bug 125051 - EDITING: CRASH when start SpellCheck +class tdf125051(UITestCase): + def test_tdf125051_crash_spelling_dialog(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + enter_text_to_cell(gridwin, "A1", "text") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + with self.ui_test.execute_dialog_through_command(".uno:SpellDialog"): + pass + + xDialog = self.xUITest.getTopFocusWindow() #Spelling dialog + #open options + optionsBtn = xDialog.getChild("options") + + self.ui_test.execute_dialog_through_action(optionsBtn, "CLICK", None, "DialogExecute", "cancel") + + 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") + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests8/tdf126248.py b/sc/qa/uitest/calc_tests8/tdf126248.py new file mode 100644 index 0000000000..9e65f9c3d5 --- /dev/null +++ b/sc/qa/uitest/calc_tests8/tdf126248.py @@ -0,0 +1,89 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.calc import enter_text_to_cell +from uitest.uihelper.common import select_pos +from uitest.uihelper.common import select_by_text + +class tdf126248(UITestCase): + + def assertFontName(self, gridwin, fontName): + + #Open the sidebar + self.xUITest.executeCommand(".uno:Sidebar") + gridwin.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "TextPropertyPanel"})) + + xCalcDoc = self.xUITest.getTopFocusWindow() + + xFontName = xCalcDoc.getChild("fontnamecombobox") + self.ui_test.wait_until_property_is_updated(xFontName, "Text", fontName) + self.assertEqual(fontName, get_state_as_dict(xFontName)['Text']) + + #Close the sidebar + self.xUITest.executeCommand(".uno:Sidebar") + + def changeLocalSetting(self, language): + with self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") as xDialog: + xPages = xDialog.getChild("pages") + xLanguageEntry = xPages.getChild('2') + xLanguageEntry.executeAction("EXPAND", tuple()) + xxLanguageEntryGeneralEntry = xLanguageEntry.getChild('0') + xxLanguageEntryGeneralEntry.executeAction("SELECT", tuple()) + + # Check asian support is enabled + asianlanguage = xDialog.getChild("asiansupport") + self.assertEqual("true", get_state_as_dict(asianlanguage)['Selected']) + + localeSetting = xDialog.getChild("localesetting") + select_by_text(localeSetting, language) + self.ui_test.wait_until_property_is_updated(localeSetting, 'SelectEntryText', language) + self.assertEqual(language, get_state_as_dict(localeSetting)['SelectEntryText']) + + def test_tdf126248(self): + + with self.ui_test.create_doc_in_start_center("calc"): + + try: + self.changeLocalSetting("Chinese (traditional)") + + with self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") + + # Get current font names from the Format Cell dialog + westFontName = get_state_as_dict(xDialog.getChild("edWestFontName"))['Text'] + eastFontName = get_state_as_dict(xDialog.getChild("edCJKFontName"))['Text'] + + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + enter_text_to_cell(gridwin, "A1", "Test") + + # Without the fix in place, this test would have failed here + self.assertFontName(gridwin, westFontName) + + enter_text_to_cell(gridwin, "B1", "測試") + + self.assertFontName(gridwin, eastFontName) + + finally: + self.changeLocalSetting("English (USA)") + + enter_text_to_cell(gridwin, "C1", "Test") + + self.assertFontName(gridwin, westFontName) + + enter_text_to_cell(gridwin, "D1", "測試") + + self.assertFontName(gridwin, eastFontName) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests8/tdf131638.py b/sc/qa/uitest/calc_tests8/tdf131638.py new file mode 100644 index 0000000000..bafbfc5d85 --- /dev/null +++ b/sc/qa/uitest/calc_tests8/tdf131638.py @@ -0,0 +1,26 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from uitest.uihelper.common import get_url_for_data_file +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + +class tdf137726(UITestCase): + + def test_tdf137726(self): + with self.ui_test.load_file(get_url_for_data_file("tdf131638.ods")) as calc_doc: + MainWindow = self.xUITest.getTopFocusWindow() + grid_window = MainWindow.getChild("grid_window") + grid_window.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + grid_window.executeAction("TYPE", mkPropertyValues({"TEXT": "-/2"})) + grid_window.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 0).getString(), "-/2") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests8/tdf137726.py b/sc/qa/uitest/calc_tests8/tdf137726.py new file mode 100644 index 0000000000..d80b51b6dc --- /dev/null +++ b/sc/qa/uitest/calc_tests8/tdf137726.py @@ -0,0 +1,27 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase + +class tdf137726(UITestCase): + + def test_tdf137726(self): + with self.ui_test.create_doc_in_start_center("calc"): + # three dialogs are displayed one after the other, click OK in all of them + with self.ui_test.execute_dialog_through_command(".uno:DataDataPilotRun"): + pass + + for i in range(2): + xDialog = self.xUITest.getTopFocusWindow() + xOKBtn = xDialog.getChild('ok') + self.ui_test.close_dialog_through_button(xOKBtn) + + # Without the fix in place, this test would have hung here + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests8/tdf144457.py b/sc/qa/uitest/calc_tests8/tdf144457.py new file mode 100644 index 0000000000..575171580a --- /dev/null +++ b/sc/qa/uitest/calc_tests8/tdf144457.py @@ -0,0 +1,47 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict +from libreoffice.uno.propertyvalue import mkPropertyValues + +class tdf144457(UITestCase): + + def test_tdf144457(self): + + with self.ui_test.create_doc_in_start_center("calc"): + + with self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") as xDialog: + xPages = xDialog.getChild("pages") + xLanguageEntry = xPages.getChild('2') + xLanguageEntry.executeAction("EXPAND", tuple()) + xxLanguageEntryGeneralEntry = xLanguageEntry.getChild('0') + xxLanguageEntryGeneralEntry.executeAction("SELECT", tuple()) + + xDatePatterns = xDialog.getChild("datepatterns") + + self.assertEqual("M/D/Y;M/D", get_state_as_dict(xDatePatterns)['Text']) + + try: + xDatePatterns.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xDatePatterns.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xDatePatterns.executeAction("TYPE", mkPropertyValues({"TEXT":"m/d/y"})) + + # Without the fix in place, this test would have failed with + # AssertionError: 'M/D/Y' != 'm/M/dM/M/d/M/M/dM/M/d/yM/M/dM/M/d/M/M/dM/M/d/y' + self.assertEqual("M/D/Y", get_state_as_dict(xDatePatterns)['Text']) + finally: + # reset default value + xDatePatterns.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xDatePatterns.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xDatePatterns.executeAction("TYPE", mkPropertyValues({"TEXT":"m/d/y;m/d"})) + + self.assertEqual("M/D/Y;M/D", get_state_as_dict(xDatePatterns)['Text']) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests8/tdf144940.py b/sc/qa/uitest/calc_tests8/tdf144940.py new file mode 100644 index 0000000000..9e577bf728 --- /dev/null +++ b/sc/qa/uitest/calc_tests8/tdf144940.py @@ -0,0 +1,61 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import select_pos +from libreoffice.uno.propertyvalue import mkPropertyValues +from tempfile import TemporaryDirectory +from org.libreoffice.unotest import systemPathToFileUrl +import os.path + +class tdf144940(UITestCase): + + def test_tdf144940(self): + + with TemporaryDirectory() as tempdir: + xFilePath = os.path.join(tempdir, "tdf144940-tmp.ods") + + with self.ui_test.create_doc_in_start_center("calc"): + + with self.ui_test.execute_dialog_through_command(".uno:PageFormatDialog") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "4") + + xCheckHeaderOn = xDialog.getChild("checkHeaderOn") + xCheckSameFP = xDialog.getChild("checkSameFP") + xCheckSameLR = xDialog.getChild("checkSameLR") + + self.assertEqual("true", get_state_as_dict(xCheckHeaderOn)["Selected"]) + self.assertEqual("true", get_state_as_dict(xCheckSameLR)["Selected"]) + self.assertEqual("false", get_state_as_dict(xCheckSameFP)["Selected"]) + + xCheckSameFP.executeAction("CLICK", tuple()) + + self.assertEqual("true", get_state_as_dict(xCheckSameFP)["Selected"]) + + with self.ui_test.execute_dialog_through_command(".uno:Save", close_button="open") as xSaveDialog: + xFileName = xSaveDialog.getChild("file_name") + xFileName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xFileName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": xFilePath})) + + with self.ui_test.load_file(systemPathToFileUrl(xFilePath)) as document: + + xPageStyles = document.StyleFamilies[1] + xDefaultPageStyle = xPageStyles[0] + + # Without the fix in place, this test would have failed with + # AssertionError: False is not true + self.assertTrue(xDefaultPageStyle.HeaderOn) + self.assertTrue(xDefaultPageStyle.FooterOn) + self.assertTrue(xDefaultPageStyle.FirstPageHeaderIsShared) + self.assertTrue(xDefaultPageStyle.FirstPageFooterIsShared) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests8/tdf147086.py b/sc/qa/uitest/calc_tests8/tdf147086.py new file mode 100755 index 0000000000..1be3d6adb2 --- /dev/null +++ b/sc/qa/uitest/calc_tests8/tdf147086.py @@ -0,0 +1,56 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues +from com.sun.star.beans import PropertyValue +from org.libreoffice.unotest import systemPathToFileUrl +from uitest.uihelper.common import select_by_text +from tempfile import TemporaryDirectory +import os.path + +#Bug 147086 - Password in .xlsx creates readonly sheet + +class tdf147086(UITestCase): + + def test_tdf147086(self): + + with TemporaryDirectory() as tempdir: + xFilePath = os.path.join(tempdir, "tdf147086_tmp.xlsx") + + with self.ui_test.create_doc_in_start_center("calc"): + # Save the document + with self.ui_test.execute_dialog_through_command(".uno:Save", close_button="") as xSaveDialog: + xFileName = xSaveDialog.getChild("file_name") + xFileName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xFileName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": xFilePath})) + xFileTypeCombo = xSaveDialog.getChild("file_type") + select_by_text(xFileTypeCombo, "Excel 2007–365 (.xlsx)") + xPasswordCheckButton = xSaveDialog.getChild("password") + xPasswordCheckButton.executeAction("CLICK", tuple()) + xOpen = xSaveDialog.getChild("open") + + with self.ui_test.execute_dialog_through_action(xOpen, "CLICK", close_button="") as xPasswordDialog: + xReadonly = xPasswordDialog.getChild("readonly") + xReadonly.executeAction("CLICK", tuple()) + + xOk = xPasswordDialog.getChild("ok") + # XLSX confirmation dialog is displayed + with self.ui_test.execute_dialog_through_action(xOk, "CLICK", close_button="save"): + pass + + with self.ui_test.load_file(systemPathToFileUrl(xFilePath), [PropertyValue(Name="Silent", Value=True)]) as document: + + self.assertTrue(document.isReadonly()) + + self.xUITest.executeCommand(".uno:EditDoc") + + self.assertFalse(document.isReadonly()) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests8/tdf152717.py b/sc/qa/uitest/calc_tests8/tdf152717.py new file mode 100644 index 0000000000..7083c651ae --- /dev/null +++ b/sc/qa/uitest/calc_tests8/tdf152717.py @@ -0,0 +1,30 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_url_for_data_file +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.document import get_cell_by_position + +class tdf152717(UITestCase): + + def test_tdf152717(self): + + with self.ui_test.create_doc_in_start_center("calc") as calc_document: + calcDoc = self.xUITest.getTopFocusWindow() + + xGridWindow = calcDoc.getChild("grid_window") + + # Use an existing document + enter_text_to_cell(xGridWindow, "A1", "=DDE(\"soffice\";\"" + get_url_for_data_file("tdf119954.ods") + "\";\"Sheet1.A1\")") + + # Without the fix in place, this test would have failed with + # AssertionError: 1.0 != 0.0 + self.assertEqual(1.0, get_cell_by_position(calc_document, 0, 0, 0).getValue()) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests8/tdf54768.py b/sc/qa/uitest/calc_tests8/tdf54768.py new file mode 100644 index 0000000000..a4342fb8e2 --- /dev/null +++ b/sc/qa/uitest/calc_tests8/tdf54768.py @@ -0,0 +1,32 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_url_for_data_file + +class tdf54768(UITestCase): + def test_tdf54768(self): + # This document contains an image with an original size of 7.99cm x 5.74cm. + # The image has been cropped 2.73cm at the top. + # Also, it has been resized to a width of 4.04cm. + with self.ui_test.load_file(get_url_for_data_file("tdf54768.ods")) as document: + xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") + + # select the image + xGridWin.executeAction("SELECT", mkPropertyValues({"OBJECT":"Image"})) + + # click "Original Size" + self.xUITest.executeCommand(".uno:OriginalSize") + + # tdf#155863: Without the fix in place, the image stays cropped, + # but stretches to the size of original image + self.assertEqual(7988, document.DrawPages[0].getByIndex(0).Size.Width) + self.assertEqual(3005, document.DrawPages[0].getByIndex(0).Size.Height) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests9/forms.py b/sc/qa/uitest/calc_tests9/forms.py new file mode 100644 index 0000000000..35f9feb418 --- /dev/null +++ b/sc/qa/uitest/calc_tests9/forms.py @@ -0,0 +1,30 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file +from libreoffice.uno.propertyvalue import mkPropertyValues + +class Forms(UITestCase): + + def test_tdf131000(self): + + with self.ui_test.load_file(get_url_for_data_file("tdf131000.ods")): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "form"})) + + # Without the fix in place, this test would have hung here + with self.ui_test.execute_modeless_dialog_through_command(".uno:ControlProperties", close_button=""): + + xCellRange = self.ui_test.wait_until_child_is_available('textfield-Source cell range') + + self.assertEqual("A1:A7000", get_state_as_dict(xCellRange)['Text']) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests9/hashIncompatible.py b/sc/qa/uitest/calc_tests9/hashIncompatible.py new file mode 100644 index 0000000000..07ab21db8e --- /dev/null +++ b/sc/qa/uitest/calc_tests9/hashIncompatible.py @@ -0,0 +1,71 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from uitest.uihelper.common import get_url_for_data_file +from uitest.uihelper.common import select_by_text +from libreoffice.uno.propertyvalue import mkPropertyValues +from tempfile import TemporaryDirectory +import os.path + +class hashIncompatible(UITestCase): + + def test_hashIncompatible(self): + + with TemporaryDirectory() as tempdir: + xFilePath = os.path.join(tempdir, "hashIncompatible-temp.ods") + + with self.ui_test.load_file(get_url_for_data_file("hashIncompatible.xlsx")): + + # Save the XLSX document as ODS with a sheet protected with an unsupported hash format + with self.ui_test.execute_dialog_through_command(".uno:SaveAs", close_button="") as xSaveDialog: + xFileName = xSaveDialog.getChild("file_name") + xFileName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xFileName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": xFilePath})) + xFileTypeCombo = xSaveDialog.getChild("file_type") + select_by_text(xFileTypeCombo, "ODF Spreadsheet (.ods)") + + xOpen = xSaveDialog.getChild("open") + + with self.ui_test.execute_dialog_through_action(xOpen, "CLICK", close_button="") as xRetypePasswordDialog: + # hash error dialog is still displayed (only disabled for the recovery file) + xCancel = xRetypePasswordDialog.getChild("cancel") + + with self.ui_test.execute_dialog_through_action(xCancel, "CLICK"): + # Write error dialog is displayed + pass + + # Check the document is not created + self.assertFalse(os.path.isfile(xFilePath)) + + # Now check it can be saved to ODS using the correct password + with self.ui_test.execute_dialog_through_command(".uno:SaveAs", close_button="") as xSaveDialog: + xFileName = xSaveDialog.getChild("file_name") + xFileName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xFileName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": xFilePath})) + xFileTypeCombo = xSaveDialog.getChild("file_type") + select_by_text(xFileTypeCombo, "ODF Spreadsheet (.ods)") + + xOpen = xSaveDialog.getChild("open") + + with self.ui_test.execute_dialog_through_action(xOpen, "CLICK") as xRetypePasswordDialog: + xRetypeBtn = xRetypePasswordDialog.getChild("button") + + with self.ui_test.execute_blocking_action( + xRetypeBtn.executeAction, args=('CLICK', ())) as xPasswordDialog: + xNewPassEntry = xPasswordDialog.getChild("newpassEntry") + xConfirmPassEntry = xPasswordDialog.getChild("confirmpassEntry") + xNewPassEntry.executeAction("TYPE", mkPropertyValues({"TEXT": "Hello"})) + xConfirmPassEntry.executeAction("TYPE", mkPropertyValues({"TEXT": "Hello"})) + + self.assertTrue(os.path.isfile(xFilePath)) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests9/pivotTable.py b/sc/qa/uitest/calc_tests9/pivotTable.py new file mode 100644 index 0000000000..bb985429f9 --- /dev/null +++ b/sc/qa/uitest/calc_tests9/pivotTable.py @@ -0,0 +1,99 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file +from libreoffice.calc.document import get_cell_by_position + +class pivotTable(UITestCase): + + def test_cancelButton(self): + + # This is basically a test for cf93998eb5abc193d95ae5433bf4dfd11a9d62d8 + # Without the fix in place, this test would have crashed + + with self.ui_test.load_file(get_url_for_data_file("basicPivotTable.ods")): + + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + gridwin.executeAction("SELECT", mkPropertyValues({"TABLE": "1"})) + + self.xUITest.executeCommand(".uno:GoUp") + + + with self.ui_test.execute_dialog_through_command(".uno:DataDataPilotRun") as xDialog: + xFields = xDialog.getChild("listbox-fields") + self.assertEqual(2, len(xFields.getChildren())) + self.assertEqual("qtX", get_state_as_dict(xFields.getChild('0'))['Text']) + self.assertEqual("qtY", get_state_as_dict(xFields.getChild('1'))['Text']) + + xColumns = xDialog.getChild("listbox-column") + self.assertEqual(1, len(xColumns.getChildren())) + self.assertEqual("Data", get_state_as_dict(xColumns.getChild('0'))['Text']) + + xPage = xDialog.getChild("listbox-page") + self.assertEqual(1, len(xPage.getChildren())) + xPageChild = xPage.getChild('0') + self.assertEqual("qtX", get_state_as_dict(xPageChild)['Text']) + + with self.ui_test.execute_blocking_action(xPageChild.executeAction, args=('DOUBLECLICK', ())) as dialog: + optionBtn = dialog.getChild("options") + + with self.ui_test.execute_blocking_action(optionBtn.executeAction, args=('CLICK', ())) as dialog2: + xEmptyLine = dialog2.getChild("emptyline") + + xEmptyLine.executeAction("CLICK", tuple()) + self.assertEqual('true', get_state_as_dict(xEmptyLine)['Selected']) + + with self.ui_test.execute_blocking_action(optionBtn.executeAction, args=('CLICK', ()), close_button="cancel") as dialog2: + xEmptyLine = dialog2.getChild("emptyline") + + xEmptyLine.executeAction("CLICK", tuple()) + self.assertEqual('false', get_state_as_dict(xEmptyLine)['Selected']) + + with self.ui_test.execute_blocking_action(optionBtn.executeAction, args=('CLICK', ())) as dialog2: + xEmptyLine = dialog2.getChild("emptyline") + + self.assertEqual('true', get_state_as_dict(xEmptyLine)['Selected']) + + def test_popup(self): + with self.ui_test.load_file(get_url_for_data_file("pivotTable.ods")) as calc_doc: + + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + self.assertEqual("a", get_cell_by_position(calc_doc, 0, 3, 1).getString()) + self.assertEqual("b", get_cell_by_position(calc_doc, 0, 3, 2).getString()) + self.assertEqual("m", get_cell_by_position(calc_doc, 0, 4, 1).getString()) + self.assertEqual("n", get_cell_by_position(calc_doc, 0, 4, 2).getString()) + self.assertEqual("1", get_cell_by_position(calc_doc, 0, 5, 1).getString()) + self.assertEqual("1", get_cell_by_position(calc_doc, 0, 5, 2).getString()) + + gridwin.executeAction("LAUNCH", mkPropertyValues({"PIVOTTABLE": "", "COL": "3", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xCheckListMenu = xFloatWindow.getChild("FilterDropDown") + + xTreeList = xCheckListMenu.getChild("check_list_box") + xFirstEntry = xTreeList.getChild("0") + + xFirstEntry.executeAction("CLICK", tuple()) + + xOkBtn = xFloatWindow.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) + + self.assertEqual("b", get_cell_by_position(calc_doc, 0, 3, 1).getString()) + self.assertEqual("Total Result", get_cell_by_position(calc_doc, 0, 3, 2).getString()) + self.assertEqual("n", get_cell_by_position(calc_doc, 0, 4, 1).getString()) + self.assertEqual("", get_cell_by_position(calc_doc, 0, 4, 2).getString()) + self.assertEqual("1", get_cell_by_position(calc_doc, 0, 5, 1).getString()) + self.assertEqual("1", get_cell_by_position(calc_doc, 0, 5, 2).getString()) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests9/tdf113571.py b/sc/qa/uitest/calc_tests9/tdf113571.py new file mode 100644 index 0000000000..0dc337ca64 --- /dev/null +++ b/sc/qa/uitest/calc_tests9/tdf113571.py @@ -0,0 +1,38 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from uitest.uihelper.common import get_url_for_data_file +from libreoffice.uno.propertyvalue import mkPropertyValues + +class Tdf113571(UITestCase): + + def test_tdf113571(self): + with self.ui_test.load_file(get_url_for_data_file("tdf113571.ods")): + + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + + self.xUITest.executeCommand(".uno:Copy") + + with self.ui_test.load_empty_file("writer") as writer_document: + + self.xUITest.getTopFocusWindow() + + self.xUITest.executeCommand(".uno:PasteUnformatted") + + # Without the fix in place, this test would have failed with + # AssertionError: '<?xml version="1.0" encoding="UTF-8"?>\n<[34 chars]est>' != + # '"<?xml version=""1.0"" encoding=""UTF-8""[40 chars]st>"' + self.assertEqual('<?xml version="1.0" encoding="UTF-8"?>\n<test>\n <hello>world</hello>\n</test>', + writer_document.Text.String) + +# vim: set shiftwidth=4 softtabstop=4 expandtab:
\ No newline at end of file diff --git a/sc/qa/uitest/calc_tests9/tdf115933.py b/sc/qa/uitest/calc_tests9/tdf115933.py new file mode 100644 index 0000000000..128b80652e --- /dev/null +++ b/sc/qa/uitest/calc_tests9/tdf115933.py @@ -0,0 +1,35 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_url_for_data_file +from com.sun.star.beans import PropertyValue +from libreoffice.uno.propertyvalue import mkPropertyValues + +#Bug 115933 - XLSX <fileSharing> password protected with algorithmName, hashValue, saltValue and spinCount + +class tdf115933(UITestCase): + + def test_tdf115933(self): + with self.ui_test.load_file(get_url_for_data_file("tdf115933.xlsx"), [PropertyValue(Name="Silent", Value=True)]): + #The document was created in Excel. + calcDoc = self.xUITest.getTopFocusWindow() + gridwin = calcDoc.getChild("grid_window") + + document = self.ui_test.get_component() + + self.assertTrue(document.isReadonly()) + + #Without the fix in place, this dialog wouldn't have been displayed + with self.ui_test.execute_dialog_through_action(gridwin, "TYPE", mkPropertyValues({"KEYCODE": "CTRL+SHIFT+M"})) as xDialog: + xPassword = xDialog.getChild("newpassEntry") + xPassword.executeAction("TYPE", mkPropertyValues({"TEXT": "a"})) + + self.assertFalse(document.isReadonly()) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests9/tdf117879.py b/sc/qa/uitest/calc_tests9/tdf117879.py new file mode 100644 index 0000000000..6e3049e6c9 --- /dev/null +++ b/sc/qa/uitest/calc_tests9/tdf117879.py @@ -0,0 +1,43 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import type_text +from libreoffice.calc.document import get_cell_by_position + +class tdf117879(UITestCase): + + def test_tdf117879(self): + + with self.ui_test.create_doc_in_start_center("calc") as document: + + calcDoc = self.xUITest.getTopFocusWindow() + gridwin = calcDoc.getChild("grid_window") + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + type_text(gridwin, "=SUM({A1},2,3,4,5}") + + # Without the fix in place, this dialog wouldn't have been displayed + with self.ui_test.execute_blocking_action(gridwin.executeAction, + args=("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})), close_button="yes"): + pass + + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getFormula(), "=SUM({A1};2;3;4;5)") + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + type_text(gridwin, "=SUM({A1},2,3,4,5}") + + with self.ui_test.execute_blocking_action(gridwin.executeAction, + args=("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})), close_button="no"): + pass + + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getFormula(), "=SUM({A1};2;3;4;5})") + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests9/tdf118938.py b/sc/qa/uitest/calc_tests9/tdf118938.py new file mode 100644 index 0000000000..33f8cde75d --- /dev/null +++ b/sc/qa/uitest/calc_tests9/tdf118938.py @@ -0,0 +1,34 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_url_for_data_file +from libreoffice.uno.propertyvalue import mkPropertyValues +from com.sun.star.beans import PropertyValue + +#Bug 118938 - FILESAVE to Microsoft Excel 2007-2013 XML (.xlsx) files as read-only +# with additional password protection for editing not working (Calc) + +class tdf118938(UITestCase): + + def test_tdf118938(self): + with self.ui_test.load_file(get_url_for_data_file("tdf118938.xlsx"), [PropertyValue(Name="Silent", Value=True)]): + #The document was created in Calc after this fix. + document = self.ui_test.get_component() + + # Without the fix in place, this test would have failed with + # AssertionError: False is not true + self.assertTrue(document.isReadonly()) + + with self.ui_test.execute_dialog_through_command(".uno:EditDoc") as xDialog: + xPassword = xDialog.getChild("newpassEntry") + xPassword.executeAction("TYPE", mkPropertyValues({"TEXT": "a"})) + + self.assertFalse(document.isReadonly()) + +# 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 0000000000..03e5012343 --- /dev/null +++ b/sc/qa/uitest/calc_tests9/tdf121949.py @@ -0,0 +1,27 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues + +class tdf121949 (UITestCase): + + def test_tdf121949_copy_block_with_single_cell_not_included(self): + with 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"})) + with self.ui_test.execute_dialog_through_command(".uno:Copy"): + pass + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests9/tdf124318.py b/sc/qa/uitest/calc_tests9/tdf124318.py new file mode 100644 index 0000000000..9fae2d5b4e --- /dev/null +++ b/sc/qa/uitest/calc_tests9/tdf124318.py @@ -0,0 +1,33 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file +from libreoffice.uno.propertyvalue import mkPropertyValues + +class tdf124318(UITestCase): + + def test_tdf124318(self): + + with self.ui_test.load_file(get_url_for_data_file("tdf124318.xls")): + + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B4"})) + + with self.ui_test.execute_dialog_through_action(gridwin, "TYPE", mkPropertyValues({"KEYCODE": "CTRL+k"})) as xDialog: + # Without the fix in place, this test would have failed with + # AssertionError: 'mobile/identification/authentification' != + # 'mobile/identification/authentification%00塹\uf481ᴻ䡿ⲯ嶂藄挧%00%00ꮥ%00' + self.assertEqual("mobile/identification/authentification", + get_state_as_dict(xDialog.getChild("target"))['Text'].split(".fr/")[1]) + self.assertEqual("mobile/identification/authentification", + get_state_as_dict(xDialog.getChild("indication"))['Text'].split(".fr/")[1]) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests9/tdf125440.py b/sc/qa/uitest/calc_tests9/tdf125440.py new file mode 100644 index 0000000000..a5319d5826 --- /dev/null +++ b/sc/qa/uitest/calc_tests9/tdf125440.py @@ -0,0 +1,41 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues +from libreoffice.calc.document import get_cell_by_position +from uitest.uihelper.common import get_url_for_data_file + +class Tdf1254400(UITestCase): + + def test_tdf125440(self): + # In order to simulate copy&paste from external source, + # import the text in Writer, copy it and paste it in Calc + with self.ui_test.load_file(get_url_for_data_file("tdf125440.odt")): + + self.xUITest.executeCommand(".uno:SelectAll") + self.xUITest.executeCommand(".uno:Copy") + + with self.ui_test.load_empty_file("calc") as calc_document: + + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + + self.xUITest.executeCommand(".uno:PasteUnformatted") + + # Without the fix in place, this test would have failed with + # AssertionError: 'Row' != '"Row"' + self.assertEqual("Row", get_cell_by_position(calc_document, 0, 0, 0).getString()) + self.assertEqual("", get_cell_by_position(calc_document, 0, 1, 0).getString()) + self.assertEqual("", get_cell_by_position(calc_document, 0, 2, 0).getString()) + self.assertEqual("50", get_cell_by_position(calc_document, 0, 3, 0).getString()) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests9/tdf126541_GridVisibilityImportXlsx.py b/sc/qa/uitest/calc_tests9/tdf126541_GridVisibilityImportXlsx.py new file mode 100644 index 0000000000..91c71f1542 --- /dev/null +++ b/sc/qa/uitest/calc_tests9/tdf126541_GridVisibilityImportXlsx.py @@ -0,0 +1,29 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from uitest.uihelper.common import get_url_for_data_file + +class tdf126541(UITestCase): + + def test_tdf126541_GridVisibilityImportXlsx(self): + # Import an ods file with 'Hide' global grid visibility setting. + with self.ui_test.load_file(get_url_for_data_file("tdf126541_GridOffGlobally.ods")) as document: + controller = document.getCurrentController() + grid = controller.ShowGrid + self.assertEqual(grid, False) + + # Importing xlsx file should set the global grid visibility setting to 'Show' + # Sheet based grid line visibility setting should not overwrite the global setting. + with self.ui_test.load_file(get_url_for_data_file("tdf126541_GridOff.xlsx")) as document: + controller = document.getCurrentController() + grid = controller.ShowGrid + self.assertEqual(grid, True) + +# 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 0000000000..d06730f93e --- /dev/null +++ b/sc/qa/uitest/calc_tests9/tdf126673.py @@ -0,0 +1,39 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import change_measurement_unit +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file + +from libreoffice.uno.propertyvalue import mkPropertyValues + + +# 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): + with self.ui_test.load_file(get_url_for_data_file("tdf126673.ods")): + + with change_measurement_unit(self, "Centimeter"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + #select A2 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A2"})) + #optimal row height + with self.ui_test.execute_dialog_through_command(".uno:SetOptimalRowHeight") as xDialog: + xvalue = xDialog.getChild("value") + self.assertEqual("0.00 cm", get_state_as_dict(xvalue)["Text"]) + + #select A2 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A2"})) + #row height + with self.ui_test.execute_dialog_through_command(".uno:RowHeight", close_button="cancel") as xDialog: + xvalue = xDialog.getChild("value") + self.assertEqual("1.24 cm", get_state_as_dict(xvalue)["Text"]) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests9/tdf133629.py b/sc/qa/uitest/calc_tests9/tdf133629.py new file mode 100644 index 0000000000..8b28fcb991 --- /dev/null +++ b/sc/qa/uitest/calc_tests9/tdf133629.py @@ -0,0 +1,57 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, select_pos +from libreoffice.uno.propertyvalue import mkPropertyValues + +class tdf133629(UITestCase): + + def test_tdf133629(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + with self.ui_test.execute_dialog_through_command(".uno:Insert"): + pass + + self.xUITest.executeCommand(".uno:TableSelectAll") + + self.xUITest.executeCommand(".uno:SelectAll") + + # Check both sheets are selected + self.assertIsNotNone(getattr(document.CurrentSelection, 'Sheet1.A1:AMJ1048576')) + self.assertIsNotNone(getattr(document.CurrentSelection, 'Sheet2.A1:AMJ1048576')) + + with self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "5") + + xPresets = xDialog.getChild("presets") + xPresets.executeAction("CHOOSE", mkPropertyValues({"POS": "4"})) + + # Change width + xLineWidth = xDialog.getChild("linewidthmf") + xLineWidth.executeAction("UP", tuple()) + xLineWidth.executeAction("UP", tuple()) + self.assertEqual("1.25 pt", get_state_as_dict(xLineWidth)['Text']) + + + # Without the fix in place, this test would have crash here + + xA1Sheet1 = document.Sheets[0].getCellRangeByName("A1") + self.assertEqual(44, xA1Sheet1.BottomBorder.OuterLineWidth) + self.assertEqual(44, xA1Sheet1.TopBorder.OuterLineWidth) + self.assertEqual(44, xA1Sheet1.LeftBorder.OuterLineWidth) + self.assertEqual(44, xA1Sheet1.RightBorder.OuterLineWidth) + + xA1Sheet2 = document.Sheets[1].getCellRangeByName("A1") + self.assertEqual(44, xA1Sheet2.BottomBorder.OuterLineWidth) + self.assertEqual(44, xA1Sheet2.TopBorder.OuterLineWidth) + self.assertEqual(44, xA1Sheet2.LeftBorder.OuterLineWidth) + self.assertEqual(44, xA1Sheet2.RightBorder.OuterLineWidth) + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests9/tdf135761.py b/sc/qa/uitest/calc_tests9/tdf135761.py new file mode 100755 index 0000000000..5de390b3e4 --- /dev/null +++ b/sc/qa/uitest/calc_tests9/tdf135761.py @@ -0,0 +1,33 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues +from libreoffice.calc.document import get_cell_by_position + +class tdf135761(UITestCase): + def test_tdf135761_ctrl_backspace(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = xCalcDoc.getChild("grid_window") + + # Enter text including two whitespaces in the text, and delete the left part of the text + xGridWindow.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + xGridWindow.executeAction("TYPE", mkPropertyValues({"TEXT": "a b"})) + xGridWindow.executeAction("TYPE", mkPropertyValues({"KEYCODE":"F2"})) + xGridWindow.executeAction("TYPE", mkPropertyValues({"KEYCODE":"LEFT"})) + xGridWindow.executeAction("TYPE", mkPropertyValues({"KEYCODE":"LEFT"})) + xGridWindow.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+BACKSPACE"})) + xGridWindow.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) + + # Without the fix in place, this test would have failed with + # AssertionError: ' b' != 'a b' + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), " b") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests9/tdf137446.py b/sc/qa/uitest/calc_tests9/tdf137446.py new file mode 100644 index 0000000000..94bb7c0c97 --- /dev/null +++ b/sc/qa/uitest/calc_tests9/tdf137446.py @@ -0,0 +1,51 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import change_measurement_unit +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file +from libreoffice.uno.propertyvalue import mkPropertyValues + +class tdf137446(UITestCase): + + def test_tdf137446(self): + + with self.ui_test.load_file(get_url_for_data_file("tdf137446.ods")): + + with change_measurement_unit(self, "Centimeter"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "lineObject"})) + + with self.ui_test.execute_dialog_through_command(".uno:TransformDialog") as xDialog: + + + self.assertEqual('10', get_state_as_dict(xDialog.getChild('MTR_FLD_WIDTH'))['Value']) + self.assertEqual('0', get_state_as_dict(xDialog.getChild('MTR_FLD_HEIGHT'))['Value']) + self.assertEqual('5.51', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_X'))['Value']) + self.assertEqual('2.55', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_Y'))['Value']) + self.assertEqual('0', get_state_as_dict(xDialog.getChild('NF_ANGLE'))['Value']) + + + xDialog.getChild('MTR_FLD_WIDTH').executeAction("UP", tuple()) + + + with self.ui_test.execute_dialog_through_command(".uno:TransformDialog") as xDialog: + + + self.assertEqual('10.1', get_state_as_dict(xDialog.getChild('MTR_FLD_WIDTH'))['Value']) + self.assertEqual('0', get_state_as_dict(xDialog.getChild('MTR_FLD_HEIGHT'))['Value']) + self.assertEqual('5.51', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_X'))['Value']) + self.assertEqual('2.55', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_Y'))['Value']) + + # Without the fix in place, this test would have failed with AssertionError: '0' != '180' + self.assertEqual('0', get_state_as_dict(xDialog.getChild('NF_ANGLE'))['Value']) + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests9/tdf141244.py b/sc/qa/uitest/calc_tests9/tdf141244.py new file mode 100644 index 0000000000..b292bfefed --- /dev/null +++ b/sc/qa/uitest/calc_tests9/tdf141244.py @@ -0,0 +1,41 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.calc import enter_text_to_cell +from uitest.uihelper.common import get_state_as_dict + + +class tdf141244(UITestCase): + + def test_tdf141244(self): + + with self.ui_test.create_doc_in_start_center("calc"): + + calcDoc = self.xUITest.getTopFocusWindow() + gridwin = calcDoc.getChild("grid_window") + + enter_text_to_cell(gridwin, "A1", '=DDE("soffice";"data1.ods";"sheet1.A1")') + + with self.ui_test.execute_dialog_through_command(".uno:EditLinks", close_button="close") as xDialog: + + xLinks = xDialog.getChild("TB_LINKS") + self.assertEqual(1, len(xLinks.getChildren())) + + xChangeBtn = xDialog.getChild("CHANGE_SOURCE") + + with self.ui_test.execute_blocking_action(xChangeBtn.executeAction, args=('CLICK', ()), close_button="cancel") as dialog: + self.assertEqual("soffice", get_state_as_dict(dialog.getChild("app"))['Text']) + self.assertEqual("data1.ods", get_state_as_dict(dialog.getChild("file"))['Text']) + self.assertEqual("sheet1.A1", get_state_as_dict(dialog.getChild("category"))['Text']) + + # tdf#141770: Without the fix in place, the cancel button wouldn't have worked here + + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests9/tdf142763.py b/sc/qa/uitest/calc_tests9/tdf142763.py new file mode 100644 index 0000000000..548be27b41 --- /dev/null +++ b/sc/qa/uitest/calc_tests9/tdf142763.py @@ -0,0 +1,71 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, select_pos + +from libreoffice.uno.propertyvalue import mkPropertyValues + + +class Tdf142763(UITestCase): + + def test_tdf142763_header(self): + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + + with self.ui_test.execute_dialog_through_command(".uno:PageFormatDialog") as xPageFormatDialog: + xTabControl = xPageFormatDialog.getChild("tabcontrol") + select_pos(xTabControl, "4") + + xHeaderOnBtn = xPageFormatDialog.getChild("checkHeaderOn") + xHeaderOnBtn.executeAction("CLICK", tuple()) + xFirstHeaderSameBtn = xPageFormatDialog.getChild("checkSameFP") + xFirstHeaderSameBtn.executeAction("CLICK", tuple()) + + with self.ui_test.execute_dialog_through_command(".uno:EditHeaderAndFooter") as xHeaderDialog: + xLeftTextWindow = xHeaderDialog.getChild("textviewWND_LEFT") + xLeftTextWindow.executeAction("TYPE", mkPropertyValues({"TEXT": "first"})) + xCenterTextWindow = xHeaderDialog.getChild("textviewWND_CENTER") + xCenterTextWindow.executeAction("TYPE", mkPropertyValues({"TEXT": "page | "})) + xRightTextWindow = xHeaderDialog.getChild("textviewWND_RIGHT") + xRightTextWindow.executeAction("TYPE", mkPropertyValues({"TEXT": "header"})) + + self.assertEqual("first", get_state_as_dict(xLeftTextWindow)["Text"]) + self.assertEqual("page | Sheet1", get_state_as_dict(xCenterTextWindow)["Text"]) + self.assertEqual("header", get_state_as_dict(xRightTextWindow)["Text"]) + + def test_tdf142763_footer(self): + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + + with self.ui_test.execute_dialog_through_command(".uno:PageFormatDialog") as xPageFormatDialog: + xTabControl = xPageFormatDialog.getChild("tabcontrol") + select_pos(xTabControl, "5") + + xFooterOnBtn = xPageFormatDialog.getChild("checkFooterOn") + xFooterOnBtn.executeAction("CLICK", tuple()) + xFirstFooterSameBtn = xPageFormatDialog.getChild("checkSameFP") + xFirstFooterSameBtn.executeAction("CLICK", tuple()) + + with self.ui_test.execute_dialog_through_command(".uno:EditHeaderAndFooter") as xFooterDialog: + xLeftTextWindow = xFooterDialog.getChild("textviewWND_LEFT") + xLeftTextWindow.executeAction("TYPE", mkPropertyValues({"TEXT": "first"})) + xCenterTextWindow = xFooterDialog.getChild("textviewWND_CENTER") + xCenterTextWindow.executeAction("TYPE", mkPropertyValues({"TEXT": "page | "})) + xRightTextWindow = xFooterDialog.getChild("textviewWND_RIGHT") + xRightTextWindow.executeAction("TYPE", mkPropertyValues({"TEXT": "footer"})) + + self.assertEqual("first", get_state_as_dict(xLeftTextWindow)["Text"]) + self.assertEqual("page | Sheet1", get_state_as_dict(xCenterTextWindow)["Text"]) + self.assertEqual("footer", get_state_as_dict(xRightTextWindow)["Text"]) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests9/tdf144996.py b/sc/qa/uitest/calc_tests9/tdf144996.py new file mode 100644 index 0000000000..fcfb366feb --- /dev/null +++ b/sc/qa/uitest/calc_tests9/tdf144996.py @@ -0,0 +1,49 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_url_for_data_file + +from libreoffice.uno.propertyvalue import mkPropertyValues +from com.sun.star.beans import PropertyValue + +class tdf144996(UITestCase): + + def test_tdf144996(self): + + # get_url_for_data_file calls makeCopyFromTDOC + # so using save doesn't affect the original file + xFilePath = get_url_for_data_file("tdf144996.xlsx") + + with self.ui_test.load_file(xFilePath, [PropertyValue(Name="Silent", Value=True)]) as document: + + self.assertTrue(document.isReadonly()) + + with self.ui_test.execute_dialog_through_command(".uno:EditDoc") as xDialog: + xPassword = xDialog.getChild("newpassEntry") + xPassword.executeAction("TYPE", mkPropertyValues({"TEXT": "password"})) + + self.assertFalse(document.isReadonly()) + + with self.ui_test.execute_dialog_through_command(".uno:Save", close_button="save"): + # Confirm file format popup + pass + + with self.ui_test.load_file(xFilePath, [PropertyValue(Name="Silent", Value=True)]) as document: + + self.assertTrue(document.isReadonly()) + + # Without the fix in place, this test would have failed here because the saved document + # doesn't need a password to edit it + with self.ui_test.execute_dialog_through_command(".uno:EditDoc") as xDialog: + xPassword = xDialog.getChild("newpassEntry") + xPassword.executeAction("TYPE", mkPropertyValues({"TEXT": "password"})) + + self.assertFalse(document.isReadonly()) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests9/tdf148437.py b/sc/qa/uitest/calc_tests9/tdf148437.py new file mode 100644 index 0000000000..d457b23248 --- /dev/null +++ b/sc/qa/uitest/calc_tests9/tdf148437.py @@ -0,0 +1,53 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues +from libreoffice.calc.document import get_cell_by_position +from uitest.uihelper.calc import enter_text_to_cell +from uitest.uihelper.common import get_state_as_dict, select_pos + +class tdf148437(UITestCase): + def test_tdf148437_formula_cell(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = xCalcDoc.getChild("grid_window") + + # Select a cell including a formula and insert a hyperlink + enter_text_to_cell(xGridWindow, "A1", "=HYPERLINK(\"www.libreoffice.org\";\"LibreOffice\")") + # Move focus to ensure cell is not in edit mode + xGridWindow.executeAction("SELECT", mkPropertyValues({"CELL": "A2"})) + xGridWindow.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + with self.ui_test.execute_dialog_through_command(".uno:HyperlinkDialog") as xDialog: + xTab = xDialog.getChild("tabcontrol") + select_pos(xTab, "0") + + # Text should contain the text of the cell + xTarget = xDialog.getChild("target") + self.assertEqual(get_state_as_dict(xTarget)["Text"], "") + xIndication = xDialog.getChild("indication") + self.assertEqual(get_state_as_dict(xIndication)["Text"], "LibreOffice") + + # Insert a sample hyperlink + xTarget.executeAction("TYPE", mkPropertyValues({"TEXT": "https://www.documentfoundation.org/"})) + xIndication.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xIndication.executeAction("TYPE", mkPropertyValues({"TEXT": "LibreOffice Document Foundation"})) + + # Move focus to ensure cell is not in edit mode + xGridWindow.executeAction("SELECT", mkPropertyValues({"CELL": "A2"})) + xGridWindow.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + + # Check contents of the cell + xCell = get_cell_by_position(document, 0, 0, 0) + self.assertEqual(xCell.getString(), "LibreOffice Document Foundation") + xTextFields = xCell.getTextFields() + self.assertEqual(xTextFields.getCount(), 1) + self.assertEqual(xTextFields.getByIndex(0).URL, "https://www.documentfoundation.org/") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests9/tdf149529.py b/sc/qa/uitest/calc_tests9/tdf149529.py new file mode 100644 index 0000000000..afd355da5f --- /dev/null +++ b/sc/qa/uitest/calc_tests9/tdf149529.py @@ -0,0 +1,51 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file +from libreoffice.uno.propertyvalue import mkPropertyValues +from libreoffice.calc.document import get_cell_by_position + +class Tdf149529(UITestCase): + + def test_tdf149529(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + + with self.ui_test.execute_dialog_through_command(".uno:Insert") as xDialog: + xBrowse = xDialog.getChild("browse") + xFromFile = xDialog.getChild("fromfile") + xTables = xDialog.getChild("tables") + + self.assertEqual("false", get_state_as_dict(xBrowse)['Enabled']) + self.assertEqual("0", get_state_as_dict(xTables)['Children']) + + xFromFile.executeAction("CLICK", tuple()) + + self.assertEqual("true", get_state_as_dict(xBrowse)['Enabled']) + + with self.ui_test.execute_blocking_action( + xBrowse.executeAction, args=('CLICK', ()), close_button="") as dialog: + xFileName = dialog.getChild("file_name") + xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": get_url_for_data_file("tdf149529.ods")})) + xOpen = dialog.getChild("open") + xOpen.executeAction("CLICK", tuple()) + + self.ui_test.wait_until_property_is_updated(xTables, "Children", "1") + self.assertEqual("Codes", get_state_as_dict(xTables.getChild('0'))['Text']) + + self.assertEqual("GROUP", get_cell_by_position(document, 0, 0, 0).getString()) + + with self.ui_test.execute_dialog_through_command(".uno:ConditionalFormatManagerDialog") as xCondFormatMgr: + xList = xCondFormatMgr.getChild("CONTAINER") + self.assertEqual("1", get_state_as_dict(xList)['Children']) + self.assertEqual("P6:P10\tColorScale", get_state_as_dict(xList.getChild('0'))['Text']) + + # Without the fix in place, this test would have crashed here + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests9/tdf156268.py b/sc/qa/uitest/calc_tests9/tdf156268.py new file mode 100644 index 0000000000..d354465369 --- /dev/null +++ b/sc/qa/uitest/calc_tests9/tdf156268.py @@ -0,0 +1,22 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from uitest.uihelper.common import get_url_for_data_file + +class Tdf156268(UITestCase): + + def test_tdf156268(self): + # In order to simulate copy&paste from external source, + # import the text in Writer, copy it and paste it in Calc + with self.ui_test.load_file(get_url_for_data_file("tdf156268.fods")): + + self.xUITest.executeCommand(".uno:SelectAll") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests9/tdf156611_hyperlink_interoper.py b/sc/qa/uitest/calc_tests9/tdf156611_hyperlink_interoper.py new file mode 100644 index 0000000000..87ee09aa5d --- /dev/null +++ b/sc/qa/uitest/calc_tests9/tdf156611_hyperlink_interoper.py @@ -0,0 +1,124 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from uitest.uihelper.common import get_url_for_data_file +from libreoffice.uno.propertyvalue import mkPropertyValues +from libreoffice.calc.document import get_cell_by_position +from uitest.uihelper.calc import enter_text_to_cell +from uitest.uihelper.common import get_state_as_dict, select_pos + +class tdf156611(UITestCase): + def test_tdf156611_insert_hyperlink_like_excel(self): + # The hyperlink interoperability setting, that this test is testing, + # works only if MS document type is opened. + # but it does not need any data from the file, any xlsx or xls file can be opened for this test + with self.ui_test.load_file(get_url_for_data_file("tdf126541_GridOff.xlsx")) as document: + + # data that we will check against when hyperlink is inserted + urls =[["",""],["https://www.documentfoundation.org/",""]] + texts =[["aaa bbb","bbb"],["cccc ddd","ddd"],["eeee","aaa cccc eeee"]] + + # 1. run, we want hyperlink insertion work like in MS excel (only 1 hyperlink/cell is allowed) + # 2. run, we want hyperlink insertion work as it did in calc (more hyperlinks can be in 1 cell) + for i in range(2): + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = xCalcDoc.getChild("grid_window") + + #Change hyperlink interoperability setting + #Go to Tools -> Options -> LibreofficeDev Calc -> Compatibility + with self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog", close_button="cancel") as xDialogOpt: + + xPages = xDialogOpt.getChild("pages") + xChartEntry = xPages.getChild('3') # LibreofficeDev Calc + xChartEntry.executeAction("EXPAND", tuple()) + xChartGeneralEntry = xChartEntry.getChild('7') + xChartGeneralEntry.executeAction("SELECT", tuple()) #Compatibility + + xLinks = xDialogOpt.getChild("cellLinkCB") + xLinks.executeAction("CLICK", tuple()) + xApply = xDialogOpt.getChild("apply") + xApply.executeAction("CLICK", tuple()) + + enter_text_to_cell(xGridWindow, "A1", "aaa bbb") + + # Select last word of the cell text: "bbb" + xGridWindow.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + xGridWindow.executeAction("TYPE", mkPropertyValues({"KEYCODE":"F2"})) + xGridWindow.executeAction("TYPE", mkPropertyValues({"KEYCODE":"SHIFT+CTRL+LEFT"})) + + # Insert hyperlink + with self.ui_test.execute_dialog_through_command(".uno:HyperlinkDialog") as xDialog: + xTab = xDialog.getChild("tabcontrol") + select_pos(xTab, "0") + + xTarget = xDialog.getChild("target") + self.assertEqual(get_state_as_dict(xTarget)["Text"], "") + xIndication = xDialog.getChild("indication") + self.assertEqual(get_state_as_dict(xIndication)["Text"], texts[0][i]) + # 1. run "aaa bbb" The whole cell text + # 2. run "bbb" Only the selected text + + # Insert a sample hyperlink, and change text + xTarget.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xTarget.executeAction("TYPE", mkPropertyValues({"TEXT": "https://www.documentfoundation.org/"})) + xIndication.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xIndication.executeAction("TYPE", mkPropertyValues({"TEXT": "cccc"})) + + # Edit cell text: insert " ddd" in the end + xGridWindow.executeAction("SELECT", mkPropertyValues({"CELL": "A2"})) + xGridWindow.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + xGridWindow.executeAction("TYPE", mkPropertyValues({"KEYCODE":"F2"})) + xGridWindow.executeAction("TYPE", mkPropertyValues({"TEXT": " ddd"})) + xGridWindow.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) + + # Select the last word of cell text: "ddd" + xGridWindow.executeAction("SELECT", mkPropertyValues({"CELL": "A2"})) + xGridWindow.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + xGridWindow.executeAction("TYPE", mkPropertyValues({"KEYCODE":"F2"})) + xGridWindow.executeAction("TYPE", mkPropertyValues({"KEYCODE":"SHIFT+CTRL+LEFT"})) + + # Insert hyperlink + with self.ui_test.execute_dialog_through_command(".uno:HyperlinkDialog") as xDialog2: + xTab = xDialog2.getChild("tabcontrol") + select_pos(xTab, "0") + + xTarget = xDialog2.getChild("target") + self.assertEqual(get_state_as_dict(xTarget)["Text"], urls[1][i]) + # 1. run: "https://www.documentfoundation.org/" the cell already have this url. + # 2. run: "" The selected text is not a hyperlink yet. + xIndication = xDialog2.getChild("indication") + self.assertEqual(get_state_as_dict(xIndication)["Text"], texts[1][i]) + # 1. run: "cccc ddd" The whole cell text + # 2. run: "ddd" Only the selected text + + # Insert a sample hyperlink, and change text + xTarget.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xTarget.executeAction("TYPE", mkPropertyValues({"TEXT": "https://aWrongLink/"})) + xIndication.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xIndication.executeAction("TYPE", mkPropertyValues({"TEXT": "eeee"})) + + # Move focus to ensure cell is not in edit mode + xGridWindow.executeAction("SELECT", mkPropertyValues({"CELL": "A2"})) + xGridWindow.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + + # Check contents of the cell + xCell = get_cell_by_position(document, 0, 0, 0) + self.assertEqual(xCell.getString(), texts[2][i]) + # 1. run: "eeee" last hyperlink insertion overwritten the whole cell text with "eeee" + # 2. run: "aaa cccc eeee" as every hyperlink insertion only overwritten the actually selected text + xTextFields = xCell.getTextFields() + self.assertEqual(xTextFields.getCount(), i+1) + self.assertEqual(xTextFields.getByIndex(i).URL, "https://aWrongLink/") + if (i==1): + self.assertEqual(xTextFields.getByIndex(0).URL, "https://www.documentfoundation.org/") + # 1. run: only the last inserted hyperlink will remain: "https://aWrongLink/" + # 2. run: both links will be in the cell + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests9/tdf80043.py b/sc/qa/uitest/calc_tests9/tdf80043.py new file mode 100644 index 0000000000..eb99f00388 --- /dev/null +++ b/sc/qa/uitest/calc_tests9/tdf80043.py @@ -0,0 +1,243 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues +from libreoffice.calc.document import get_cell_by_position +from uitest.uihelper.calc import enter_text_to_cell +from uitest.uihelper.common import get_state_as_dict, select_pos + +class tdf80043(UITestCase): + def test_tdf80043_empty_cell(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = xCalcDoc.getChild("grid_window") + + # Select an empty cell and insert a hyperlink + xGridWindow.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + with self.ui_test.execute_dialog_through_command(".uno:HyperlinkDialog") as xDialog: + xTab = xDialog.getChild("tabcontrol") + select_pos(xTab, "0") + + # Both fields in the hyperlink dialog should be empty + xTarget = xDialog.getChild("target") + self.assertEqual(get_state_as_dict(xTarget)["Text"], "") + xIndication = xDialog.getChild("indication") + self.assertEqual(get_state_as_dict(xIndication)["Text"], "") + + # Insert a sample hyperlink + xTarget.executeAction("TYPE", mkPropertyValues({"TEXT": "http://www.libreoffice.org/"})) + xIndication.executeAction("TYPE", mkPropertyValues({"TEXT": "LibreOffice"})) + + # Move focus to ensure cell is not in edit mode + xGridWindow.executeAction("SELECT", mkPropertyValues({"CELL": "A2"})) + xGridWindow.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + + # Check contents of the cell + xCell = get_cell_by_position(document, 0, 0, 0) + self.assertEqual(xCell.getString(), "LibreOffice") + xTextFields = xCell.getTextFields() + self.assertEqual(xTextFields.getCount(), 1) + self.assertEqual(xTextFields.getByIndex(0).URL, "http://www.libreoffice.org/") + + # Reopen hyperlink dialog and check the target and the indication of the hyperlink + with self.ui_test.execute_dialog_through_command(".uno:HyperlinkDialog", close_button="cancel") as xDialog: + xTab = xDialog.getChild("tabcontrol") + select_pos(xTab, "0") + + # Text should contain the text of the cell + xTarget = xDialog.getChild("target") + self.assertEqual(get_state_as_dict(xTarget)["Text"], "http://www.libreoffice.org/") + xIndication = xDialog.getChild("indication") + self.assertEqual(get_state_as_dict(xIndication)["Text"], "LibreOffice") + + def test_tdf80043_text_cell(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = xCalcDoc.getChild("grid_window") + + # Select a cell including a text and insert a hyperlink + enter_text_to_cell(xGridWindow, "A1", "LibreOffice") + # Move focus to ensure cell is not in edit mode + xGridWindow.executeAction("SELECT", mkPropertyValues({"CELL": "A2"})) + xGridWindow.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + with self.ui_test.execute_dialog_through_command(".uno:HyperlinkDialog") as xDialog: + xTab = xDialog.getChild("tabcontrol") + select_pos(xTab, "0") + + # Text should contain the text of the cell + xTarget = xDialog.getChild("target") + self.assertEqual(get_state_as_dict(xTarget)["Text"], "") + xIndication = xDialog.getChild("indication") + self.assertEqual(get_state_as_dict(xIndication)["Text"], "LibreOffice") + + # Insert a sample hyperlink + xTarget.executeAction("TYPE", mkPropertyValues({"TEXT": "http://www.libreoffice.org/"})) + + # Move focus to ensure cell is not in edit mode + xGridWindow.executeAction("SELECT", mkPropertyValues({"CELL": "A2"})) + xGridWindow.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + + # Check contents of the cell + xCell = get_cell_by_position(document, 0, 0, 0) + self.assertEqual(xCell.getString(), "LibreOffice") + xTextFields = xCell.getTextFields() + self.assertEqual(xTextFields.getCount(), 1) + self.assertEqual(xTextFields.getByIndex(0).URL, "http://www.libreoffice.org/") + + # Reopen hyperlink dialog and check the target and the indication of the hyperlink + with self.ui_test.execute_dialog_through_command(".uno:HyperlinkDialog", close_button="cancel") as xDialog: + xTab = xDialog.getChild("tabcontrol") + select_pos(xTab, "0") + + # Text should contain the text of the cell + xTarget = xDialog.getChild("target") + self.assertEqual(get_state_as_dict(xTarget)["Text"], "http://www.libreoffice.org/") + xIndication = xDialog.getChild("indication") + self.assertEqual(get_state_as_dict(xIndication)["Text"], "LibreOffice") + + def test_tdf80043_link_text_cell(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = xCalcDoc.getChild("grid_window") + + # Select a cell including a text and insert a hyperlink + enter_text_to_cell(xGridWindow, "A1", "LibreOffice") + # Move focus to ensure cell is not in edit mode + xGridWindow.executeAction("SELECT", mkPropertyValues({"CELL": "A2"})) + xGridWindow.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + with self.ui_test.execute_dialog_through_command(".uno:HyperlinkDialog") as xDialog: + xTab = xDialog.getChild("tabcontrol") + select_pos(xTab, "0") + + # Text should contain the text of the cell + xTarget = xDialog.getChild("target") + self.assertEqual(get_state_as_dict(xTarget)["Text"], "") + xIndication = xDialog.getChild("indication") + self.assertEqual(get_state_as_dict(xIndication)["Text"], "LibreOffice") + + # Insert a sample hyperlink + xTarget.executeAction("TYPE", mkPropertyValues({"TEXT": "http://www.libreoffice.org/"})) + + # Move focus to ensure cell is not in edit mode + xGridWindow.executeAction("SELECT", mkPropertyValues({"CELL": "A2"})) + xGridWindow.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + + # Insert an additional text without a hyperlink in the cell including a hyperlink + self.xUITest.executeCommand(".uno:SetInputMode") + enter_text_to_cell(xGridWindow, "A1", " Document Foundation") + + # Check contents of the cell + xCell = get_cell_by_position(document, 0, 0, 0) + self.assertEqual(xCell.getString(), "LibreOffice Document Foundation") + xTextFields = xCell.getTextFields() + self.assertEqual(xTextFields.getCount(), 1) + self.assertEqual(xTextFields.getByIndex(0).URL, "http://www.libreoffice.org/") + + # Move focus to ensure cell is not in edit mode + xGridWindow.executeAction("SELECT", mkPropertyValues({"CELL": "A2"})) + xGridWindow.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + + # Reopen hyperlink dialog and check the target and the indication of the hyperlink + with self.ui_test.execute_dialog_through_command(".uno:HyperlinkDialog") as xDialog: + xTab = xDialog.getChild("tabcontrol") + select_pos(xTab, "0") + + # Text should contain the text of the cell + xTarget = xDialog.getChild("target") + self.assertEqual(get_state_as_dict(xTarget)["Text"], "") + xTarget.executeAction("TYPE", mkPropertyValues({"TEXT": "https://www.documentfoundation.org/"})) + xIndication = xDialog.getChild("indication") + self.assertEqual(get_state_as_dict(xIndication)["Text"], "LibreOffice Document Foundation") + + # Check contents of the cell - move focus, otherwise text fields won't be updated + xGridWindow.executeAction("SELECT", mkPropertyValues({"CELL": "A2"})) + xCell = get_cell_by_position(document, 0, 0, 0) + self.assertEqual(xCell.getString(), "LibreOffice Document Foundation") + xTextFields = xCell.getTextFields() + self.assertEqual(xTextFields.getCount(), 1) + self.assertEqual(xTextFields.getByIndex(0).URL, "https://www.documentfoundation.org/") + + def test_tdf80043_link_link_cell(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = xCalcDoc.getChild("grid_window") + + # Select a cell including a text and insert a hyperlink + enter_text_to_cell(xGridWindow, "A1", "Libre") + # Move focus to ensure cell is not in edit mode + xGridWindow.executeAction("SELECT", mkPropertyValues({"CELL": "A2"})) + xGridWindow.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + with self.ui_test.execute_dialog_through_command(".uno:HyperlinkDialog") as xDialog: + xTab = xDialog.getChild("tabcontrol") + select_pos(xTab, "0") + + # Text should contain the text of the cell + xTarget = xDialog.getChild("target") + self.assertEqual(get_state_as_dict(xTarget)["Text"], "") + xIndication = xDialog.getChild("indication") + self.assertEqual(get_state_as_dict(xIndication)["Text"], "Libre") + + # Insert a sample hyperlink + xTarget.executeAction("TYPE", mkPropertyValues({"TEXT": "http://www.libreoffice.org/"})) + + # Move focus to ensure cell is not in edit mode + xGridWindow.executeAction("SELECT", mkPropertyValues({"CELL": "A2"})) + xGridWindow.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + + # Insert an additional hyperlink in the cell + self.xUITest.executeCommand(".uno:SetInputMode") + xGridWindow.executeAction("TYPE", mkPropertyValues({"KEYCODE": "Office Document Foundation"})) + xGridWindow.executeAction("TYPE", mkPropertyValues({"KEYCODE": "SHIFT+CTRL+LEFT"})) + with self.ui_test.execute_dialog_through_command(".uno:HyperlinkDialog") as xDialog: + xTab = xDialog.getChild("tabcontrol") + select_pos(xTab, "0") + + # Text should contain the text of the cell + xTarget = xDialog.getChild("target") + self.assertEqual(get_state_as_dict(xTarget)["Text"], "") + xIndication = xDialog.getChild("indication") + self.assertEqual(get_state_as_dict(xIndication)["Text"], "Foundation") + + # Insert a sample hyperlink + xTarget.executeAction("TYPE", mkPropertyValues({"TEXT": "https://www.documentfoundation.org/"})) + + # Check contents of the cell + xGridWindow.executeAction("SELECT", mkPropertyValues({"CELL": "A2"})) + xCell = get_cell_by_position(document, 0, 0, 0) + self.assertEqual(xCell.getString(), "LibreOffice Document Foundation") + xTextFields = xCell.getTextFields() + self.assertEqual(xTextFields.getCount(), 2) + self.assertEqual(xTextFields.getByIndex(0).URL, "http://www.libreoffice.org/") + self.assertEqual(xTextFields.getByIndex(1).URL, "https://www.documentfoundation.org/") + + # Move focus to ensure cell is not in edit mode + xGridWindow.executeAction("SELECT", mkPropertyValues({"CELL": "A2"})) + xGridWindow.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + + # Reopen hyperlink dialog and check the target and the indication of the hyperlink + with self.ui_test.execute_dialog_through_command(".uno:HyperlinkDialog") as xDialog: + xTab = xDialog.getChild("tabcontrol") + select_pos(xTab, "0") + + xTarget = xDialog.getChild("target") + self.assertEqual(get_state_as_dict(xTarget)["Text"], "") + xTarget.executeAction("TYPE", mkPropertyValues({"TEXT": "https://wiki.documentfoundation.org/Main_Page"})) + xIndication = xDialog.getChild("indication") + self.assertEqual(get_state_as_dict(xIndication)["Text"], "LibreOffice Document Foundation") + + # Check contents of the cell - move focus, otherwise text fields won't be updated + xGridWindow.executeAction("SELECT", mkPropertyValues({"CELL": "A2"})) + xCell = get_cell_by_position(document, 0, 0, 0) + self.assertEqual(xCell.getString(), "LibreOffice Document Foundation") + xTextFields = xCell.getTextFields() + self.assertEqual(xTextFields.getCount(), 1) + self.assertEqual(xTextFields.getByIndex(0).URL, "https://wiki.documentfoundation.org/Main_Page") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests9/tdf95554.py b/sc/qa/uitest/calc_tests9/tdf95554.py new file mode 100644 index 0000000000..734711e415 --- /dev/null +++ b/sc/qa/uitest/calc_tests9/tdf95554.py @@ -0,0 +1,51 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.calc import enter_text_to_cell + +import platform + +class Tdf95554(UITestCase): + + def test_tdf95554(self): + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + enter_text_to_cell(gridwin, "A1", "A") + enter_text_to_cell(gridwin, "A2", "B") + enter_text_to_cell(gridwin, "A3", "C") + enter_text_to_cell(gridwin, "A4", "D") + enter_text_to_cell(gridwin, "A5", "E") + enter_text_to_cell(gridwin, "A6", "F") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A1"})) + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A3:A3", "EXTEND":"1"})) + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A5:A5", "EXTEND":"1"})) + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A6:A6", "EXTEND":"1"})) + self.xUITest.executeCommand(".uno:Copy") + + with self.ui_test.load_empty_file("writer") as writer_document: + + self.xUITest.getTopFocusWindow() + self.xUITest.executeCommand(".uno:PasteUnformatted") + + # Without the fix, the test breaks here with: + #AssertionError: 'A\n\nC\n\nE\nF' != 'A' + + if platform.system() == "Windows": + self.assertEqual('A\r\n\r\nC\r\n\r\nE\r\nF', + writer_document.Text.String) + else: + self.assertEqual('A\n\nC\n\nE\nF', + writer_document.Text.String) + +# vim: set shiftwidth=4 softtabstop=4 expandtab:
\ No newline at end of file diff --git a/sc/qa/uitest/chart/chartArea.py b/sc/qa/uitest/chart/chartArea.py new file mode 100644 index 0000000000..520ab8e83a --- /dev/null +++ b/sc/qa/uitest/chart/chartArea.py @@ -0,0 +1,155 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import change_measurement_unit, select_pos +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file + +from libreoffice.uno.propertyvalue import mkPropertyValues + + +# Chart Area dialog +class chartArea(UITestCase): + def test_chart_area_dialog(self): + with self.ui_test.load_file(get_url_for_data_file("chartArea.ods")) as calc_doc: + + with change_measurement_unit(self, "Centimeter"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + xArea = calc_doc.Sheets[0].Charts[0].getEmbeddedObject().Area + self.assertEqual(xArea.LineWidth, 0) + self.assertEqual(xArea.LineTransparence, 0) + self.assertEqual(hex(xArea.FillColor), '0xffffff') + self.assertEqual(xArea.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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramArea"})) as xDialog: + #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()) + + + self.assertEqual(xArea.LineWidth, 100) + self.assertEqual(xArea.LineTransparence, 5) + self.assertEqual(hex(xArea.FillColor), '0xffffff') + self.assertEqual(xArea.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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramArea"})) as xDialog: + + 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 + + self.assertEqual(xArea.LineWidth, 100) + self.assertEqual(xArea.LineTransparence, 5) + self.assertEqual(hex(xArea.FillColor), '0x23a9d3') + self.assertEqual(xArea.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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramArea"})) as xDialog: + + 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()) + + + self.assertEqual(xArea.LineWidth, 100) + self.assertEqual(xArea.LineTransparence, 5) + self.assertEqual(hex(xArea.FillColor), '0x23a9d3') + self.assertEqual(xArea.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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramArea"})) as xDialog: + + 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(xArea.LineWidth, 100) + self.assertEqual(xArea.LineTransparence, 5) + self.assertEqual(hex(xArea.FillColor), '0x23a9d3') + self.assertEqual(xArea.FillTransparence, 51) + +# 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 0000000000..4a5cbab2e5 --- /dev/null +++ b/sc/qa/uitest/chart/chartAxes.py @@ -0,0 +1,72 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file + +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import select_pos + + +# Chart Enable Axes dialog +class chartAxes(UITestCase): + def test_chart_enable_grids_dialog(self): + with self.ui_test.load_file(get_url_for_data_file("tdf98390.ods")): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + 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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuAxes"})) as xDialog: + + 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()) + + + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuAxes"})) as xDialog: + + 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") + + # Test Format -> Axis -> X Axis...: the child name is generated in + # lcl_getAxisCIDForCommand(). + xAxisX = xChartMain.getChild("CID/D=0:CS=0:Axis=0,0") + with self.ui_test.execute_dialog_through_action(xAxisX, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) as xDialog: + xTabs = xDialog.getChild("tabcontrol") + # Select RID_SVXPAGE_CHAR_EFFECTS, see the SchAttribTabDlg ctor. + select_pos(xTabs, "6") + xFontTransparency = xDialog.getChild("fonttransparencymtr") + # Without the accompanying fix in place, this test would have failed, the + # semi-transparent text UI was visible, but then it was lost on save. + self.assertEqual(get_state_as_dict(xFontTransparency)["Visible"], "false") + + +# 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 0000000000..b201803534 --- /dev/null +++ b/sc/qa/uitest/chart/chartDataLabels.py @@ -0,0 +1,290 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import change_measurement_unit +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file +from uitest.uihelper.common import select_by_text, select_pos + +from libreoffice.uno.propertyvalue import mkPropertyValues + +from com.sun.star.lang import Locale + + +# Chart Display Data Labels dialog +class chartDataLabels(UITestCase): + def test_chart_data_labels_dialog(self): + with self.ui_test.load_file(get_url_for_data_file("tdf98390.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + 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 = calc_doc.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, " ") + + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuDataLabels"})) as xDialog: + + 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, " ") + + 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()) + select_by_text(separator, "Comma") + + select_by_text(placement, "Below") + degrees.executeAction("UP", tuple()) + select_by_text(textDirection, "Right-to-left") + + + 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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuDataLabels"})) as xDialog: + + 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") + + + self.assertTrue(xDataSeries[0].Label.ShowNumber) + self.assertTrue(xDataSeries[0].Label.ShowCategoryName) + self.assertTrue(xDataSeries[0].Label.ShowLegendSymbol) + self.assertEqual(xDataSeries[0].LabelSeparator, ", ") + + def test_chart_data_labels_percentage_dialog(self): + with self.ui_test.load_file(get_url_for_data_file("dataLabels.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + 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 = calc_doc.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) + + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatDataLabels"})) as xDialog: + + 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") + buttonPercentage = xDialog.getChild("PB_PERCENT_NUMBERFORMAT") + + valueAsNumber.executeAction("CLICK", tuple()) + valueAsPercentage.executeAction("CLICK", tuple()) + #button Percentage format + + with self.ui_test.execute_blocking_action(buttonPercentage.executeAction, args=('CLICK', ())) as 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%") + + self.assertEqual(get_state_as_dict(valueAsNumber)["Selected"], "false") + self.assertEqual(get_state_as_dict(valueAsPercentage)["Selected"], "true") + + + xNumberFormats = calc_doc.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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatDataLabels"})) as xDialog: + + 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") + + self.assertEqual(get_state_as_dict(valueAsNumber)["Selected"], "false") + self.assertEqual(get_state_as_dict(valueAsPercentage)["Selected"], "true") + + self.assertFalse(xDataSeries[0].Label.ShowNumber) + self.assertTrue(xDataSeries[0].Label.ShowNumberInPercent) + self.assertEqual(xDataSeries[0].PercentageNumberFormat, xFormat) + + def test_tdf131291(self): + with self.ui_test.load_file(get_url_for_data_file("tdf131291.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + 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 = calc_doc.Sheets[0].Charts[0].getEmbeddedObject().getFirstDiagram().CoordinateSystems[0].ChartTypes[0].DataSeries + self.assertTrue(xDataSeries[0].Label.ShowNumber) + self.assertFalse(xDataSeries[0].Label.ShowNumberInPercent) + + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatDataLabels"})) as xDialog: + + 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") + + with self.ui_test.execute_blocking_action(xNumberFormatBtn.executeAction, args=('CLICK', ())) as 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") + + + xNumberFormats = calc_doc.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 + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatDataLabels"})) as xDialog: + + 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) + + + self.assertTrue(xDataSeries[0].Label.ShowNumber) + self.assertFalse(xDataSeries[0].Label.ShowNumberInPercent) + self.assertEqual(xDataSeries[0].NumberFormat, xFormat) + + def test_tdf136573(self): + with self.ui_test.load_file(get_url_for_data_file("dataLabels.ods")): + + with change_measurement_unit(self, "Centimeter"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + + # Select the first label + xDataLabel = xChartMain.getChild("CID/MultiClick/CID/D=0:CS=0:CT=0:Series=0:DataLabels=:DataLabel=0") + xDataLabel.executeAction("SELECT", tuple()) + + with self.ui_test.execute_dialog_through_action(xDataLabel, "COMMAND", mkPropertyValues({"COMMAND": "TransformDialog"})) as xDialog: + + self.assertEqual("0.74", get_state_as_dict(xDialog.getChild("MTR_FLD_POS_X"))['Value']) + self.assertEqual("2.82", get_state_as_dict(xDialog.getChild("MTR_FLD_POS_Y"))['Value']) + + # Use OK button in order to test tdf#137165 + + xChartMain.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + xChartMain.executeAction("TYPE", mkPropertyValues({"KEYCODE": "LEFT"})) + + with self.ui_test.execute_dialog_through_action(xDataLabel, "COMMAND", mkPropertyValues({"COMMAND": "TransformDialog"})) as xDialog: + + # Check the position has changed after moving the label using the arrows keys + self.assertEqual("0.64", get_state_as_dict(xDialog.getChild("MTR_FLD_POS_X"))['Value']) + self.assertEqual("2.72", get_state_as_dict(xDialog.getChild("MTR_FLD_POS_Y"))['Value']) + + +# 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 0000000000..bd017248ad --- /dev/null +++ b/sc/qa/uitest/chart/chartGrid.py @@ -0,0 +1,200 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import change_measurement_unit, select_pos +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file +from libreoffice.uno.propertyvalue import mkPropertyValues + + +# Chart Grid dialog +# Bug 98390 - Crash when modifying minor grid +class chartGrid(UITestCase): + def test_tdf98390_chart_grid_dialog(self): + with self.ui_test.load_file(get_url_for_data_file("tdf98390.ods")): + + with change_measurement_unit(self, "Centimeter"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridYMain"})) as xDialog: + #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()) + + + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridYMain"})) as xDialog: + + 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%") + + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridXMain"})) as xDialog: + + 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()) + + + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridXMain"})) as xDialog: + + 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%") + + + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridXHelp"})) as xDialog: + + 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()) + + + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridXHelp"})) as xDialog: + + 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%") + + + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridYHelp"})) as xDialog: + + 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()) + + + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridYHelp"})) as xDialog: + + 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%") + + + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridAll"})) as xDialog: + + 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()) + + + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramGridYHelp"})) as xDialog: + + 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%") + + +# 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 0000000000..781486b15d --- /dev/null +++ b/sc/qa/uitest/chart/chartGrids.py @@ -0,0 +1,83 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file + +from libreoffice.uno.propertyvalue import mkPropertyValues + + +# Chart Enable Grids dialog +class chartGrids(UITestCase): + def test_chart_enable_grids_dialog(self): + with self.ui_test.load_file(get_url_for_data_file("tdf98390.ods")): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + 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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuGrids"})) as xDialog: + + 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()) + + + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuGrids"})) as xDialog: + + 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()) + + + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuGrids"})) as xDialog: + + 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") + + +# 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 0000000000..a1cf40f44e --- /dev/null +++ b/sc/qa/uitest/chart/chartLegend.py @@ -0,0 +1,125 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import change_measurement_unit +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file + +from libreoffice.uno.propertyvalue import mkPropertyValues + + +# Chart Display Legend dialog +class chartLegend(UITestCase): + def test_chart_display_legend_dialog(self): + with self.ui_test.load_file(get_url_for_data_file("tdf98390.ods")): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + 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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuLegend"})) as xDialog: + left = xDialog.getChild("left") + + left.executeAction("CLICK", tuple()) + + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuLegend"})) as xDialog: + 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()) + + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuLegend"})) as xDialog: + 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") + + def test_legends_move_with_arrows_keys(self): + + with self.ui_test.load_file(get_url_for_data_file("dataLabels.ods")): + + with change_measurement_unit(self, "Centimeter"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + + # Select the legends + xLegends = xChartMain.getChild("CID/D=0:Legend=") + xLegends.executeAction("SELECT", tuple()) + + with self.ui_test.execute_dialog_through_action(xLegends, "COMMAND", mkPropertyValues({"COMMAND": "TransformDialog"})) as xDialog: + self.assertEqual("4.61", get_state_as_dict(xDialog.getChild("MTR_FLD_POS_X"))['Value']) + self.assertEqual("1.54", get_state_as_dict(xDialog.getChild("MTR_FLD_POS_Y"))['Value']) + + xChartMain.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + xChartMain.executeAction("TYPE", mkPropertyValues({"KEYCODE": "LEFT"})) + + # Check the position has changed after moving the label using the arrows keys + with self.ui_test.execute_dialog_through_action(xLegends, "COMMAND", mkPropertyValues({"COMMAND": "TransformDialog"})) as xDialog: + self.assertEqual("4.51", get_state_as_dict(xDialog.getChild("MTR_FLD_POS_X"))['Value']) + self.assertEqual("1.44", get_state_as_dict(xDialog.getChild("MTR_FLD_POS_Y"))['Value']) + + def test_Tdf147394(self): + + with self.ui_test.load_file(get_url_for_data_file("dataLabels.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + + xLegend = calc_doc.Sheets[0].Charts[0].getEmbeddedObject().getFirstDiagram().Legend + self.assertTrue(xLegend.Show) + + # Select the legends + xLegends = xChartMain.getChild("CID/D=0:Legend=") + xLegends.executeAction("SELECT", tuple()) + + # Without the fix in place, this test would have crashed here + xChartMain.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DELETE"})) + + self.assertFalse(xLegend.Show) + +# 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 0000000000..793b634922 --- /dev/null +++ b/sc/qa/uitest/chart/chartTitles.py @@ -0,0 +1,119 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase + +from uitest.uihelper.common import change_measurement_unit + + +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file + +#Chart Display Titles dialog + +class chartTitles(UITestCase): + def test_chart_display_titles_dialog(self): + with self.ui_test.load_file(get_url_for_data_file("tdf98390.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + xCS = calc_doc.Sheets[0].Charts[0].getEmbeddedObject().FirstDiagram.CoordinateSystems[0] + + self.assertFalse(calc_doc.Sheets[0].Charts[0].getEmbeddedObject().HasMainTitle) + self.assertFalse(calc_doc.Sheets[0].Charts[0].getEmbeddedObject().HasSubTitle) + self.assertIsNone(xCS.getAxisByDimension(0, 0).TitleObject) + self.assertIsNone(xCS.getAxisByDimension(1, 0).TitleObject) + + 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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuTitles"})) as xDialog: + + 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"})) + + + self.assertTrue(calc_doc.Sheets[0].Charts[0].getEmbeddedObject().HasMainTitle) + self.assertTrue(calc_doc.Sheets[0].Charts[0].getEmbeddedObject().HasSubTitle) + self.assertEqual("A", calc_doc.Sheets[0].Charts[0].getEmbeddedObject().Title.String) + self.assertEqual("B", calc_doc.Sheets[0].Charts[0].getEmbeddedObject().SubTitle.String) + self.assertEqual("C", xCS.getAxisByDimension(0, 0).TitleObject.Text[0].String) + self.assertEqual("D", xCS.getAxisByDimension(1, 0).TitleObject.Text[0].String) + self.assertEqual("E", xCS.getAxisByDimension(0, 1).TitleObject.Text[0].String) + self.assertEqual("F", xCS.getAxisByDimension(1, 1).TitleObject.Text[0].String) + + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "InsertMenuTitles"})) as xDialog: + + 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") + + + def test_title_move_with_arrows_keys(self): + + with self.ui_test.load_file(get_url_for_data_file("chartArea.ods")): + + with change_measurement_unit(self, "Centimeter"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + + # Select the title + xTitle = xChartMain.getChild("CID/Title=") + xTitle.executeAction("SELECT", tuple()) + + with self.ui_test.execute_dialog_through_action(xTitle, "COMMAND", mkPropertyValues({"COMMAND": "TransformDialog"})) as xDialog: + + self.assertEqual("3.52", get_state_as_dict(xDialog.getChild("MTR_FLD_POS_X"))['Value']) + self.assertEqual("0.3", get_state_as_dict(xDialog.getChild("MTR_FLD_POS_Y"))['Value']) + + + xChartMain.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + xChartMain.executeAction("TYPE", mkPropertyValues({"KEYCODE": "LEFT"})) + + with self.ui_test.execute_dialog_through_action(xTitle, "COMMAND", mkPropertyValues({"COMMAND": "TransformDialog"})) as xDialog: + + # Check the position has changed after moving the title using the arrows keys + self.assertEqual("3.42", get_state_as_dict(xDialog.getChild("MTR_FLD_POS_X"))['Value']) + self.assertEqual("0.2", get_state_as_dict(xDialog.getChild("MTR_FLD_POS_Y"))['Value']) + + +# 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 0000000000..8afacc0c54 --- /dev/null +++ b/sc/qa/uitest/chart/chartWall.py @@ -0,0 +1,170 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import change_measurement_unit, select_pos +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file + +from libreoffice.uno.propertyvalue import mkPropertyValues + + +# Chart Wall dialog +class chartWall(UITestCase): + def test_chart_wall_dialog(self): + with self.ui_test.load_file(get_url_for_data_file("tdf122398.ods")) as calc_doc: + + with change_measurement_unit(self, "Centimeter"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + xWall = calc_doc.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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramWall"})) as xDialog: + #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()) + + + 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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramWall"})) as xDialog: + + 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 + + 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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramWall"})) as xDialog: + + 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()) + + + 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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramWall"})) as xDialog: + + 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) + + + self.assertEqual(xWall.LineWidth, 100) + self.assertEqual(xWall.LineTransparence, 5) + self.assertEqual(hex(xWall.FillColor), '0x23a9d3') + self.assertEqual(xWall.FillTransparence, 51) + +# 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 0000000000..c61cbd97ef --- /dev/null +++ b/sc/qa/uitest/chart/chartXAxis.py @@ -0,0 +1,242 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import change_measurement_unit +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file +from uitest.uihelper.common import select_by_text, select_pos + +from libreoffice.uno.propertyvalue import mkPropertyValues + + +# Chart - X Axis +class chartXAxis(UITestCase): + def test_chart_x_axis_dialog(self): + with self.ui_test.load_file(get_url_for_data_file("tdf122398.ods")): + + with change_measurement_unit(self, "Centimeter"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + 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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) as xDialog: + #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 + + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) as xDialog: + #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") + + select_by_text(crossAxis, "Start") + select_by_text(placeLabels, "Outside end") + innerMajorTick.executeAction("CLICK", tuple()) + outerMajorTick.executeAction("CLICK", tuple()) + innerMinorTick.executeAction("CLICK", tuple()) + outerMinorTick.executeAction("CLICK", tuple()) + select_by_text(placeMarks, "At axis") + + + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) as xDialog: + + 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". + select_by_text(crossAxis, "Value") + crossAxisValue.executeAction("UP", tuple()) #1 + + + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) as xDialog: + + 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()) + + + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) as xDialog: + + 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()) + select_by_text(textdirLB, "Right-to-left") + + + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) as xDialog: + + 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") + + +# 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 0000000000..0bae8f8142 --- /dev/null +++ b/sc/qa/uitest/chart/chartYAxis.py @@ -0,0 +1,243 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import change_measurement_unit, select_by_text, select_pos +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file + +from libreoffice.uno.propertyvalue import mkPropertyValues + + +# Chart - Y Axis +class chartYAxis(UITestCase): + def test_chart_y_axis_dialog(self): + with self.ui_test.load_file(get_url_for_data_file("tdf122398.ods")): + + with change_measurement_unit(self, "Centimeter"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + 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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisY"})) as xDialog: + #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 + + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisY"})) as xDialog: + #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") + + select_by_text(crossAxis, "Start") + select_by_text(placeLabels, "Outside end") + innerMajorTick.executeAction("CLICK", tuple()) + outerMajorTick.executeAction("CLICK", tuple()) + innerMinorTick.executeAction("CLICK", tuple()) + outerMinorTick.executeAction("CLICK", tuple()) + select_by_text(placeMarks, "At axis") + + + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisY"})) as xDialog: + + 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". + select_by_text(crossAxis, "Value") + crossAxisValue.executeAction("CLEAR", tuple()) + crossAxisValue.executeAction("TYPE", mkPropertyValues({"TEXT":"19.01.2018"})) #19.01.2018 + + + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisY"})) as xDialog: + + 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()) + + + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisY"})) as xDialog: + + 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()) + select_by_text(textdirLB, "Right-to-left") + + + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisY"})) as xDialog: + + 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") + + +# 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 0000000000..171371151d --- /dev/null +++ b/sc/qa/uitest/chart/formatDataSeries.py @@ -0,0 +1,96 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import change_measurement_unit, select_pos +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file + +from libreoffice.uno.propertyvalue import mkPropertyValues + + +# test Chart - Data series dialog /core/chart2/uiconfig/ui/tp_SeriesToAxis.ui +class chartFormatDataSeries(UITestCase): + def test_chart_format_data_series_dialog(self): + with self.ui_test.load_file(get_url_for_data_file("tdf93506.ods")): + + with change_measurement_unit(self, "Centimeter"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + 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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatDataSeries"})) as xDialog: + #Click on tab "Options". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + + secondaryYAxis = xDialog.getChild("RBT_OPT_AXIS_2") + leaveGap = xDialog.getChild("RB_DONT_PAINT") + 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()) + + + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatDataSeries"})) as xDialog: + #Click on tab "Options". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + + secondaryYAxis = xDialog.getChild("RBT_OPT_AXIS_2") + leaveGap = xDialog.getChild("RB_DONT_PAINT") + 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") + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/chart/tdf122011.py b/sc/qa/uitest/chart/tdf122011.py new file mode 100644 index 0000000000..478c44a3a8 --- /dev/null +++ b/sc/qa/uitest/chart/tdf122011.py @@ -0,0 +1,51 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.calc import enter_text_to_cell +from uitest.uihelper.common import get_url_for_data_file +from libreoffice.uno.propertyvalue import mkPropertyValues + + +class tdf122011(UITestCase): + + def test_tdf122011(self): + + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + # FIXME: tdf#148166 + enter_text_to_cell(gridwin, "A2", "4") + + # use an existing document + xReference = "'" + get_url_for_data_file("tdf119954.ods") + "'#$Sheet1.$A$1" + + with self.ui_test.execute_dialog_through_command(".uno:InsertObjectChart", close_button="finish") as xChartDlg: + xNextBtn = xChartDlg.getChild("next") + xNextBtn.executeAction("CLICK", tuple()) + + xRange = xChartDlg.getChild("ED_RANGE") + xRange.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xRange.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xRange.executeAction("TYPE", mkPropertyValues({"TEXT": xReference})) + + # Without the fix in place, this test would have gotten stack here because the dialog is not closed + # as the reference to an external file is incorrect + + xChart = document.Sheets[0].Charts[0] + xDataSeries = xChart.getEmbeddedObject().getFirstDiagram().CoordinateSystems[0].ChartTypes[0].DataSeries + + self.assertEqual(1, len(xDataSeries)) + + xDS = xDataSeries[0].DataSequences + + self.assertEqual(1, len(xDS)) + self.assertEqual(xReference, xDS[0].Values.SourceRangeRepresentation) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/chart/tdf43175.py b/sc/qa/uitest/chart/tdf43175.py new file mode 100644 index 0000000000..9851515da1 --- /dev/null +++ b/sc/qa/uitest/chart/tdf43175.py @@ -0,0 +1,43 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from uitest.uihelper.common import get_url_for_data_file + +class Tdf43175(UITestCase): + + def test_tdf43175(self): + with self.ui_test.load_file(get_url_for_data_file("tdf43175.ods")) as document: + + self.xUITest.executeCommand(".uno:TableSelectAll") + + with self.ui_test.execute_dialog_through_command(".uno:Move") as xDialog: + insertBefore = xDialog.getChild("insertBefore") + + # Select - move to end position - + xTreeEntry = insertBefore.getChild('2') + xTreeEntry.executeAction("SELECT", tuple()) + + + aSheetNames = ['Blad1', 'Blad2', 'Blad1_2', 'Blad2_2'] + + self.assertEqual(4, document.Sheets.getCount()) + for i in range(4): + self.assertEqual(aSheetNames[i], document.Sheets[i].Name) + + xChart = document.Sheets[i].Charts[0] + xDataSeries = xChart.getEmbeddedObject().getFirstDiagram().CoordinateSystems[0].ChartTypes[0].DataSeries + self.assertEqual(1, len(xDataSeries)) + + # Without the fix in place, this test would have failed with + # AssertionError: '$Blad1_2.$A$1:$A$5' != '$Blad1.$A$1:$A$5' + aExpectedRangeName = '$' + aSheetNames[i] + '.$A$1:$A$5' + self.assertEqual(aExpectedRangeName, xDataSeries[0].DataSequences[0].Values.SourceRangeRepresentation) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/chart/tdf46885.py b/sc/qa/uitest/chart/tdf46885.py new file mode 100644 index 0000000000..6c3c0d3dc0 --- /dev/null +++ b/sc/qa/uitest/chart/tdf46885.py @@ -0,0 +1,46 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.calc import enter_text_to_cell + +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + + +# Bug 46885 - LibO crash when creating chart with no cells selected +class tdf46885(UITestCase): + def test_tdf46885_crash_chart_no_cell_selected_nextButton(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + enter_text_to_cell(gridwin, "A10", "col1") + #When you start a new chart and have one empty cell selected LibO will crash when you select the Next>> button. + with self.ui_test.execute_dialog_through_command(".uno:InsertObjectChart", close_button="finish") as xChartDlg: + xNextBtn = xChartDlg.getChild("next") + xNextBtn.executeAction("CLICK", tuple()) + + #verify, we didn't crash + self.assertEqual(get_cell_by_position(document, 0, 0, 9).getString(), "col1") + + + def test_tdf46885_crash_chart_multiple_empty_cells_selected(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + enter_text_to_cell(gridwin, "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"})) + with self.ui_test.execute_dialog_through_command(".uno:InsertObjectChart", close_button="finish") as xChartDlg: + xNextBtn = xChartDlg.getChild("next") + xNextBtn.executeAction("CLICK", tuple()) + + #verify, we didn't crash + self.assertEqual(get_cell_by_position(document, 0, 0, 9).getString(), "col1") + +# 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 0000000000..f6cbc0261f --- /dev/null +++ b/sc/qa/uitest/chart/tdf62349.py @@ -0,0 +1,38 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_url_for_data_file + +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + + +# Bug 62349 - Calc crashes when a newly created chart copied to clipboard +class tdf62349(UITestCase): + def test_tdf62349_crash_copy_chart_clipboard(self): + with self.ui_test.load_file(get_url_for_data_file("tdf62349.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #3: select all data cells C5:H9 + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "C5:H9"})) + # 4: create a chart with insert/chart menu + with self.ui_test.execute_dialog_through_command(".uno:InsertObjectChart", close_button="finish"): + pass + + # 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(calc_doc, 0, 2, 5).getString(), "group1") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/chart/tdf64086.py b/sc/qa/uitest/chart/tdf64086.py new file mode 100644 index 0000000000..463b7ae784 --- /dev/null +++ b/sc/qa/uitest/chart/tdf64086.py @@ -0,0 +1,33 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from uitest.uihelper.common import get_url_for_data_file + +class NamedRangesChart(UITestCase): + + def test_chart_series_ranges_with_named_ranges_as_datasource(self): + with self.ui_test.load_file(get_url_for_data_file("tdf64086.xlsx")) as calc_doc: + + xChart = calc_doc.Sheets[0].Charts[0] + xDataSeries = xChart.getEmbeddedObject().getFirstDiagram().CoordinateSystems[0].ChartTypes[0].DataSeries + + self.assertEqual(3, len(xDataSeries)) + + test_range1 = calc_doc.Sheets[0].NamedRanges.getByName("Local_sheet_name") + self.assertEqual(xDataSeries[0].DataSequences[0].Values.SourceRangeRepresentation, test_range1.Name) + + test_range2 = calc_doc.NamedRanges.getByName("global_name") + self.assertEqual(xDataSeries[1].DataSequences[0].Values.SourceRangeRepresentation, test_range2.Name) + + test_range3 = calc_doc.Sheets[1].NamedRanges.getByName("other_sheet_name") + test_range3_Name = calc_doc.Sheets[1].Name + '.' + test_range3.Name + self.assertEqual(xDataSeries[2].DataSequences[0].Values.SourceRangeRepresentation, test_range3_Name) + +# 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 0000000000..4ba39930bc --- /dev/null +++ b/sc/qa/uitest/chart/tdf93506_trendline.py @@ -0,0 +1,433 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import change_measurement_unit, select_by_text, select_pos +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file + +from libreoffice.uno.propertyvalue import mkPropertyValues + + +# 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): + with self.ui_test.load_file(get_url_for_data_file("tdf93506.ods")): + + with change_measurement_unit(self, "Centimeter"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + 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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) as xDialog: + #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") + + 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") + + 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%") + + + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) as xDialog: + #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%") + + + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) as xDialog: + #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%") + + + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) as xDialog: + #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%") + + + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) as xDialog: + #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%") + + + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) as xDialog: + #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%") + + + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) as xDialog: + #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%") + + + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) as xDialog: + #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%") + + + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) as xDialog: + #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 + movingAverageType = xDialog.getChild("combo_moving_type") #type regression Moving average type + 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 + select_by_text(movingAverageType, "Averaged Abscissa") + 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%") + + + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) as xDialog: + #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 + movingAverageType = xDialog.getChild("combo_moving_type") #type regression Moving average type + 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(movingAverageType)["SelectEntryText"], "Averaged Abscissa") + 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%") + + +# 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 0000000000..cb4ed86e6a --- /dev/null +++ b/sc/qa/uitest/chart/tdf96432.py @@ -0,0 +1,71 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file +from uitest.uihelper.common import select_pos +from libreoffice.uno.propertyvalue import mkPropertyValues + +#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): + with self.ui_test.load_file(get_url_for_data_file("tdf96432.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + xDataSeries = calc_doc.Sheets[0].Charts[0].getEmbeddedObject().getFirstDiagram().CoordinateSystems[0].ChartTypes[0].DataSeries + self.assertEqual(0, xDataSeries[0].ErrorBarY.LineTransparence) + + 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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatYErrorBars"})) as xDialog: + #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()) + + #verify - we didn't crash + gridwin.executeAction("DESELECT", mkPropertyValues({"OBJECT": ""})) + + xDataSeries = calc_doc.Sheets[0].Charts[0].getEmbeddedObject().getFirstDiagram().CoordinateSystems[0].ChartTypes[0].DataSeries + self.assertEqual(5, xDataSeries[0].ErrorBarY.LineTransparence) + + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatYErrorBars"})) as xDialog: + #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()) + + #verify - we didn't crash + gridwin.executeAction("DESELECT", mkPropertyValues({"OBJECT": ""})) + + xDataSeries = calc_doc.Sheets[0].Charts[0].getEmbeddedObject().getFirstDiagram().CoordinateSystems[0].ChartTypes[0].DataSeries + self.assertEqual(10, xDataSeries[0].ErrorBarY.LineTransparence) + +# 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 0000000000..6af8869444 --- /dev/null +++ b/sc/qa/uitest/chart/tdf99069.py @@ -0,0 +1,65 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_url_for_data_file +from uitest.uihelper.common import select_pos + +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + + +# Bug 99069 - assertion "SolarMutex not locked" from <Cancel> Data Ranges dialog +class tdf99069(UITestCase): + def test_tdf99069_chart_cancel_data_ranges_dialog(self): + with self.ui_test.load_file(get_url_for_data_file("tdf99069.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #(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. + with self.ui_test.execute_dialog_through_command(".uno:InsertObjectChart", close_button="finish"): + # the chart shows a border with handles on each side and at each corner. + pass + + 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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DataRanges"}), close_button="cancel") as xDialog: + + #(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>. + + #verify - we didn't crash + gridwin.executeAction("DESELECT", mkPropertyValues({"OBJECT": ""})) + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 0).getValue(), 0.529084) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/chart2/tdf122398.py b/sc/qa/uitest/chart2/tdf122398.py new file mode 100644 index 0000000000..7f41c428f1 --- /dev/null +++ b/sc/qa/uitest/chart2/tdf122398.py @@ -0,0 +1,87 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file +from uitest.uihelper.common import select_pos + +from libreoffice.uno.propertyvalue import mkPropertyValues + + +# 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): + with self.ui_test.load_file(get_url_for_data_file("tdf122398.ods")): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) as xDialog: + #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 + + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) as xDialog: + #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") + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/chart2/tdf123013.py b/sc/qa/uitest/chart2/tdf123013.py new file mode 100644 index 0000000000..d7a0b32c87 --- /dev/null +++ b/sc/qa/uitest/chart2/tdf123013.py @@ -0,0 +1,52 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file +from uitest.uihelper.common import select_pos + +from libreoffice.uno.propertyvalue import mkPropertyValues + + +# Bug 123013 - Can not change Trendline name in charts +class tdf123013(UITestCase): + def test_tdf96432_chart_trendline_name(self): + with self.ui_test.load_file(get_url_for_data_file("tdf123013.ods")): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + 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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) as xDialog: + #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"})) + + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) as xDialog: + #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") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/chart2/tdf123231.py b/sc/qa/uitest/chart2/tdf123231.py new file mode 100644 index 0000000000..86c31f74f4 --- /dev/null +++ b/sc/qa/uitest/chart2/tdf123231.py @@ -0,0 +1,65 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file +from uitest.uihelper.common import select_pos + +from libreoffice.uno.propertyvalue import mkPropertyValues + + +# Bug 123231 - Chart set trendline format regression type Power twice +class tdf123231(UITestCase): + def test_tdf123231_chart_trendline_dialog_power(self): + with self.ui_test.load_file(get_url_for_data_file("tdf93506.ods")): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) as xDialog: + #Click on tab "Type". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + power = xDialog.getChild("exponential") #type regression power + + power.executeAction("CLICK", tuple()) #set power + + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) as xDialog: + #Click on tab "Type". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + power = xDialog.getChild("exponential") #type regression power + self.assertEqual(get_state_as_dict(power)["Checked"], "true") + + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) as xDialog: + #Click on tab "Type". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + power = xDialog.getChild("exponential") #type regression power + + self.assertEqual(get_state_as_dict(power)["Checked"], "true") + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/chart2/tdf123520.py b/sc/qa/uitest/chart2/tdf123520.py new file mode 100644 index 0000000000..6854ef0449 --- /dev/null +++ b/sc/qa/uitest/chart2/tdf123520.py @@ -0,0 +1,62 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file +from uitest.uihelper.common import select_by_text, select_pos + +from libreoffice.uno.propertyvalue import mkPropertyValues + + +# 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): + with self.ui_test.load_file(get_url_for_data_file("tdf123520.ods")): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + 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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisY"})) as xDialog: + #Click on tab "positioning". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "1") + + crossAxisValue = xDialog.getChild("EDT_CROSSES_OTHER_AXIS_AT") #only available when crossAxis = Value + placeLabels = xDialog.getChild("LB_PLACE_LABELS") + 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 + select_by_text(placeLabels, "Outside start") + + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisY"})) as xDialog: + + 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") + + 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") + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/chart2/tdf124111.py b/sc/qa/uitest/chart2/tdf124111.py new file mode 100644 index 0000000000..91fac95e0a --- /dev/null +++ b/sc/qa/uitest/chart2/tdf124111.py @@ -0,0 +1,53 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file +from uitest.uihelper.common import select_pos + +from libreoffice.uno.propertyvalue import mkPropertyValues + + +# Bug 124111 - Cannot enter negative number for cross other axis at value +class tdf124111(UITestCase): + def test_tdf124111_chart_x_negative_cross(self): + with self.ui_test.load_file(get_url_for_data_file("tdf124111.ods")): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + 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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) as xDialog: + #Click on tab "positioning". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "1") + + crossAxisValue = xDialog.getChild("EDT_CROSSES_OTHER_AXIS_AT") #only available when crossAxis = Value + crossAxisValue.executeAction("DOWN", tuple()) #-1 + + #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") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) as xDialog: + + 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 + + self.assertEqual(get_state_as_dict(crossAxis)["SelectEntryText"], "Value") + self.assertEqual(get_state_as_dict(crossAxisValue)["Text"], "-1") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/chart2/tdf124295.py b/sc/qa/uitest/chart2/tdf124295.py new file mode 100644 index 0000000000..0c64e0e238 --- /dev/null +++ b/sc/qa/uitest/chart2/tdf124295.py @@ -0,0 +1,32 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict + + +class tdf124295(UITestCase): + + def test_tdf124295(self): + # Open spreadsheet and insert chart + with self.ui_test.create_doc_in_start_center("calc"): + with self.ui_test.execute_dialog_through_command(".uno:InsertObjectChart", close_button="cancel") as xChartDlg: + + # Click 3D look check button + x3DCheckBtn = xChartDlg.getChild("3dlook") + x3DCheckBtn.executeAction("CLICK", tuple()) + + x3DSchemeLstBox = xChartDlg.getChild("3dscheme") + # Without the fix in place, this test would have failed with: + # AssertionError: 'Realistic' != '' + self.assertEqual("Realistic", get_state_as_dict(x3DSchemeLstBox)["SelectEntryText"]) + + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/chart2/tdf129587.py b/sc/qa/uitest/chart2/tdf129587.py new file mode 100644 index 0000000000..1fa06c889f --- /dev/null +++ b/sc/qa/uitest/chart2/tdf129587.py @@ -0,0 +1,56 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file +from uitest.uihelper.common import select_pos +from libreoffice.uno.propertyvalue import mkPropertyValues + +class tdf129587(UITestCase): + def test_tdf129587(self): + + with self.ui_test.load_file(get_url_for_data_file("tdf129587.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + xDataSeries = calc_doc.Sheets[0].Charts[0].getEmbeddedObject().getFirstDiagram().CoordinateSystems[0].ChartTypes[0].DataSeries + self.assertEqual("$Tabelle1.$F$2:$G$11", xDataSeries[0].ErrorBarY.ErrorBarRangeNegative) + + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + + xSeriesObj = xChartMain.getChild("CID/MultiClick/D=0:CS=0:CT=0:Series=0:ErrorsY=") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatYErrorBars"})) as xDialog: + + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + + xPerBtn = xDialog.getChild("RB_PERCENT") + xPerBtn.executeAction("CLICK", tuple()) + + xPosField = xDialog.getChild("MF_POSITIVE") + xNegField = xDialog.getChild("MF_NEGATIVE") + + self.assertEqual("0%", get_state_as_dict(xPosField)['Text']) + self.assertEqual("0%", get_state_as_dict(xNegField)['Text']) + + #Increase value by one + xPosField.executeAction("UP", tuple()) + + #Both fields are updated because 'Same value for both' is enabled + self.assertEqual("1%", get_state_as_dict(xPosField)['Text']) + self.assertEqual("1%", get_state_as_dict(xNegField)['Text']) + + + #Without the fix in place, it would have crashed here + xDataSeries = calc_doc.Sheets[0].Charts[0].getEmbeddedObject().getFirstDiagram().CoordinateSystems[0].ChartTypes[0].DataSeries + self.assertEqual(1.0, xDataSeries[0].ErrorBarY.PercentageError) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/chart2/tdf131715.py b/sc/qa/uitest/chart2/tdf131715.py new file mode 100644 index 0000000000..e001eaa7be --- /dev/null +++ b/sc/qa/uitest/chart2/tdf131715.py @@ -0,0 +1,28 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import select_pos + +class tdf131715(UITestCase): + + def test_tdf131715(self): + with self.ui_test.create_doc_in_start_center("calc"): + with self.ui_test.execute_dialog_through_command(".uno:InsertObjectChart", close_button="finish") as xChartDlg: + + 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") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/chart2/tdf133630.py b/sc/qa/uitest/chart2/tdf133630.py new file mode 100644 index 0000000000..ba8099bdc0 --- /dev/null +++ b/sc/qa/uitest/chart2/tdf133630.py @@ -0,0 +1,61 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import select_pos, get_url_for_data_file +from uitest.uihelper.common import change_measurement_unit +from libreoffice.uno.propertyvalue import mkPropertyValues + +class tdf133630(UITestCase): + + def test_tdf133630(self): + + with self.ui_test.load_file(get_url_for_data_file("chartArea.ods")) as calc_doc: + + with change_measurement_unit(self, "Centimeter"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + xCS = calc_doc.Sheets[0].Charts[0].getEmbeddedObject().getFirstDiagram().CoordinateSystems[0] + self.assertEqual(0, xCS.getAxisByDimension(0, 0).LineWidth) + self.assertEqual(80, xCS.ChartTypes[0].DataSeries[0].LineWidth) + + # First change the line width of one element + 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:Axis=0,0") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) as xDialog: + + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "2") + + xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") + xWidth.executeAction("UP", tuple()) + + + self.assertEqual(100, xCS.getAxisByDimension(0, 0).LineWidth) + self.assertEqual(80, xCS.ChartTypes[0].DataSeries[0].LineWidth) + + # Now change the line width of another element + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatDataSeries"})) as xDialog: + + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "1") + + xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") + xWidth.executeAction("UP", tuple()) + + # Without the fix in place, this test would have crashed here + + self.assertEqual(100, xCS.getAxisByDimension(0, 0).LineWidth) + self.assertEqual(100, xCS.ChartTypes[0].DataSeries[0].LineWidth) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/chart2/tdf134059.py b/sc/qa/uitest/chart2/tdf134059.py new file mode 100644 index 0000000000..92be27ffa0 --- /dev/null +++ b/sc/qa/uitest/chart2/tdf134059.py @@ -0,0 +1,64 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import select_pos +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file +from libreoffice.calc.document import get_row + +class Tdf134059(UITestCase): + + def assertSeriesNames(self, gridwin): + + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + + xPage = xChartMain.getChild("CID/Page=") + + with self.ui_test.execute_dialog_through_action(xPage, "COMMAND", mkPropertyValues({"COMMAND": "DataRanges"})) as xDialog: + + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") + + xSeries = xDialog.getChild("LB_SERIES") + self.assertEqual(3, len(xSeries.getChildren())) + self.assertEqual("Col. 1", get_state_as_dict(xSeries.getChild('0'))['Text']) + self.assertEqual("Col. 2", get_state_as_dict(xSeries.getChild('1'))['Text']) + self.assertEqual("Col. 3", get_state_as_dict(xSeries.getChild('2'))['Text']) + + + gridwin.executeAction("DESELECT", mkPropertyValues({"OBJECT": "Object 1"})) + + def test_tdf134059(self): + with self.ui_test.load_file(get_url_for_data_file("tdf134059.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + self.assertSeriesNames(gridwin) + + # Hide row 10 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A10"})) + self.ui_test._xUITest.executeCommand(".uno:HideRow") + + row = get_row(calc_doc, 9) + self.assertFalse(row.getPropertyValue("IsVisible")) + + # Without the fix in place, this test would have failed with + # AssertionError: 'Col. 1' != 'Column C' + self.assertSeriesNames(gridwin) + + self.xUITest.executeCommand(".uno:Undo") + + self.assertTrue(row.getPropertyValue("IsVisible")) + + self.assertSeriesNames(gridwin) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/chart2/tdf142851.py b/sc/qa/uitest/chart2/tdf142851.py new file mode 100644 index 0000000000..e48b9cf466 --- /dev/null +++ b/sc/qa/uitest/chart2/tdf142851.py @@ -0,0 +1,34 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file + +# Bug 142851 - UI Chart Type dialog empty with unsupported combo chart + +class tdf142851(UITestCase): + def test_tdf142851_combo_chart_type(self): + with self.ui_test.load_file(get_url_for_data_file("tdf142851.xlsx")): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Diagram 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xChart = xChartMain.getChild("CID/Page=") + + with self.ui_test.execute_dialog_through_action(xChart, "COMMAND", mkPropertyValues({"COMMAND" : "DiagramType"})) as xDialog: + chartTypeVisible = get_state_as_dict(xDialog.getChild("charttype"))['Visible'] + subTypeVisible = get_state_as_dict(xDialog.getChild("subtype"))['Visible'] + + self.assertEqual('true', chartTypeVisible) + self.assertEqual('true', subTypeVisible) + +# 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 0000000000..e69de29bb2 --- /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 0000000000..692c3c8109 --- /dev/null +++ b/sc/qa/uitest/conditional_format/tdf100793.py @@ -0,0 +1,87 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file +from 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 + +#Bug 100793 - FORMATTING - conditional formatting gets corrupted upon copy/paste/insert +class tdf100793(UITestCase): + def test_tdf100793(self): + + with self.ui_test.load_file(get_url_for_data_file("tdf100793.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + 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 + with self.ui_test.execute_dialog_through_command(".uno:ConditionalFormatManagerDialog", close_button="") as xCondFormatMgr: + + # 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") + with self.ui_test.execute_dialog_through_action(xEditBtn, "CLICK", event_name = "ModelessDialogVisible") as xCondFormatDlg: + + #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"})) + + # 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 + with self.ui_test.execute_dialog_through_command(".uno:ConditionalFormatManagerDialog", close_button="") as xCondFormatMgr: + xEditBtn = xCondFormatMgr.getChild("edit") + with self.ui_test.execute_dialog_through_action(xEditBtn, "CLICK", event_name = "ModelessDialogVisible") as xCondFormatDlg: + xedassign = xCondFormatDlg.getChild("edassign") + self.assertEqual(get_state_as_dict(xedassign)["Text"], "G18:K29,F18:K33,F20:F29") + + xCondFormatMgr = self.xUITest.getTopFocusWindow() + xCancelBtn = xCondFormatMgr.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/conditional_format/tdf104026.py b/sc/qa/uitest/conditional_format/tdf104026.py new file mode 100644 index 0000000000..2d8c5fc66c --- /dev/null +++ b/sc/qa/uitest/conditional_format/tdf104026.py @@ -0,0 +1,45 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file + +class Tdf104026(UITestCase): + + def execute_conditional_format_manager_dialog(self, nCount): + + with self.ui_test.execute_dialog_through_command(".uno:ConditionalFormatManagerDialog") as xCondFormatMgr: + + aExpectedResults = ['A2\tCell value != $Sheet1.$B2', 'A3\tCell value != $Sheet1.$B3', + 'A4\tCell value != $Sheet1.$B4', 'A5\tCell value != $Sheet1.$B5', + 'A6\tCell value != $Sheet1.$B6', 'A7\tCell value != $Sheet1.$B7'] + + xList = xCondFormatMgr.getChild("CONTAINER") + self.assertEqual(nCount, len(xList.getChildren())) + + for i in range(nCount): + self.assertEqual(aExpectedResults[i], get_state_as_dict(xList.getChild(str(i)))['Text']) + + + def test_tdf104026(self): + with self.ui_test.load_file(get_url_for_data_file("tdf104026.ods")): + + self.execute_conditional_format_manager_dialog(6) + + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A2"})) + + self.xUITest.executeCommand(".uno:DeleteRows") + + # Without the fix in place, this test would have failed with + # AssertionError: 'A2\tCell value != $Sheet1.$B2' != 'A2\tCell value != $Sheet1.$B#REF!' + self.execute_conditional_format_manager_dialog(5) + +# 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 0000000000..42d2c5b20c --- /dev/null +++ b/sc/qa/uitest/conditional_format/tdf105351.py @@ -0,0 +1,57 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.calc import enter_text_to_cell +from uitest.uihelper.common import get_state_as_dict, select_by_text + +from libreoffice.uno.propertyvalue import mkPropertyValues + + +# Bug 105351 - FORMATTING: Unable to change Data Bar conditional formatting +class tdf105351(UITestCase): + def test_tdf105351_cond_format_data_bar(self): + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #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"})) + with self.ui_test.execute_modeless_dialog_through_command(".uno:DataBarFormatDialog") as xDialog: + 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 + select_by_text(xcolscalemin, "Value") + xedcolscalemin.executeAction("TYPE", mkPropertyValues({"TEXT":"0"})) + + select_by_text(xcolscalemax, "Value") + xedcolscalemax.executeAction("TYPE", mkPropertyValues({"TEXT":"10"})) + + #Verify : The conditions set for cell A1 should be shown and editable. + with self.ui_test.execute_modeless_dialog_through_command(".uno:DataBarFormatDialog") as xDialog: + 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") + + + +# 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 0000000000..69362f4c3f --- /dev/null +++ b/sc/qa/uitest/conditional_format/tdf105411.py @@ -0,0 +1,32 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase + +class tdf105411(UITestCase): + + def test_delete_conditional_format(self): + + with self.ui_test.create_doc_in_start_center("calc"): + + with self.ui_test.execute_modeless_dialog_through_command(".uno:ConditionalFormatDialog", close_button="") as xCondFormatDlg: + 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) + +# 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 0000000000..1790575fdf --- /dev/null +++ b/sc/qa/uitest/conditional_format/tdf105466.py @@ -0,0 +1,32 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from uitest.uihelper.common import select_pos + + +class tdf105466(UITestCase): + + def test_changing_conditional_format(self): + + with self.ui_test.create_doc_in_start_center("calc"): + + with self.ui_test.execute_modeless_dialog_through_command(".uno:ConditionalFormatDialog", close_button="") as xCondFormatDlg: + + for i in range(0,4): + xTypeLstBox = xCondFormatDlg.getChild("type") + select_pos(xTypeLstBox, str(i)) + + # After changing the type, the dialog is recalculated + xCondFormatDlg = self.xUITest.getTopFocusWindow() + + xOkBtn = xCondFormatDlg.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) + +# 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 0000000000..b172d4067a --- /dev/null +++ b/sc/qa/uitest/conditional_format/tdf105544.py @@ -0,0 +1,50 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file + +from libreoffice.uno.propertyvalue import mkPropertyValues + + +# Bug 105544 - Manage Conditional Formatting is not able to edit a condition +class tdf105544(UITestCase): + def test_tdf105544_Manage_Conditional_Formatting_edit_condition(self): + + with self.ui_test.load_file(get_url_for_data_file("tdf105544.ods")): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #2. select B3. Format> conditional formatting> manage + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B3"})) + with self.ui_test.execute_dialog_through_command(".uno:ConditionalFormatManagerDialog", close_button="") as xCondFormatMgr: + + # 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") + with self.ui_test.execute_dialog_through_action(xEditBtn, "CLICK", event_name = "ModelessDialogVisible"): + pass + + # 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) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/conditional_format/tdf117899.py b/sc/qa/uitest/conditional_format/tdf117899.py new file mode 100644 index 0000000000..81c270cc89 --- /dev/null +++ b/sc/qa/uitest/conditional_format/tdf117899.py @@ -0,0 +1,63 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +import os.path +from tempfile import TemporaryDirectory + +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file +from libreoffice.uno.propertyvalue import mkPropertyValues + +from org.libreoffice.unotest import systemPathToFileUrl + + +class Tdf117899(UITestCase): + + def execute_conditional_format_manager_dialog(self): + + with self.ui_test.execute_dialog_through_command(".uno:ConditionalFormatManagerDialog") as xCondFormatMgr: + + aExpectedResult = 'Formula is $E3="нет"' + xList = xCondFormatMgr.getChild("CONTAINER") + self.assertEqual(1, len(xList.getChildren())) + self.assertTrue(get_state_as_dict(xList.getChild('0'))['Text'].endswith(aExpectedResult)) + + + def test_tdf117899(self): + with TemporaryDirectory() as tempdir: + xFilePath = os.path.join(tempdir, "tdf117899-temp.ods") + + with self.ui_test.load_file(get_url_for_data_file("tdf117899.ods")): + + self.execute_conditional_format_manager_dialog() + + self.xUITest.executeCommand(".uno:SelectAll") + + self.xUITest.executeCommand(".uno:Copy") + + with self.ui_test.load_empty_file("writer"): + + self.xUITest.getTopFocusWindow() + + # Paste as an OLE spreadsheet + formatProperty = mkPropertyValues({"SelectedFormat": 85}) + self.xUITest.executeCommandWithParameters(".uno:ClipboardFormatItems", formatProperty) + + # Save Copy as + with self.ui_test.execute_dialog_through_command(".uno:ObjectMenue?VerbID:short=-8", close_button="open") as xDialog: + + xFileName = xDialog.getChild("file_name") + xFileName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xFileName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": xFilePath})) + + with self.ui_test.load_file(systemPathToFileUrl(xFilePath)): + # Without the fix in place, this test would have failed here + self.execute_conditional_format_manager_dialog() + +# 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 0000000000..efbebdd604 --- /dev/null +++ b/sc/qa/uitest/conditional_format/tdf118206.py @@ -0,0 +1,43 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_url_for_data_file + +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + + +# Bug 118206 - [GTK3] Calc hangs copying/cutting a conditional format column +class tdf118206(UITestCase): + def test_tdf118206(self): + with self.ui_test.load_file(get_url_for_data_file("tdf118206.xlsx")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + 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(calc_doc, 0, 1, 0).getString(), "On Back Order") + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 1).getValue(), 0) + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 7).getValue(), 1) + + #Undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 0).getString(), "On Back Order") + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 1).getValue(), 0) + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 7).getValue(), 1) + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 0).getString(), "") + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 1).getString(), "") + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 7).getString(), "") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/conditional_format/tdf119178.py b/sc/qa/uitest/conditional_format/tdf119178.py new file mode 100644 index 0000000000..04a30fc516 --- /dev/null +++ b/sc/qa/uitest/conditional_format/tdf119178.py @@ -0,0 +1,58 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, select_by_text +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.uno.propertyvalue import mkPropertyValues + +class tdf119178(UITestCase): + + def test_tdf119178(self): + + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + enter_text_to_cell(gridwin, "A15", "test") + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + + with self.ui_test.execute_modeless_dialog_through_command(".uno:ConditionalFormatDialog", close_button="") as xCondFormatDlg: + + xRange = xCondFormatDlg.getChild("edassign") + xRange.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xRange.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xRange.executeAction("TYPE", mkPropertyValues({"TEXT": "$B$15"})) + + xType = xCondFormatDlg.getChild("type") + select_by_text(xType, "Formula is") + + # After changing the type, the dialog is recalculated + xCondFormatDlg = self.xUITest.getTopFocusWindow() + + xStyle = xCondFormatDlg.getChild("style") + select_by_text(xStyle, "Error") + + xFormula = xCondFormatDlg.getChild("formula") + xFormula.executeAction("TYPE", mkPropertyValues({"TEXT": "$A15 = \"test\""})) + + xOkBtn = xCondFormatDlg.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) + + # Check the conditional format is correctly displayed in the manager + with self.ui_test.execute_dialog_through_command(".uno:ConditionalFormatManagerDialog") as xCondFormatMgr: + aExpectedResult = 'B15\tFormula is $A15 = "test"' + xList = xCondFormatMgr.getChild("CONTAINER") + self.assertEqual(1, len(xList.getChildren())) + + # Without the fix in place, this test would have failed with + # AssertionError: 'B15\tFormula is $A15 = "test"' != 'B15\tFormula is $A29 = "test"' + self.assertEqual(aExpectedResult, get_state_as_dict(xList.getChild('0'))['Text']) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/conditional_format/tdf124412.py b/sc/qa/uitest/conditional_format/tdf124412.py new file mode 100644 index 0000000000..3a2b457127 --- /dev/null +++ b/sc/qa/uitest/conditional_format/tdf124412.py @@ -0,0 +1,36 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from uitest.uihelper.common import get_url_for_data_file, get_state_as_dict +from libreoffice.uno.propertyvalue import mkPropertyValues + +class tdf124412(UITestCase): + + def test_tdf124412(self): + + with self.ui_test.load_file(get_url_for_data_file("tdf124412.ods")): + + xTopWindow = self.xUITest.getTopFocusWindow() + gridwin = xTopWindow.getChild("grid_window") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A2:A13"})) + + with self.ui_test.execute_modeless_dialog_through_command(".uno:ConditionalFormatDialog") as xCondFormatDlg: + xCondition1 = xCondFormatDlg.getChild("Condition 1") + xCondition2 = xCondFormatDlg.getChild("Condition 2") + + # This is empty because the entry is selected + self.assertEqual("", get_state_as_dict(xCondition1)["DisplayText"]) + + # Without the fix in place, this test would have failed with + # AssertionError: 'Date is last month' != 'Date is today' + self.assertEqual("Date is last month", get_state_as_dict(xCondition2)["DisplayText"]) + +# 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 0000000000..0c03d6fcd2 --- /dev/null +++ b/sc/qa/uitest/conditional_format/tdf81696.py @@ -0,0 +1,38 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_url_for_data_file, select_pos + +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + + +# Bug 81696 - CRASH while sorting cells with conditional formatting +class tdf81696(UITestCase): + + def test_tdf81696_sort_cell_conditional_formatting(self): + with self.ui_test.load_file(get_url_for_data_file("tdf81696.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B3"})) + #Open sort dialog by DATA - SORT,Just sort it by Column A, ascending. (it's default) + with self.ui_test.execute_dialog_through_command(".uno:DataSort") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + + #verify + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 0).getString(), "A") + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 0).getString(), "B") + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 1).getValue(), 1) + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 1).getValue(), 2) + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 2).getValue(), 2) + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 2).getValue(), 1) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/conditional_format/tdf96453.py b/sc/qa/uitest/conditional_format/tdf96453.py new file mode 100644 index 0000000000..453a9ff48e --- /dev/null +++ b/sc/qa/uitest/conditional_format/tdf96453.py @@ -0,0 +1,64 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file +from libreoffice.calc.document import get_sheet_from_doc +from libreoffice.calc.conditional_format import get_conditional_format_from_sheet + +class ConditionalFormatDlgTest(UITestCase): + + def test_tdf96453(self): + + with self.ui_test.load_file(get_url_for_data_file("tdf96453.ods")) as calc_doc: + + sheet = get_sheet_from_doc(calc_doc, 0) + conditional_format_list = get_conditional_format_from_sheet(sheet) + self.assertEqual(conditional_format_list.getLength(), 2) + + with self.ui_test.execute_dialog_through_command(".uno:ConditionalFormatManagerDialog", close_button="") as xCondFormatMgr: + + + # 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") + with self.ui_test.execute_dialog_through_action(xAddBtn, "CLICK", event_name = "ModelessDialogVisible"): + pass + + # 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) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/csv_dialog/tdf114878.py b/sc/qa/uitest/csv_dialog/tdf114878.py new file mode 100644 index 0000000000..90fa00ed95 --- /dev/null +++ b/sc/qa/uitest/csv_dialog/tdf114878.py @@ -0,0 +1,48 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict +from libreoffice.calc.document import get_cell_by_position +from libreoffice.calc.csv_dialog import load_csv_file + +class Td114878(UITestCase): + + def test_tdf114878(self): + + # First import the file with 'Evaluate Formulas' unchecked + with load_csv_file(self, "tdf114878.csv", True): + # Without the fix in place, this test would have failed with + # Could not find child with id: evaluateformulas + pass + + document = self.ui_test.get_component() + + self.assertEqual("=-3+5", get_cell_by_position(document, 0, 0, 0).getString()) + self.assertEqual('=TRUE()', get_cell_by_position(document, 0, 0, 1).getString()) + self.assertEqual('=4*10', get_cell_by_position(document, 0, 0, 2).getString()) + self.assertEqual('=SUM(A1:A3)', get_cell_by_position(document, 0, 0, 3).getString()) + + self.ui_test.close_doc() + + # Now import the file with 'Evaluate Formulas' checked + with load_csv_file(self, "tdf114878.csv", True) as xDialog: + xEvalutateFormulas = xDialog.getChild("evaluateformulas") + xEvalutateFormulas.executeAction("CLICK", tuple()) + self.assertEqual('true', get_state_as_dict(xEvalutateFormulas)['Selected']) + + document = self.ui_test.get_component() + + self.assertEqual("2", get_cell_by_position(document, 0, 0, 0).getString()) + self.assertEqual('1', get_cell_by_position(document, 0, 0, 1).getString()) + self.assertEqual('40', get_cell_by_position(document, 0, 0, 2).getString()) + self.assertEqual('43', get_cell_by_position(document, 0, 0, 3).getString()) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/csv_dialog/tdf117868.py b/sc/qa/uitest/csv_dialog/tdf117868.py new file mode 100644 index 0000000000..d5306117e3 --- /dev/null +++ b/sc/qa/uitest/csv_dialog/tdf117868.py @@ -0,0 +1,48 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict +from libreoffice.calc.document import get_cell_by_position +from libreoffice.calc.csv_dialog import load_csv_file + +class Td117868(UITestCase): + + def test_tdf117868(self): + + with load_csv_file(self, "tdf117868.csv", False) as xDialog: + # Set text delimiter in case it's changed by another test + xSeparatedBy = xDialog.getChild("toseparatedby") + xSeparatedBy.executeAction("CLICK", tuple()) + + # Without the fix in place, this test would have failed with + # AssertionError: 'true' != 'false' + self.assertEqual('true', get_state_as_dict(xDialog.getChild("other"))['Selected']) + self.assertEqual('false', get_state_as_dict(xDialog.getChild("tab"))['Selected']) + self.assertEqual('false', get_state_as_dict(xDialog.getChild("comma"))['Selected']) + self.assertEqual('false', get_state_as_dict(xDialog.getChild("semicolon"))['Selected']) + + self.assertEqual('1', get_state_as_dict(xDialog.getChild("fromrow"))['Text']) + + xInputOther = xDialog.getChild("inputother") + self.assertEqual("|", get_state_as_dict(xInputOther)['Text']) + + document = self.ui_test.get_component() + + self.assertEqual("LETTER", get_cell_by_position(document, 0, 0, 1).getString()) + self.assertEqual("ANIMAL", get_cell_by_position(document, 0, 1, 1).getString()) + self.assertEqual('a', get_cell_by_position(document, 0, 0, 2).getString()) + self.assertEqual('aardvark', get_cell_by_position(document, 0, 1, 2).getString()) + self.assertEqual('b', get_cell_by_position(document, 0, 0, 3).getString()) + self.assertEqual('bear', get_cell_by_position(document, 0, 1, 3).getString()) + self.assertEqual('c', get_cell_by_position(document, 0, 0, 4).getString()) + self.assertEqual('cow', get_cell_by_position(document, 0, 1, 4).getString()) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/csv_dialog/tdf142395.py b/sc/qa/uitest/csv_dialog/tdf142395.py new file mode 100644 index 0000000000..718a3ac47b --- /dev/null +++ b/sc/qa/uitest/csv_dialog/tdf142395.py @@ -0,0 +1,40 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues +from libreoffice.calc.document import get_cell_by_position +from libreoffice.calc.csv_dialog import load_csv_file + +class Tdf142395(UITestCase): + + def test_tdf142395(self): + with load_csv_file(self, "tdf142395.csv", True) as xDialog: + # Remove the text delimiter + xTextDelimiter = xDialog.getChild("textdelimiter") + xTextDelimiter.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xTextDelimiter.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + + document = self.ui_test.get_component() + + self.assertEqual("a", get_cell_by_position(document, 0, 0, 0).getString()) + self.assertEqual(" b", get_cell_by_position(document, 0, 1, 0).getString()) + self.assertEqual(" c", get_cell_by_position(document, 0, 2, 0).getString()) + + # Without the fix in place, this test would have failed with + # AssertionError: ' ' != '晦餪' + self.assertEqual(" ", get_cell_by_position(document, 0, 3, 0).getString()) + + self.assertEqual("e", get_cell_by_position(document, 0, 0, 1).getString()) + self.assertEqual(" f", get_cell_by_position(document, 0, 1, 1).getString()) + self.assertEqual(" g", get_cell_by_position(document, 0, 2, 1).getString()) + self.assertEqual(" ", get_cell_by_position(document, 0, 3, 1).getString()) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/csv_dialog/tdf39716.py b/sc/qa/uitest/csv_dialog/tdf39716.py new file mode 100644 index 0000000000..395596602a --- /dev/null +++ b/sc/qa/uitest/csv_dialog/tdf39716.py @@ -0,0 +1,31 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase + +from libreoffice.calc.csv_dialog import load_csv_file +from libreoffice.calc.document import get_cell_by_position + + +class Tdf39716(UITestCase): + + def test_tdf39716(self): + + with load_csv_file(self, "tdf39716.csv", True): + pass + + document = self.ui_test.get_component() + + # Without the fix in place, this test would have failed with + # AssertionError: 2.5e-13 != 0.0 + self.assertEqual(2.5e-13, get_cell_by_position(document, 0, 0, 0).getValue()) + self.assertEqual(5e-13, get_cell_by_position(document, 0, 0, 1).getValue()) + self.assertEqual(7.5e-13, get_cell_by_position(document, 0, 0, 2).getValue()) + self.assertEqual(1e-12, get_cell_by_position(document, 0, 0, 3).getValue()) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/csv_dialog/tdf57841.py b/sc/qa/uitest/csv_dialog/tdf57841.py new file mode 100644 index 0000000000..3fb4da921e --- /dev/null +++ b/sc/qa/uitest/csv_dialog/tdf57841.py @@ -0,0 +1,28 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from libreoffice.calc.document import get_cell_by_position +from libreoffice.calc.csv_dialog import load_csv_file + +class Tdf57841(UITestCase): + + def test_tdf57841(self): + with load_csv_file(self, "tdf57841.csv", True): + pass + + document = self.ui_test.get_component() + + # Without the fix in place, this test would have failed with + # AssertionError: '2' != '' + for i in range(4): + self.assertEqual(str(i + 1), get_cell_by_position(document, 0, i, 0).getString()) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/csv_dialog/tdf60468.py b/sc/qa/uitest/csv_dialog/tdf60468.py new file mode 100644 index 0000000000..db83664fee --- /dev/null +++ b/sc/qa/uitest/csv_dialog/tdf60468.py @@ -0,0 +1,37 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from libreoffice.calc.document import get_cell_by_position +from libreoffice.calc.csv_dialog import load_csv_file + +class Tdf60468(UITestCase): + + def test_tdf60468(self): + + # Load file from Open dialog + with load_csv_file(self, "tdf60468.csv", True): + pass + + document = self.ui_test.get_component() + + # tdf#142040: Without the fix in place, this test would have failed with + # AssertionError: 'head1' != '' + for i in range(3): + self.assertEqual("head" + str(i + 1), get_cell_by_position(document, 0, i, 0).getString()) + + self.assertEqual("value1.1\nvalue1.2", get_cell_by_position(document, 0, 0, 1).getString()) + + # Without the fix in place, this test would have failed with + # AssertionError: 'value2.1\n\tvalue2.2\nvalue2.3' != 'value2.1\n\tvalue2.2' + self.assertEqual("value2.1\n\tvalue2.2\nvalue2.3", get_cell_by_position(document, 0, 1, 1).getString()) + self.assertEqual("value3", get_cell_by_position(document, 0, 2, 1).getString()) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/csv_dialog/tdf88359.py b/sc/qa/uitest/csv_dialog/tdf88359.py new file mode 100644 index 0000000000..19fa8b9192 --- /dev/null +++ b/sc/qa/uitest/csv_dialog/tdf88359.py @@ -0,0 +1,40 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, select_pos +from libreoffice.calc.csv_dialog import load_csv_file +from libreoffice.uno.propertyvalue import mkPropertyValues + +class Tdf88359(UITestCase): + + def test_tdf88359(self): + + # Import the file with 'Detect Special Numbers' unchecked + with load_csv_file(self, "tdf88359.csv", True): + pass + + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A2"})) + + with self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + xliststore1 = xDialog.getChild("categorylb") + xliststore2 = xDialog.getChild("formatlb") + xformatted = xDialog.getChild("formatted") + + # Without the fix in place, this test would have failed with + # AssertionError: 'Date' != 'Text' + self.assertEqual("Date", get_state_as_dict(xliststore1)["SelectEntryText"]) + self.assertEqual("1999-12-31T13:37:46", get_state_as_dict(xliststore2)["SelectEntryText"]) + self.assertEqual("YYYY-MM-DD\"T\"HH:MM:SS", get_state_as_dict(xformatted)["Text"]) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/csv_dialog/tdf92503.py b/sc/qa/uitest/csv_dialog/tdf92503.py new file mode 100644 index 0000000000..9774b03c35 --- /dev/null +++ b/sc/qa/uitest/csv_dialog/tdf92503.py @@ -0,0 +1,52 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, select_by_text +from libreoffice.uno.propertyvalue import mkPropertyValues +from libreoffice.calc.document import get_cell_by_position +from libreoffice.calc.csv_dialog import load_csv_file + +class Tdf92503(UITestCase): + + def test_tdf92503(self): + with load_csv_file(self, "tdf92503.csv", True) as xDialog: + xFixedWidth = xDialog.getChild("tofixedwidth") + xGrid = xDialog.getChild("csvgrid") + xColumnType = xDialog.getChild("columntype") + + xFixedWidth.executeAction("CLICK", tuple()) + self.assertEqual('true', get_state_as_dict(xFixedWidth)['Checked']) + + # Use the right arrow to put the focus in the grid + xGrid.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RIGHT"})) + + self.assertEqual('true', get_state_as_dict(xColumnType)['Enabled']) + + select_by_text(xColumnType, "Date (DMY)") + + self.assertEqual('Date (DMY)', get_state_as_dict(xColumnType)['SelectEntryText']) + + document = self.ui_test.get_component() + + self.assertEqual("03/31/13 01:00 AM", get_cell_by_position(document, 0, 0, 0).getString()) + + # Without the fix in place, this test would have failed with + # AssertionError: '03/31/13 02:00 AM' != '31 Mar 2013, 02:00' + self.assertEqual("03/31/13 02:00 AM", get_cell_by_position(document, 0, 0, 1).getString()) + self.assertEqual("03/31/13 03:00 AM", get_cell_by_position(document, 0, 0, 2).getString()) + self.assertEqual("03/30/14 01:00 AM", get_cell_by_position(document, 0, 0, 3).getString()) + self.assertEqual("03/30/14 02:00 AM", get_cell_by_position(document, 0, 0, 4).getString()) + self.assertEqual("03/30/14 03:00 AM", get_cell_by_position(document, 0, 0, 5).getString()) + self.assertEqual("03/29/15 01:00 AM", get_cell_by_position(document, 0, 0, 6).getString()) + self.assertEqual("03/29/15 02:00 AM", get_cell_by_position(document, 0, 0, 7).getString()) + self.assertEqual("03/29/15 03:00 AM", get_cell_by_position(document, 0, 0, 8).getString()) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/csv_dialog/tdf96561.py b/sc/qa/uitest/csv_dialog/tdf96561.py new file mode 100644 index 0000000000..a22b9180c7 --- /dev/null +++ b/sc/qa/uitest/csv_dialog/tdf96561.py @@ -0,0 +1,34 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from libreoffice.calc.document import get_cell_by_position +from libreoffice.calc.csv_dialog import load_csv_file + +class Tdf96561(UITestCase): + + def test_tdf96561(self): + with load_csv_file(self, "tdf96561.csv", True): + pass + + document = self.ui_test.get_component() + + self.assertEqual('Campo con ";" en medio', get_cell_by_position(document, 0, 0, 0).getString()) + + # Without the fix in place, this test would have failed with + # AssertionError: '""; esta al """""principio del Campo' != 'Campo la tiene al final;"' + self.assertEqual('""; esta al """""principio del Campo', get_cell_by_position(document, 0, 0, 1).getString()) + self.assertEqual('Campo la tiene al final;"', get_cell_by_position(document, 0, 0, 2).getString()) + + for i in range(1,5): + for j in range(0,3): + self.assertEqual("1", get_cell_by_position(document, 0, i, j).getString()) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/data/autofilter/autofilter.ods b/sc/qa/uitest/data/autofilter/autofilter.ods Binary files differnew file mode 100644 index 0000000000..49285933ce --- /dev/null +++ b/sc/qa/uitest/data/autofilter/autofilter.ods diff --git a/sc/qa/uitest/data/autofilter/tdf101165.ods b/sc/qa/uitest/data/autofilter/tdf101165.ods Binary files differnew file mode 100644 index 0000000000..9c459bbc52 --- /dev/null +++ b/sc/qa/uitest/data/autofilter/tdf101165.ods diff --git a/sc/qa/uitest/data/autofilter/tdf112656.ods b/sc/qa/uitest/data/autofilter/tdf112656.ods Binary files differnew file mode 100644 index 0000000000..c6859f238e --- /dev/null +++ b/sc/qa/uitest/data/autofilter/tdf112656.ods diff --git a/sc/qa/uitest/data/autofilter/tdf115046.ods b/sc/qa/uitest/data/autofilter/tdf115046.ods Binary files differnew file mode 100644 index 0000000000..edd544373e --- /dev/null +++ b/sc/qa/uitest/data/autofilter/tdf115046.ods diff --git a/sc/qa/uitest/data/autofilter/tdf116818.xlsx b/sc/qa/uitest/data/autofilter/tdf116818.xlsx Binary files differnew file mode 100644 index 0000000000..060615cc04 --- /dev/null +++ b/sc/qa/uitest/data/autofilter/tdf116818.xlsx diff --git a/sc/qa/uitest/data/autofilter/tdf117276.ods b/sc/qa/uitest/data/autofilter/tdf117276.ods Binary files differnew file mode 100644 index 0000000000..d1310526e7 --- /dev/null +++ b/sc/qa/uitest/data/autofilter/tdf117276.ods diff --git a/sc/qa/uitest/data/autofilter/tdf122260.ods b/sc/qa/uitest/data/autofilter/tdf122260.ods Binary files differnew file mode 100644 index 0000000000..00c86d00a3 --- /dev/null +++ b/sc/qa/uitest/data/autofilter/tdf122260.ods diff --git a/sc/qa/uitest/data/autofilter/tdf130770.ods b/sc/qa/uitest/data/autofilter/tdf130770.ods Binary files differnew file mode 100644 index 0000000000..952cf3866b --- /dev/null +++ b/sc/qa/uitest/data/autofilter/tdf130770.ods diff --git a/sc/qa/uitest/data/autofilter/tdf133160.ods b/sc/qa/uitest/data/autofilter/tdf133160.ods Binary files differnew file mode 100644 index 0000000000..40f83e60af --- /dev/null +++ b/sc/qa/uitest/data/autofilter/tdf133160.ods diff --git a/sc/qa/uitest/data/autofilter/tdf137626.xlsx b/sc/qa/uitest/data/autofilter/tdf137626.xlsx Binary files differnew file mode 100644 index 0000000000..eb5ce4da7b --- /dev/null +++ b/sc/qa/uitest/data/autofilter/tdf137626.xlsx diff --git a/sc/qa/uitest/data/autofilter/tdf138438.ods b/sc/qa/uitest/data/autofilter/tdf138438.ods Binary files differnew file mode 100644 index 0000000000..1dbecc37fc --- /dev/null +++ b/sc/qa/uitest/data/autofilter/tdf138438.ods diff --git a/sc/qa/uitest/data/autofilter/tdf140462.ods b/sc/qa/uitest/data/autofilter/tdf140462.ods Binary files differnew file mode 100644 index 0000000000..8fe7ed8a97 --- /dev/null +++ b/sc/qa/uitest/data/autofilter/tdf140462.ods diff --git a/sc/qa/uitest/data/autofilter/tdf140469.xlsx b/sc/qa/uitest/data/autofilter/tdf140469.xlsx Binary files differnew file mode 100644 index 0000000000..3c90c7cfe1 --- /dev/null +++ b/sc/qa/uitest/data/autofilter/tdf140469.xlsx diff --git a/sc/qa/uitest/data/autofilter/tdf140754.ods b/sc/qa/uitest/data/autofilter/tdf140754.ods Binary files differnew file mode 100644 index 0000000000..f3b3923e34 --- /dev/null +++ b/sc/qa/uitest/data/autofilter/tdf140754.ods diff --git a/sc/qa/uitest/data/autofilter/tdf140968.xlsx b/sc/qa/uitest/data/autofilter/tdf140968.xlsx Binary files differnew file mode 100644 index 0000000000..e4dd31bd14 --- /dev/null +++ b/sc/qa/uitest/data/autofilter/tdf140968.xlsx diff --git a/sc/qa/uitest/data/autofilter/tdf142579.xlsx b/sc/qa/uitest/data/autofilter/tdf142579.xlsx Binary files differnew file mode 100644 index 0000000000..1fc53eba95 --- /dev/null +++ b/sc/qa/uitest/data/autofilter/tdf142579.xlsx diff --git a/sc/qa/uitest/data/autofilter/tdf142579_cond_format.ods b/sc/qa/uitest/data/autofilter/tdf142579_cond_format.ods Binary files differnew file mode 100644 index 0000000000..04b5f3f300 --- /dev/null +++ b/sc/qa/uitest/data/autofilter/tdf142579_cond_format.ods diff --git a/sc/qa/uitest/data/autofilter/tdf142580.xlsx b/sc/qa/uitest/data/autofilter/tdf142580.xlsx Binary files differnew file mode 100644 index 0000000000..9dd8710fbe --- /dev/null +++ b/sc/qa/uitest/data/autofilter/tdf142580.xlsx diff --git a/sc/qa/uitest/data/autofilter/tdf144253.ods b/sc/qa/uitest/data/autofilter/tdf144253.ods Binary files differnew file mode 100644 index 0000000000..d2581904d0 --- /dev/null +++ b/sc/qa/uitest/data/autofilter/tdf144253.ods diff --git a/sc/qa/uitest/data/autofilter/tdf144549.ods b/sc/qa/uitest/data/autofilter/tdf144549.ods Binary files differnew file mode 100644 index 0000000000..811e5676a2 --- /dev/null +++ b/sc/qa/uitest/data/autofilter/tdf144549.ods diff --git a/sc/qa/uitest/data/autofilter/tdf152082.ods b/sc/qa/uitest/data/autofilter/tdf152082.ods Binary files differnew file mode 100644 index 0000000000..6a0e1cac67 --- /dev/null +++ b/sc/qa/uitest/data/autofilter/tdf152082.ods diff --git a/sc/qa/uitest/data/autofilter/tdf153972.ods b/sc/qa/uitest/data/autofilter/tdf153972.ods Binary files differnew file mode 100644 index 0000000000..e60828be9c --- /dev/null +++ b/sc/qa/uitest/data/autofilter/tdf153972.ods diff --git a/sc/qa/uitest/data/autofilter/tdf35294.ods b/sc/qa/uitest/data/autofilter/tdf35294.ods Binary files differnew file mode 100644 index 0000000000..0261275de8 --- /dev/null +++ b/sc/qa/uitest/data/autofilter/tdf35294.ods diff --git a/sc/qa/uitest/data/autofilter/tdf55712.ods b/sc/qa/uitest/data/autofilter/tdf55712.ods Binary files differnew file mode 100644 index 0000000000..ebcd6d39a8 --- /dev/null +++ b/sc/qa/uitest/data/autofilter/tdf55712.ods diff --git a/sc/qa/uitest/data/autofilter/tdf73565.ods b/sc/qa/uitest/data/autofilter/tdf73565.ods Binary files differnew file mode 100644 index 0000000000..11c6cda834 --- /dev/null +++ b/sc/qa/uitest/data/autofilter/tdf73565.ods diff --git a/sc/qa/uitest/data/autofilter/tdf74857.ods b/sc/qa/uitest/data/autofilter/tdf74857.ods Binary files differnew file mode 100644 index 0000000000..f4fe4fe0ad --- /dev/null +++ b/sc/qa/uitest/data/autofilter/tdf74857.ods diff --git a/sc/qa/uitest/data/autofilter/tdf77479.ods b/sc/qa/uitest/data/autofilter/tdf77479.ods Binary files differnew file mode 100644 index 0000000000..100df9ae2d --- /dev/null +++ b/sc/qa/uitest/data/autofilter/tdf77479.ods diff --git a/sc/qa/uitest/data/autofilter/tdf81124.ods b/sc/qa/uitest/data/autofilter/tdf81124.ods Binary files differnew file mode 100644 index 0000000000..6d3d97b418 --- /dev/null +++ b/sc/qa/uitest/data/autofilter/tdf81124.ods diff --git a/sc/qa/uitest/data/autofilter/tdf92767.ods b/sc/qa/uitest/data/autofilter/tdf92767.ods Binary files differnew file mode 100644 index 0000000000..34dfb002e2 --- /dev/null +++ b/sc/qa/uitest/data/autofilter/tdf92767.ods diff --git a/sc/qa/uitest/data/autofilter/time_value.xlsx b/sc/qa/uitest/data/autofilter/time_value.xlsx Binary files differnew file mode 100644 index 0000000000..e81b4f24e3 --- /dev/null +++ b/sc/qa/uitest/data/autofilter/time_value.xlsx diff --git a/sc/qa/uitest/data/autosum.ods b/sc/qa/uitest/data/autosum.ods Binary files differnew file mode 100644 index 0000000000..05fa934b75 --- /dev/null +++ b/sc/qa/uitest/data/autosum.ods diff --git a/sc/qa/uitest/data/basicPivotTable.ods b/sc/qa/uitest/data/basicPivotTable.ods Binary files differnew file mode 100644 index 0000000000..27487fd05a --- /dev/null +++ b/sc/qa/uitest/data/basicPivotTable.ods diff --git a/sc/qa/uitest/data/cell_recalc.ods b/sc/qa/uitest/data/cell_recalc.ods Binary files differnew file mode 100644 index 0000000000..4b125fd2e2 --- /dev/null +++ b/sc/qa/uitest/data/cell_recalc.ods diff --git a/sc/qa/uitest/data/chartArea.ods b/sc/qa/uitest/data/chartArea.ods Binary files differnew file mode 100644 index 0000000000..d7f863c31e --- /dev/null +++ b/sc/qa/uitest/data/chartArea.ods diff --git a/sc/qa/uitest/data/consolidate.ods b/sc/qa/uitest/data/consolidate.ods Binary files differnew file mode 100644 index 0000000000..8e17d7478f --- /dev/null +++ b/sc/qa/uitest/data/consolidate.ods diff --git a/sc/qa/uitest/data/dataLabels.ods b/sc/qa/uitest/data/dataLabels.ods Binary files differnew file mode 100644 index 0000000000..89c8485fc4 --- /dev/null +++ b/sc/qa/uitest/data/dataLabels.ods diff --git a/sc/qa/uitest/data/goalSeek.ods b/sc/qa/uitest/data/goalSeek.ods Binary files differnew file mode 100644 index 0000000000..fd78ec0197 --- /dev/null +++ b/sc/qa/uitest/data/goalSeek.ods diff --git a/sc/qa/uitest/data/hashIncompatible.xlsx b/sc/qa/uitest/data/hashIncompatible.xlsx Binary files differnew file mode 100644 index 0000000000..6ffeab242e --- /dev/null +++ b/sc/qa/uitest/data/hashIncompatible.xlsx diff --git a/sc/qa/uitest/data/navigator.ods b/sc/qa/uitest/data/navigator.ods Binary files differnew file mode 100644 index 0000000000..c487b1d6bc --- /dev/null +++ b/sc/qa/uitest/data/navigator.ods diff --git a/sc/qa/uitest/data/pivotTable.ods b/sc/qa/uitest/data/pivotTable.ods Binary files differnew file mode 100644 index 0000000000..cbb7738576 --- /dev/null +++ b/sc/qa/uitest/data/pivotTable.ods diff --git a/sc/qa/uitest/data/regression.ods b/sc/qa/uitest/data/regression.ods Binary files differnew file mode 100644 index 0000000000..1c8b72cc91 --- /dev/null +++ b/sc/qa/uitest/data/regression.ods diff --git a/sc/qa/uitest/data/search_replace/tdf106194.ods b/sc/qa/uitest/data/search_replace/tdf106194.ods Binary files differnew file mode 100644 index 0000000000..acc4199f3a --- /dev/null +++ b/sc/qa/uitest/data/search_replace/tdf106194.ods diff --git a/sc/qa/uitest/data/search_replace/tdf132783.ods b/sc/qa/uitest/data/search_replace/tdf132783.ods Binary files differnew file mode 100644 index 0000000000..fd06c83e5c --- /dev/null +++ b/sc/qa/uitest/data/search_replace/tdf132783.ods diff --git a/sc/qa/uitest/data/search_replace/tdf35020.ods b/sc/qa/uitest/data/search_replace/tdf35020.ods Binary files differnew file mode 100644 index 0000000000..ef9a5455d9 --- /dev/null +++ b/sc/qa/uitest/data/search_replace/tdf35020.ods diff --git a/sc/qa/uitest/data/search_replace/tdf39959.ods b/sc/qa/uitest/data/search_replace/tdf39959.ods Binary files differnew file mode 100644 index 0000000000..971bf877c6 --- /dev/null +++ b/sc/qa/uitest/data/search_replace/tdf39959.ods diff --git a/sc/qa/uitest/data/search_replace/tdf44861.ods b/sc/qa/uitest/data/search_replace/tdf44861.ods Binary files differnew file mode 100644 index 0000000000..d4dd9efb47 --- /dev/null +++ b/sc/qa/uitest/data/search_replace/tdf44861.ods diff --git a/sc/qa/uitest/data/solver.ods b/sc/qa/uitest/data/solver.ods Binary files differnew file mode 100644 index 0000000000..a6739664ab --- /dev/null +++ b/sc/qa/uitest/data/solver.ods diff --git a/sc/qa/uitest/data/stableSorting.ods b/sc/qa/uitest/data/stableSorting.ods Binary files differnew file mode 100644 index 0000000000..90d0575c7f --- /dev/null +++ b/sc/qa/uitest/data/stableSorting.ods diff --git a/sc/qa/uitest/data/standardFilter.ods b/sc/qa/uitest/data/standardFilter.ods Binary files differnew file mode 100644 index 0000000000..eee728b46e --- /dev/null +++ b/sc/qa/uitest/data/standardFilter.ods diff --git a/sc/qa/uitest/data/tdf100793.ods b/sc/qa/uitest/data/tdf100793.ods Binary files differnew file mode 100644 index 0000000000..e68efdb926 --- /dev/null +++ b/sc/qa/uitest/data/tdf100793.ods diff --git a/sc/qa/uitest/data/tdf104026.ods b/sc/qa/uitest/data/tdf104026.ods Binary files differnew file mode 100644 index 0000000000..3d6611fb75 --- /dev/null +++ b/sc/qa/uitest/data/tdf104026.ods diff --git a/sc/qa/uitest/data/tdf105301.ods b/sc/qa/uitest/data/tdf105301.ods Binary files differnew file mode 100644 index 0000000000..58f2fe759e --- /dev/null +++ b/sc/qa/uitest/data/tdf105301.ods diff --git a/sc/qa/uitest/data/tdf105412.ods b/sc/qa/uitest/data/tdf105412.ods Binary files differnew file mode 100644 index 0000000000..d633ed38d0 --- /dev/null +++ b/sc/qa/uitest/data/tdf105412.ods diff --git a/sc/qa/uitest/data/tdf105544.ods b/sc/qa/uitest/data/tdf105544.ods Binary files differnew file mode 100644 index 0000000000..52a1a618c8 --- /dev/null +++ b/sc/qa/uitest/data/tdf105544.ods diff --git a/sc/qa/uitest/data/tdf107267.ods b/sc/qa/uitest/data/tdf107267.ods Binary files differnew file mode 100644 index 0000000000..c0eb39fd16 --- /dev/null +++ b/sc/qa/uitest/data/tdf107267.ods diff --git a/sc/qa/uitest/data/tdf113571.ods b/sc/qa/uitest/data/tdf113571.ods Binary files differnew file mode 100644 index 0000000000..137c74c18f --- /dev/null +++ b/sc/qa/uitest/data/tdf113571.ods diff --git a/sc/qa/uitest/data/tdf114710.ods b/sc/qa/uitest/data/tdf114710.ods Binary files differnew file mode 100644 index 0000000000..1638cb82c5 --- /dev/null +++ b/sc/qa/uitest/data/tdf114710.ods diff --git a/sc/qa/uitest/data/tdf114878.csv b/sc/qa/uitest/data/tdf114878.csv new file mode 100644 index 0000000000..2104f559eb --- /dev/null +++ b/sc/qa/uitest/data/tdf114878.csv @@ -0,0 +1,4 @@ +=-3+5 +=TRUE() +=4*10 +=SUM(A1:A3) diff --git a/sc/qa/uitest/data/tdf114992.ods b/sc/qa/uitest/data/tdf114992.ods Binary files differnew file mode 100644 index 0000000000..b22a43ae28 --- /dev/null +++ b/sc/qa/uitest/data/tdf114992.ods diff --git a/sc/qa/uitest/data/tdf115933.xlsx b/sc/qa/uitest/data/tdf115933.xlsx Binary files differnew file mode 100644 index 0000000000..a6073a76e5 --- /dev/null +++ b/sc/qa/uitest/data/tdf115933.xlsx diff --git a/sc/qa/uitest/data/tdf117868.csv b/sc/qa/uitest/data/tdf117868.csv new file mode 100644 index 0000000000..0bb5df792e --- /dev/null +++ b/sc/qa/uitest/data/tdf117868.csv @@ -0,0 +1,5 @@ +sep=| +"LETTER"|"ANIMAL" +"a"|"aardvark" +"b"|"bear" +"c"|"cow" diff --git a/sc/qa/uitest/data/tdf117899.ods b/sc/qa/uitest/data/tdf117899.ods Binary files differnew file mode 100644 index 0000000000..6c75ed0d15 --- /dev/null +++ b/sc/qa/uitest/data/tdf117899.ods diff --git a/sc/qa/uitest/data/tdf118206.xlsx b/sc/qa/uitest/data/tdf118206.xlsx Binary files differnew file mode 100644 index 0000000000..5208b9de9b --- /dev/null +++ b/sc/qa/uitest/data/tdf118206.xlsx diff --git a/sc/qa/uitest/data/tdf118638.ods b/sc/qa/uitest/data/tdf118638.ods Binary files differnew file mode 100644 index 0000000000..251d6c7c44 --- /dev/null +++ b/sc/qa/uitest/data/tdf118638.ods diff --git a/sc/qa/uitest/data/tdf118938.xlsx b/sc/qa/uitest/data/tdf118938.xlsx Binary files differnew file mode 100644 index 0000000000..5e571f9f24 --- /dev/null +++ b/sc/qa/uitest/data/tdf118938.xlsx diff --git a/sc/qa/uitest/data/tdf119343.ods b/sc/qa/uitest/data/tdf119343.ods Binary files differnew file mode 100644 index 0000000000..489d5c5fe2 --- /dev/null +++ b/sc/qa/uitest/data/tdf119343.ods diff --git a/sc/qa/uitest/data/tdf119954.ods b/sc/qa/uitest/data/tdf119954.ods Binary files differnew file mode 100644 index 0000000000..12a1123519 --- /dev/null +++ b/sc/qa/uitest/data/tdf119954.ods diff --git a/sc/qa/uitest/data/tdf122398.ods b/sc/qa/uitest/data/tdf122398.ods Binary files differnew file mode 100644 index 0000000000..48e24de0fb --- /dev/null +++ b/sc/qa/uitest/data/tdf122398.ods diff --git a/sc/qa/uitest/data/tdf122509.ods b/sc/qa/uitest/data/tdf122509.ods Binary files differnew file mode 100644 index 0000000000..cca0c5beb6 --- /dev/null +++ b/sc/qa/uitest/data/tdf122509.ods diff --git a/sc/qa/uitest/data/tdf123013.ods b/sc/qa/uitest/data/tdf123013.ods Binary files differnew file mode 100644 index 0000000000..1b433b2cbf --- /dev/null +++ b/sc/qa/uitest/data/tdf123013.ods diff --git a/sc/qa/uitest/data/tdf123479.ods b/sc/qa/uitest/data/tdf123479.ods Binary files differnew file mode 100644 index 0000000000..90cf7efd85 --- /dev/null +++ b/sc/qa/uitest/data/tdf123479.ods diff --git a/sc/qa/uitest/data/tdf123508.ods b/sc/qa/uitest/data/tdf123508.ods Binary files differnew file mode 100644 index 0000000000..a91951b08c --- /dev/null +++ b/sc/qa/uitest/data/tdf123508.ods diff --git a/sc/qa/uitest/data/tdf123520.ods b/sc/qa/uitest/data/tdf123520.ods Binary files differnew file mode 100644 index 0000000000..48e24de0fb --- /dev/null +++ b/sc/qa/uitest/data/tdf123520.ods diff --git a/sc/qa/uitest/data/tdf124111.ods b/sc/qa/uitest/data/tdf124111.ods Binary files differnew file mode 100644 index 0000000000..82265c4ced --- /dev/null +++ b/sc/qa/uitest/data/tdf124111.ods diff --git a/sc/qa/uitest/data/tdf124318.xls b/sc/qa/uitest/data/tdf124318.xls Binary files differnew file mode 100644 index 0000000000..9dc7c12d79 --- /dev/null +++ b/sc/qa/uitest/data/tdf124318.xls diff --git a/sc/qa/uitest/data/tdf124412.ods b/sc/qa/uitest/data/tdf124412.ods Binary files differnew file mode 100644 index 0000000000..4693e0a681 --- /dev/null +++ b/sc/qa/uitest/data/tdf124412.ods diff --git a/sc/qa/uitest/data/tdf124829.ods b/sc/qa/uitest/data/tdf124829.ods Binary files differnew file mode 100644 index 0000000000..280d349cf7 --- /dev/null +++ b/sc/qa/uitest/data/tdf124829.ods diff --git a/sc/qa/uitest/data/tdf124896.ods b/sc/qa/uitest/data/tdf124896.ods Binary files differnew file mode 100644 index 0000000000..2eef3473c1 --- /dev/null +++ b/sc/qa/uitest/data/tdf124896.ods diff --git a/sc/qa/uitest/data/tdf125440.odt b/sc/qa/uitest/data/tdf125440.odt Binary files differnew file mode 100644 index 0000000000..5e3862fb6c --- /dev/null +++ b/sc/qa/uitest/data/tdf125440.odt diff --git a/sc/qa/uitest/data/tdf126541_GridOff.xlsx b/sc/qa/uitest/data/tdf126541_GridOff.xlsx Binary files differnew file mode 100644 index 0000000000..e27089b016 --- /dev/null +++ b/sc/qa/uitest/data/tdf126541_GridOff.xlsx diff --git a/sc/qa/uitest/data/tdf126541_GridOffGlobally.ods b/sc/qa/uitest/data/tdf126541_GridOffGlobally.ods Binary files differnew file mode 100644 index 0000000000..389fe347d4 --- /dev/null +++ b/sc/qa/uitest/data/tdf126541_GridOffGlobally.ods diff --git a/sc/qa/uitest/data/tdf126673.ods b/sc/qa/uitest/data/tdf126673.ods Binary files differnew file mode 100644 index 0000000000..9c75b69cae --- /dev/null +++ b/sc/qa/uitest/data/tdf126673.ods diff --git a/sc/qa/uitest/data/tdf127484.html b/sc/qa/uitest/data/tdf127484.html new file mode 100644 index 0000000000..d479c3f9cb --- /dev/null +++ b/sc/qa/uitest/data/tdf127484.html @@ -0,0 +1,28 @@ +<!doctype html> +<html> + <body> + <table> + <caption>He-Man and Skeletor facts</caption> + <tr> + <td> </td> + <th scope="col" class="heman">He-Man</th> + <th scope="col" class="skeletor">Skeletor</th> + </tr> + <tr> + <th scope="row">Role</th> + <td>Hero</td> + <td>Villain</td> + </tr> + <tr> + <th scope="row">Weapon</th> + <td>Power Sword</td> + <td>Havoc Staff</td> + </tr> + <tr> + <th scope="row">Dark secret</th> + <td>Expert florist</td> + <td>Cries at romcoms</td> + </tr> + </table> + </body> +</html> diff --git a/sc/qa/uitest/data/tdf129587.ods b/sc/qa/uitest/data/tdf129587.ods Binary files differnew file mode 100644 index 0000000000..37b4807904 --- /dev/null +++ b/sc/qa/uitest/data/tdf129587.ods diff --git a/sc/qa/uitest/data/tdf130371.ods b/sc/qa/uitest/data/tdf130371.ods Binary files differnew file mode 100644 index 0000000000..41099bda3c --- /dev/null +++ b/sc/qa/uitest/data/tdf130371.ods diff --git a/sc/qa/uitest/data/tdf131000.ods b/sc/qa/uitest/data/tdf131000.ods Binary files differnew file mode 100644 index 0000000000..f0b1d38ea7 --- /dev/null +++ b/sc/qa/uitest/data/tdf131000.ods diff --git a/sc/qa/uitest/data/tdf131170.ods b/sc/qa/uitest/data/tdf131170.ods Binary files differnew file mode 100644 index 0000000000..09d74a4a26 --- /dev/null +++ b/sc/qa/uitest/data/tdf131170.ods diff --git a/sc/qa/uitest/data/tdf131291.ods b/sc/qa/uitest/data/tdf131291.ods Binary files differnew file mode 100644 index 0000000000..76a87c2c22 --- /dev/null +++ b/sc/qa/uitest/data/tdf131291.ods diff --git a/sc/qa/uitest/data/tdf131638.ods b/sc/qa/uitest/data/tdf131638.ods Binary files differnew file mode 100644 index 0000000000..a66a7e9c9d --- /dev/null +++ b/sc/qa/uitest/data/tdf131638.ods diff --git a/sc/qa/uitest/data/tdf131907.ods b/sc/qa/uitest/data/tdf131907.ods Binary files differnew file mode 100644 index 0000000000..2a08fa54b7 --- /dev/null +++ b/sc/qa/uitest/data/tdf131907.ods diff --git a/sc/qa/uitest/data/tdf133855.ods b/sc/qa/uitest/data/tdf133855.ods Binary files differnew file mode 100644 index 0000000000..c40a25ab0d --- /dev/null +++ b/sc/qa/uitest/data/tdf133855.ods diff --git a/sc/qa/uitest/data/tdf134059.ods b/sc/qa/uitest/data/tdf134059.ods Binary files differnew file mode 100644 index 0000000000..59be547d9f --- /dev/null +++ b/sc/qa/uitest/data/tdf134059.ods diff --git a/sc/qa/uitest/data/tdf136062.ods b/sc/qa/uitest/data/tdf136062.ods Binary files differnew file mode 100644 index 0000000000..300e8eff7f --- /dev/null +++ b/sc/qa/uitest/data/tdf136062.ods diff --git a/sc/qa/uitest/data/tdf137397.ods b/sc/qa/uitest/data/tdf137397.ods Binary files differnew file mode 100644 index 0000000000..2034848048 --- /dev/null +++ b/sc/qa/uitest/data/tdf137397.ods diff --git a/sc/qa/uitest/data/tdf137446.ods b/sc/qa/uitest/data/tdf137446.ods Binary files differnew file mode 100644 index 0000000000..62bb39e14a --- /dev/null +++ b/sc/qa/uitest/data/tdf137446.ods diff --git a/sc/qa/uitest/data/tdf137945.ods b/sc/qa/uitest/data/tdf137945.ods Binary files differnew file mode 100644 index 0000000000..ddda28140b --- /dev/null +++ b/sc/qa/uitest/data/tdf137945.ods diff --git a/sc/qa/uitest/data/tdf138089.xlsx b/sc/qa/uitest/data/tdf138089.xlsx Binary files differnew file mode 100644 index 0000000000..e24fe7516c --- /dev/null +++ b/sc/qa/uitest/data/tdf138089.xlsx diff --git a/sc/qa/uitest/data/tdf139974.ods b/sc/qa/uitest/data/tdf139974.ods Binary files differnew file mode 100644 index 0000000000..77ec252479 --- /dev/null +++ b/sc/qa/uitest/data/tdf139974.ods diff --git a/sc/qa/uitest/data/tdf141547.xlsx b/sc/qa/uitest/data/tdf141547.xlsx Binary files differnew file mode 100644 index 0000000000..414ef23b34 --- /dev/null +++ b/sc/qa/uitest/data/tdf141547.xlsx diff --git a/sc/qa/uitest/data/tdf141973.ods b/sc/qa/uitest/data/tdf141973.ods Binary files differnew file mode 100644 index 0000000000..00885cf954 --- /dev/null +++ b/sc/qa/uitest/data/tdf141973.ods diff --git a/sc/qa/uitest/data/tdf142395.csv b/sc/qa/uitest/data/tdf142395.csv new file mode 100644 index 0000000000..56fc9c3575 --- /dev/null +++ b/sc/qa/uitest/data/tdf142395.csv @@ -0,0 +1,2 @@ +a, b, c,
+e, f, g,
diff --git a/sc/qa/uitest/data/tdf142851.xlsx b/sc/qa/uitest/data/tdf142851.xlsx Binary files differnew file mode 100644 index 0000000000..e2cdaf7c12 --- /dev/null +++ b/sc/qa/uitest/data/tdf142851.xlsx diff --git a/sc/qa/uitest/data/tdf142932.ods b/sc/qa/uitest/data/tdf142932.ods Binary files differnew file mode 100644 index 0000000000..cc0dac97aa --- /dev/null +++ b/sc/qa/uitest/data/tdf142932.ods diff --git a/sc/qa/uitest/data/tdf144996.xlsx b/sc/qa/uitest/data/tdf144996.xlsx Binary files differnew file mode 100644 index 0000000000..aedf252355 --- /dev/null +++ b/sc/qa/uitest/data/tdf144996.xlsx diff --git a/sc/qa/uitest/data/tdf145077.ods b/sc/qa/uitest/data/tdf145077.ods Binary files differnew file mode 100644 index 0000000000..9c9c2a4230 --- /dev/null +++ b/sc/qa/uitest/data/tdf145077.ods diff --git a/sc/qa/uitest/data/tdf146260.xml b/sc/qa/uitest/data/tdf146260.xml new file mode 100644 index 0000000000..fc41f8d463 --- /dev/null +++ b/sc/qa/uitest/data/tdf146260.xml @@ -0,0 +1,139 @@ +<?xml version="1.0" encoding="GBK"?> +<Kp> + <Version>2.0</Version> + <Fpxx> + <Zsl>43</Zsl> + <Fpsj> + <Fp> + <Djh></Djh> + <Fpzl>רÓ÷¢Æ±</Fpzl> + <Lbdm>210***3130</Lbdm> + <Fphm>01***724</Fphm> + <Kprq>202***02</Kprq> + <Gfmc>ÉϺ£***ÒµÓÐÏÞ¹«Ë¾</Gfmc> + <Gfsh>913101***95811677F</Gfsh> + <Gfyhzh>½¨ÐÐÉϺ£»ª³Ø·֧ÐÐ31001546***050004961</Gfyhzh> + <Gfdzdh>ÉϺ£ÊвÜÑî·1***ºÅAÇø10ºÅ 021-62***662</Gfdzdh> + <Xfmc>µ¤¶«******ÓÐÏÞ¹«Ë¾</Xfmc> + <Xfsh>9121***826612142928</Xfsh> + <Xfyhzh>ÖйúÅ©ÒµÒøÐÐ***Ö§ÐÐ 50590***0003583</Xfyhzh> + <Xfdzdh>Áõ***´å 8922857</Xfdzdh> + <Hjje>94847.03</Hjje> + <Hjse>8536.23</Hjse> + <Bz></Bz> + <Kpr>ÓÚ*Ìï</Kpr> + <Fhr>½¯*Ó¢</Fhr> + <Skr>Âí*Ó¨</Skr> + <Spbmbbh>39.0</Spbmbbh> + <Hsbz>0</Hsbz> + <Spxx> + <Sph> + <Xh>1</Xh> + <Spmc>*Èâ****¶³¼¦ÅÅÍÈ</Spmc> + <Ggxh></Ggxh> + <Jldw>kg</Jldw> + <Spbm>1030107010100000000</Spbm> + <Qyspbm>00005</Qyspbm> + <Syyhzcbz>0</Syyhzcbz> + <Lslbz></Lslbz> + <Yhzcsm></Yhzcsm> + <Dj>11.743119266055046</Dj> + <Sl>169.2</Sl> + <Je>1986.94</Je> + <Slv>0.09</Slv> + <Se>178.82</Se> + </Sph> + <Sph> + <Xh>2</Xh> + <Spmc>*Èâ****¶³¼¦ÅÅÍÈ</Spmc> + <Ggxh></Ggxh> + <Jldw>kg</Jldw> + <Spbm>1030107010100000000</Spbm> + <Qyspbm>00005</Qyspbm> + <Syyhzcbz>0</Syyhzcbz> + <Lslbz></Lslbz> + <Yhzcsm></Yhzcsm> + <Dj>11.467889908256881</Dj> + <Sl>385.4</Sl> + <Je>4419.72</Je> + <Slv>0.09</Slv> + <Se>397.78</Se> + </Sph> + <Sph> + <Xh>3</Xh> + <Spmc>*Èâ****¶³¼¦ÅÅÍÈ</Spmc> + <Ggxh></Ggxh> + <Jldw>kg</Jldw> + <Spbm>1030107010100000000</Spbm> + <Qyspbm>00021</Qyspbm> + <Syyhzcbz>0</Syyhzcbz> + <Lslbz></Lslbz> + <Yhzcsm></Yhzcsm> + <Dj>10.550458715596330</Dj> + <Sl>500</Sl> + <Je>5275.23</Je> + <Slv>0.09</Slv> + <Se>474.77</Se> + </Sph> + <Sph> + <Xh>4</Xh> + <Spmc>*Èâ****¶³¼¦ÅÅÍÈ</Spmc> + <Ggxh></Ggxh> + <Jldw>kg</Jldw> + <Spbm>1030107010100000000</Spbm> + <Qyspbm>00015</Qyspbm> + <Syyhzcbz>0</Syyhzcbz> + <Lslbz></Lslbz> + <Yhzcsm></Yhzcsm> + <Dj>33.944954128440367</Dj> + <Sl>2450</Sl> + <Je>83165.14</Je> + <Slv>0.09</Slv> + <Se>7484.86</Se> + </Sph> + </Spxx> + </Fp> + <Fp> + <Djh></Djh> + <Fpzl>ÆÕͨ·¢Æ±</Fpzl> + <Lbdm>0210***00404</Lbdm> + <Fphm>47***608</Fphm> + <Kprq>20***802</Kprq> + <Gfmc>ÉϺ£***ʳƷÓÐÏÞ¹«Ë¾</Gfmc> + <Gfsh>9131011***1334373K</Gfsh> + <Gfyhzh>¹¤ÉÌÒøÐÐÉϺ£ÊÐÌìɽ·֧ÐÐ 10012469***06906246</Gfyhzh> + <Gfdzdh>ÉϺ£ÊÐÆÕÍÓÇø½»Í¨Â·4***Ū4ºÅ18Â¥ 52***0300</Gfdzdh> + <Xfmc>µ¤¶«***ÓÐÏÞ¹«Ë¾</Xfmc> + <Xfsh>91210******12142928</Xfsh> + <Xfyhzh>ÖйúÅ©ÒµÒøÐÐ***Ö§ÐÐ 50590***0003583</Xfyhzh> + <Xfdzdh>Áõ***´å 8922857</Xfdzdh> + <Hjje>87590.64</Hjje> + <Hjse>7883.16</Hjse> + <Bz></Bz> + <Kpr>ÓÚ*Ìï</Kpr> + <Fhr>½¯*Ó¢</Fhr> + <Skr>Âí*Ó¨</Skr> + <Spbmbbh>39.0</Spbmbbh> + <Hsbz>0</Hsbz> + <Spxx> + <Sph> + <Xh>1</Xh> + <Spmc>*Èâ***¶³¼¦´óÐØ</Spmc> + <Ggxh></Ggxh> + <Jldw>kg</Jldw> + <Spbm>1030107010100000000</Spbm> + <Qyspbm>00002</Qyspbm> + <Syyhzcbz>0</Syyhzcbz> + <Lslbz></Lslbz> + <Yhzcsm></Yhzcsm> + <Dj>10.642201834862385</Dj> + <Sl>8230.5</Sl> + <Je>87590.64</Je> + <Slv>0.09</Slv> + <Se>7883.16</Se> + </Sph> + </Spxx> + </Fp> + </Fpsj> + </Fpxx> +</Kp> diff --git a/sc/qa/uitest/data/tdf147767.html b/sc/qa/uitest/data/tdf147767.html new file mode 100644 index 0000000000..86a10e2d16 --- /dev/null +++ b/sc/qa/uitest/data/tdf147767.html @@ -0,0 +1,12 @@ +<!doctype html> +<html> +<body> + <table> + <tr> + <td width="126" bgcolor="#90080c" style="background: #90080c; border-top: 1px double #808080; border-bottom: 1px double #808080; border-left: 1px double #808080; border-right: 1px double #808080; padding: 0.11cm"><p align="center"> + <strong><font color="#ffffff"><font size="4" style="font-size: 14pt">Fecha</font></font></strong></p> + </td> + </tr> + </table> +</body> +</html> diff --git a/sc/qa/uitest/data/tdf147830.ods b/sc/qa/uitest/data/tdf147830.ods Binary files differnew file mode 100644 index 0000000000..207dec88ed --- /dev/null +++ b/sc/qa/uitest/data/tdf147830.ods diff --git a/sc/qa/uitest/data/tdf149529.ods b/sc/qa/uitest/data/tdf149529.ods Binary files differnew file mode 100644 index 0000000000..994b9d1ab3 --- /dev/null +++ b/sc/qa/uitest/data/tdf149529.ods diff --git a/sc/qa/uitest/data/tdf153604.xml b/sc/qa/uitest/data/tdf153604.xml new file mode 100644 index 0000000000..e43b477341 --- /dev/null +++ b/sc/qa/uitest/data/tdf153604.xml @@ -0,0 +1,6 @@ +<?xml encoding="utf-8"?> +<root> + <data>v1</data> + <data>v2</data> + <data>v3</data> +</root> diff --git a/sc/qa/uitest/data/tdf153622.xlsx b/sc/qa/uitest/data/tdf153622.xlsx Binary files differnew file mode 100644 index 0000000000..12636f87af --- /dev/null +++ b/sc/qa/uitest/data/tdf153622.xlsx diff --git a/sc/qa/uitest/data/tdf156268.fods b/sc/qa/uitest/data/tdf156268.fods new file mode 100644 index 0000000000..aaa8ed1e13 --- /dev/null +++ b/sc/qa/uitest/data/tdf156268.fods @@ -0,0 +1,358 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<office:document xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" xmlns:css3t="http://www.w3.org/TR/css3-text/" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:rpt="http://openoffice.org/2005/report" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.spreadsheet"> + <office:meta><meta:creation-date>2013-06-26T09:55:09</meta:creation-date><dc:date>2023-07-27T01:42:19.917690749</dc:date><meta:editing-cycles>8</meta:editing-cycles><meta:editing-duration>P23DT22H13M17S</meta:editing-duration><meta:generator>LibreOffice/7.5.1.2$Linux_X86_64 LibreOffice_project/fcbaee479e84c6cd81291587d2ee68cba099e129</meta:generator><meta:document-statistic meta:table-count="1" meta:cell-count="40" meta:object-count="0"/></office:meta> + <office:settings> + <config:config-item-set config:name="ooo:view-settings"> + <config:config-item config:name="VisibleAreaTop" config:type="int">0</config:config-item> + <config:config-item config:name="VisibleAreaLeft" config:type="int">0</config:config-item> + <config:config-item config:name="VisibleAreaWidth" config:type="int">399</config:config-item> + <config:config-item config:name="VisibleAreaHeight" config:type="int">18062</config:config-item> + <config:config-item-map-indexed config:name="Views"> + <config:config-item-map-entry> + <config:config-item config:name="ViewId" config:type="string">view1</config:config-item> + <config:config-item-map-named config:name="Tables"> + <config:config-item-map-entry config:name="Sheet1"> + <config:config-item config:name="CursorPositionX" config:type="int">0</config:config-item> + <config:config-item config:name="CursorPositionY" config:type="int">1</config:config-item> + <config:config-item config:name="HorizontalSplitMode" config:type="short">2</config:config-item> + <config:config-item config:name="VerticalSplitMode" config:type="short">2</config:config-item> + <config:config-item config:name="HorizontalSplitPosition" config:type="int">3</config:config-item> + <config:config-item config:name="VerticalSplitPosition" config:type="int">9</config:config-item> + <config:config-item config:name="ActiveSplitRange" config:type="short">0</config:config-item> + <config:config-item config:name="PositionLeft" config:type="int">0</config:config-item> + <config:config-item config:name="PositionRight" config:type="int">3</config:config-item> + <config:config-item config:name="PositionTop" config:type="int">0</config:config-item> + <config:config-item config:name="PositionBottom" config:type="int">9</config:config-item> + <config:config-item config:name="ZoomType" config:type="short">0</config:config-item> + <config:config-item config:name="ZoomValue" config:type="int">75</config:config-item> + <config:config-item config:name="PageViewZoomValue" config:type="int">60</config:config-item> + <config:config-item config:name="ShowGrid" config:type="boolean">true</config:config-item> + <config:config-item config:name="AnchoredTextOverflowLegacy" config:type="boolean">false</config:config-item> + <config:config-item config:name="LegacySingleLineFontwork" config:type="boolean">false</config:config-item> + </config:config-item-map-entry> + </config:config-item-map-named> + <config:config-item config:name="ActiveTable" config:type="string">Sheet1</config:config-item> + <config:config-item config:name="HorizontalScrollbarWidth" config:type="int">889</config:config-item> + <config:config-item config:name="ZoomType" config:type="short">0</config:config-item> + <config:config-item config:name="ZoomValue" config:type="int">75</config:config-item> + <config:config-item config:name="PageViewZoomValue" config:type="int">60</config:config-item> + <config:config-item config:name="ShowPageBreakPreview" config:type="boolean">false</config:config-item> + <config:config-item config:name="ShowZeroValues" config:type="boolean">true</config:config-item> + <config:config-item config:name="ShowNotes" config:type="boolean">true</config:config-item> + <config:config-item config:name="ShowGrid" config:type="boolean">true</config:config-item> + <config:config-item config:name="GridColor" config:type="int">12632256</config:config-item> + <config:config-item config:name="ShowPageBreaks" config:type="boolean">true</config:config-item> + <config:config-item config:name="HasColumnRowHeaders" config:type="boolean">true</config:config-item> + <config:config-item config:name="FormulaBarHeight" config:type="short">1</config:config-item> + <config:config-item config:name="IsOutlineSymbolsSet" config:type="boolean">true</config:config-item> + <config:config-item config:name="IsValueHighlightingEnabled" config:type="boolean">false</config:config-item> + <config:config-item config:name="IsSnapToRaster" config:type="boolean">false</config:config-item> + <config:config-item config:name="RasterIsVisible" config:type="boolean">false</config:config-item> + <config:config-item config:name="RasterResolutionX" config:type="int">1270</config:config-item> + <config:config-item config:name="RasterResolutionY" config:type="int">1270</config:config-item> + <config:config-item config:name="RasterSubdivisionX" config:type="int">1</config:config-item> + <config:config-item config:name="RasterSubdivisionY" config:type="int">1</config:config-item> + <config:config-item config:name="IsRasterAxisSynchronized" config:type="boolean">true</config:config-item> + <config:config-item config:name="AnchoredTextOverflowLegacy" config:type="boolean">false</config:config-item> + <config:config-item config:name="LegacySingleLineFontwork" config:type="boolean">false</config:config-item> + </config:config-item-map-entry> + </config:config-item-map-indexed> + </config:config-item-set> + <config:config-item-set config:name="ooo:configuration-settings"> + <config:config-item config:name="AllowPrintJobCancel" config:type="boolean">true</config:config-item> + <config:config-item config:name="ApplyUserData" config:type="boolean">true</config:config-item> + <config:config-item config:name="AutoCalculate" config:type="boolean">true</config:config-item> + <config:config-item config:name="CharacterCompressionType" config:type="short">0</config:config-item> + <config:config-item config:name="EmbedAsianScriptFonts" config:type="boolean">true</config:config-item> + <config:config-item config:name="EmbedComplexScriptFonts" config:type="boolean">true</config:config-item> + <config:config-item config:name="EmbedFonts" config:type="boolean">false</config:config-item> + <config:config-item config:name="EmbedLatinScriptFonts" config:type="boolean">true</config:config-item> + <config:config-item config:name="EmbedOnlyUsedFonts" config:type="boolean">false</config:config-item> + <config:config-item config:name="GridColor" config:type="int">12632256</config:config-item> + <config:config-item config:name="HasColumnRowHeaders" config:type="boolean">true</config:config-item> + <config:config-item config:name="HasSheetTabs" config:type="boolean">true</config:config-item> + <config:config-item config:name="ImagePreferredDPI" config:type="int">0</config:config-item> + <config:config-item config:name="IsDocumentShared" config:type="boolean">false</config:config-item> + <config:config-item config:name="IsKernAsianPunctuation" config:type="boolean">false</config:config-item> + <config:config-item config:name="IsOutlineSymbolsSet" config:type="boolean">true</config:config-item> + <config:config-item config:name="IsRasterAxisSynchronized" config:type="boolean">true</config:config-item> + <config:config-item config:name="IsSnapToRaster" config:type="boolean">false</config:config-item> + <config:config-item config:name="LinkUpdateMode" config:type="short">3</config:config-item> + <config:config-item config:name="LoadReadonly" config:type="boolean">false</config:config-item> + <config:config-item config:name="PrinterName" config:type="string">Generic Printer</config:config-item> + <config:config-item config:name="PrinterPaperFromSetup" config:type="boolean">false</config:config-item> + <config:config-item config:name="PrinterSetup" config:type="base64Binary">2QH+/0dlbmVyaWMgUHJpbnRlcgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAU0dFTlBSVAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWAAMAxQAAAAAAAAAIAFZUAAAkbQAASm9iRGF0YSAxCnByaW50ZXI9R2VuZXJpYyBQcmludGVyCm9yaWVudGF0aW9uPVBvcnRyYWl0CmNvcGllcz0xCmNvbGxhdGU9ZmFsc2UKbWFyZ2luYWRqdXN0bWVudD0wLDAsMCwwCmNvbG9yZGVwdGg9MjQKcHNsZXZlbD0wCnBkZmRldmljZT0xCmNvbG9yZGV2aWNlPTAKUFBEQ29udGV4dERhdGEKRHVwbGV4Ok5vbmUAUGFnZVNpemU6TGV0dGVyAAASAENPTVBBVF9EVVBMRVhfTU9ERQ8ARHVwbGV4TW9kZTo6T2ZmDABQUklOVEVSX05BTUUPAEdlbmVyaWMgUHJpbnRlcgsARFJJVkVSX05BTUUHAFNHRU5QUlQ=</config:config-item> + <config:config-item config:name="RasterIsVisible" config:type="boolean">false</config:config-item> + <config:config-item config:name="RasterResolutionX" config:type="int">1270</config:config-item> + <config:config-item config:name="RasterResolutionY" config:type="int">1270</config:config-item> + <config:config-item config:name="RasterSubdivisionX" config:type="int">1</config:config-item> + <config:config-item config:name="RasterSubdivisionY" config:type="int">1</config:config-item> + <config:config-item config:name="SaveThumbnail" config:type="boolean">true</config:config-item> + <config:config-item config:name="SaveVersionOnClose" config:type="boolean">false</config:config-item> + <config:config-item config:name="ShowGrid" config:type="boolean">true</config:config-item> + <config:config-item config:name="ShowNotes" config:type="boolean">true</config:config-item> + <config:config-item config:name="ShowPageBreaks" config:type="boolean">true</config:config-item> + <config:config-item config:name="ShowZeroValues" config:type="boolean">true</config:config-item> + <config:config-item config:name="SyntaxStringRef" config:type="short">7</config:config-item> + <config:config-item config:name="UpdateFromTemplate" config:type="boolean">true</config:config-item> + <config:config-item-map-named config:name="ScriptConfiguration"> + <config:config-item-map-entry config:name="Sheet1"> + <config:config-item config:name="CodeName" config:type="string">Sheet1</config:config-item> + </config:config-item-map-entry> + </config:config-item-map-named> + </config:config-item-set> + </office:settings> + <office:scripts> + <office:script script:language="ooo:Basic"> + <ooo:libraries xmlns:ooo="http://openoffice.org/2004/office" xmlns:xlink="http://www.w3.org/1999/xlink"/> + </office:script> + </office:scripts> + <office:automatic-styles> + <style:style style:name="co1" style:family="table-column"> + <style:table-column-properties fo:break-before="auto" style:column-width="0.1571in"/> + </style:style> + <style:style style:name="co2" style:family="table-column"> + <style:table-column-properties fo:break-before="auto" style:column-width="0.889in"/> + </style:style> + <style:style style:name="ro1" style:family="table-row"> + <style:table-row-properties style:row-height="0.178in" fo:break-before="auto" style:use-optimal-row-height="true"/> + </style:style> + <style:style style:name="ta1" style:family="table" style:master-page-name="Default"> + <style:table-properties table:display="true" style:writing-mode="lr-tb"/> + </style:style> + <style:page-layout style:name="pm1"> + <style:page-layout-properties fo:page-width="8.5in" fo:page-height="11in" style:writing-mode="lr-tb"/> + <style:header-style> + <style:header-footer-properties fo:min-height="0.2953in" fo:margin-left="0in" fo:margin-right="0in" fo:margin-bottom="0.0984in"/> + </style:header-style> + <style:footer-style> + <style:header-footer-properties fo:min-height="0.2953in" fo:margin-left="0in" fo:margin-right="0in" fo:margin-top="0.0984in"/> + </style:footer-style> + </style:page-layout> + </office:automatic-styles> + <office:master-styles> + <style:master-page style:name="Default" style:page-layout-name="pm1"> + <style:header> + <text:p><text:sheet-name>???</text:sheet-name></text:p> + </style:header> + <style:header-left style:display="false"/> + <style:header-first style:display="false"/> + <style:footer> + <text:p>Page <text:page-number>1</text:page-number></text:p> + </style:footer> + <style:footer-left style:display="false"/> + <style:footer-first style:display="false"/> + </style:master-page> + </office:master-styles> + <office:body> + <office:spreadsheet> + <table:calculation-settings table:case-sensitive="false" table:use-regular-expressions="false" table:use-wildcards="true"/> + <table:table table:name="Sheet1" table:style-name="ta1"> + <office:forms form:automatic-focus="false" form:apply-design-mode="false"/> + <table:table-column table:style-name="co1" table:default-cell-style-name="Default"/> + <table:table-row table:style-name="ro1"> + <table:table-cell office:value-type="float" office:value="1" calcext:value-type="float"> + <text:p>1</text:p> + </table:table-cell> + </table:table-row> + <table:table-row table:style-name="ro1"> + <table:table-cell table:formula="of:=[.A1]+1" office:value-type="float" office:value="2" calcext:value-type="float"> + <text:p>2</text:p> + </table:table-cell> + </table:table-row> + <table:table-row table:style-name="ro1"> + <table:table-cell table:formula="of:=[.A2]+1" office:value-type="float" office:value="3" calcext:value-type="float"> + <text:p>3</text:p> + </table:table-cell> + </table:table-row> + <table:table-row table:style-name="ro1"> + <table:table-cell table:formula="of:=[.A3]+1" office:value-type="float" office:value="4" calcext:value-type="float"> + <text:p>4</text:p> + </table:table-cell> + </table:table-row> + <table:table-row table:style-name="ro1"> + <table:table-cell table:formula="of:=[.A4]+1" office:value-type="float" office:value="5" calcext:value-type="float"> + <text:p>5</text:p> + </table:table-cell> + </table:table-row> + <table:table-row table:style-name="ro1"> + <table:table-cell table:formula="of:=[.A5]+1" office:value-type="float" office:value="6" calcext:value-type="float"> + <text:p>6</text:p> + </table:table-cell> + </table:table-row> + <table:table-row table:style-name="ro1"> + <table:table-cell table:formula="of:=[.A6]+1" office:value-type="float" office:value="7" calcext:value-type="float"> + <text:p>7</text:p> + </table:table-cell> + </table:table-row> + <table:table-row table:style-name="ro1"> + <table:table-cell table:formula="of:=[.A7]+1" office:value-type="float" office:value="8" calcext:value-type="float"> + <text:p>8</text:p> + </table:table-cell> + </table:table-row> + <table:table-row table:style-name="ro1"> + <table:table-cell table:formula="of:=[.A8]+1" office:value-type="float" office:value="9" calcext:value-type="float"> + <text:p>9</text:p> + </table:table-cell> + </table:table-row> + <table:table-row table:style-name="ro1"> + <table:table-cell table:formula="of:=[.A9]+1" office:value-type="float" office:value="10" calcext:value-type="float"> + <text:p>10</text:p> + </table:table-cell> + </table:table-row> + <table:table-row table:style-name="ro1"> + <table:table-cell table:formula="of:=[.A10]+1" office:value-type="float" office:value="11" calcext:value-type="float"> + <text:p>11</text:p> + </table:table-cell> + </table:table-row> + <table:table-row table:style-name="ro1"> + <table:table-cell table:formula="of:=[.A11]+1" office:value-type="float" office:value="12" calcext:value-type="float"> + <text:p>12</text:p> + </table:table-cell> + </table:table-row> + <table:table-row table:style-name="ro1"> + <table:table-cell table:formula="of:=[.A12]+1" office:value-type="float" office:value="13" calcext:value-type="float"> + <text:p>13</text:p> + </table:table-cell> + </table:table-row> + <table:table-row table:style-name="ro1"> + <table:table-cell table:formula="of:=[.A13]+1" office:value-type="float" office:value="14" calcext:value-type="float"> + <text:p>14</text:p> + </table:table-cell> + </table:table-row> + <table:table-row table:style-name="ro1"> + <table:table-cell table:formula="of:=[.A14]+1" office:value-type="float" office:value="15" calcext:value-type="float"> + <text:p>15</text:p> + </table:table-cell> + </table:table-row> + <table:table-row table:style-name="ro1"> + <table:table-cell table:formula="of:=[.A15]+1" office:value-type="float" office:value="16" calcext:value-type="float"> + <text:p>16</text:p> + </table:table-cell> + </table:table-row> + <table:table-row table:style-name="ro1"> + <table:table-cell table:formula="of:=[.A16]+1" office:value-type="float" office:value="17" calcext:value-type="float"> + <text:p>17</text:p> + </table:table-cell> + </table:table-row> + <table:table-row table:style-name="ro1"> + <table:table-cell table:formula="of:=[.A17]+1" office:value-type="float" office:value="18" calcext:value-type="float"> + <text:p>18</text:p> + </table:table-cell> + </table:table-row> + <table:table-row table:style-name="ro1"> + <table:table-cell table:formula="of:=[.A18]+1" office:value-type="float" office:value="19" calcext:value-type="float"> + <text:p>19</text:p> + </table:table-cell> + </table:table-row> + <table:table-row table:style-name="ro1"> + <table:table-cell table:formula="of:=[.A19]+1" office:value-type="float" office:value="20" calcext:value-type="float"> + <text:p>20</text:p> + </table:table-cell> + </table:table-row> + <table:table-row table:style-name="ro1"> + <table:table-cell table:formula="of:=[.A20]+1" office:value-type="float" office:value="21" calcext:value-type="float"> + <text:p>21</text:p> + </table:table-cell> + </table:table-row> + <table:table-row table:style-name="ro1"> + <table:table-cell table:formula="of:=[.A21]+1" office:value-type="float" office:value="22" calcext:value-type="float"> + <text:p>22</text:p> + </table:table-cell> + </table:table-row> + <table:table-row table:style-name="ro1"> + <table:table-cell table:formula="of:=[.A22]+1" office:value-type="float" office:value="23" calcext:value-type="float"> + <text:p>23</text:p> + </table:table-cell> + </table:table-row> + <table:table-row table:style-name="ro1"> + <table:table-cell table:formula="of:=[.A23]+1" office:value-type="float" office:value="24" calcext:value-type="float"> + <text:p>24</text:p> + </table:table-cell> + </table:table-row> + <table:table-row table:style-name="ro1"> + <table:table-cell table:formula="of:=[.A24]+1" office:value-type="float" office:value="25" calcext:value-type="float"> + <text:p>25</text:p> + </table:table-cell> + </table:table-row> + <table:table-row table:style-name="ro1"> + <table:table-cell table:formula="of:=[.A25]+1" office:value-type="float" office:value="26" calcext:value-type="float"> + <text:p>26</text:p> + </table:table-cell> + </table:table-row> + <table:table-row table:style-name="ro1"> + <table:table-cell table:formula="of:=[.A26]+1" office:value-type="float" office:value="27" calcext:value-type="float"> + <text:p>27</text:p> + </table:table-cell> + </table:table-row> + <table:table-row table:style-name="ro1"> + <table:table-cell table:formula="of:=[.A27]+1" office:value-type="float" office:value="28" calcext:value-type="float"> + <text:p>28</text:p> + </table:table-cell> + </table:table-row> + <table:table-row table:style-name="ro1"> + <table:table-cell table:formula="of:=[.A28]+1" office:value-type="float" office:value="29" calcext:value-type="float"> + <text:p>29</text:p> + </table:table-cell> + </table:table-row> + <table:table-row table:style-name="ro1"> + <table:table-cell table:formula="of:=[.A29]+1" office:value-type="float" office:value="30" calcext:value-type="float"> + <text:p>30</text:p> + </table:table-cell> + </table:table-row> + <table:table-row table:style-name="ro1"> + <table:table-cell table:formula="of:=[.A30]+1" office:value-type="float" office:value="31" calcext:value-type="float"> + <text:p>31</text:p> + </table:table-cell> + </table:table-row> + <table:table-row table:style-name="ro1"> + <table:table-cell table:formula="of:=[.A31]+1" office:value-type="float" office:value="32" calcext:value-type="float"> + <text:p>32</text:p> + </table:table-cell> + </table:table-row> + <table:table-row table:style-name="ro1"> + <table:table-cell table:formula="of:=[.A32]+1" office:value-type="float" office:value="33" calcext:value-type="float"> + <text:p>33</text:p> + </table:table-cell> + </table:table-row> + <table:table-row table:style-name="ro1"> + <table:table-cell table:formula="of:=[.A33]+1" office:value-type="float" office:value="34" calcext:value-type="float"> + <text:p>34</text:p> + </table:table-cell> + </table:table-row> + <table:table-row table:style-name="ro1"> + <table:table-cell table:formula="of:=[.A34]+1" office:value-type="float" office:value="35" calcext:value-type="float"> + <text:p>35</text:p> + </table:table-cell> + </table:table-row> + <table:table-row table:style-name="ro1"> + <table:table-cell table:formula="of:=[.A35]+1" office:value-type="float" office:value="36" calcext:value-type="float"> + <text:p>36</text:p> + </table:table-cell> + </table:table-row> + <table:table-row table:style-name="ro1"> + <table:table-cell table:formula="of:=[.A36]+1" office:value-type="float" office:value="37" calcext:value-type="float"> + <text:p>37</text:p> + </table:table-cell> + </table:table-row> + <table:table-row table:style-name="ro1"> + <table:table-cell table:formula="of:=[.A37]+1" office:value-type="float" office:value="38" calcext:value-type="float"> + <text:p>38</text:p> + </table:table-cell> + </table:table-row> + <table:table-row table:style-name="ro1"> + <table:table-cell table:formula="of:=[.A38]+1" office:value-type="float" office:value="39" calcext:value-type="float"> + <text:p>39</text:p> + </table:table-cell> + </table:table-row> + <table:table-row table:style-name="ro1"> + <table:table-cell table:formula="of:=[.A39]+1" office:value-type="float" office:value="40" calcext:value-type="float"> + <text:p>40</text:p> + </table:table-cell> + </table:table-row> + </table:table> + <table:named-expressions/> + </office:spreadsheet> + </office:body> +</office:document> diff --git a/sc/qa/uitest/data/tdf31805.ods b/sc/qa/uitest/data/tdf31805.ods Binary files differnew file mode 100644 index 0000000000..4660363efa --- /dev/null +++ b/sc/qa/uitest/data/tdf31805.ods diff --git a/sc/qa/uitest/data/tdf37341.ods b/sc/qa/uitest/data/tdf37341.ods Binary files differnew file mode 100644 index 0000000000..d0f5024fb1 --- /dev/null +++ b/sc/qa/uitest/data/tdf37341.ods diff --git a/sc/qa/uitest/data/tdf39716.csv b/sc/qa/uitest/data/tdf39716.csv new file mode 100644 index 0000000000..e400e61108 --- /dev/null +++ b/sc/qa/uitest/data/tdf39716.csv @@ -0,0 +1,4 @@ +2.5E-13 +5E-13 +7.5E-13 +1E-12 diff --git a/sc/qa/uitest/data/tdf43175.ods b/sc/qa/uitest/data/tdf43175.ods Binary files differnew file mode 100644 index 0000000000..63f498627d --- /dev/null +++ b/sc/qa/uitest/data/tdf43175.ods diff --git a/sc/qa/uitest/data/tdf43693.ods b/sc/qa/uitest/data/tdf43693.ods Binary files differnew file mode 100644 index 0000000000..501a07765e --- /dev/null +++ b/sc/qa/uitest/data/tdf43693.ods diff --git a/sc/qa/uitest/data/tdf49531.ods b/sc/qa/uitest/data/tdf49531.ods Binary files differnew file mode 100644 index 0000000000..26fe76d3cb --- /dev/null +++ b/sc/qa/uitest/data/tdf49531.ods diff --git a/sc/qa/uitest/data/tdf51368.ods b/sc/qa/uitest/data/tdf51368.ods Binary files differnew file mode 100644 index 0000000000..a899fcd6e2 --- /dev/null +++ b/sc/qa/uitest/data/tdf51368.ods diff --git a/sc/qa/uitest/data/tdf53482.ods b/sc/qa/uitest/data/tdf53482.ods Binary files differnew file mode 100644 index 0000000000..cfd682d6a7 --- /dev/null +++ b/sc/qa/uitest/data/tdf53482.ods diff --git a/sc/qa/uitest/data/tdf54018.ods b/sc/qa/uitest/data/tdf54018.ods Binary files differnew file mode 100644 index 0000000000..dab482fb4f --- /dev/null +++ b/sc/qa/uitest/data/tdf54018.ods diff --git a/sc/qa/uitest/data/tdf54768.ods b/sc/qa/uitest/data/tdf54768.ods Binary files differnew file mode 100644 index 0000000000..222481db8b --- /dev/null +++ b/sc/qa/uitest/data/tdf54768.ods diff --git a/sc/qa/uitest/data/tdf55734.ods b/sc/qa/uitest/data/tdf55734.ods Binary files differnew file mode 100644 index 0000000000..d3ccc258fa --- /dev/null +++ b/sc/qa/uitest/data/tdf55734.ods diff --git a/sc/qa/uitest/data/tdf56958.ods b/sc/qa/uitest/data/tdf56958.ods Binary files differnew file mode 100644 index 0000000000..e2c65a2185 --- /dev/null +++ b/sc/qa/uitest/data/tdf56958.ods diff --git a/sc/qa/uitest/data/tdf57274.ods b/sc/qa/uitest/data/tdf57274.ods Binary files differnew file mode 100644 index 0000000000..306f3c7a24 --- /dev/null +++ b/sc/qa/uitest/data/tdf57274.ods diff --git a/sc/qa/uitest/data/tdf57465.ods b/sc/qa/uitest/data/tdf57465.ods Binary files differnew file mode 100644 index 0000000000..0c4215d816 --- /dev/null +++ b/sc/qa/uitest/data/tdf57465.ods diff --git a/sc/qa/uitest/data/tdf57841.csv b/sc/qa/uitest/data/tdf57841.csv Binary files differnew file mode 100644 index 0000000000..a712d09d04 --- /dev/null +++ b/sc/qa/uitest/data/tdf57841.csv diff --git a/sc/qa/uitest/data/tdf60468.csv b/sc/qa/uitest/data/tdf60468.csv new file mode 100644 index 0000000000..9f9cfa7238 --- /dev/null +++ b/sc/qa/uitest/data/tdf60468.csv @@ -0,0 +1,5 @@ +head1 head2 head3 +"value1.1 +value1.2" "value2.1 + value2.2 +value2.3" value3 diff --git a/sc/qa/uitest/data/tdf62267.ods b/sc/qa/uitest/data/tdf62267.ods Binary files differnew file mode 100644 index 0000000000..51ed9aecf3 --- /dev/null +++ b/sc/qa/uitest/data/tdf62267.ods diff --git a/sc/qa/uitest/data/tdf62349.ods b/sc/qa/uitest/data/tdf62349.ods Binary files differnew file mode 100644 index 0000000000..71bc5274c4 --- /dev/null +++ b/sc/qa/uitest/data/tdf62349.ods diff --git a/sc/qa/uitest/data/tdf64086.xlsx b/sc/qa/uitest/data/tdf64086.xlsx Binary files differnew file mode 100644 index 0000000000..4cbd5ce8db --- /dev/null +++ b/sc/qa/uitest/data/tdf64086.xlsx diff --git a/sc/qa/uitest/data/tdf65856.ods b/sc/qa/uitest/data/tdf65856.ods Binary files differnew file mode 100644 index 0000000000..c3c27c7104 --- /dev/null +++ b/sc/qa/uitest/data/tdf65856.ods diff --git a/sc/qa/uitest/data/tdf65856_2.ods b/sc/qa/uitest/data/tdf65856_2.ods Binary files differnew file mode 100644 index 0000000000..4a0fe0ff41 --- /dev/null +++ b/sc/qa/uitest/data/tdf65856_2.ods diff --git a/sc/qa/uitest/data/tdf69981.ods b/sc/qa/uitest/data/tdf69981.ods Binary files differnew file mode 100644 index 0000000000..4647d1a2c8 --- /dev/null +++ b/sc/qa/uitest/data/tdf69981.ods diff --git a/sc/qa/uitest/data/tdf74577.html b/sc/qa/uitest/data/tdf74577.html new file mode 100644 index 0000000000..26ee541086 --- /dev/null +++ b/sc/qa/uitest/data/tdf74577.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<html> +<head> + <title>Table</title> +</head> +<body> + + <table border=1 width="90%"> + <tr> + <td>Cell1</td> + <td colspan="2">Cell2 + 3</td> + </tr> + <tr> + <td>Cell1</td> + <td>Cell2</td> + <td>Cell3</td> + </tr> + <tr> + <td colspan="2"> Cell1 + Cell2</td> + <td>Cell3</td> + </tr> + <tr> + <td colspan="3"> Cell1 + Cell2 + Cell3</td> + </tr> + <tr> + <td rowspan="2">Cell1 + Cell2</td> + <td colspan="2"> Cell2 + Cell3</td> + </tr> + <tr> + <td>Cell2</td> + <td>Cell3</td> + </tr> + </table> +</body> +</html> diff --git a/sc/qa/uitest/data/tdf76731.ods b/sc/qa/uitest/data/tdf76731.ods Binary files differnew file mode 100644 index 0000000000..6435d5f505 --- /dev/null +++ b/sc/qa/uitest/data/tdf76731.ods diff --git a/sc/qa/uitest/data/tdf77509.xls b/sc/qa/uitest/data/tdf77509.xls Binary files differnew file mode 100644 index 0000000000..d8d690c8be --- /dev/null +++ b/sc/qa/uitest/data/tdf77509.xls diff --git a/sc/qa/uitest/data/tdf81696.ods b/sc/qa/uitest/data/tdf81696.ods Binary files differnew file mode 100644 index 0000000000..593c8072c8 --- /dev/null +++ b/sc/qa/uitest/data/tdf81696.ods diff --git a/sc/qa/uitest/data/tdf85353.ods b/sc/qa/uitest/data/tdf85353.ods Binary files differnew file mode 100644 index 0000000000..001523e36f --- /dev/null +++ b/sc/qa/uitest/data/tdf85353.ods diff --git a/sc/qa/uitest/data/tdf85403.ods b/sc/qa/uitest/data/tdf85403.ods Binary files differnew file mode 100644 index 0000000000..c809d25793 --- /dev/null +++ b/sc/qa/uitest/data/tdf85403.ods diff --git a/sc/qa/uitest/data/tdf85979.ods b/sc/qa/uitest/data/tdf85979.ods Binary files differnew file mode 100644 index 0000000000..2b8584a20d --- /dev/null +++ b/sc/qa/uitest/data/tdf85979.ods diff --git a/sc/qa/uitest/data/tdf86253.ods b/sc/qa/uitest/data/tdf86253.ods Binary files differnew file mode 100644 index 0000000000..d4042df43b --- /dev/null +++ b/sc/qa/uitest/data/tdf86253.ods diff --git a/sc/qa/uitest/data/tdf88359.csv b/sc/qa/uitest/data/tdf88359.csv new file mode 100644 index 0000000000..1f71e3d98e --- /dev/null +++ b/sc/qa/uitest/data/tdf88359.csv @@ -0,0 +1,2 @@ +start_date
+2010-10-15T20:56:30
diff --git a/sc/qa/uitest/data/tdf88735.ods b/sc/qa/uitest/data/tdf88735.ods Binary files differnew file mode 100644 index 0000000000..59abf6050b --- /dev/null +++ b/sc/qa/uitest/data/tdf88735.ods diff --git a/sc/qa/uitest/data/tdf88792.ods b/sc/qa/uitest/data/tdf88792.ods Binary files differnew file mode 100644 index 0000000000..ecd9e60407 --- /dev/null +++ b/sc/qa/uitest/data/tdf88792.ods diff --git a/sc/qa/uitest/data/tdf89958.ods b/sc/qa/uitest/data/tdf89958.ods Binary files differnew file mode 100644 index 0000000000..5a48917db0 --- /dev/null +++ b/sc/qa/uitest/data/tdf89958.ods diff --git a/sc/qa/uitest/data/tdf91425.ods b/sc/qa/uitest/data/tdf91425.ods Binary files differnew file mode 100644 index 0000000000..5a72f162d2 --- /dev/null +++ b/sc/qa/uitest/data/tdf91425.ods diff --git a/sc/qa/uitest/data/tdf92503.csv b/sc/qa/uitest/data/tdf92503.csv new file mode 100644 index 0000000000..0ceaaeeb39 --- /dev/null +++ b/sc/qa/uitest/data/tdf92503.csv @@ -0,0 +1,9 @@ +31 Mar 2013, 01:00 +31 Mar 2013, 02:00 +31 Mar 2013, 03:00 +30 Mar 2014, 01:00 +30 Mar 2014, 02:00 +30 Mar 2014, 03:00 +29 Mar 2015, 01:00 +29 Mar 2015, 02:00 +29 Mar 2015, 03:00 diff --git a/sc/qa/uitest/data/tdf93506.ods b/sc/qa/uitest/data/tdf93506.ods Binary files differnew file mode 100644 index 0000000000..3995e563e4 --- /dev/null +++ b/sc/qa/uitest/data/tdf93506.ods diff --git a/sc/qa/uitest/data/tdf95192.ods b/sc/qa/uitest/data/tdf95192.ods Binary files differnew file mode 100644 index 0000000000..8cee74288a --- /dev/null +++ b/sc/qa/uitest/data/tdf95192.ods diff --git a/sc/qa/uitest/data/tdf95217.html b/sc/qa/uitest/data/tdf95217.html new file mode 100644 index 0000000000..0d036333ec --- /dev/null +++ b/sc/qa/uitest/data/tdf95217.html @@ -0,0 +1,49 @@ +<!doctype html> +<html> + <head><title>.:TSETMC:. :: شرکت مدیریت Ùناوری بورس تهران</title></head> + <body> + <table class="table1"> + <tbody> + <tr> + <td>وضعیت بازار</td> + <td>بسته </td> + </tr> + + <tr> + <td>شاخص Ú©Ù„</td> + <td>63,175</td> + </tr> + + <tr> + <td>شاخص كل (هم وزن)</td> + <td>9,690.30 (22.80)</td> + </tr> + + <tr> + <td>ارزش بازار</td> + <td>2,733,260.531 B</td> + </tr> + + <tr> + <td>اطلاعات قیمت</td> + <td>94/7/29 12:34:44</td> + </tr> + + <tr> + <td>تعداد معاملات</td> + <td>25,211</td> + </tr> + + <tr> + <td>ارزش معاملات</td> + <td>732.587 B</td> + </tr> + + <tr> + <td>Øجم معاملات</td> + <td>312.439 M</td> + </tr> + </tbody> + </table> + </body> +</html> diff --git a/sc/qa/uitest/data/tdf96432.ods b/sc/qa/uitest/data/tdf96432.ods Binary files differnew file mode 100644 index 0000000000..68aa06fb3c --- /dev/null +++ b/sc/qa/uitest/data/tdf96432.ods diff --git a/sc/qa/uitest/data/tdf96453.ods b/sc/qa/uitest/data/tdf96453.ods Binary files differnew file mode 100644 index 0000000000..89114f6365 --- /dev/null +++ b/sc/qa/uitest/data/tdf96453.ods diff --git a/sc/qa/uitest/data/tdf96499.html b/sc/qa/uitest/data/tdf96499.html new file mode 100644 index 0000000000..fac3fe5584 --- /dev/null +++ b/sc/qa/uitest/data/tdf96499.html @@ -0,0 +1,70 @@ +<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"> + <head> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> + <meta name="ProgId" content="Excel.Sheet"/> + <meta name="Generator" content="WPS Office ET"/> + <style> +.xl67 + {mso-style-parent:style0; + mso-number-format:"\@"; + white-space:normal; + mso-font-charset:134; + border-left:.5pt solid #000000; + border-right:.5pt solid #000000; + border-bottom:.5pt solid #000000;} +.xl68 + {mso-style-parent:style0; + mso-number-format:"\@"; + white-space:normal; + mso-font-charset:134; + border-right:.5pt solid #000000; + border-bottom:.5pt solid #000000;} + </style> + </head> + <body link="blue" vlink="purple"> + <table width="337" border="0" cellpadding="0" cellspacing="0" style='width:252.75pt;border-collapse:collapse;table-layout:fixed;'> + <col width="173" style='mso-width-source:userset;mso-width-alt:5536;'/> + <col width="164" style='mso-width-source:userset;mso-width-alt:5248;'/> + <tr height="19" style='height:14.25pt;'> + <td class="xl65" height="19" width="173" style='height:14.25pt;width:129.75pt;' x:str>银行å¡å·</td> + <td class="xl66" width="164" style='width:123.00pt;' x:str>身份è¯å·</td> + </tr> + <tr height="19" style='height:14.25pt;'> + <td class="xl67" height="19" style='height:14.25pt;' x:str>4100025601074122197</td> + <td class="xl68" x:str>350627197809253585</td> + </tr> + <tr height="19" style='height:14.25pt;'> + <td class="xl67" height="19" style='height:14.25pt;' x:str>4100025601074122197</td> + <td class="xl68" x:str>522226198707114824</td> + </tr> + <tr height="19" style='height:14.25pt;'> + <td class="xl67" height="19" style='height:14.25pt;' x:str>4100025601074122197</td> + <td class="xl68" x:str>522221199410104927</td> + </tr> + <tr height="19" style='height:14.25pt;'> + <td class="xl67" height="19" style='height:14.25pt;' x:str>4100025601074122197</td> + <td class="xl68" x:str>411502199103159021</td> + </tr> + <tr height="19" style='height:14.25pt;'> + <td class="xl67" height="19" style='height:14.25pt;' x:str>4100025601074122197</td> + <td class="xl68" x:str>42062519890201532X</td> + </tr> + <tr height="19" style='height:14.25pt;'> + <td class="xl67" height="19" style='height:14.25pt;' x:str>4100025601074122197</td> + <td class="xl68" x:str>350426198609203513</td> + </tr> + <tr height="19" style='height:14.25pt;'> + <td class="xl67" height="19" style='height:14.25pt;' x:str>4100025601074122197</td> + <td class="xl68" x:str>430481197909111223</td> + </tr> + <tr height="19" style='height:14.25pt;'> + <td class="xl67" height="19" style='height:14.25pt;' x:str>4100025601074122197</td> + <td class="xl68" x:str>452524197106103880</td> + </tr> + <tr height="19" style='height:14.25pt;'> + <td class="xl67" height="19" style='height:14.25pt;' x:str>4100025601074122197</td> + <td class="xl68" x:str>350628198907113536</td> + </tr> + </table> + </body> +</html> diff --git a/sc/qa/uitest/data/tdf96561.csv b/sc/qa/uitest/data/tdf96561.csv Binary files differnew file mode 100644 index 0000000000..f3ac249101 --- /dev/null +++ b/sc/qa/uitest/data/tdf96561.csv diff --git a/sc/qa/uitest/data/tdf98390.ods b/sc/qa/uitest/data/tdf98390.ods Binary files differnew file mode 100644 index 0000000000..19baf412b6 --- /dev/null +++ b/sc/qa/uitest/data/tdf98390.ods diff --git a/sc/qa/uitest/data/tdf98493.ods b/sc/qa/uitest/data/tdf98493.ods Binary files differnew file mode 100644 index 0000000000..1cc0d8b119 --- /dev/null +++ b/sc/qa/uitest/data/tdf98493.ods diff --git a/sc/qa/uitest/data/tdf99069.ods b/sc/qa/uitest/data/tdf99069.ods Binary files differnew file mode 100644 index 0000000000..9c4fbda4a4 --- /dev/null +++ b/sc/qa/uitest/data/tdf99069.ods diff --git a/sc/qa/uitest/data/tdf99208.ods b/sc/qa/uitest/data/tdf99208.ods Binary files differnew file mode 100644 index 0000000000..2767e77315 --- /dev/null +++ b/sc/qa/uitest/data/tdf99208.ods diff --git a/sc/qa/uitest/data/tdf99627.ods b/sc/qa/uitest/data/tdf99627.ods Binary files differnew file mode 100644 index 0000000000..84c4e51341 --- /dev/null +++ b/sc/qa/uitest/data/tdf99627.ods diff --git a/sc/qa/uitest/data/text_to_columns_comma.ods b/sc/qa/uitest/data/text_to_columns_comma.ods Binary files differnew file mode 100644 index 0000000000..3d5b7d5830 --- /dev/null +++ b/sc/qa/uitest/data/text_to_columns_comma.ods diff --git a/sc/qa/uitest/data/text_to_columns_dot.ods b/sc/qa/uitest/data/text_to_columns_dot.ods Binary files differnew file mode 100644 index 0000000000..29136ae453 --- /dev/null +++ b/sc/qa/uitest/data/text_to_columns_dot.ods diff --git a/sc/qa/uitest/data/text_to_columns_pipe.ods b/sc/qa/uitest/data/text_to_columns_pipe.ods Binary files differnew file mode 100644 index 0000000000..16652ceeda --- /dev/null +++ b/sc/qa/uitest/data/text_to_columns_pipe.ods diff --git a/sc/qa/uitest/data/text_to_columns_pipe_space.ods b/sc/qa/uitest/data/text_to_columns_pipe_space.ods Binary files differnew file mode 100644 index 0000000000..0895d3497b --- /dev/null +++ b/sc/qa/uitest/data/text_to_columns_pipe_space.ods diff --git a/sc/qa/uitest/data/text_to_columns_semicolon.ods b/sc/qa/uitest/data/text_to_columns_semicolon.ods Binary files differnew file mode 100644 index 0000000000..53eb7c6150 --- /dev/null +++ b/sc/qa/uitest/data/text_to_columns_semicolon.ods diff --git a/sc/qa/uitest/data/text_to_columns_space.ods b/sc/qa/uitest/data/text_to_columns_space.ods Binary files differnew file mode 100644 index 0000000000..4ae3f176cc --- /dev/null +++ b/sc/qa/uitest/data/text_to_columns_space.ods diff --git a/sc/qa/uitest/data/xmlSource.xml b/sc/qa/uitest/data/xmlSource.xml new file mode 100644 index 0000000000..b86a2e0b17 --- /dev/null +++ b/sc/qa/uitest/data/xmlSource.xml @@ -0,0 +1,50 @@ +<nat> + <rules> + <entry name="ZoneA-to-ZoneB"> + <source-translation> + <dynamic-ip-and-port> + <translated-address> + IPPool_NAT-1.2.3 + </translated-address> + </dynamic-ip-and-port> + </source-translation> + <to> + internet + </to> + <from> + INTRA + </from> + <source> + 10.60.0.0/24 + 10.62.0.0/24 + </source> + <destination> + any + </destination> + <service>any</service> + </entry> + <entry name="ZoneB2ZoneA"> + <source-translation> + <dynamic-ip-and-port> + <translated-address> + NAT Pool 1 + </translated-address> + </dynamic-ip-and-port> + </source-translation> + <to> + internet + </to> + <from> + INTRA + </from> + <source> + any + </source> + <destination> + any + </destination> + <service>any</service> + <disabled>no</disabled> + </entry> + </rules> +</nat> diff --git a/sc/qa/uitest/external_links/tdf114995.py b/sc/qa/uitest/external_links/tdf114995.py new file mode 100644 index 0000000000..f0b05ddc79 --- /dev/null +++ b/sc/qa/uitest/external_links/tdf114995.py @@ -0,0 +1,53 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file + +from libreoffice.uno.propertyvalue import mkPropertyValues +from libreoffice.calc.document import get_cell_by_position + + +class tdf114995(UITestCase): + + def test_tdf114995(self): + + with self.ui_test.create_doc_in_start_center("calc") as document: + + with self.ui_test.execute_dialog_through_command(".uno:InsertExternalDataSource", close_button="") as xDialog: + xUrl = xDialog.getChild("url") + + # Reuse existing file + xUrl.executeAction("TYPE", mkPropertyValues({"TEXT": get_url_for_data_file("tdf60468.csv")})) + + with self.ui_test.execute_blocking_action( + xUrl.executeAction, args=("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))): + pass + + xRanges = xDialog.getChild("ranges") + + # Without the fix in place, this test would have failed with + # AssertionError: '1' != '0' + self.assertEqual("1", get_state_as_dict(xRanges)["Children"]) + + self.assertEqual("CSV_all", get_state_as_dict(xRanges.getChild("0"))["Text"]) + + # FIXME: close_dialog_through_button fails here + xOkBtn = xDialog.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) + + for i in range(3): + self.assertEqual("head" + str(i + 1), get_cell_by_position(document, 0, i, 0).getString()) + + self.assertEqual("value1.1\nvalue1.2", get_cell_by_position(document, 0, 0, 1).getString()) + + self.assertEqual("value2.1\n\tvalue2.2\nvalue2.3", get_cell_by_position(document, 0, 1, 1).getString()) + self.assertEqual("value3", get_cell_by_position(document, 0, 2, 1).getString()) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/external_links/tdf127484.py b/sc/qa/uitest/external_links/tdf127484.py new file mode 100644 index 0000000000..257b631b6a --- /dev/null +++ b/sc/qa/uitest/external_links/tdf127484.py @@ -0,0 +1,54 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file + +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + + +class tdf127484(UITestCase): + + def test_tdf127484(self): + + with self.ui_test.create_doc_in_start_center("calc") as calc_doc: + + with self.ui_test.execute_dialog_through_command(".uno:InsertExternalDataSource", close_button="") as xDialog: + xUrl = xDialog.getChild("url") + xUrl.executeAction("TYPE", mkPropertyValues({"TEXT": get_url_for_data_file("tdf127484.html")})) + + with self.ui_test.execute_blocking_action(xUrl.executeAction, args=("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))): + pass + + xRanges = xDialog.getChild("ranges") + self.assertEqual("3", get_state_as_dict(xRanges)["Children"]) + + self.assertEqual("HTML_all", get_state_as_dict(xRanges.getChild("0"))["Text"]) + self.assertEqual("HTML_tables", get_state_as_dict(xRanges.getChild("1"))["Text"]) + + # Without the fix in place, this test would have failed with + # AssertionError: 'HTML_1 - He-Man and Skeletor facts' != 'HTML_1' + self.assertEqual("HTML_1 - He-Man and Skeletor facts", get_state_as_dict(xRanges.getChild("2"))["Text"]) + + xRanges.getChild("0").executeAction("DESELECT", tuple()) + xRanges.getChild("2").executeAction("SELECT", tuple()) + + # FIXME: close_dialog_through_button fails here + xOkBtn = xDialog.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) + + self.assertEqual("", get_cell_by_position(calc_doc, 0, 0, 0).getString()) + self.assertEqual("Role", get_cell_by_position(calc_doc, 0, 0, 1).getString()) + self.assertEqual("Weapon", get_cell_by_position(calc_doc, 0, 0, 2).getString()) + self.assertEqual("Dark secret", get_cell_by_position(calc_doc, 0, 0, 3).getString()) + self.assertEqual("He-Man", get_cell_by_position(calc_doc, 0, 1, 0).getString()) + self.assertEqual("Skeletor", get_cell_by_position(calc_doc, 0, 2, 0).getString()) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/external_links/tdf147767.py b/sc/qa/uitest/external_links/tdf147767.py new file mode 100644 index 0000000000..b25816029f --- /dev/null +++ b/sc/qa/uitest/external_links/tdf147767.py @@ -0,0 +1,49 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file + +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + + +class tdf147767(UITestCase): + + def test_tdf147767(self): + + with self.ui_test.create_doc_in_start_center("calc") as calc_doc: + + with self.ui_test.execute_dialog_through_command(".uno:InsertExternalDataSource", close_button="") as xDialog: + xUrl = xDialog.getChild("url") + xUrl.executeAction("TYPE", mkPropertyValues({"TEXT": get_url_for_data_file("tdf147767.html")})) + + with self.ui_test.execute_blocking_action(xUrl.executeAction, args=("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))): + pass + + xRanges = xDialog.getChild("ranges") + self.assertEqual("3", get_state_as_dict(xRanges)["Children"]) + + self.assertEqual("HTML_all", get_state_as_dict(xRanges.getChild("0"))["Text"]) + self.assertEqual("HTML_tables", get_state_as_dict(xRanges.getChild("1"))["Text"]) + + # FIXME: close_dialog_through_button fails here + xOkBtn = xDialog.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) + + xCell = get_cell_by_position(calc_doc, 0, 0, 0) + + # Without the fix in place, this test would have failed with + # AssertionError: 14.0 != 0.699999988079071 + self.assertEqual(14.0, xCell.CharHeight) + self.assertEqual("0x90080c", hex(xCell.CellBackColor)) + self.assertEqual("0xffffff", hex(xCell.CharColor)) + self.assertEqual("Fecha", xCell.getString()) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/external_links/tdf95217.py b/sc/qa/uitest/external_links/tdf95217.py new file mode 100644 index 0000000000..fb0125a995 --- /dev/null +++ b/sc/qa/uitest/external_links/tdf95217.py @@ -0,0 +1,52 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file + +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + + +class tdf95217(UITestCase): + + def test_tdf95217(self): + + with self.ui_test.create_doc_in_start_center("calc") as calc_doc: + + with self.ui_test.execute_dialog_through_command(".uno:InsertExternalDataSource", close_button="") as xDialog: + xUrl = xDialog.getChild("url") + xUrl.executeAction("TYPE", mkPropertyValues({"TEXT": get_url_for_data_file("tdf95217.html")})) + + with self.ui_test.execute_blocking_action(xUrl.executeAction, args=("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))): + pass + + xRanges = xDialog.getChild("ranges") + self.assertEqual("3", get_state_as_dict(xRanges)["Children"]) + + # tdf#142600: Without the fix in place, this test would have failed with + # AssertionError: 'HTML_all' != 'HTML_1' + self.assertEqual("HTML_all", get_state_as_dict(xRanges.getChild("0"))["Text"]) + self.assertEqual("HTML_tables", get_state_as_dict(xRanges.getChild("1"))["Text"]) + self.assertEqual("HTML_1", get_state_as_dict(xRanges.getChild("2"))["Text"]) + + # FIXME: close_dialog_through_button fails here + xOkBtn = xDialog.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) + + # Without the fix in place, this test would have failed with + # AssertionError: 'وضعیت بازار' != 'وضعیت بازار' + self.assertEqual("وضعیت بازار", get_cell_by_position(calc_doc, 0, 0, 0).getString()) + self.assertEqual("شاخص Ú©Ù„", get_cell_by_position(calc_doc, 0, 0, 1).getString()) + self.assertEqual("شاخص كل (هم وزن)", get_cell_by_position(calc_doc, 0, 0, 2).getString()) + self.assertEqual("بسته", get_cell_by_position(calc_doc, 0, 1, 0).getString()) + self.assertEqual("63175", get_cell_by_position(calc_doc, 0, 1, 1).getString()) + self.assertEqual("9,690.30 (22.80)", get_cell_by_position(calc_doc, 0, 1, 2).getString()) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/external_links/tdf96499.py b/sc/qa/uitest/external_links/tdf96499.py new file mode 100644 index 0000000000..e6cac99eec --- /dev/null +++ b/sc/qa/uitest/external_links/tdf96499.py @@ -0,0 +1,48 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file + +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + + +class tdf96499(UITestCase): + + def test_tdf96499(self): + + with self.ui_test.create_doc_in_start_center("calc") as document: + + with self.ui_test.execute_dialog_through_command(".uno:InsertExternalDataSource", close_button="") as xDialog: + xUrl = xDialog.getChild("url") + + xUrl.executeAction("TYPE", mkPropertyValues({"TEXT": get_url_for_data_file("tdf96499.html")})) + + with self.ui_test.execute_blocking_action( + xUrl.executeAction, args=("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))): + pass + + xRanges = xDialog.getChild("ranges") + + self.assertEqual("3", get_state_as_dict(xRanges)["Children"]) + + # FIXME: close_dialog_through_button fails here + xOkBtn = xDialog.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) + + self.assertEqual("银行å¡å·", get_cell_by_position(document, 0, 0, 0).getString()) + self.assertEqual("身份è¯å·", get_cell_by_position(document, 0, 1, 0).getString()) + + for i in range (1, 10): + # Without the fix in place, this test would have failed with + # AssertionError: '4100025601074122197' != '4,10002560107412E+018' + self.assertEqual("4100025601074122197", get_cell_by_position(document, 0, 0, i).getString()) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/function_wizard/function_wizard.py b/sc/qa/uitest/function_wizard/function_wizard.py new file mode 100644 index 0000000000..5b5ff6533f --- /dev/null +++ b/sc/qa/uitest/function_wizard/function_wizard.py @@ -0,0 +1,26 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase + + +class FunctionWizardTest(UITestCase): + # tdf#98427 + def test_open_function_wizard(self): + with self.ui_test.create_doc_in_start_center("calc"): + + with self.ui_test.execute_modeless_dialog_through_command(".uno:FunctionDialog", close_button="cancel") as xFunctionDlg: + + + xArrayChkBox = xFunctionDlg.getChild("array") + xArrayChkBox.executeAction("CLICK", tuple()) + + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/function_wizard/tdf104487.py b/sc/qa/uitest/function_wizard/tdf104487.py new file mode 100755 index 0000000000..13a219ea44 --- /dev/null +++ b/sc/qa/uitest/function_wizard/tdf104487.py @@ -0,0 +1,28 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, select_pos + +class tdf104487(UITestCase): + def test_tdf104487_remember_function_category(self): + with self.ui_test.create_doc_in_start_center("calc"): + # Open function dialog and select a function category + with self.ui_test.execute_modeless_dialog_through_command(".uno:FunctionDialog") as xDialog: + xCategory = xDialog.getChild("category") + select_pos(xCategory, "3") + + # Open function dialog again and check whether function category was remembered + with self.ui_test.execute_modeless_dialog_through_command(".uno:FunctionDialog") as xDialog: + xCategory = xDialog.getChild("category") + # Without the fix in place, this test would have failed with + # AssertionError: '3' != '1' + # i.e. the last used function category in the function wizard was not remembered + self.assertEqual("3", get_state_as_dict(xCategory)["SelectEntryPos"]) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/function_wizard/tdf123479.py b/sc/qa/uitest/function_wizard/tdf123479.py new file mode 100644 index 0000000000..aee7b97aa5 --- /dev/null +++ b/sc/qa/uitest/function_wizard/tdf123479.py @@ -0,0 +1,39 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file + +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + + +# Bug 123479 - Crash in: ScFormulaResult::GetMatrixFormulaCellToken() +class tdf123479(UITestCase): + def test_tdf123479_Crash_ScFormulaResult_GetMatrixFormulaCellToken(self): + #numberingformatpage.ui + with self.ui_test.load_file(get_url_for_data_file("tdf123479.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #Select D14:D16 + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "D14:D16"})) + #Open Formula Wizard (Ctrl+F2) + with self.ui_test.execute_modeless_dialog_through_command(".uno:FunctionDialog") as xDialog: + 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}") + + #verify; no crashes + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 0).getString(), "Pass/Fail") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/function_wizard/tdf132173.py b/sc/qa/uitest/function_wizard/tdf132173.py new file mode 100644 index 0000000000..18724b5c1e --- /dev/null +++ b/sc/qa/uitest/function_wizard/tdf132173.py @@ -0,0 +1,30 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from 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): + with self.ui_test.create_doc_in_start_center("calc") as document: + + with self.ui_test.execute_modeless_dialog_through_command(".uno:FunctionDialog") as xDialog: + 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")') + + + + #Without the fix in place, cell's value would have been #NAME? + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "2") + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/function_wizard/tdf37864.py b/sc/qa/uitest/function_wizard/tdf37864.py new file mode 100644 index 0000000000..b38b550fc6 --- /dev/null +++ b/sc/qa/uitest/function_wizard/tdf37864.py @@ -0,0 +1,35 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.uno.propertyvalue import mkPropertyValues + +class tdf37864(UITestCase): + + def test_tdf37864(self): + + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + enter_text_to_cell(gridwin, "A1", "test") + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + + self.xUITest.executeCommand(".uno:Copy") + + with self.ui_test.execute_modeless_dialog_through_command(".uno:FunctionDialog") as xDialog: + xFormula = xDialog.getChild("ed_formula") + xFormula.executeAction("TYPE", mkPropertyValues({"KEYCODE": 'CTRL+v'})) + + # Without the fix in place, this test would have failed with + # AssertionError: '=test' != '=test\n' + self.assertEqual("=test", get_state_as_dict(xFormula)["Text"]) + +# 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 0000000000..a238ea8c5f --- /dev/null +++ b/sc/qa/uitest/goalSeek/goalSeek.py @@ -0,0 +1,36 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_url_for_data_file + +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + + +class goalSeek(UITestCase): + def test_goalSeek(self): + with self.ui_test.load_file(get_url_for_data_file("goalSeek.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B4"})) + with self.ui_test.execute_modeless_dialog_through_command(".uno:GoalSeekDialog", close_button="") as xDialog: + xtarget = xDialog.getChild("target") + xvaredit = xDialog.getChild("varedit") + xtarget.executeAction("TYPE", mkPropertyValues({"TEXT":"15000"})) + xvaredit.executeAction("TYPE", mkPropertyValues({"TEXT":"B1"})) + xOKBtn = xDialog.getChild("ok") + + with self.ui_test.execute_blocking_action(xOKBtn.executeAction, args=('CLICK', ()), close_button="yes"): + pass + + #verify + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 0).getValue(), 200000) + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 3).getValue(), 15000) + +# 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 0000000000..ad1a1f1792 --- /dev/null +++ b/sc/qa/uitest/goalSeek/tdf37341.py @@ -0,0 +1,36 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_url_for_data_file + +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + + +# Bug 37341 - Goal Seek hangs indefinitely for too many calculation steps (Formula Cell $F$110) +class tdf37341(UITestCase): + def test_tdf37341_goalSeek(self): + with self.ui_test.load_file(get_url_for_data_file("tdf37341.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "F111"})) + with self.ui_test.execute_modeless_dialog_through_command(".uno:GoalSeekDialog", close_button="") as xDialog: + xtarget = xDialog.getChild("target") + xvaredit = xDialog.getChild("varedit") + xtarget.executeAction("TYPE", mkPropertyValues({"TEXT":"0"})) + xvaredit.executeAction("TYPE", mkPropertyValues({"TEXT":"E7"})) + xOKBtn = xDialog.getChild("ok") + + with self.ui_test.execute_blocking_action(xOKBtn.executeAction, args=('CLICK', ()), close_button="yes"): + pass + + #verify + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 6).getValue() > 0, True) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/goalSeek/tdf43693.py b/sc/qa/uitest/goalSeek/tdf43693.py new file mode 100644 index 0000000000..3c0436ef72 --- /dev/null +++ b/sc/qa/uitest/goalSeek/tdf43693.py @@ -0,0 +1,36 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_url_for_data_file + +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + + +# Bug 43693 - Goal Seek: reproducible crash using "target value search" +class tdf43693(UITestCase): + def test_tdf43693_goalSeek(self): + with self.ui_test.load_file(get_url_for_data_file("tdf43693.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "K248"})) + with self.ui_test.execute_modeless_dialog_through_command(".uno:GoalSeekDialog", close_button="") as xDialog: + xtarget = xDialog.getChild("target") + xvaredit = xDialog.getChild("varedit") + xtarget.executeAction("TYPE", mkPropertyValues({"TEXT":"0"})) + xvaredit.executeAction("TYPE", mkPropertyValues({"TEXT":"H5"})) + xOKBtn = xDialog.getChild("ok") + + with self.ui_test.execute_blocking_action(xOKBtn.executeAction, args=('CLICK', ()), close_button="yes"): + pass + + #verify + self.assertEqual(get_cell_by_position(calc_doc, 0, 7, 4).getValue(), 0.04) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/inputLine/tdf131326.py b/sc/qa/uitest/inputLine/tdf131326.py new file mode 100755 index 0000000000..90809ab42c --- /dev/null +++ b/sc/qa/uitest/inputLine/tdf131326.py @@ -0,0 +1,28 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.calc import enter_text_to_cell +from uitest.uihelper.common import get_state_as_dict + +# Bug 131326 - Formula to Value does not automatically change text in input line +class tdf131326(UITestCase): + + def test_tdf131326_formula_to_value_input_line(self): + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + enter_text_to_cell(gridwin, "A1", "=1") + self.xUITest.executeCommand(".uno:ConvertFormulaToValue") + xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit') + xToolkit.processEventsToIdle() + xInputWin = xCalcDoc.getChild("sc_input_window") + self.assertEqual(get_state_as_dict(xInputWin)["Text"], "1") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/inputLine/tdf142031.py b/sc/qa/uitest/inputLine/tdf142031.py new file mode 100755 index 0000000000..588c3cdf15 --- /dev/null +++ b/sc/qa/uitest/inputLine/tdf142031.py @@ -0,0 +1,41 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, type_text +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + +class tdf142031(UITestCase): + + def test_tdf142031(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + xPosWindow = xCalcDoc.getChild('pos_window') + + with self.ui_test.execute_modeless_dialog_through_command(".uno:AddName", close_button="add") as xAddNameDlg: + xEdit = xAddNameDlg.getChild("edit") + type_text(xEdit, "crédit") + + self.assertEqual('crédit', get_state_as_dict(xPosWindow)['Text']) + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B1"})) + + xInputWin = xCalcDoc.getChild("sc_input_window") + xInputWin.executeAction("TYPE", mkPropertyValues({"TEXT":"=cré"})) + xInputWin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) + + # Without the fix in place, this test would have failed here + self.assertEqual("=crédit", get_state_as_dict(xInputWin)["Text"]) + + xInputWin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) + + self.assertEqual("0", get_cell_by_position(document, 0, 1, 0).getString()) + +# 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 0000000000..a7a82d5c33 --- /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 file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.calc import enter_text_to_cell +from uitest.uihelper.common import get_state_as_dict + +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): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + # 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") + xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit') + xToolkit.processEventsToIdle() + xInputWin = xCalcDoc.getChild("sc_input_window") + self.assertEqual(get_state_as_dict(xInputWin)["Text"], "t") + + +# 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 0000000000..27764af5c3 --- /dev/null +++ b/sc/qa/uitest/inputLine/tdf67346.py @@ -0,0 +1,51 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.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): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + enter_text_to_cell(gridwin, "A1", "Apple") + + # Move focus to input window and copy the text from there + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+SHIFT+F2"})) + + xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit') + xToolkit.processEventsToIdle() + xInputWin = xCalcDoc.getChild("sc_input_window") + self.assertEqual('true', get_state_as_dict(xInputWin)["HasFocus"]) + + self.xUITest.executeCommand(".uno:SelectAll") + self.xUITest.executeCommand(".uno:Copy") + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A2"})) + + 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") +# this test keeps failing here on jenkins +# self.assertEqual(get_state_as_dict(xInputWin)["Text"], "Apple") +# +# 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"], "") + + +# 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 0000000000..d132dd5ac2 --- /dev/null +++ b/sc/qa/uitest/key_f4/f4.py @@ -0,0 +1,77 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.calc import enter_text_to_cell + +from libreoffice.uno.propertyvalue import mkPropertyValues +from libreoffice.calc.document import get_cell_by_position + + +class keyF4(UITestCase): + def test_f4(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #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") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/manual_tests/calc.py b/sc/qa/uitest/manual_tests/calc.py new file mode 100644 index 0000000000..574e343337 --- /dev/null +++ b/sc/qa/uitest/manual_tests/calc.py @@ -0,0 +1,199 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues +from libreoffice.calc.document import get_cell_by_position +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file, type_text, select_pos +from uitest.uihelper.calc import enter_text_to_cell + +class ManualCalcTests(UITestCase): + + # http://manual-test.libreoffice.org/manage/case/189/ + def test_define_database_range(self): + + with self.ui_test.create_doc_in_start_center("calc"): + + # Select range A1:D10 + xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") + xGridWin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:D10"})) + + # Execute "Define DB Range dialog" + with self.ui_test.execute_modeless_dialog_through_command(".uno:DefineDBName") as xDefineNameDlg: + + + xEntryBox = xDefineNameDlg.getChild("entry") + type_text(xEntryBox, "my_database") + + + # Deselect range + xGridWin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + + # Execute "Select DB Range dialog" + with self.ui_test.execute_dialog_through_command(".uno:SelectDB") as xSelectNameDlg: + + xListBox = xSelectNameDlg.getChild("treeview") + xListBoxState = get_state_as_dict(xListBox) + self.assertEqual(xListBoxState["SelectionCount"], "1") + self.assertEqual(xListBoxState["SelectEntryText"], "my_database") + + # Assert that the correct range has been selected + gridWinState = get_state_as_dict(xGridWin) + self.assertEqual(gridWinState["MarkedArea"], "Sheet1.A1:Sheet1.D10") + + + # http://manual-test.libreoffice.org/manage/case/190/ + def test_sort_data(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + + # Insert data + xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") + enter_text_to_cell(xGridWin, "B1", "3") + enter_text_to_cell(xGridWin, "B2", "25") + enter_text_to_cell(xGridWin, "B3", "17") + enter_text_to_cell(xGridWin, "B4", "9") + enter_text_to_cell(xGridWin, "B5", "19") + enter_text_to_cell(xGridWin, "B6", "0") + enter_text_to_cell(xGridWin, "B7", "107") + enter_text_to_cell(xGridWin, "B8", "89") + enter_text_to_cell(xGridWin, "B9", "8") + enter_text_to_cell(xGridWin, "B10", "33") + + xGridWin.executeAction("SELECT", mkPropertyValues({"RANGE": "B1:B10"})) + + # Execute "Sort" dialog + with self.ui_test.execute_dialog_through_command(".uno:DataSort"): + pass + + + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getValue(), 0) + self.assertEqual(get_cell_by_position(document, 0, 1, 1).getValue(), 3) + self.assertEqual(get_cell_by_position(document, 0, 1, 2).getValue(), 8) + self.assertEqual(get_cell_by_position(document, 0, 1, 3).getValue(), 9) + self.assertEqual(get_cell_by_position(document, 0, 1, 4).getValue(), 17) + self.assertEqual(get_cell_by_position(document, 0, 1, 5).getValue(), 19) + self.assertEqual(get_cell_by_position(document, 0, 1, 6).getValue(), 25) + self.assertEqual(get_cell_by_position(document, 0, 1, 7).getValue(), 33) + self.assertEqual(get_cell_by_position(document, 0, 1, 8).getValue(), 89) + self.assertEqual(get_cell_by_position(document, 0, 1, 9).getValue(), 107) + + + # http://manual-test.libreoffice.org/manage/case/191/ + def test_validation(self): + with self.ui_test.create_doc_in_start_center("calc"): + + xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") + xGridWin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C10"})) + + with self.ui_test.execute_dialog_through_command(".uno:Validation") as xValidationDlg: + + xAllowList = xValidationDlg.getChild("allow") + select_pos(xAllowList, "1") + + xData = xValidationDlg.getChild("data") + select_pos(xData, "5") + + xVal = xValidationDlg.getChild("max") + xVal.executeAction("TYPE", mkPropertyValues({"TEXT":"0"})) + + + def enter_text(cell, text): + enter_text_to_cell(xGridWin, cell, text) + + with self.ui_test.execute_blocking_action(enter_text, args=("A1", "abc")): + pass + with self.ui_test.execute_blocking_action(enter_text, args=("B6", "2.18")): + pass + + enter_text_to_cell(xGridWin, "C2", "24") + + + # http://manual-test.libreoffice.org/manage/case/187/ + def test_transpose(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + + xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") + enter_text_to_cell(xGridWin, "B3", "abcd") + enter_text_to_cell(xGridWin, "B4", "edfg") + enter_text_to_cell(xGridWin, "C3", "35") + enter_text_to_cell(xGridWin, "C4", "5678") + + xGridWin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C10"})) + + self.xUITest.executeCommand(".uno:Cut") + + xGridWin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + + with self.ui_test.execute_dialog_through_command(".uno:PasteSpecial") as xPasteSpecialDlg: + + xAllChkBox = xPasteSpecialDlg.getChild("paste_all") + xAllChkBox.executeAction("CLICK", tuple()) + + xTransposeChkBox = xPasteSpecialDlg.getChild("transpose") + xTransposeChkBox.executeAction("CLICK", tuple()) + + + self.assertEqual(get_cell_by_position(document, 0, 2, 1).getString(), "abcd") + self.assertEqual(get_cell_by_position(document, 0, 2, 2).getValue(), 35) + self.assertEqual(get_cell_by_position(document, 0, 3, 1).getString(), "edfg") + self.assertEqual(get_cell_by_position(document, 0, 3, 2).getValue(), 5678) + + + # http://manual-test.libreoffice.org/manage/case/151/ + def test_cell_recalc(self): + with self.ui_test.load_file(get_url_for_data_file("cell_recalc.ods")) as document: + + xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") + xGridWin.executeAction("SELECT", mkPropertyValues({"RANGE": "D2:D9"})) + self.xUITest.executeCommand(".uno:Cut") + + self.assertEqual(get_cell_by_position(document, 0, 3, 15).getValue(), 0) + + self.xUITest.executeCommand(".uno:Undo") + + for i in range(1, 9): + self.assertTrue(get_cell_by_position(document, 0, 3, i).getValue() != 0) + + self.assertEqual(get_cell_by_position(document, 0, 3, 15).getValue(), 195) + + # http://manual-test.libreoffice.org/manage/case/143/ + def test_random_numbers(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") + + xGridWin.executeAction("SELECT", mkPropertyValues({"RANGE": "A2:A10"})) + + with self.ui_test.execute_modeless_dialog_through_command(".uno:RandomNumberGeneratorDialog") as xRandomNumberDlg: + xDistributionLstBox = xRandomNumberDlg.getChild("distribution-combo") + select_pos(xDistributionLstBox, "1") + + xMin = xRandomNumberDlg.getChild("parameter1-spin") + xMin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "CTRL+A"})) + xMin.executeAction("TYPE", mkPropertyValues({"TEXT": "-2"})) + xMax = xRandomNumberDlg.getChild("parameter2-spin") + xMax.executeAction("TYPE", mkPropertyValues({"KEYCODE": "CTRL+A"})) + xMax.executeAction("TYPE", mkPropertyValues({"TEXT": "10"})) + + xApplyBtn = xRandomNumberDlg.getChild("apply") + xApplyBtn.executeAction("CLICK", tuple()) + + + def check_random_values(): + for i in range(1, 9): + val = get_cell_by_position(document, 0, 0, i).getValue() + self.assertTrue(val <= 10 and val >= -2) + + check_random_values() + + + # we might want to check that clicking 'ok' actually changes the values + check_random_values() + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/options/tdf122977.py b/sc/qa/uitest/options/tdf122977.py new file mode 100644 index 0000000000..8d71b195a9 --- /dev/null +++ b/sc/qa/uitest/options/tdf122977.py @@ -0,0 +1,51 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict + + +# Bug 122977 - CRASH: "Tools"->"Options" "LibreOfficeDev"->"Charts"->"Default Colors" +class chartDefaultColors(UITestCase): + def test_tdf122977_crash_chart_default_colors_options(self): + with self.ui_test.create_doc_in_start_center("calc"): + #Go to Tools -> Options -> Charts -> Default Colors + with self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog", close_button="cancel") as xDialogOpt: + + 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 + with self.ui_test.execute_blocking_action(xDelete.executeAction, args=('CLICK', ()), close_button="yes"): + pass + + 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) + + + +# 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 0000000000..7e1f7e987b --- /dev/null +++ b/sc/qa/uitest/pageFormat/tdf123508.py @@ -0,0 +1,46 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import select_by_text, select_pos + +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file + + +# 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): + with self.ui_test.load_file(get_url_for_data_file("tdf123508.ods")): + #open "Format > Page - Sheet > Scale + with self.ui_test.execute_dialog_through_command(".uno:PageFormatDialog") as xDialog: + 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 "Shrink print range(s) to width/height" from the scale mode drop-down list + select_by_text(scalingMode, "Shrink print range(s) to width/height") + #define a value for the page, e.g.: width 2; height 2 + spinEDSCALEPAGEWIDTH.executeAction("UP", tuple()) + spinEDSCALEPAGEHEIGHT.executeAction("UP", tuple()) + + + #verify + with self.ui_test.execute_dialog_through_command(".uno:PageFormatDialog", close_button="cancel") as xDialog: + 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"], "Shrink print range(s) to width/height") + self.assertEqual(get_state_as_dict(spinEDSCALEPAGEWIDTH)["Text"], "2") + self.assertEqual(get_state_as_dict(spinEDSCALEPAGEHEIGHT)["Text"], "2") + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/pasteSpecial/tdf114710.py b/sc/qa/uitest/pasteSpecial/tdf114710.py new file mode 100644 index 0000000000..cb6fb3654a --- /dev/null +++ b/sc/qa/uitest/pasteSpecial/tdf114710.py @@ -0,0 +1,44 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file +from libreoffice.uno.propertyvalue import mkPropertyValues + +class tdf114710(UITestCase): + + def test_tdf114710(self): + with self.ui_test.load_file(get_url_for_data_file("tdf114710.ods")): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:O7"})) + self.xUITest.executeCommand(".uno:Copy") + + with self.ui_test.load_empty_file("writer") as writer_document: + + self.xUITest.getTopFocusWindow() + + with self.ui_test.execute_dialog_through_command(".uno:PasteSpecial") as xDialog: + + xList = xDialog.getChild('list') + + for childName in xList.getChildren(): + xChild = xList.getChild(childName) + if get_state_as_dict(xChild)['Text'] == "Graphics Device Interface metafile (GDI)": + break + + xChild.executeAction("SELECT", tuple()) + self.assertEqual( + get_state_as_dict(xList)['SelectEntryText'], "Graphics Device Interface metafile (GDI)") + + + # Without the fix in place, this test would have crashed here + self.assertEqual(1, writer_document.GraphicObjects.getCount()) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/pasteSpecial/tdf118308.py b/sc/qa/uitest/pasteSpecial/tdf118308.py new file mode 100644 index 0000000000..68c462414b --- /dev/null +++ b/sc/qa/uitest/pasteSpecial/tdf118308.py @@ -0,0 +1,42 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.document import get_cell_by_position +from libreoffice.calc.paste_special import reset_default_values + +class tdf118308(UITestCase): + + def test_tdf118308(self): + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + enter_text_to_cell(gridwin, "A1", "A") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + self.xUITest.executeCommand(".uno:Copy") + + with self.ui_test.load_empty_file("calc") as calc_document: + + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + + with self.ui_test.execute_dialog_through_command(".uno:PasteSpecial") as xDialog: + + # Without the fix in place, this test would have failed here + # since a different dialog would have been opened and the children + # wouldn't have been found + reset_default_values(self, xDialog) + + self.assertEqual("A", get_cell_by_position(calc_document, 0, 0, 0).getString()) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/pasteSpecial/tdf139858.py b/sc/qa/uitest/pasteSpecial/tdf139858.py new file mode 100755 index 0000000000..ca81c7715c --- /dev/null +++ b/sc/qa/uitest/pasteSpecial/tdf139858.py @@ -0,0 +1,60 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from 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 +from libreoffice.calc.paste_special import reset_default_values + +class tdf139858(UITestCase): + def test_tdf139858_paste_comment(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") + + # Write text to cell A1 and B1 + enter_text_to_cell(xGridWin, "A1", "A1 sample text") + enter_text_to_cell(xGridWin, "B1", "B1 sample text") + + # Insert a comment in cell B1 + xArgs = mkPropertyValues({"Text": "Comment 1"}) + self.xUITest.executeCommandWithParameters(".uno:InsertAnnotation", xArgs) + + # Insert a comment in cell A2 + xGridWin.executeAction("SELECT", mkPropertyValues({"CELL":"A2"})) + xArgs = mkPropertyValues({"Text": "Comment 2"}) + self.xUITest.executeCommandWithParameters(".uno:InsertAnnotation", xArgs) + + # Copy cell A2 to clipboard + xGridWin.executeAction("SELECT", mkPropertyValues({"CELL": "A2"})) + self.xUITest.executeCommand(".uno:Copy") + + # Set cursor to cells and paste data using special options (check only comments) + targetCells = ["A1", "B1"] + for index, targetCell in enumerate(targetCells): + xGridWin.executeAction("SELECT", mkPropertyValues({"CELL": targetCell})) + with self.ui_test.execute_dialog_through_command(".uno:PasteSpecial") as xPasteSpecialDlg: + reset_default_values(self, xPasteSpecialDlg) + xDateTimeChkBox = xPasteSpecialDlg.getChild("datetime") + xDateTimeChkBox.executeAction("CLICK", tuple()) + xTextChkBox = xPasteSpecialDlg.getChild("text") + xTextChkBox.executeAction("CLICK", tuple()) + xNumbersChkBox = xPasteSpecialDlg.getChild("numbers") + xNumbersChkBox.executeAction("CLICK", tuple()) + xCommentsChkBox = xPasteSpecialDlg.getChild("comments") + xCommentsChkBox.executeAction("CLICK", tuple()) + + # Without the fix in place, this test would have failed with + # AssertionError: 'A1 sample text' != '' + # i.e., the cell content was overwritten + self.assertEqual(targetCell + " sample text", get_cell_by_position(document, 0, index, 0).getString()) + self.assertEqual("Comment 2", get_cell_by_position(document, 0, index, 0).Annotation.String) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/pasteSpecial/tdf142932.py b/sc/qa/uitest/pasteSpecial/tdf142932.py new file mode 100644 index 0000000000..18e45f2b55 --- /dev/null +++ b/sc/qa/uitest/pasteSpecial/tdf142932.py @@ -0,0 +1,56 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_url_for_data_file +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict +from libreoffice.calc.paste_special import reset_default_values + +class tdf142932(UITestCase): + + def test_tdf142932(self): + with self.ui_test.load_file(get_url_for_data_file("tdf142932.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + self.xUITest.executeCommand(".uno:SelectRow") + + self.assertEqual("some comment", get_cell_by_position(calc_doc, 0, 4, 0).Annotation.String) + + self.xUITest.executeCommand(".uno:Copy") + + with self.ui_test.execute_dialog_through_command(".uno:Insert") as xDialog: + xAfter = xDialog.getChild('after') + xAfter.executeAction("CLICK", tuple()) + + self.assertEqual(get_state_as_dict(gridwin)["SelectedTable"], "1") + + with self.ui_test.execute_dialog_through_command(".uno:PasteSpecial") as xDialog: + reset_default_values(self, xDialog) + + xSkipEmpty = xDialog.getChild("skip_empty") + xSkipEmpty.executeAction("CLICK", tuple()) + self.assertEqual('true', get_state_as_dict(xSkipEmpty)['Selected']) + + # Without the fix in place, this test would have crashed here + + self.assertEqual("A", get_cell_by_position(calc_doc, 1, 0, 0).getString()) + self.assertEqual("row", get_cell_by_position(calc_doc, 1, 1, 0).getString()) + self.assertEqual("with", get_cell_by_position(calc_doc, 1, 2, 0).getString()) + self.assertEqual("comment", get_cell_by_position(calc_doc, 1, 3, 0).getString()) + self.assertEqual("for", get_cell_by_position(calc_doc, 1, 4, 0).getString()) + self.assertEqual("a", get_cell_by_position(calc_doc, 1, 5, 0).getString()) + self.assertEqual("certain", get_cell_by_position(calc_doc, 1, 6, 0).getString()) + self.assertEqual("cell", get_cell_by_position(calc_doc, 1, 7, 0).getString()) + + self.assertEqual("", get_cell_by_position(calc_doc, 1, 4, 0).Annotation.String) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/pasteSpecial/tdf57274.py b/sc/qa/uitest/pasteSpecial/tdf57274.py new file mode 100644 index 0000000000..977c063938 --- /dev/null +++ b/sc/qa/uitest/pasteSpecial/tdf57274.py @@ -0,0 +1,42 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_url_for_data_file +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +from libreoffice.calc.paste_special import reset_default_values + +#Bug: Paste Special Link Checkbox fails to insert cell references when the source cell is blank + +class tdf57274(UITestCase): + + def test_tdf57274_tdf116385_row_only(self): + with self.ui_test.load_file(get_url_for_data_file("tdf57274.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + #* Source Cells, range B6..E6 + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "B6:E6"})) + self.xUITest.executeCommand(".uno:Copy") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B11"})) + with self.ui_test.execute_dialog_through_command(".uno:PasteSpecial", close_button="") as xDialog: + reset_default_values(self, xDialog) + #We paste here using Paste Special with 'Link' Checkbox activated + xLink = xDialog.getChild("link") + xLink.executeAction("CLICK", tuple()) + + xOkBtn = xDialog.getChild("ok") + with self.ui_test.execute_blocking_action(xOkBtn.executeAction, args=('CLICK', ()), close_button="yes"): + pass + + #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(calc_doc, 0, 4, 10).getValue(), 0) + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 10).getFormula(), "=$Sheet1.$E$6") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/pasteSpecial/tdf62267.py b/sc/qa/uitest/pasteSpecial/tdf62267.py new file mode 100644 index 0000000000..608875db49 --- /dev/null +++ b/sc/qa/uitest/pasteSpecial/tdf62267.py @@ -0,0 +1,46 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file +from libreoffice.uno.propertyvalue import mkPropertyValues +from libreoffice.calc.paste_special import reset_default_values + +#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. + +class tdf62267(UITestCase): + + def test_tdf62267(self): + with self.ui_test.load_file(get_url_for_data_file("tdf62267.ods")): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + #* Copy A1, then paste special to C1; + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + self.xUITest.executeCommand(".uno:Copy") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C1"})) + with self.ui_test.execute_dialog_through_command(".uno:PasteSpecial") as xDialog: + reset_default_values(self, xDialog) + pass + + #--> Cell formatting should stay as before + with self.ui_test.execute_dialog_through_command(".uno:ConditionalFormatManagerDialog", close_button="cancel") as xCondFormatMgr: + + + # 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") + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/pasteSpecial/tdf65856.py b/sc/qa/uitest/pasteSpecial/tdf65856.py new file mode 100644 index 0000000000..6b9e928b42 --- /dev/null +++ b/sc/qa/uitest/pasteSpecial/tdf65856.py @@ -0,0 +1,88 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_url_for_data_file, get_state_as_dict +from libreoffice.uno.propertyvalue import mkPropertyValues +from libreoffice.calc.document import get_cell_by_position +from libreoffice.calc.paste_special import reset_default_values + +class tdf65856(UITestCase): + + def test_tdf65856_paste_special_shift_right(self): + with self.ui_test.load_file(get_url_for_data_file("tdf65856.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + #- 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"})) + with self.ui_test.execute_dialog_through_command(".uno:PasteSpecial") as xDialog: + reset_default_values(self, xDialog) + + xmove_right = xDialog.getChild("move_right") + xmove_right.executeAction("CLICK", tuple()) + + #check + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 0).getString(), "T1") + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 0).getString(), "TE1") + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 0).getString(), "TES1") + self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 0).getString(), "TEST1") + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 0).getString(), "TEST1") + self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 0).getString(), "TEST1") + self.assertEqual(get_cell_by_position(calc_doc, 0, 6, 0).getString(), "TEST1") + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 13).getString(), "T14") + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 13).getString(), "TE14") + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 13).getString(), "TES14") + self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 13).getString(), "TEST14") + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 13).getString(), "TEST14") + self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 13).getString(), "TEST14") + self.assertEqual(get_cell_by_position(calc_doc, 0, 6, 13).getString(), "TEST14") + + def test_tdf65856_paste_special_shift_right_2(self): + with self.ui_test.load_file(get_url_for_data_file("tdf65856_2.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + #- 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"})) + with self.ui_test.execute_dialog_through_command(".uno:PasteSpecial") as xDialog: + xmove_right = xDialog.getChild("move_right") + + # tdf#69750: Without the fix in place, this test would have failed here + self.assertEqual("true", get_state_as_dict(xmove_right)["Checked"]) + + #check + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 1).getString(), "1") + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 1).getString(), "1") + self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 1).getString(), "1") + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 1).getString(), "1") + self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 1).getString(), "1") + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 2).getString(), "2") + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 2).getString(), "2") + self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 2).getString(), "2") + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 2).getString(), "2") + self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 2).getString(), "2") + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 3).getString(), "3") + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 3).getString(), "3") + self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 3).getString(), "3") + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 3).getString(), "3") + self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 3).getString(), "3") + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 1).getFormula(), "=D2") + self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 1).getFormula(), "=D2") + self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 2).getFormula(), "=E3") + self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 2).getFormula(), "=E3") + self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 3).getFormula(), "=F4") + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 3).getFormula(), "=F4") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/pasteSpecial/tdf69450.py b/sc/qa/uitest/pasteSpecial/tdf69450.py new file mode 100644 index 0000000000..133a4f6782 --- /dev/null +++ b/sc/qa/uitest/pasteSpecial/tdf69450.py @@ -0,0 +1,54 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.document import get_cell_by_position +from libreoffice.calc.paste_special import reset_default_values + +class tdf69450(UITestCase): + + def test_tdf69450(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + #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"})) + with self.ui_test.execute_dialog_through_command(".uno:PasteSpecial") as xDialog: + reset_default_values(self, xDialog) + + 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()) + + #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"})) + with self.ui_test.execute_dialog_through_command(".uno:PasteSpecial"): + pass + + #check B1 text + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "B") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/pasteSpecial/tdf74577.py b/sc/qa/uitest/pasteSpecial/tdf74577.py new file mode 100644 index 0000000000..87fdd2f9a1 --- /dev/null +++ b/sc/qa/uitest/pasteSpecial/tdf74577.py @@ -0,0 +1,65 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file + +from libreoffice.calc.document import get_cell_by_position + + +class tdf74577(UITestCase): + + def test_tdf74577(self): + + # Open the HTML in writer + with self.ui_test.load_file(get_url_for_data_file("tdf74577.html")): + + # Use SelectAll twice to select the table + self.xUITest.executeCommand(".uno:SelectAll") + self.xUITest.executeCommand(".uno:SelectAll") + + self.xUITest.executeCommand(".uno:Copy") + + with self.ui_test.load_empty_file("calc") as calc_document: + with self.ui_test.execute_dialog_through_command(".uno:PasteSpecial", close_button="") as xDialog: + + xList = xDialog.getChild('list') + + for childName in xList.getChildren(): + xChild = xList.getChild(childName) + if get_state_as_dict(xChild)['Text'] == "HyperText Markup Language (HTML)": + break + + xChild.executeAction("SELECT", tuple()) + self.assertEqual( + get_state_as_dict(xList)['SelectEntryText'], "HyperText Markup Language (HTML)") + + xOkBtn = xDialog.getChild("ok") + + with self.ui_test.execute_blocking_action(xOkBtn.executeAction, args=('CLICK', ())): + pass + + self.assertEqual("Cell1", get_cell_by_position(calc_document, 0, 0, 0).getString()) + self.assertEqual("Cell1", get_cell_by_position(calc_document, 0, 0, 1).getString()) + self.assertEqual("Cell1 + Cell2", get_cell_by_position(calc_document, 0, 0, 2).getString()) + self.assertEqual("Cell1 + Cell2 + Cell3", get_cell_by_position(calc_document, 0, 0, 3).getString()) + self.assertEqual("Cell1 + Cell2", get_cell_by_position(calc_document, 0, 0, 4).getString()) + + self.assertEqual("Cell2 + 3", get_cell_by_position(calc_document, 0, 1, 0).getString()) + self.assertEqual("Cell2", get_cell_by_position(calc_document, 0, 1, 1).getString()) + self.assertEqual("Cell3", get_cell_by_position(calc_document, 0, 2, 1).getString()) + + # Without the fix in place, this test would have failed with + # AssertionError: 'Cell3' != '' + self.assertEqual("Cell3", get_cell_by_position(calc_document, 0, 2, 2).getString()) + + self.assertEqual("Cell2 + Cell3", get_cell_by_position(calc_document, 0, 1, 4).getString()) + self.assertEqual("Cell2", get_cell_by_position(calc_document, 0, 1, 5).getString()) + self.assertEqual("Cell3", get_cell_by_position(calc_document, 0, 2, 5).getString()) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/pasteSpecial/tdf84810.py b/sc/qa/uitest/pasteSpecial/tdf84810.py new file mode 100644 index 0000000000..95d72df17a --- /dev/null +++ b/sc/qa/uitest/pasteSpecial/tdf84810.py @@ -0,0 +1,47 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase + +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.paste_special import reset_default_values + +class ManualCalcTests(UITestCase): + def test_paste_special(self): + # EN-8:Paste special with options + # This test is to check that paste special combined with some options and link is ok. + # Refers to tdf#84810 + + with self.ui_test.create_doc_in_start_center("calc") as document: + + # Write text to cell A1 + xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") + enter_text_to_cell(xGridWin, "A1", "abcd") + + # Copy cell A1 to clipboard + xGridWin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + self.xUITest.executeCommand(".uno:Copy") + + # Set cursor to cell A3 + xGridWin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) + + # Choose Paste Special Options and paste data + with self.ui_test.execute_dialog_through_command(".uno:PasteSpecial") as xPasteSpecialDlg: + reset_default_values(self, xPasteSpecialDlg) + xAllChkBox = xPasteSpecialDlg.getChild("paste_all") + xAllChkBox.executeAction("CLICK", tuple()) + xLinkChkBox = xPasteSpecialDlg.getChild("link") + xLinkChkBox.executeAction("CLICK", tuple()) + + # Assert successful paste + self.assertEqual(get_cell_by_position(document, 0, 0, 2).getString(), "abcd") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/pasteSpecial/tdf86253.py b/sc/qa/uitest/pasteSpecial/tdf86253.py new file mode 100644 index 0000000000..6e6e1bcd49 --- /dev/null +++ b/sc/qa/uitest/pasteSpecial/tdf86253.py @@ -0,0 +1,52 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file +from libreoffice.uno.propertyvalue import mkPropertyValues +from libreoffice.calc.paste_special import reset_default_values + +class tdf86253(UITestCase): + + def test_tdf86253(self): + with self.ui_test.load_file(get_url_for_data_file("tdf86253.ods")): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + #* 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"})) + with self.ui_test.execute_dialog_through_command(".uno:PasteSpecial") as xDialog: + reset_default_values(self, xDialog) + + 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()) + + + #--> 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. + with self.ui_test.execute_dialog_through_command(".uno:ConditionalFormatManagerDialog", close_button="cancel") as xCondFormatMgr: + + + # 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") + +# 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 0000000000..4b65e3b9e0 --- /dev/null +++ b/sc/qa/uitest/protect/protectSheet.py @@ -0,0 +1,52 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.calc import enter_text_to_cell +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 protectSheet(UITestCase): + def test_protect_sheet(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #enter password - lock + with self.ui_test.execute_dialog_through_command(".uno:Protect") as xDialog: + 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"})) + + #Unlock + + with self.ui_test.execute_dialog_through_command(".uno:Protect") as xDialog: + xpass1ed = xDialog.getChild("pass1ed") + + xpass1ed.executeAction("TYPE", mkPropertyValues({"TEXT":"aa"})) + + #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 + with self.ui_test.execute_dialog_through_command(".uno:Protect", close_button="cancel"): + pass + + enter_text_to_cell(gridwin, "B2", "B") + self.assertEqual(get_cell_by_position(document, 0, 1, 1).getString(), "B") + + +# 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 0000000000..bb4a471aca --- /dev/null +++ b/sc/qa/uitest/protect/protectSpreadsheet.py @@ -0,0 +1,32 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase + +from libreoffice.uno.propertyvalue import mkPropertyValues + + +class protectSpreadsheet(UITestCase): + def test_protect_spreadsheet(self): + with self.ui_test.create_doc_in_start_center("calc"): + #enter password + with self.ui_test.execute_dialog_through_command(".uno:ToolProtectionDocument") as xDialog: + xpass1ed = xDialog.getChild("pass1ed") + xconfirm1ed = xDialog.getChild("confirm1ed") + + xpass1ed.executeAction("TYPE", mkPropertyValues({"TEXT":"aa"})) + xconfirm1ed.executeAction("TYPE", mkPropertyValues({"TEXT":"aa"})) + + #Verify + with self.ui_test.execute_dialog_through_command(".uno:ToolProtectionDocument", close_button="cancel") as xDialog: + xpass1ed = xDialog.getChild("pass1ed") + + xpass1ed.executeAction("TYPE", mkPropertyValues({"TEXT":"aa"})) + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/range_name/create_range_name.py b/sc/qa/uitest/range_name/create_range_name.py new file mode 100644 index 0000000000..f3351326f7 --- /dev/null +++ b/sc/qa/uitest/range_name/create_range_name.py @@ -0,0 +1,162 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from libreoffice.uno.propertyvalue import mkPropertyValues + +from uitest.framework import UITestCase +from uitest.uihelper.common import type_text, select_pos +from uitest.uihelper.common import get_state_as_dict +from libreoffice.calc.document import get_cell_by_position +from uitest.uihelper.calc import enter_text_to_cell + +class CreateRangeNameTest(UITestCase): + + def test_create_range_name(self): + + with self.ui_test.create_doc_in_start_center("calc"): + + calcDoc = self.xUITest.getTopFocusWindow() + xPosWindow = calcDoc.getChild('pos_window') + self.assertEqual('A1', get_state_as_dict(xPosWindow)['Text']) + + with self.ui_test.execute_modeless_dialog_through_command(".uno:AddName", close_button="add") as xAddNameDlg: + + + xEdit = xAddNameDlg.getChild("edit") + type_text(xEdit, "globalRangeName") + + + self.assertEqual('globalRangeName', get_state_as_dict(xPosWindow)['Text']) + + + def test_create_range_name_from_ui(self): + + with self.ui_test.create_doc_in_start_center("calc") as document: + + calcDoc = self.xUITest.getTopFocusWindow() + gridwin = calcDoc.getChild("grid_window") + + enter_text_to_cell(gridwin, "A1", "1") + enter_text_to_cell(gridwin, "B1", "1") + enter_text_to_cell(gridwin, "C1", "1") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C1"})) + xPosWindow = calcDoc.getChild('pos_window') + self.assertEqual('A1:C1', get_state_as_dict(xPosWindow)['Text']) + + xPosWindow.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xPosWindow.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xPosWindow.executeAction("TYPE", mkPropertyValues({"TEXT":"RANGE1"})) + xPosWindow.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) + + self.assertEqual('RANGE1', get_state_as_dict(xPosWindow)['Text']) + + calcDoc = self.xUITest.getTopFocusWindow() + gridwin = calcDoc.getChild("grid_window") + + enter_text_to_cell(gridwin, "A2", "=SUM(RANGE1)") + self.assertEqual(3.0, get_cell_by_position(document, 0, 0, 1).getValue()) + + # Change the name + with self.ui_test.execute_dialog_through_command(".uno:DefineName") as xDialog: + xNamesList = xDialog.getChild('names') + self.assertEqual(1, len(xNamesList.getChildren())) + + xName = xDialog.getChild('name') + self.assertEqual( 'RANGE1', get_state_as_dict(xName)["Text"]) + + xName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xName.executeAction("TYPE", mkPropertyValues({"TEXT":"RANGE2"})) + + + # tdf#87474 check the formula is updated after changing the name + self.assertEqual("=SUM(RANGE2)", get_cell_by_position(document, 0, 0, 1).getFormula()) + + self.xUITest.executeCommand(".uno:Undo") + + self.assertEqual("=SUM(RANGE1)", get_cell_by_position(document, 0, 0, 1).getFormula()) + + + def test_create_local_range_name(self): + + with self.ui_test.create_doc_in_start_center("calc") as document: + + calcDoc = self.xUITest.getTopFocusWindow() + xPosWindow = calcDoc.getChild('pos_window') + self.assertEqual('A1', get_state_as_dict(xPosWindow)['Text']) + + with self.ui_test.execute_modeless_dialog_through_command(".uno:AddName", close_button="add") as xAddNameDlg: + + + xEdit = xAddNameDlg.getChild("edit") + type_text(xEdit, "localRangeName") + + xScope = xAddNameDlg.getChild("scope") + select_pos(xScope, "1") + + + # tdf#67007: Without the fix in place, this test would have failed with + # AssertionError: 'localRangeName' != 'A1' + # Additionally, newly check a sheet-local scoped name has " (sheetname)" appended. + self.assertEqual('localRangeName (Sheet1)', get_state_as_dict(xPosWindow)['Text']) + + gridwin = calcDoc.getChild("grid_window") + enter_text_to_cell(gridwin, "A1", "1") + + # Use the name range in the current sheet + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B1"})) + + with self.ui_test.execute_dialog_through_command(".uno:InsertName", close_button="paste") as xDialog: + + xCtrl = xDialog.getChild('ctrl') + self.assertEqual(1, len(xCtrl.getChildren())) + self.assertEqual("localRangeName\t$Sheet1.$A$1\tSheet1", get_state_as_dict(xCtrl.getChild('0'))['Text']) + xCtrl.getChild('0').executeAction("SELECT", tuple()) + + # use return key to paste the name range + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + + self.assertEqual("1", get_cell_by_position(document, 0, 1, 0).getString()) + self.assertEqual("=localRangeName", get_cell_by_position(document, 0, 1, 0).getFormula()) + + # Insert a new sheet + with self.ui_test.execute_dialog_through_command(".uno:Insert"): + pass + + # Use the name range in the new sheet + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B1"})) + + with self.ui_test.execute_dialog_through_command(".uno:InsertName", close_button="paste") as xDialog: + + xCtrl = xDialog.getChild('ctrl') + self.assertEqual(1, len(xCtrl.getChildren())) + self.assertEqual("localRangeName\t$Sheet1.$A$1\tSheet1", get_state_as_dict(xCtrl.getChild('0'))['Text']) + xCtrl.getChild('0').executeAction("SELECT", tuple()) + + # use return key to paste the name range + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + + # tdf#137896: Without the fix in place, this test would have failed with + # AssertionError: '1' != '#NAME?' + self.assertEqual("1", get_cell_by_position(document, 0, 1, 0).getString()) + + # and AssertionError: '=Sheet1.localRangeName' != '=localrangename' + self.assertEqual("=Sheet1.localRangeName", get_cell_by_position(document, 0, 1, 0).getFormula()) + + with self.ui_test.execute_dialog_through_command(".uno:DefineName") as xDialog: + + # tdf#138851: Without the fix in place, this test would have failed with + # AssertionError: 'Sheet1' != 'Document (Global)' + xScope = xDialog.getChild("scope") + self.assertEqual("Sheet1", get_state_as_dict(xScope)['SelectEntryText']) + + + +# 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 0000000000..8bea8d6c3c --- /dev/null +++ b/sc/qa/uitest/range_name/tdf119954.py @@ -0,0 +1,72 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.calc import enter_text_to_cell +from uitest.uihelper.common import get_url_for_data_file, type_text +from uitest.uihelper.keyboard import select_all + +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + + +# 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): + with self.ui_test.load_file(get_url_for_data_file("tdf119954.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #* 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"})) + with self.ui_test.execute_modeless_dialog_through_command(".uno:DefineDBName") as xDefineNameDlg: + xEntryBox = xDefineNameDlg.getChild("entry") + type_text(xEntryBox, "aaa") + add = xDefineNameDlg.getChild("add") + assign = xDefineNameDlg.getChild("assign") + add.executeAction("CLICK", tuple()) + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + with self.ui_test.execute_modeless_dialog_through_command(".uno:DefineDBName") as xDefineNameDlg: + xEntryBox = xDefineNameDlg.getChild("entry") + add = xDefineNameDlg.getChild("add") + assign = xDefineNameDlg.getChild("assign") + select_all(xEntryBox) + type_text(xEntryBox, "bbb") + select_all(assign) + type_text(assign, "$Sheet2.$C$3") + add.executeAction("CLICK", tuple()) + + enter_text_to_cell(gridwin, "B2", "=bbb") + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 1).getValue(), 2) + + enter_text_to_cell(gridwin, "C2", "=aaa") + gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 1).getValue(), 1) + + self.xUITest.executeCommand(".uno:Undo") + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 1).getValue(), 0) + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 1).getValue(), 0) + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 2).getFormula(), "") + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 1).getFormula(), "") + + # check cancel button + with self.ui_test.execute_modeless_dialog_through_command(".uno:DefineDBName", close_button="cancel"): + pass + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/range_name/tdf130371.py b/sc/qa/uitest/range_name/tdf130371.py new file mode 100644 index 0000000000..8e7c091593 --- /dev/null +++ b/sc/qa/uitest/range_name/tdf130371.py @@ -0,0 +1,57 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file + +class namedRanges(UITestCase): + + def test_tdf130371(self): + with self.ui_test.load_file(get_url_for_data_file("tdf130371.ods")): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + text1 = "value\t$Sheet2.$B$2\tSheet2" + text2 = "value\t$Sheet3.$B$2\tSheet3" + text3 = "value\t$Sheet4.$B$2\tSheet4" + + with self.ui_test.execute_dialog_through_command(".uno:DefineName") as xDialog: + 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) + + + 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") + + with self.ui_test.execute_dialog_through_command(".uno:DefineName") as xDialog: + 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) + + + self.xUITest.executeCommand(".uno:Undo") + + with self.ui_test.execute_dialog_through_command(".uno:DefineName", close_button="cancel") as xDialog: + 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) + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/range_name/tdf137617.py b/sc/qa/uitest/range_name/tdf137617.py new file mode 100644 index 0000000000..c2ac24ebc6 --- /dev/null +++ b/sc/qa/uitest/range_name/tdf137617.py @@ -0,0 +1,90 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import select_by_text +from uitest.uihelper.calc import enter_text_to_cell + +class tdf137617(UITestCase): + + def change_formula_syntax(self, syntax): + with self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") as xDialogOpt: + + xPages = xDialogOpt.getChild("pages") + xCalcEntry = xPages.getChild('3') + xCalcEntry.executeAction("EXPAND", tuple()) + xCalcFormulaEntry = xCalcEntry.getChild('4') + xCalcFormulaEntry.executeAction("SELECT", tuple()) + + xFormulaSyntax = xDialogOpt.getChild('formulasyntax') + select_by_text(xFormulaSyntax, syntax) + + def test_tdf137617(self): + + with self.ui_test.create_doc_in_start_center("calc"): + + calcDoc = self.xUITest.getTopFocusWindow() + gridwin = calcDoc.getChild("grid_window") + + enter_text_to_cell(gridwin, "A1", "Result1") + enter_text_to_cell(gridwin, "A2", "Result2") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B2"})) + + with self.ui_test.execute_dialog_through_command(".uno:CreateNames") as xDialog: + + + # Only left is selected + self.assertEqual('true', get_state_as_dict(xDialog.getChild('left'))['Selected']) + self.assertEqual('false', get_state_as_dict(xDialog.getChild('right'))['Selected']) + self.assertEqual('false', get_state_as_dict(xDialog.getChild('bottom'))['Selected']) + self.assertEqual('false', get_state_as_dict(xDialog.getChild('top'))['Selected']) + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B1"})) + + xPosWindow = calcDoc.getChild('pos_window') + self.assertEqual('Result1', get_state_as_dict(xPosWindow)['Text']) + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B2"})) + + self.assertEqual('Result2', get_state_as_dict(xPosWindow)['Text']) + + try: + self.change_formula_syntax("Excel R1C1") + + enter_text_to_cell(gridwin, "C1", "Result3") + enter_text_to_cell(gridwin, "D1", "Result4") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "C1:D2"})) + + with self.ui_test.execute_dialog_through_command(".uno:CreateNames") as xDialog: + + + # Only top is selected + self.assertEqual('false', get_state_as_dict(xDialog.getChild('left'))['Selected']) + self.assertEqual('false', get_state_as_dict(xDialog.getChild('right'))['Selected']) + self.assertEqual('false', get_state_as_dict(xDialog.getChild('bottom'))['Selected']) + self.assertEqual('true', get_state_as_dict(xDialog.getChild('top'))['Selected']) + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "C2"})) + + # Without the fix in place, this test would have failed with + # AssertionError: 'Result3' != 'R2C3' + self.assertEqual('Result3', get_state_as_dict(xPosWindow)['Text']) + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D2"})) + + self.assertEqual('Result4', get_state_as_dict(xPosWindow)['Text']) + + finally: + self.change_formula_syntax("Calc A1") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/range_name/tdf138822.py b/sc/qa/uitest/range_name/tdf138822.py new file mode 100644 index 0000000000..d8d72d3138 --- /dev/null +++ b/sc/qa/uitest/range_name/tdf138822.py @@ -0,0 +1,55 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import type_text + +class tdf138822(UITestCase): + + def test_tdf138822(self): + with self.ui_test.create_doc_in_start_center("calc"): + + calcDoc = self.xUITest.getTopFocusWindow() + xPosWindow = calcDoc.getChild('pos_window') + self.assertEqual('A1', get_state_as_dict(xPosWindow)['Text']) + + with self.ui_test.execute_modeless_dialog_through_command(".uno:DefineName", close_button="add"): + pass + + xDefineNamesDialog = self.xUITest.getTopFocusWindow() + + xAddBtn = xDefineNamesDialog.getChild("add") + self.assertEqual("false", get_state_as_dict(xAddBtn)['Enabled']) + + xEdit = xDefineNamesDialog.getChild("edit") + type_text(xEdit, "rangeName") + + self.assertEqual("true", get_state_as_dict(xAddBtn)['Enabled']) + + self.ui_test.close_dialog_through_button(xAddBtn) + + xManageNamesDialog = self.xUITest.getTopFocusWindow() + + xNamesList = xManageNamesDialog.getChild('names') + self.assertEqual(1, len(xNamesList.getChildren())) + self.assertEqual(get_state_as_dict(xNamesList.getChild('0'))["Text"], "rangeName\t$Sheet1.$A$1\tDocument (Global)") + + xCancelBtn = xManageNamesDialog.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + + # Open the dialog again + with self.ui_test.execute_modeless_dialog_through_command(".uno:DefineName") as xManageNamesDialog: + + xNamesList = xManageNamesDialog.getChild('names') + + # Without the fix in place, this test would have failed with + # AssertionError: 0 != 1 + self.assertEqual(0, len(xNamesList.getChildren())) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/range_name/tdf145077.py b/sc/qa/uitest/range_name/tdf145077.py new file mode 100644 index 0000000000..38c23c62ac --- /dev/null +++ b/sc/qa/uitest/range_name/tdf145077.py @@ -0,0 +1,41 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file +from uitest.uihelper.common import select_by_text + +class tdf145077(UITestCase): + + def test_tdf145077(self): + + with self.ui_test.load_file(get_url_for_data_file("tdf145077.ods")): + + calcDoc = self.xUITest.getTopFocusWindow() + gridwin = calcDoc.getChild("grid_window") + + xPosWindow = calcDoc.getChild('pos_window') + + rangeList = ["Players (Team1)", "Points (Team1)", "Winners (Team1)"] + expectedSelection = ["Team1.D1:Team1.R1", "Team1.D10:Team1.R10", "Team1.B2:Team1.B9"] + + # Without the fix in place, this test would have failed with + # AssertionError: 'Team1.D10:Team1.R10' != 'Team1.D1:Team1.R1' + for index, rangeName in enumerate(rangeList): + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B10"})) + + self.assertEqual("Team1.B10:Team1.B10", get_state_as_dict(gridwin)["MarkedArea"]) + + select_by_text(xPosWindow, rangeName) + + # Check selection + self.assertEqual(expectedSelection[index], get_state_as_dict(gridwin)["MarkedArea"]) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/range_name/tdf148072.py b/sc/qa/uitest/range_name/tdf148072.py new file mode 100644 index 0000000000..a923136b81 --- /dev/null +++ b/sc/qa/uitest/range_name/tdf148072.py @@ -0,0 +1,95 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict, type_text, select_by_text +from libreoffice.calc.document import get_cell_by_position +from uitest.uihelper.calc import enter_text_to_cell + +class Tdf148072(UITestCase): + + def test_tdf148072(self): + with self.ui_test.create_doc_in_start_center("calc") as calc_doc: + + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B2"})) + + with self.ui_test.execute_modeless_dialog_through_command(".uno:AddName", close_button="add") as xAddNameDlg: + xEdit = xAddNameDlg.getChild("edit") + type_text(xEdit, "testfield_1") + + xRange = xAddNameDlg.getChild("range") + self.assertEqual("$Sheet1.$B$2", get_state_as_dict(xRange)['Text']) + + xScope = xAddNameDlg.getChild("scope") + select_by_text(xScope, "Sheet1") + + enter_text_to_cell(gridwin, "B2", "1") + enter_text_to_cell(gridwin, "B3", "=testfield_1") + + self.assertEqual("1", get_cell_by_position(calc_doc, 0, 1, 1).getString()) + self.assertEqual("1", get_cell_by_position(calc_doc, 0, 1, 2).getString()) + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "B2:B3"})) + + self.xUITest.executeCommand(".uno:Cut") + + # Insert a new sheet + with self.ui_test.execute_dialog_through_command(".uno:Add") as xDialog: + xName = xDialog.getChild('name_entry') + self.assertEqual( 'Sheet2', get_state_as_dict(xName)["Text"]) + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "$Sheet2.B2"})) + + self.xUITest.executeCommand(".uno:Paste") + + self.assertEqual("", get_cell_by_position(calc_doc, 0, 1, 1).getString()) + self.assertEqual("", get_cell_by_position(calc_doc, 0, 1, 2).getString()) + self.assertEqual("1", get_cell_by_position(calc_doc, 1, 1, 1).getString()) + self.assertEqual("1", get_cell_by_position(calc_doc, 1, 1, 2).getString()) + + with self.ui_test.execute_dialog_through_command(".uno:DefineName") as xDialog: + xNamesList = xDialog.getChild('names') + self.assertEqual(1, len(xNamesList.getChildren())) + + xName = xDialog.getChild('name') + self.assertEqual( 'testfield_1', get_state_as_dict(xName)["Text"]) + + xRange = xDialog.getChild("range") + self.assertEqual("$Sheet2.$B$2", get_state_as_dict(xRange)['Text']) + + xScope = xDialog.getChild("scope") + self.assertEqual("$Sheet2.$B$2", get_state_as_dict(xRange)['Text']) + + self.xUITest.executeCommand(".uno:Undo") + self.xUITest.executeCommand(".uno:Undo") + self.xUITest.executeCommand(".uno:Undo") + + self.assertEqual("1", get_cell_by_position(calc_doc, 0, 1, 1).getString()) + + # Without the fix in place, this test would have failed with + # AssertionError: '1' != '#REF!' + self.assertEqual("1", get_cell_by_position(calc_doc, 0, 1, 2).getString()) + + with self.ui_test.execute_dialog_through_command(".uno:DefineName") as xDialog: + xNamesList = xDialog.getChild('names') + self.assertEqual(1, len(xNamesList.getChildren())) + + xName = xDialog.getChild('name') + self.assertEqual( 'testfield_1', get_state_as_dict(xName)["Text"]) + + xRange = xDialog.getChild("range") + self.assertEqual("$Sheet1.$B$2", get_state_as_dict(xRange)['Text']) + + xScope = xDialog.getChild("scope") + self.assertEqual("$Sheet1.$B$2", get_state_as_dict(xRange)['Text']) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/range_name/tdf150307.py b/sc/qa/uitest/range_name/tdf150307.py new file mode 100644 index 0000000000..2f9e44720b --- /dev/null +++ b/sc/qa/uitest/range_name/tdf150307.py @@ -0,0 +1,75 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict, type_text + +class tdf150307(UITestCase): + + def check_navigator(self, xGridWin, nLen): + xGridWin.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "ScNavigatorPanel"})) + + xCalcDoc = self.xUITest.getTopFocusWindow() + xNavigatorPanel = xCalcDoc.getChild("NavigatorPanel") + xContentBox = xNavigatorPanel.getChild('contentbox') + xSheets = xContentBox.getChild("0") + self.assertEqual('Sheets', get_state_as_dict(xSheets)['Text']) + + self.ui_test.wait_until_property_is_updated(xSheets, "Children", str(nLen)) + self.assertEqual(nLen, len(xSheets.getChildren())) + self.assertEqual('Sheet1', get_state_as_dict(xSheets.getChild('0'))['Text']) + + if nLen == 2: + self.assertEqual('Sheet1_2', get_state_as_dict(xSheets.getChild('1'))['Text']) + + xRangeNames = xContentBox.getChild("1") + self.assertEqual('Range names', get_state_as_dict(xRangeNames)['Text']) + + self.ui_test.wait_until_property_is_updated(xRangeNames, "Children", str(nLen)) + self.assertEqual(nLen, len(xRangeNames.getChildren())) + self.assertEqual('Test', get_state_as_dict(xRangeNames.getChild('0'))['Text']) + + if nLen == 2: + self.assertEqual('Test (Sheet1_2)', get_state_as_dict(xRangeNames.getChild('1'))['Text']) + + def test_tdf150307(self): + + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWin = xCalcDoc.getChild("grid_window") + + self.xUITest.executeCommand(".uno:Sidebar") + + with self.ui_test.execute_modeless_dialog_through_command(".uno:AddName", close_button="add") as xAddNameDlg: + xEdit = xAddNameDlg.getChild("edit") + type_text(xEdit, "Test") + + self.check_navigator(xGridWin, 1) + + self.xUITest.executeCommand(".uno:DuplicateSheet") + + self.check_navigator(xGridWin, 2) + + self.xUITest.executeCommand(".uno:Remove") + + self.check_navigator(xGridWin, 1) + + self.xUITest.executeCommand(".uno:DuplicateSheet") + + self.check_navigator(xGridWin, 2) + + # Now test tdf#150829 + self.xUITest.executeCommand(".uno:Undo") + + self.check_navigator(xGridWin, 1) + + self.xUITest.executeCommand(".uno:Sidebar") + +# 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 0000000000..8cbed2f00d --- /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 file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from uitest.uihelper.common import type_text, get_state_as_dict +from uitest.uihelper.keyboard import select_all + + +class InvalidNames(UITestCase): + + def test_invalid_names(self): + + with self.ui_test.create_doc_in_start_center("calc"): + + with self.ui_test.execute_modeless_dialog_through_command(".uno:AddName", close_button="add") as xAddNameDlg: + + + 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) + + # tdf#132869 - Without the fix in place, this test would have failed with + # - Expected: "Invalid name. Start with a letter, use only letters, numbers and underscore." + # - Actual : "" + self.assertNotEqual(success_text, get_state_as_dict(xEdit)["QuickHelpText"]) + self.assertEqual(get_state_as_dict(xAddBtn)["Enabled"], "false") + + + select_all(xEdit) + type_text(xEdit, "valid_name") + + self.assertEqual(success_text, get_state_as_dict(xLabel)["Text"]) + self.assertEqual(success_text, get_state_as_dict(xEdit)["QuickHelpText"]) + self.assertEqual(get_state_as_dict(xAddBtn)["Enabled"], "true") + + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/search_replace/replace.py b/sc/qa/uitest/search_replace/replace.py new file mode 100644 index 0000000000..bb9afa65ce --- /dev/null +++ b/sc/qa/uitest/search_replace/replace.py @@ -0,0 +1,56 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file + +class ReplaceTest(UITestCase): + + def test_tdf106194(self): + with self.ui_test.load_file(get_url_for_data_file("tdf106194.ods")): + + xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") + + with self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button="close") as xSearchDlg: + + + 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()) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/search_replace/tdf132097.py b/sc/qa/uitest/search_replace/tdf132097.py new file mode 100644 index 0000000000..6fe09754ac --- /dev/null +++ b/sc/qa/uitest/search_replace/tdf132097.py @@ -0,0 +1,35 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict +from libreoffice.uno.propertyvalue import mkPropertyValues + +class tdf132097(UITestCase): + + def test_tdf132097(self): + with self.ui_test.create_doc_in_start_center("calc"): + with self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button="close") as xDialog: + 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") + + + +# 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 0000000000..5c28e47970 --- /dev/null +++ b/sc/qa/uitest/search_replace/tdf132783.py @@ -0,0 +1,32 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file +from libreoffice.uno.propertyvalue import mkPropertyValues + +class tdf132783(UITestCase): + + def test_tdf132783(self): + with self.ui_test.load_file(get_url_for_data_file("tdf132783.ods")): + + for i in range(5): + with self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button="close") as xDialog: + xSearchTerm = xDialog.getChild("searchterm") + + xSearchTerm.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) + + xSearch = xDialog.getChild("search") + xSearch.executeAction("CLICK", tuple()) + + + 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)) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/search_replace/tdf143759.py b/sc/qa/uitest/search_replace/tdf143759.py new file mode 100644 index 0000000000..351d141f99 --- /dev/null +++ b/sc/qa/uitest/search_replace/tdf143759.py @@ -0,0 +1,58 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict + +class tdf143759(UITestCase): + + def test_tdf143759(self): + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + enter_text_to_cell(gridwin, "C2", "A") + enter_text_to_cell(gridwin, "E3", "1") + enter_text_to_cell(gridwin, "B5", "2") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:F6"})) + + with self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button="close") as xDialog: + + # More Options is expanded when there is a selection with data + xExpander = xDialog.getChild("OptionsExpander") + self.assertEqual("true", get_state_as_dict(xExpander)['Expanded']) + + xSearchterm = xDialog.getChild("searchterm") + xSearchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xSearchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xSearchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"^$"})) + + xRegexp = xDialog.getChild("regexp") + xRegexp.executeAction("CLICK", tuple()) + self.assertEqual("true", get_state_as_dict(xRegexp)['Selected']) + + xSelection = xDialog.getChild("selection") + if get_state_as_dict(xSelection)['Selected'] == 'false': + xSelection.executeAction("CLICK", tuple()) + self.assertEqual("true", get_state_as_dict(xSelection)['Selected']) + + xSearchall = xDialog.getChild("searchall") + with self.ui_test.execute_dialog_through_action( + xSearchall, "CLICK", event_name = "ModelessDialogVisible", close_button="close") as dialog: + # Without the fix in place, this test would have failed with + # AssertionError: 13 != 0 + self.assertEqual(13, len(dialog.getChild("results").getChildren())) + + # Deselect regex button, otherwise it might affect other tests + xRegexp.executeAction("CLICK", tuple()) + self.assertEqual("false", get_state_as_dict(xRegexp)['Selected']) + +# 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 0000000000..bf04661411 --- /dev/null +++ b/sc/qa/uitest/search_replace/tdf35020.py @@ -0,0 +1,41 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file + +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + + +# Bug 35020 - Find and Replace changes case of sheet name in formulas +class tdf35020(UITestCase): + def test_tdf39959_find_replace_all_sheets(self): + with self.ui_test.load_file(get_url_for_data_file("tdf35020.ods")) as calc_doc: + with self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button="close") as xDialog: + 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") + self.assertEqual("Formulas", get_state_as_dict(calcsearchin)['SelectEntryText']) + replaceall = xDialog.getChild("replaceall") + replaceall.executeAction("CLICK", tuple()) + + #verify Sheet1.A13 A14 = 2 + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 12).getValue(), 2) + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 13).getValue(), 2) + #Undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 12).getValue(), 1) + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 13).getValue(), 1) +# 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 0000000000..3a0b064674 --- /dev/null +++ b/sc/qa/uitest/search_replace/tdf39917.py @@ -0,0 +1,80 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.calc import enter_text_to_cell +from uitest.uihelper.common import select_by_text + +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + +# Bug 39917 - EDITING Find/Replace modifies formula in R1C1 syntax to invalid lowercase +class tdf39917(UITestCase): + def change_formula_syntax(self, syntax): + with self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") as xDialogOpt: + + xPages = xDialogOpt.getChild("pages") + xCalcEntry = xPages.getChild('3') + xCalcEntry.executeAction("EXPAND", tuple()) + xCalcFormulaEntry = xCalcEntry.getChild('4') + xCalcFormulaEntry.executeAction("SELECT", tuple()) + + xFormulaSyntax = xDialogOpt.getChild('formulasyntax') + select_by_text(xFormulaSyntax, syntax) + + def test_tdf39917_find_replace_R1C1(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + try: + self.change_formula_syntax("Excel R1C1") + + #1. Create a workbook with 3 sheets: Page1, Page2, Page3. + # 2. Tools -> Options -> LibreOffice Calc -> Formula: Set syntax to Excel A1 + # 5. Fill fields: + + with self.ui_test.execute_dialog_through_command(".uno:Insert") as xDialog: + 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"})) + with self.ui_test.execute_dialog_through_command(".uno:Insert") as xDialog: + 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"})) + 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 + with self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button="close") as xDialog: + 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()) + + #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") + finally: + self.change_formula_syntax("Calc A1") + +# 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 0000000000..f08019ab0a --- /dev/null +++ b/sc/qa/uitest/search_replace/tdf39959.py @@ -0,0 +1,43 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_url_for_data_file + +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + + +# Bug 39959 - Find-and-replace doesn't search all tables anymore +class tdf39959(UITestCase): + def test_tdf39959_find_replace_all_sheets(self): + with self.ui_test.load_file(get_url_for_data_file("tdf39959.ods")) as calc_doc: + # 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 + with self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button="close") as xDialog: + 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()) + + #verify Sheet2.A1 = "bbb" + self.assertEqual(get_cell_by_position(calc_doc, 1, 0, 0).getString(), "bbb ") + self.assertEqual(get_cell_by_position(calc_doc, 1, 0, 2).getString(), "abc") + #Undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(calc_doc, 1, 0, 0).getString(), "asdf ") +# 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 0000000000..0fe70817a0 --- /dev/null +++ b/sc/qa/uitest/search_replace/tdf44398.py @@ -0,0 +1,91 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.calc import enter_text_to_cell +from uitest.uihelper.common import get_state_as_dict + +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + + +# Bug 44398 - : Find, replace, regular expression bug +class tdf44398(UITestCase): + def test_tdf44398_find_replace_regexp(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + # 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 + + with self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button="close") as xDialog: + 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()) + self.assertEqual("true", get_state_as_dict(regexp)['Selected']) + replaceall = xDialog.getChild("replaceall") + replaceall.executeAction("CLICK", tuple()) + + # Deselect regex button, otherwise it might affect other tests + regexp.executeAction("CLICK", tuple()) + self.assertEqual("false", get_state_as_dict(regexp)['Selected']) + + #verify 3. A1 => 123456 + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "123456") + + + def test_tdf44398_find_replace_regexp_string(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + # 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 + + with self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button="close") as xDialog: + 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") + regexp.executeAction("CLICK", tuple()) + self.assertEqual("true", get_state_as_dict(regexp)['Selected']) + matchcase = xDialog.getChild("matchcase") + matchcase.executeAction("CLICK", tuple()) #case + + replaceall = xDialog.getChild("replaceall") + replaceall.executeAction("CLICK", tuple()) + + # Deselect regex button, otherwise it might affect other tests + regexp.executeAction("CLICK", tuple()) + self.assertEqual("false", get_state_as_dict(regexp)['Selected']) + + #verify A1 => ' Var Number A' + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), " Var Number A") + +# 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 0000000000..7f0b213617 --- /dev/null +++ b/sc/qa/uitest/search_replace/tdf44861.py @@ -0,0 +1,49 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file + +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + + +# Bug 44861 - EDITING: result 'Find&Replace All' wrong for particular Regular Expression +class tdf44861(UITestCase): + def test_tdf44861_find_replaceAll_regexp(self): + with self.ui_test.load_file(get_url_for_data_file("tdf44861.ods")) as calc_doc: + # 2. ctrl-h, in dialog + # Search: ([0-9]{2})([0-9]{2}) + # Replace: $1.$2 + # check option "Enable regular expressions" + # Press "Replace all" + with self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button="close") as xDialog: + 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") + regexp.executeAction("CLICK", tuple()) + self.assertEqual("true", get_state_as_dict(regexp)['Selected']) + replaceall = xDialog.getChild("replaceall") + replaceall.executeAction("CLICK", tuple()) + + # Deselect regex button, otherwise it might affect other tests + regexp.executeAction("CLICK", tuple()) + self.assertEqual("false", get_state_as_dict(regexp)['Selected']) + + #Expected: instead of 1345-1430 appears 13.45-14.30 + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 0).getString(), "13.45-14.30") + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 1).getString(), "13.45-14.30") + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 2).getString(), "14.50-15.30") + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 3).getString(), "12.55-13.35") + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 4).getString(), "12.30-13.40") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/search_replace/tdf57523.py b/sc/qa/uitest/search_replace/tdf57523.py new file mode 100644 index 0000000000..f753a7a8a0 --- /dev/null +++ b/sc/qa/uitest/search_replace/tdf57523.py @@ -0,0 +1,59 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict + +class tdf57523(UITestCase): + + def test_tdf57523(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + enter_text_to_cell(gridwin, "A1", "AAA") + enter_text_to_cell(gridwin, "A4", "AAA") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"})) + + with self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button="close") as xDialog: + + # More Options is expanded when there is a selection with data + xExpander = xDialog.getChild("OptionsExpander") + self.assertEqual("true", get_state_as_dict(xExpander)['Expanded']) + + searchterm = xDialog.getChild("searchterm") + searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"^$"})) + + replaceterm = xDialog.getChild("replaceterm") + replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"BBB"})) + regexp = xDialog.getChild("regexp") + + regexp.executeAction("CLICK", tuple()) + self.assertEqual("true", get_state_as_dict(regexp)['Selected']) + + replaceall = xDialog.getChild("replaceall") + replaceall.executeAction("CLICK", tuple()) + + # Deselect regex button, otherwise it might affect other tests + regexp.executeAction("CLICK", tuple()) + self.assertEqual("false", get_state_as_dict(regexp)['Selected']) + + + # Without the fix in place, this test would have failed with + # AssertionError: '' != 'BBB' + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "BBB") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), "BBB") + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/search_replace/tdf65334.py b/sc/qa/uitest/search_replace/tdf65334.py new file mode 100644 index 0000000000..855fb47a45 --- /dev/null +++ b/sc/qa/uitest/search_replace/tdf65334.py @@ -0,0 +1,75 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import select_by_text +from uitest.uihelper.calc import enter_text_to_cell + +class tdf65334(UITestCase): + + def test_tdf65334(self): + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A5"})) + + # Insert a comment in a cell without text + xArgs = mkPropertyValues({"Text": "Comment 1"}) + self.xUITest.executeCommandWithParameters(".uno:InsertAnnotation", xArgs) + + # Insert a comment in a cell with text + enter_text_to_cell(gridwin, "C10", "Cell with text") + xArgs = mkPropertyValues({"Text": "Comment 2"}) + self.xUITest.executeCommandWithParameters(".uno:InsertAnnotation", xArgs) + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + + with self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button="close") as xDialog: + xExpander = xDialog.getChild("OptionsExpander") + + # tdf#129629: Without the fix in place, this test would have failed with + # AssertionError: 'false' != 'true' + self.assertEqual("false", get_state_as_dict(xExpander)['Expanded']) + + xExpander.executeAction("EXPAND", tuple()) + self.assertEqual("true", get_state_as_dict(xExpander)['Expanded']) + + xCalcsearchin = xDialog.getChild("calcsearchin") + select_by_text(xCalcsearchin, "Comments") + + xSearchterm = xDialog.getChild("searchterm") + xSearchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"Comment"})) + + xSearch = xDialog.getChild("search") + xSearch.executeAction("CLICK", tuple()) + + self.assertEqual("0", get_state_as_dict(gridwin)["CurrentColumn"]) + + # Without the fix in place, this test would have failed with + # AssertionError: '4' != '0' + self.assertEqual("4", get_state_as_dict(gridwin)["CurrentRow"]) + + with self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button="close") as xDialog: + xSearchterm = xDialog.getChild("searchterm") + xCalcsearchin = xDialog.getChild("calcsearchin") + xExpander = xDialog.getChild("OptionsExpander") + + self.assertEqual("false", get_state_as_dict(xExpander)['Expanded']) + self.assertEqual("Comment", get_state_as_dict(xSearchterm)['Text']) + self.assertEqual("Comments", get_state_as_dict(xCalcsearchin)['SelectEntryText']) + + xSearch = xDialog.getChild("search") + xSearch.executeAction("CLICK", tuple()) + + self.assertEqual("2", get_state_as_dict(gridwin)["CurrentColumn"]) + self.assertEqual("9", get_state_as_dict(gridwin)["CurrentRow"]) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/search_replace/tdf83126.py b/sc/qa/uitest/search_replace/tdf83126.py new file mode 100644 index 0000000000..818b688f72 --- /dev/null +++ b/sc/qa/uitest/search_replace/tdf83126.py @@ -0,0 +1,58 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.calc import enter_text_to_cell + +class tdf83126(UITestCase): + + def test_tdf132097(self): + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + enter_text_to_cell(gridwin, "A4", "Test") + enter_text_to_cell(gridwin, "D1", "Test") + enter_text_to_cell(gridwin, "D4", "Test") + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + + with self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button="close") as xDialog: + xRows = xDialog.getChild('rows') + self.assertEqual('true', get_state_as_dict(xRows)['Checked']) + + xSearchTerm = xDialog.getChild("searchterm") + + xSearchTerm.executeAction("TYPE", mkPropertyValues({"TEXT":"Test"})) + + xSearchall = xDialog.getChild("searchall") + with self.ui_test.execute_dialog_through_action( + xSearchall, "CLICK", event_name = "ModelessDialogVisible", close_button="close") as xResultsDialog: + xResults = xResultsDialog.getChild("results") + self.assertEqual(3, len(xResults.getChildren())) + + # Without the fix in place, this test would have failed with + # AssertionError: 'Sheet1\t$D$1\tTest' != 'Sheet1\t$A$4\tTest' + self.assertEqual("Sheet1\t$D$1\tTest", get_state_as_dict(xResults.getChild('0'))['Text']) + self.assertEqual("Sheet1\t$A$4\tTest", get_state_as_dict(xResults.getChild('1'))['Text']) + self.assertEqual("Sheet1\t$D$4\tTest", get_state_as_dict(xResults.getChild('2'))['Text']) + + xCols = xDialog.getChild('cols') + xCols.executeAction("CLICK", tuple()) + + with self.ui_test.execute_dialog_through_action( + xSearchall, "CLICK", event_name = "ModelessDialogVisible", close_button="close") as xResultsDialog: + xResults = xResultsDialog.getChild("results") + self.assertEqual(3, len(xResults.getChildren())) + self.assertEqual("Sheet1\t$A$4\tTest", get_state_as_dict(xResults.getChild('0'))['Text']) + self.assertEqual("Sheet1\t$D$1\tTest", get_state_as_dict(xResults.getChild('1'))['Text']) + self.assertEqual("Sheet1\t$D$4\tTest", get_state_as_dict(xResults.getChild('2'))['Text']) + +# 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 0000000000..5bed522440 --- /dev/null +++ b/sc/qa/uitest/signatureLine/insertSignatureLine.py @@ -0,0 +1,45 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase + +from libreoffice.uno.propertyvalue import mkPropertyValues + + +# Bug 117903 - Allow signature lines in Calc +class insertSignatureLineCalc(UITestCase): + + def test_insert_signature_line_calc(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + # set the signature line + with self.ui_test.execute_dialog_through_command(".uno:InsertSignatureLine") as xDialog: + + 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"})) + + #check the signature Line in the document + element = document.Sheets.getByIndex(0).DrawPage.getByIndex(0) + self.assertEqual(element.SignatureLineSuggestedSignerName, "Name") + self.assertEqual(element.SignatureLineSuggestedSignerTitle, "Title") + self.assertEqual(element.SignatureLineSuggestedSignerEmail, "Email") + self.assertEqual(element.SignatureLineSuggestedSignerTitle, "Title") + self.assertEqual(element.SignatureLineCanAddComment, False) + self.assertEqual(element.SignatureLineShowSignDate, True) + self.assertEqual(element.SignatureLineSigningInstructions, "Instructions") + +# 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 0000000000..faabdfb1ce --- /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 file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file +from uitest.uihelper.common import select_by_text + +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + + +class solver(UITestCase): + def test_solver(self): + with self.ui_test.load_file(get_url_for_data_file("solver.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B4"})) + with self.ui_test.execute_modeless_dialog_through_command(".uno:SolverDialog", close_button="") as xDialog: + xtargetedit = xDialog.getChild("targetedit") + xmax = xDialog.getChild("max") + xvalue = xDialog.getChild("value") + xvalueedit = xDialog.getChild("valueedit") + xchangeedit = xDialog.getChild("changeedit") + xref1edit = xDialog.getChild("ref1edit") + xval1edit = xDialog.getChild("val1edit") + xop1list = xDialog.getChild("op1list") + xref2edit = xDialog.getChild("ref2edit") + xval2edit = xDialog.getChild("val2edit") + xop2list = xDialog.getChild("op2list") + + self.assertEqual("$B$4", get_state_as_dict(xtargetedit)["Text"]) + self.assertEqual("true", get_state_as_dict(xmax)["Checked"]) + + xvalue.executeAction("CLICK", tuple()) + select_by_text(xop2list, "≥") + + self.assertEqual("≤", get_state_as_dict(xop1list)["SelectEntryText"]) + self.assertEqual("≥", get_state_as_dict(xop2list)["SelectEntryText"]) + + 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"})) + xval2edit.executeAction("TYPE", mkPropertyValues({"TEXT":"0"})) + + xOKBtn = xDialog.getChild("ok") + + with self.ui_test.execute_blocking_action(xOKBtn.executeAction, args=('CLICK', ())) as xWarnDialog: + self.assertEqual("Solving successfully finished.", get_state_as_dict(xWarnDialog.getChild("label2"))["Text"]) + self.assertEqual("Result: 1000", get_state_as_dict(xWarnDialog.getChild("result"))["Text"]) + + #verify + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 1).getValue(), 400) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/sort/naturalSort.py b/sc/qa/uitest/sort/naturalSort.py new file mode 100644 index 0000000000..91c2f35c3f --- /dev/null +++ b/sc/qa/uitest/sort/naturalSort.py @@ -0,0 +1,101 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.calc import enter_text_to_cell +from uitest.uihelper.common import get_state_as_dict, select_pos + +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): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #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 + with self.ui_test.execute_dialog_through_command(".uno:DataSort") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + xNatural = xDialog.getChild("naturalsort") + xNatural.executeAction("CLICK", tuple()) + #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 + with self.ui_test.execute_dialog_through_command(".uno:DataSort") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") + xNatural = xDialog.getChild("naturalsort") + if (get_state_as_dict(xNatural)["Selected"]) == "false": + xNatural.executeAction("CLICK", tuple()) + + 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") + + + def test_natural_sorting_columns(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #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 + with self.ui_test.execute_dialog_through_command(".uno:DataSort") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") + xNatural = xDialog.getChild("naturalsort") + if (get_state_as_dict(xNatural)["Selected"]) == "false": + xNatural.executeAction("CLICK", tuple()) + select_pos(xTabs, "0") + xleftright = xDialog.getChild("rbLeftRight") + xleftright.executeAction("CLICK", tuple()) + + #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") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/sort/sorting.py b/sc/qa/uitest/sort/sorting.py new file mode 100644 index 0000000000..b78eae4c77 --- /dev/null +++ b/sc/qa/uitest/sort/sorting.py @@ -0,0 +1,273 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.calc import enter_text_to_cell +from uitest.uihelper.common import get_state_as_dict, select_pos + +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): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #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 + with self.ui_test.execute_dialog_through_command(".uno:DataSort", close_button="cancel") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") + #Verify that option "Range contains column labels" is set + xHeader = xDialog.getChild("cbHeader") + self.assertEqual(get_state_as_dict(xHeader)["Selected"], "true") + #Cancel dialog + #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") + + def test_Sortingbuttons_list_has_not_columnheaders(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #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 + with self.ui_test.execute_dialog_through_command(".uno:DataSort", close_button="cancel") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") + #Verify that option "Range contains column labels" is not set + xHeader = xDialog.getChild("cbHeader") + self.assertEqual(get_state_as_dict(xHeader)["Selected"], "false") + #Cancel dialog + + def test_Sorting_default_to_selected_column(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #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") + + + def test_Sorting_default_to_selected_TAB_A_column(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #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) + + + def test_Sorting_default_to_selected_TAB_B_column(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #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") + + + def test_Sorting_sort_criteria(self): + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #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 + with self.ui_test.execute_dialog_through_command(".uno:DataSort", close_button="cancel") as xDialog: + 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 + #Select cell B3 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B3"})) + #Open sort dialog by DATA - SORT + with self.ui_test.execute_dialog_through_command(".uno:DataSort", close_button="cancel") as xDialog: + 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 + #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 + with self.ui_test.execute_dialog_through_command(".uno:DataSort", close_button="cancel") as xDialog: + 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 + #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 + with self.ui_test.execute_dialog_through_command(".uno:DataSort", close_button="cancel") as xDialog: + 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 + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/sort/stableSorting.py b/sc/qa/uitest/sort/stableSorting.py new file mode 100644 index 0000000000..162bf9d7fa --- /dev/null +++ b/sc/qa/uitest/sort/stableSorting.py @@ -0,0 +1,95 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from uitest.uihelper.common import get_url_for_data_file + +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + + +# Testcases Sorting TCS_Sorting Stable sorting +class CalcStableSorting(UITestCase): + + def test_Must_keep_sort_order_previous_sorting_toolbar_button_Ascending(self): + with self.ui_test.load_file(get_url_for_data_file("stableSorting.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #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(calc_doc, 0, 5, i).getValue(), i) + + def test_Must_keep_sort_order_previous_sorting_toolbar_button_Descending(self): + with self.ui_test.load_file(get_url_for_data_file("stableSorting.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #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(calc_doc, 0, 5, i).getValue(), j) + + # 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/sort/subtotals.py b/sc/qa/uitest/sort/subtotals.py new file mode 100644 index 0000000000..b824dcab98 --- /dev/null +++ b/sc/qa/uitest/sort/subtotals.py @@ -0,0 +1,140 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from uitest.uihelper.calc import enter_text_to_cell +from uitest.uihelper.common import select_by_text, select_pos +from uitest.uihelper.common import get_url_for_data_file + +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + + +class Subtotals(UITestCase): + + def test_tdf114720(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + XcalcDoc = self.xUITest.getTopFocusWindow() + gridwin = XcalcDoc.getChild("grid_window") + + enter_text_to_cell(gridwin, "A1", "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"})) + + with self.ui_test.execute_dialog_through_command(".uno:DataSubTotals"): + pass + + 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 + with self.ui_test.execute_dialog_through_command(".uno:DataSubTotals", close_button="cancel"): + pass + + + def test_tdf88792(self): + with self.ui_test.load_file(get_url_for_data_file("tdf88792.ods")) as calc_doc: + XcalcDoc = self.xUITest.getTopFocusWindow() + 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 + with self.ui_test.execute_dialog_through_command(".uno:DataSubTotals") as xDialog: + # Select group by: Category + xGroupBy = xDialog.getChild("group_by1") + select_by_text(xGroupBy, "Category") + # 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 + + self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 5).getValue(), 28000) + + def test_tdf88735(self): + with self.ui_test.load_file(get_url_for_data_file("tdf88735.ods")) as calc_doc: + # 1 select all cells + self.xUITest.executeCommand(".uno:SelectAll")#use uno command Menu Edit->Select All + # 2 invoke sub-total menu and select none + with self.ui_test.execute_dialog_through_command(".uno:DataSubTotals") as xDialog: + xGroupBy = xDialog.getChild("group_by1") + select_by_text(xGroupBy, "- none -") + # 2 invoke sort menu and... crash + with self.ui_test.execute_dialog_through_command(".uno:DataSort", close_button="cancel"): + pass + + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 8).getString(), "z") + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 8).getValue(), 8) + + def test_tdf56958(self): + with self.ui_test.load_file(get_url_for_data_file("tdf56958.ods")) as calc_doc: + # 1. Open the test file + # 2. Data->Subtotals + with self.ui_test.execute_dialog_through_command(".uno:DataSubTotals") as xDialog: + # 3. Group by->Trans date + xGroupBy = xDialog.getChild("group_by1") + select_by_text(xGroupBy, "Trans Date") + # 4. Tick 'Calculate subtotals for' -> Amount (grid1) + xCheckListMenu = xDialog.getChild("grid1") + xTreeList = xCheckListMenu.getChild("columns1") + xFirstEntry = xTreeList.getChild("2") + xFirstEntry.executeAction("CLICK", tuple()) + # 5. Click OK + # 6. Data->Subtotals + with self.ui_test.execute_dialog_through_command(".uno:DataSubTotals") as xDialog: + # 7. Group by->-none- + xGroupBy = xDialog.getChild("group_by1") + select_by_text(xGroupBy, "- none -") + # 8. Untick 'Calculate subtotals for' -> Amount + xCheckListMenu = xDialog.getChild("grid1") + xTreeList = xCheckListMenu.getChild("columns1") + xFirstEntry = xTreeList.getChild("2") + xFirstEntry.executeAction("CLICK", tuple()) + # 9. Click OK + # 10. Data->Sort + with self.ui_test.execute_dialog_through_command(".uno:DataSort") as xDialog: + # 11. Sort key 1->Post Date. + sortkey1 = xDialog.getChild("sortlb") + select_by_text(sortkey1, "Post Date") + # 12. Sort key 2->-undefined- + sortkey2 = xDialog.getChild("sortuserlb") + select_by_text(sortkey2, "- undefined -") + # 13. Click OK + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 1).getValue(), -0.25) + + def test_tdf55734(self): + with self.ui_test.load_file(get_url_for_data_file("tdf55734.ods")) as calc_doc: + XcalcDoc = self.xUITest.getTopFocusWindow() + 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 + with self.ui_test.execute_dialog_through_command(".uno:DataSubTotals") as xDialog: + # 4. Group by: "- none -" + xGroupBy = xDialog.getChild("group_by1") + select_by_text(xGroupBy, "- none -") + # 5. Press "OK" and watch LibreOffice crash. + + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 1).getValue(), 1) + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 1).getValue(), 2) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/sort/tdf100517.py b/sc/qa/uitest/sort/tdf100517.py new file mode 100644 index 0000000000..d5a6097f54 --- /dev/null +++ b/sc/qa/uitest/sort/tdf100517.py @@ -0,0 +1,77 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.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 tdf100517(UITestCase): + + def execute_sort_dialog(self, gridwin, bIncludeNotes): + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B3"})) + + with self.ui_test.execute_dialog_through_command(".uno:DataSort") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") + + xIncludeNotes = xDialog.getChild("includenotes") + + if (get_state_as_dict(xIncludeNotes)["Selected"]) != bIncludeNotes: + xIncludeNotes.executeAction("CLICK", tuple()) + + + def test_tdf100517(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + enter_text_to_cell(gridwin, "A1", "Text 2") + enter_text_to_cell(gridwin, "A2", "Text 3") + enter_text_to_cell(gridwin, "A3", "Text 1") + + for i in ['B1', 'B2', 'B3']: + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": i})) + xArgs = mkPropertyValues({"Text": i}) + + self.xUITest.executeCommandWithParameters(".uno:InsertAnnotation", xArgs) + + self.execute_sort_dialog(gridwin, "true") + + self.assertEqual("Text 1", get_cell_by_position(document, 0, 0, 0).getString()) + self.assertEqual("Text 2", get_cell_by_position(document, 0, 0, 1).getString()) + self.assertEqual("Text 3", get_cell_by_position(document, 0, 0, 2).getString()) + + self.assertEqual("B3", get_cell_by_position(document, 0, 1, 0).Annotation.String) + self.assertEqual("B1", get_cell_by_position(document, 0, 1, 1).Annotation.String) + self.assertEqual("B2", get_cell_by_position(document, 0, 1, 2).Annotation.String) + + self.xUITest.executeCommand(".uno:Undo") + + self.assertEqual("Text 2", get_cell_by_position(document, 0, 0, 0).getString()) + self.assertEqual("Text 3", get_cell_by_position(document, 0, 0, 1).getString()) + self.assertEqual("Text 1", get_cell_by_position(document, 0, 0, 2).getString()) + + self.assertEqual("B1", get_cell_by_position(document, 0, 1, 0).Annotation.String) + self.assertEqual("B2", get_cell_by_position(document, 0, 1, 1).Annotation.String) + self.assertEqual("B3", get_cell_by_position(document, 0, 1, 2).Annotation.String) + + self.execute_sort_dialog(gridwin, "false") + + self.assertEqual("Text 1", get_cell_by_position(document, 0, 0, 0).getString()) + self.assertEqual("Text 2", get_cell_by_position(document, 0, 0, 1).getString()) + self.assertEqual("Text 3", get_cell_by_position(document, 0, 0, 2).getString()) + + self.assertEqual("B1", get_cell_by_position(document, 0, 1, 0).Annotation.String) + self.assertEqual("B2", get_cell_by_position(document, 0, 1, 1).Annotation.String) + self.assertEqual("B3", get_cell_by_position(document, 0, 1, 2).Annotation.String) + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/sort/tdf105301.py b/sc/qa/uitest/sort/tdf105301.py new file mode 100644 index 0000000000..c215e95bc8 --- /dev/null +++ b/sc/qa/uitest/sort/tdf105301.py @@ -0,0 +1,40 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file +from uitest.uihelper.common import select_pos +from libreoffice.uno.propertyvalue import mkPropertyValues + +class tdf105301(UITestCase): + + def test_tdf105301(self): + with self.ui_test.load_file(get_url_for_data_file("tdf105301.ods")): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:R9"})) + + with self.ui_test.execute_dialog_through_command(".uno:DataSort") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + self.assertEqual("B", get_state_as_dict(xDialog.getChild("sortlb"))['DisplayText']) + self.assertEqual("C", get_state_as_dict(xDialog.getChild("sortlb2"))['DisplayText']) + self.assertEqual("D", get_state_as_dict(xDialog.getChild("sortlb3"))['DisplayText']) + + # Without the fix in place, this test would have failed with + # AssertionError: 'E' != '- undefined -' + self.assertEqual("E", get_state_as_dict(xDialog.getChild("sortlb4"))['DisplayText']) + self.assertEqual("F", get_state_as_dict(xDialog.getChild("sortlb5"))['DisplayText']) + self.assertEqual("G", get_state_as_dict(xDialog.getChild("sortlb6"))['DisplayText']) + + # tdf#51828: Without the fix in place, this test would have failed here + self.assertEqual("- undefined -", get_state_as_dict(xDialog.getChild("sortlb7"))['DisplayText']) + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/sort/tdf126678.py b/sc/qa/uitest/sort/tdf126678.py new file mode 100644 index 0000000000..80e12a5da7 --- /dev/null +++ b/sc/qa/uitest/sort/tdf126678.py @@ -0,0 +1,72 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.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 tdf126678(UITestCase): + + def execute_sort_dialog(self, gridwin, bIncludeFormats): + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B3"})) + + with self.ui_test.execute_dialog_through_command(".uno:DataSort") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") + + xIncludeFormats = xDialog.getChild("formats") + + if (get_state_as_dict(xIncludeFormats)["Selected"]) != bIncludeFormats: + xIncludeFormats.executeAction("CLICK", tuple()) + + + def test_tdf126678(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + enter_text_to_cell(gridwin, "A1", "Text 2") + enter_text_to_cell(gridwin, "A2", "Text 3") + enter_text_to_cell(gridwin, "A3", "Text 1") + + # Set the background of the corresponding cell + colorProperty = mkPropertyValues({"BackgroundColor": 16776960}) + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B2"})) + self.xUITest.executeCommandWithParameters(".uno:BackgroundColor", colorProperty) + + self.execute_sort_dialog(gridwin, "false") + + self.assertEqual("Text 1", get_cell_by_position(document, 0, 0, 0).getString()) + self.assertEqual("Text 2", get_cell_by_position(document, 0, 0, 1).getString()) + self.assertEqual("Text 3", get_cell_by_position(document, 0, 0, 2).getString()) + + # Sorting without option "including formats" does not include cells with cell formats + self.assertEqual(get_cell_by_position(document, 0, 1, 0).CellBackColor, -1) + self.assertEqual(get_cell_by_position(document, 0, 1, 1).CellBackColor, 16776960) + self.assertEqual(get_cell_by_position(document, 0, 1, 2).CellBackColor, -1) + + self.xUITest.executeCommand(".uno:Undo") + + self.execute_sort_dialog(gridwin, "true") + + self.assertEqual("Text 1", get_cell_by_position(document, 0, 0, 0).getString()) + self.assertEqual("Text 2", get_cell_by_position(document, 0, 0, 1).getString()) + self.assertEqual("Text 3", get_cell_by_position(document, 0, 0, 2).getString()) + + # Sorting with option "including formats" includes all cells with visible cell formats + # tdf126678 - Without the fix in place, the test would have failed with + # AssertionError: -1 != 16776960 + self.assertEqual(get_cell_by_position(document, 0, 1, 0).CellBackColor, -1) + self.assertEqual(get_cell_by_position(document, 0, 1, 1).CellBackColor, -1) + self.assertEqual(get_cell_by_position(document, 0, 1, 2).CellBackColor, 16776960) + + +# 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 0000000000..6e0498cfaf --- /dev/null +++ b/sc/qa/uitest/sort/tdf49531.py @@ -0,0 +1,58 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file +from uitest.uihelper.common import select_by_text, select_pos + +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + + +# Bug 49531 - EDITING: Sort rows for will sort columns +# Bug 49520 - EDITING: CRASH when undo sort with chart +class tdf49531(UITestCase): + def test_td49531_sort_undo_crash(self): + with self.ui_test.load_file(get_url_for_data_file("tdf49531.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #select A3:C147 + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A3:C147"})) + + #Menu 'Data -> Sort -> Top to bottom - all otheroptions unchecked + #Column B - Ascending' <ok> + with self.ui_test.execute_dialog_through_command(".uno:DataSort") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") + xNatural = xDialog.getChild("naturalsort") + if (get_state_as_dict(xNatural)["Selected"]) == "true": + xNatural.executeAction("CLICK", tuple()) + select_pos(xTabs, "0") + xtopdown = xDialog.getChild("rbTopDown") + xHeader = xDialog.getChild("cbHeader") + if (get_state_as_dict(xHeader)["Selected"]) == "true": + xHeader.executeAction("CLICK", tuple()) + xtopdown.executeAction("CLICK", tuple()) + xSortKey1 = xDialog.getChild("sortlb") + xAsc = xDialog.getChild("up") + select_by_text(xSortKey1, "B") + xAsc.executeAction("CLICK", tuple()) + #Verify + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 0).getString(), "x") + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 1).getString(), "0") + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 2).getValue(), 111) + self.assertEqual(get_cell_by_position(calc_doc, 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(calc_doc, 0, 0, 0).getString(), "x") + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 1).getString(), "0") + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 2).getValue(), 2) + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 3).getValue(), 3) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/sort/tdf53482.py b/sc/qa/uitest/sort/tdf53482.py new file mode 100644 index 0000000000..fbcbac0a85 --- /dev/null +++ b/sc/qa/uitest/sort/tdf53482.py @@ -0,0 +1,81 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file +from uitest.uihelper.common import select_pos +from uitest.uihelper.common import select_by_text +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + +#Bug 53482 - UI: Option 'Range contains column headings' ignored + +class tdf53482(UITestCase): + + def test_tdf53482_Range_contains_column_headings_file(self): + with self.ui_test.load_file(get_url_for_data_file("tdf53482.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #1. Highlight cells to be sorted A8:J124 + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A8:J124"})) + #2. Click Data menu, Sort + with self.ui_test.execute_dialog_through_command(".uno:DataSort") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") + #3. On Options tab, tick 'Range contains column labels' + xHeader = xDialog.getChild("cbHeader") + 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") + select_by_text(xSortKey1, "Occupation") + #5. Click Ok + #6. Expected behavior: Ignore column labels when sorting + self.assertEqual(get_cell_by_position(calc_doc, 0, 6, 7).getString(), "Occupation") + self.assertEqual(get_cell_by_position(calc_doc, 0, 6, 8).getString(), "Travel Industry") + self.assertEqual(get_cell_by_position(calc_doc, 0, 6, 123).getString(), "13") + + def test_tdf53482_Range_contains_column_headings(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #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 + with self.ui_test.execute_dialog_through_command(".uno:DataSort") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + #3. On Options tab, tick 'Range contains column labels' + xHeader = xDialog.getChild("cbHeader") + xHeader.executeAction("CLICK", tuple()) + if (get_state_as_dict(xHeader)["Selected"]) == "false": + xHeader.executeAction("CLICK", tuple()) + #4. On Sort Criteria tab, set appropriate criteria + xDown = xDialog.getChild("down") + xDown.executeAction("CLICK", tuple()) + #5. Click Ok + #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") + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/sort/tdf54018.py b/sc/qa/uitest/sort/tdf54018.py new file mode 100644 index 0000000000..147fb8fa98 --- /dev/null +++ b/sc/qa/uitest/sort/tdf54018.py @@ -0,0 +1,40 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_url_for_data_file +from uitest.uihelper.common import select_by_text, select_pos + +from libreoffice.calc.document import get_cell_by_position + + +# Bug 54018 - EDITING: CRASH sorting cells range with Comments +class tdf54018(UITestCase): + def test_td54018_sort_with_comments(self): + with self.ui_test.load_file(get_url_for_data_file("tdf54018.ods")) as calc_doc: + #click top left columns / rows heading field to select all cells + self.xUITest.executeCommand(".uno:SelectAll") + #Menu 'Data -> Sort -> Column D -> Descending' <ok> + with self.ui_test.execute_dialog_through_command(".uno:DataSort") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + xSortKey1 = xDialog.getChild("sortlb") + xdown = xDialog.getChild("down") + select_by_text(xSortKey1, "Column B") + xdown.executeAction("CLICK", tuple()) + #Bug: When progress bar reaches 40% LibO Stops responding + #Verify + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 0).getString(), "7") + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 1).getString(), "6") + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 2).getString(), "5") + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 3).getString(), "4") + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 4).getString(), "3") + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 5).getString(), "2") + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 6).getString(), "1") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/sort/tdf57465.py b/sc/qa/uitest/sort/tdf57465.py new file mode 100644 index 0000000000..bd7efaabc5 --- /dev/null +++ b/sc/qa/uitest/sort/tdf57465.py @@ -0,0 +1,48 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file +from uitest.uihelper.common import select_pos +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + +class tdf57465(UITestCase): + + def test_tdf57465(self): + with self.ui_test.load_file(get_url_for_data_file("tdf57465.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "B1:G4"})) + + with self.ui_test.execute_dialog_through_command(".uno:DataSort") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + + xHeader = xDialog.getChild("cbHeader") + if (get_state_as_dict(xHeader)["Selected"]) == 'true': + xHeader.executeAction("CLICK", tuple()) + + xLeftRight = xDialog.getChild("rbLeftRight") + xLeftRight.executeAction("CLICK", tuple()) + + self.assertEqual("1", get_state_as_dict(xDialog.getChild("sortlb"))['DisplayText']) + + + self.assertEqual("a", get_cell_by_position(calc_doc, 0, 1, 1).getString()) + + # Without the fix in place, this test would have failed with + # AssertionError: 'b' != '' + self.assertEqual("b", get_cell_by_position(calc_doc, 0, 2, 2).getString()) + self.assertEqual("c", get_cell_by_position(calc_doc, 0, 3, 3).getString()) + self.assertEqual("d", get_cell_by_position(calc_doc, 0, 4, 1).getString()) + self.assertEqual("e", get_cell_by_position(calc_doc, 0, 5, 2).getString()) + self.assertEqual("f", get_cell_by_position(calc_doc, 0, 6, 3).getString()) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/sort/tdf91305.py b/sc/qa/uitest/sort/tdf91305.py new file mode 100644 index 0000000000..bc0b8738fc --- /dev/null +++ b/sc/qa/uitest/sort/tdf91305.py @@ -0,0 +1,105 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.calc import enter_text_to_cell +from uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import select_pos + +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_columns(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #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 + with self.ui_test.execute_dialog_through_command(".uno:DataSort") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + xleftright = xDialog.getChild("rbLeftRight") + select_pos(xTabs, "0") + xleftright.executeAction("CLICK", tuple()) + #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 + with self.ui_test.execute_dialog_through_command(".uno:DataSort") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + xleftright = xDialog.getChild("rbLeftRight") + xdown = xDialog.getChild("down") + select_pos(xTabs, "0") + xleftright.executeAction("CLICK", tuple()) + xdown.executeAction("CLICK", tuple()) + 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") + + #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. + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #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") + + + #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): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #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") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/sort/tdf95192.py b/sc/qa/uitest/sort/tdf95192.py new file mode 100644 index 0000000000..1c33f56f7b --- /dev/null +++ b/sc/qa/uitest/sort/tdf95192.py @@ -0,0 +1,43 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_url_for_data_file, select_pos + +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + + +# Bug 95192 - SORTING Natural sorting not working with non-letter,non-number content +class tdf95192(UITestCase): + def test_td99627_natural_sort(self): + with self.ui_test.load_file(get_url_for_data_file("tdf95192.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + + #Open sort dialog by DATA - SORT + with self.ui_test.execute_dialog_through_command(".uno:DataSort") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") + xNatural = xDialog.getChild("naturalsort") + xNatural.executeAction("CLICK", tuple()) + #Verify + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 0).getString(), "Sal. Capra 1/17") + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 1).getString(), "Sal. Capra 1/20") + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 2).getString(), "Sal. Oregina 1/2") + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 41).getString(), "Vico Chiuso Cinque Santi 18/10") + #UNDO + self.xUITest.executeCommand(".uno:Undo") + #Verify + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 0).getString(), "Sal. Oregina 1/2") + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 1).getString(), "Via A. Centurione 11/7") + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 41).getString(), "Vico Chiuso Cinque Santi 18/10") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/sort/tdf99208.py b/sc/qa/uitest/sort/tdf99208.py new file mode 100644 index 0000000000..e740a9c4a5 --- /dev/null +++ b/sc/qa/uitest/sort/tdf99208.py @@ -0,0 +1,60 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file +from uitest.uihelper.common import select_by_text, select_pos + +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + + +# Bug 99208 - Spreadsheet sort hangs +class tdf99208(UITestCase): + def test_td99627_natural_sort(self): + with self.ui_test.load_file(get_url_for_data_file("tdf99208.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #select A3:C245 + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C245"})) + + #Menu 'Data -> Sort + #Column A - Ascending' <ok> + with self.ui_test.execute_dialog_through_command(".uno:DataSort") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") + xNatural = xDialog.getChild("naturalsort") + xFormats = xDialog.getChild("formats") + if (get_state_as_dict(xNatural)["Selected"]) == "false": + xNatural.executeAction("CLICK", tuple()) + if (get_state_as_dict(xFormats)["Selected"]) == "false": + xFormats.executeAction("CLICK", tuple()) + select_pos(xTabs, "0") + xtopdown = xDialog.getChild("rbTopDown") + xHeader = xDialog.getChild("cbHeader") + if (get_state_as_dict(xHeader)["Selected"]) == "false": + xHeader.executeAction("CLICK", tuple()) + xtopdown.executeAction("CLICK", tuple()) + + xSortKey1 = xDialog.getChild("sortlb") + xAsc = xDialog.getChild("up") + select_by_text(xSortKey1, "FODMAP") + xAsc.executeAction("CLICK", tuple()) + #Verify Expected: Values column B sorted ascending, column "control" unsorted + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 0).getString(), "FODMAP") + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 1).getString(), "agave") + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 2).getString(), "almond milk") + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 244).getString(), "zucchini") + # UNDO + self.xUITest.executeCommand(".uno:Undo") + # Verify + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 0).getString(), "FODMAP") + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 1).getString(), "beef (grass fed, no breadcrumbs)") + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 244).getString(), "salsa") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/sort/tdf99627.py b/sc/qa/uitest/sort/tdf99627.py new file mode 100644 index 0000000000..281f4340de --- /dev/null +++ b/sc/qa/uitest/sort/tdf99627.py @@ -0,0 +1,43 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_url_for_data_file, select_pos + +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + + +# Bug 99627 - Calc freezes when applying natural sorting on text columns +class tdf99627(UITestCase): + def test_td99627_natural_sort(self): + with self.ui_test.load_file(get_url_for_data_file("tdf99627.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + + #Open sort dialog by DATA - SORT + with self.ui_test.execute_dialog_through_command(".uno:DataSort") as xDialog: + 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()) + #Verify + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 1).getString(), "2998") + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 2998).getString(), "1") + #UNDO + self.xUITest.executeCommand(".uno:Undo") + #Verify + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 1).getString(), "1") + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 2998).getString(), "2998") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/sort/tdf99773.py b/sc/qa/uitest/sort/tdf99773.py new file mode 100644 index 0000000000..49775899fb --- /dev/null +++ b/sc/qa/uitest/sort/tdf99773.py @@ -0,0 +1,47 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.calc import enter_text_to_cell +from uitest.uihelper.common import get_state_as_dict, select_pos + +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): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #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 + with self.ui_test.execute_dialog_through_command(".uno:DataSort") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") + xNatural = xDialog.getChild("naturalsort") + if (get_state_as_dict(xNatural)["Selected"]) == "false": + xNatural.executeAction("CLICK", tuple()) + #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") + +# 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 0000000000..57e24b49b0 --- /dev/null +++ b/sc/qa/uitest/statistics/anova.py @@ -0,0 +1,136 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.calc import enter_text_to_cell + +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + + +class anova(UITestCase): + def test_statistic_anova(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #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"})) + with self.ui_test.execute_modeless_dialog_through_command(".uno:AnalysisOfVarianceDialog") as xDialog: + xinputrangeedit = xDialog.getChild("input-range-edit") + xoutputrangeedit = xDialog.getChild("output-range-edit") + xradiosinglefactor = xDialog.getChild("radio-single-factor") + 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"})) + #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.56832844575) + 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.02246149518798) + + 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 + with self.ui_test.execute_modeless_dialog_through_command(".uno:AnalysisOfVarianceDialog", close_button="cancel"): + pass + +# 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 0000000000..1bc2e7f3a8 --- /dev/null +++ b/sc/qa/uitest/statistics/chiSquare.py @@ -0,0 +1,85 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.calc import enter_text_to_cell + +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + + +class chiSquare(UITestCase): + def test_chiSquare(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #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"})) + with self.ui_test.execute_modeless_dialog_through_command(".uno:ChiSquareTestDialog") as xDialog: + xinputrangeedit = xDialog.getChild("input-range-edit") + xoutputrangeedit = xDialog.getChild("output-range-edit") + 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()) + #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 + with self.ui_test.execute_modeless_dialog_through_command(".uno:ChiSquareTestDialog", close_button="cancel"): + pass + +# 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 0000000000..a7f67a2e7c --- /dev/null +++ b/sc/qa/uitest/statistics/correlation.py @@ -0,0 +1,187 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.calc import enter_text_to_cell + +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + + +class correlation(UITestCase): + def test_statistic_correlation_column(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #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"})) + with self.ui_test.execute_modeless_dialog_through_command(".uno:CorrelationDialog") as xDialog: + 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()) + + #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 + with self.ui_test.execute_modeless_dialog_through_command(".uno:CorrelationDialog", close_button="cancel"): + pass + + def test_statistic_correlation_row(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #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"})) + with self.ui_test.execute_modeless_dialog_through_command(".uno:CorrelationDialog") as xDialog: + xinputrangeedit = xDialog.getChild("input-range-edit") + xoutputrangeedit = xDialog.getChild("output-range-edit") + xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-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()) + #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(), "") + +# 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 0000000000..cec5a1d785 --- /dev/null +++ b/sc/qa/uitest/statistics/covariance.py @@ -0,0 +1,184 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.calc import enter_text_to_cell + +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + + +class covariance(UITestCase): + def test_statistic_covariance_column(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #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"})) + with self.ui_test.execute_modeless_dialog_through_command(".uno:CovarianceDialog") as xDialog: + xinputrangeedit = xDialog.getChild("input-range-edit") + xoutputrangeedit = xDialog.getChild("output-range-edit") + 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()) + #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 + with self.ui_test.execute_modeless_dialog_through_command(".uno:CovarianceDialog", close_button="cancel"): + pass + + def test_statistic_covariance_row(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #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"})) + with self.ui_test.execute_modeless_dialog_through_command(".uno:CovarianceDialog") as xDialog: + xinputrangeedit = xDialog.getChild("input-range-edit") + xoutputrangeedit = xDialog.getChild("output-range-edit") + xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-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()) + #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(), "") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/statistics/descriptiveStatistics.py b/sc/qa/uitest/statistics/descriptiveStatistics.py new file mode 100644 index 0000000000..48a15e6411 --- /dev/null +++ b/sc/qa/uitest/statistics/descriptiveStatistics.py @@ -0,0 +1,155 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.calc import enter_text_to_cell + +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + + +class descriptiveStatistics(UITestCase): + def test_descriptive_statistics(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #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"})) + with self.ui_test.execute_modeless_dialog_through_command(".uno:DescriptiveStatisticsDialog") as xDialog: + 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()) + + + #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() , "Math") + 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(),13) , 0.0152409532904) + 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() , "Physics") + 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() , "Biology") + 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 + with self.ui_test.execute_modeless_dialog_through_command(".uno:DescriptiveStatisticsDialog", close_button="cancel"): + pass + +# 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 0000000000..5823c3265d --- /dev/null +++ b/sc/qa/uitest/statistics/exponentialSmoothing.py @@ -0,0 +1,173 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.calc import enter_text_to_cell + +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + + +class exponentialSmoothing(UITestCase): + def test_exponential_smoothing_column(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #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"})) + with self.ui_test.execute_modeless_dialog_through_command(".uno:ExponentialSmoothingDialog") as xDialog: + xinputrangeedit = xDialog.getChild("input-range-edit") + xoutputrangeedit = xDialog.getChild("output-range-edit") + 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"})) + #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 + with self.ui_test.execute_modeless_dialog_through_command(".uno:ExponentialSmoothingDialog", close_button="cancel"): + pass + + + def test_exponential_smoothing_row(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #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"})) + with self.ui_test.execute_modeless_dialog_through_command(".uno:ExponentialSmoothingDialog") as xDialog: + xinputrangeedit = xDialog.getChild("input-range-edit") + xoutputrangeedit = xDialog.getChild("output-range-edit") + xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-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()) + #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(), "") + +# 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 0000000000..0580163730 --- /dev/null +++ b/sc/qa/uitest/statistics/fTest.py @@ -0,0 +1,111 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.calc import enter_text_to_cell + +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + + +class tTest(UITestCase): + def test_fTest_column(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #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"})) + with self.ui_test.execute_modeless_dialog_through_command(".uno:FTestDialog") as xDialog: + xvariable1rangeedit = xDialog.getChild("variable1-range-edit") + xvariable2rangeedit = xDialog.getChild("variable2-range-edit") + xoutputrangeedit = xDialog.getChild("output-range-edit") + 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()) + #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 + with self.ui_test.execute_modeless_dialog_through_command(".uno:FTestDialog", close_button="cancel"): + pass + +# 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 0000000000..4f5348d187 --- /dev/null +++ b/sc/qa/uitest/statistics/movingAverage.py @@ -0,0 +1,166 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.calc import enter_text_to_cell + +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + + +class movingAverage(UITestCase): + def test_moving_average_column(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #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"})) + with self.ui_test.execute_modeless_dialog_through_command(".uno:MovingAverageDialog") as xDialog: + xinputrangeedit = xDialog.getChild("input-range-edit") + xoutputrangeedit = xDialog.getChild("output-range-edit") + 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"})) + #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 + with self.ui_test.execute_modeless_dialog_through_command(".uno:MovingAverageDialog", close_button="cancel"): + pass + + + def test_moving_average_row(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #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"})) + with self.ui_test.execute_modeless_dialog_through_command(".uno:MovingAverageDialog") as xDialog: + xinputrangeedit = xDialog.getChild("input-range-edit") + xoutputrangeedit = xDialog.getChild("output-range-edit") + xgroupedbyrowsradio = xDialog.getChild("groupedby-rows-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()) + #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(), "") + + +# 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 0000000000..dced529896 --- /dev/null +++ b/sc/qa/uitest/statistics/regression.py @@ -0,0 +1,104 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file + +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + + +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): + with self.ui_test.load_file(get_url_for_data_file("regression.ods")) as calc_doc: + # Initially the final check status is "FALSE" (failed). + self.assertEqual(get_cell_by_position(calc_doc, 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(calc_doc, 14, 1, 6).getString(), "TRUE", + "One of more of the checks failed for data_groupedby_column = {}, manually try with the calc_doc". + format(data_groupedby_column)) + + 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") + with self.ui_test.execute_modeless_dialog_through_command(".uno:RegressionDialog") as xDialog: + 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()) + + + def test_regression_cancel(self): + with self.ui_test.create_doc_in_start_center("calc"): + with self.ui_test.execute_modeless_dialog_through_command(".uno:RegressionDialog", close_button="cancel"): + pass + +# 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 0000000000..adcf6a5b77 --- /dev/null +++ b/sc/qa/uitest/statistics/sampling.py @@ -0,0 +1,147 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.calc import enter_text_to_cell +from uitest.uihelper.common import get_state_as_dict + +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + + +class sampling(UITestCase): + def test_statistic_sampling(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #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"})) + with self.ui_test.execute_modeless_dialog_through_command(".uno:SamplingDialog") as xDialog: + xinputrangeedit = xDialog.getChild("input-range-edit") + xoutputrangeedit = xDialog.getChild("output-range-edit") + 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"})) + #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 + with self.ui_test.execute_modeless_dialog_through_command(".uno:SamplingDialog", close_button="cancel"): + pass + + def test_tdf142986(self): + with self.ui_test.create_doc_in_start_center("calc") as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #fill data + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A200"})) + with self.ui_test.execute_dialog_through_command(".uno:FillSeries") as xDialog: + xStartValue = xDialog.getChild("startValue") + xStartValue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xStartValue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xStartValue.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) + + xIncrement = xDialog.getChild("increment") + xIncrement.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xIncrement.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xIncrement.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) + + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 199).getValue(), 200) + + with self.ui_test.execute_modeless_dialog_through_command(".uno:SamplingDialog") as xDialog: + xInputRangeEdit = xDialog.getChild("input-range-edit") + xOutputRangeEdit = xDialog.getChild("output-range-edit") + xRandomMethodRadio = xDialog.getChild("random-method-radio") + xSampleSizeSpin = xDialog.getChild("sample-size-spin") + + self.assertEqual("$Sheet1.$A$1:$A$200", get_state_as_dict(xInputRangeEdit)['Text']) + + xOutputRangeEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xOutputRangeEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xOutputRangeEdit.executeAction("TYPE", mkPropertyValues({"TEXT":"$B$1"})) + + xRandomMethodRadio.executeAction("CLICK", tuple()) + + xSampleSizeSpin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xSampleSizeSpin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xSampleSizeSpin.executeAction("TYPE", mkPropertyValues({"TEXT":"200"})) + + for i in range(200): + self.assertTrue(get_cell_by_position(calc_doc, 0, 1, i).getValue() != 0.0, + "Value in cell B" + str(i) + " shouldn't be equal to 0.0") + +# 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 0000000000..1c7bc3a682 --- /dev/null +++ b/sc/qa/uitest/statistics/tTest.py @@ -0,0 +1,112 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.calc import enter_text_to_cell + +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + + +class tTest(UITestCase): + def test_tTest_column(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #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"})) + with self.ui_test.execute_modeless_dialog_through_command(".uno:TTestDialog") as xDialog: + xvariable1rangeedit = xDialog.getChild("variable1-range-edit") + xvariable2rangeedit = xDialog.getChild("variable2-range-edit") + xoutputrangeedit = xDialog.getChild("output-range-edit") + 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()) + #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 + with self.ui_test.execute_modeless_dialog_through_command(".uno:TTestDialog", close_button="cancel"): + pass + +# 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 0000000000..9d10cd62c4 --- /dev/null +++ b/sc/qa/uitest/statistics/tdf76731.py @@ -0,0 +1,58 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_url_for_data_file + +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + + +# Bug 76731 - ANOVA: F critical is not shown +class anova(UITestCase): + def test_tdf76731_anova(self): + with self.ui_test.load_file(get_url_for_data_file("tdf76731.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #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. + with self.ui_test.execute_modeless_dialog_through_command(".uno:AnalysisOfVarianceDialog") as xDialog: + xoutputrangeedit = xDialog.getChild("output-range-edit") + xradiosinglefactor = xDialog.getChild("radio-single-factor") + 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"})) + #Verify, Table of results is shown, "F critical" cell has "#NAME?" error value. + self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 0).getString(), "ANOVA - Single Factor") + self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 1).getString(), "Alpha") + self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 3).getString(), "Groups") + self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 4).getString(), "Column 1") + self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 5).getString(), "Column 2") + self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 6).getString(), "Column 3") + self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 8).getString(), "Source of Variation") + self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 9).getString(), "Between Groups") + self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 10).getString(), "Within Groups") + self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 11).getString(), "Total") + + self.assertEqual(get_cell_by_position(calc_doc, 0, 11, 8).getString(), "F critical") + self.assertEqual(round(get_cell_by_position(calc_doc, 0, 11, 9).getValue(),9), 3.885293835) + + #undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 0).getString(), "") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/statistics/zTest.py b/sc/qa/uitest/statistics/zTest.py new file mode 100644 index 0000000000..4ed285a9b8 --- /dev/null +++ b/sc/qa/uitest/statistics/zTest.py @@ -0,0 +1,102 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.calc import enter_text_to_cell + +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + + +class zTest(UITestCase): + def test_zTest_column(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #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"})) + with self.ui_test.execute_modeless_dialog_through_command(".uno:ZTestDialog") as xDialog: + xvariable1rangeedit = xDialog.getChild("variable1-range-edit") + xvariable2rangeedit = xDialog.getChild("variable2-range-edit") + xoutputrangeedit = xDialog.getChild("output-range-edit") + 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()) + #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 + with self.ui_test.execute_modeless_dialog_through_command(".uno:ZTestDialog", close_button="cancel"): + pass + +# 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 0000000000..10abb64d0c --- /dev/null +++ b/sc/qa/uitest/textCase/textCase.py @@ -0,0 +1,128 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.calc import enter_text_to_cell + +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + + +class textCase(UITestCase): + def test_text_case_switch(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + #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") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/textToColumns/tdf143008.py b/sc/qa/uitest/textToColumns/tdf143008.py new file mode 100644 index 0000000000..087a7b5a8f --- /dev/null +++ b/sc/qa/uitest/textToColumns/tdf143008.py @@ -0,0 +1,41 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.calc import enter_text_to_cell +from uitest.uihelper.common import get_state_as_dict, select_by_text +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + +class tdf143008(UITestCase): + + def test_tdf143008(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + #fill data + enter_text_to_cell(gridwin, "A1", "22/06/2021 10:02 PM") + + with self.ui_test.execute_dialog_through_command(".uno:TextToColumns") as xDialog: + xGrid = xDialog.getChild("csvgrid") + xColumnType = xDialog.getChild("columntype") + + # Use the right arrow to put the focus in the grid + xGrid.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RIGHT"})) + + self.assertEqual('true', get_state_as_dict(xColumnType)['Enabled']) + + select_by_text(xColumnType, "Date (DMY)") + + self.assertEqual('Date (DMY)', get_state_as_dict(xColumnType)['SelectEntryText']) + + # Without the fix in place, this test would have failed with + # AssertionError: '06/22/21 10:02 PM' != '06/22/21 10:02 AM' + self.assertEqual("06/22/21 10:02 PM", get_cell_by_position(document, 0, 0, 0).getString()) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/textToColumns/tdf51700.py b/sc/qa/uitest/textToColumns/tdf51700.py new file mode 100644 index 0000000000..98c33d8f31 --- /dev/null +++ b/sc/qa/uitest/textToColumns/tdf51700.py @@ -0,0 +1,51 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.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): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + #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 + with self.ui_test.execute_dialog_through_command(".uno:TextToColumns") as xDialog: + xcomma = xDialog.getChild("comma") + if (get_state_as_dict(xcomma)["Selected"]) == "false": + xcomma.executeAction("CLICK", tuple()) + # Click Ok + + #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) + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/textToColumns/tdf69981.py b/sc/qa/uitest/textToColumns/tdf69981.py new file mode 100644 index 0000000000..87c09e8ffc --- /dev/null +++ b/sc/qa/uitest/textToColumns/tdf69981.py @@ -0,0 +1,67 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + +class tdf69981(UITestCase): + + def test_tdf69981_text_to_columns(self): + + with self.ui_test.load_file(get_url_for_data_file("tdf69981.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + #Select A2:A7 + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A2:A7"})) + #Data - Text to Columns + with self.ui_test.execute_dialog_through_command(".uno:TextToColumns", close_button="") as xDialog: + xtab = xDialog.getChild("tab") + xcomma = xDialog.getChild("comma") + xtab.executeAction("CLICK", tuple()) + + if get_state_as_dict(xcomma)['Selected'] == 'false': + xcomma.executeAction("CLICK", tuple()) + + self.assertEqual('false', get_state_as_dict(xtab)['Selected']) + self.assertEqual('true', get_state_as_dict(xcomma)['Selected']) + #Click Ok + #overwrite warning come up + #press Ok. + xOK = xDialog.getChild("ok") + with self.ui_test.execute_blocking_action(xOK.executeAction, args=('CLICK', ()), close_button="yes"): + pass + + #Verify + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 0).getString(), "Original") + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 1).getString(), "a") + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 2).getString(), "") + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 3).getString(), "") + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 4).getString(), "a") + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 5).getString(), "a") + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 6).getString(), "a") + + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 0).getString(), "Copy") + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 1).getString(), "b") + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 2).getString(), "b") + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 3).getString(), "") + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 4).getString(), "") + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 5).getString(), "b") + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 6).getString(), "") + + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 0).getString(), "") + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 1).getString(), "c") + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 2).getString(), "c") + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 3).getString(), "c") + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 4).getString(), "") + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 5).getString(), "") + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 6).getString(), "c") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/textToColumns/tdf73006.py b/sc/qa/uitest/textToColumns/tdf73006.py new file mode 100644 index 0000000000..1ac519f73c --- /dev/null +++ b/sc/qa/uitest/textToColumns/tdf73006.py @@ -0,0 +1,39 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict +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): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + #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 + with self.ui_test.execute_dialog_through_command(".uno:TextToColumns") as xDialog: + xspace = xDialog.getChild("space") + if (get_state_as_dict(xspace)["Selected"]) == "false": + xspace.executeAction("CLICK", tuple()) + # Click Ok + + #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") + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/textToColumns/tdf82398.py b/sc/qa/uitest/textToColumns/tdf82398.py new file mode 100644 index 0000000000..b0722fcbd1 --- /dev/null +++ b/sc/qa/uitest/textToColumns/tdf82398.py @@ -0,0 +1,59 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.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): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + #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 + with self.ui_test.execute_dialog_through_command(".uno:TextToColumns") as xDialog: + 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 + + #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) + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/textToColumns/tdf85403.py b/sc/qa/uitest/textToColumns/tdf85403.py new file mode 100644 index 0000000000..771e9dc4bc --- /dev/null +++ b/sc/qa/uitest/textToColumns/tdf85403.py @@ -0,0 +1,33 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_url_for_data_file +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + +#Bug 85403 - no broadcast after text to columns to convert text to numbers + +class tdf85403(UITestCase): + def test_tdf85403_text_to_columns(self): + with self.ui_test.load_file(get_url_for_data_file("tdf85403.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + #'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 + with self.ui_test.execute_dialog_through_command(".uno:TextToColumns"): + pass + + #Verify + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 0).getValue(), 123) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/textToColumns/tdf85979.py b/sc/qa/uitest/textToColumns/tdf85979.py new file mode 100644 index 0000000000..ca5808947e --- /dev/null +++ b/sc/qa/uitest/textToColumns/tdf85979.py @@ -0,0 +1,49 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + +#Bug 85979 - Crash: data text to columns + +class tdf85979(UITestCase): + def test_td85979_text_to_columns(self): + with self.ui_test.load_file(get_url_for_data_file("tdf85979.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + #(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 + with self.ui_test.execute_dialog_through_command(".uno:TextToColumns") as xDialog: + xspace = xDialog.getChild("space") + if (get_state_as_dict(xspace)["Selected"]) == "false": + xspace.executeAction("CLICK", tuple()) + # Click Ok + + #Verify + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 0).getValue(), 99) + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 1).getValue(), 4) + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 2).getValue(), 9) + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 3).getValue(), 9) + self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 0).getValue(), 260) + self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 1).getValue(), 10) + self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 2).getValue(), 23) + self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 3).getValue(), 23) + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 0).getValue(), 149) + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 1).getValue(), 6) + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 2).getValue(), 14) + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 3).getValue(), 14) + self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 0).getValue(), 0) + self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 1).getValue(), 16) + self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 2).getValue(), 35) + self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 3).getValue(), 35) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/textToColumns/tdf89907.py b/sc/qa/uitest/textToColumns/tdf89907.py new file mode 100644 index 0000000000..ef5f164f92 --- /dev/null +++ b/sc/qa/uitest/textToColumns/tdf89907.py @@ -0,0 +1,66 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import change_measurement_unit +#Bug 89907 - Text to columns only affects first line when width is auto set + +class tdf89907(UITestCase): + def test_tdf89907_text_to_columns(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + + with change_measurement_unit(self, "Centimeter"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + #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 + with self.ui_test.execute_dialog_through_command(".uno:SetOptimalColumnWidth") as xDialog: + xvalue = xDialog.getChild("value") + self.assertEqual("0.20 cm", get_state_as_dict(xvalue)["Text"]) + + # Data - Text to Columns + with self.ui_test.execute_dialog_through_command(".uno:TextToColumns") as xDialog: + 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 + + #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) + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/textToColumns/tdf92423.py b/sc/qa/uitest/textToColumns/tdf92423.py new file mode 100644 index 0000000000..99486bb2f0 --- /dev/null +++ b/sc/qa/uitest/textToColumns/tdf92423.py @@ -0,0 +1,55 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +#Bug 92423 - EDITING Text to columns... does not respect currently selected cells + +class tdf92423(UITestCase): + def test_tdf92423_text_to_columns(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + #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 + with self.ui_test.execute_dialog_through_command(".uno:TextToColumns") as xDialog: + xSemicolon = xDialog.getChild("semicolon") #check semicolon checkbox + if (get_state_as_dict(xSemicolon)["Selected"]) == "false": + xSemicolon.executeAction("CLICK", tuple()) + + #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) + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/textToColumns/textToColumns.py b/sc/qa/uitest/textToColumns/textToColumns.py new file mode 100644 index 0000000000..c67e879d18 --- /dev/null +++ b/sc/qa/uitest/textToColumns/textToColumns.py @@ -0,0 +1,369 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + +#text to column testcase + +class CalcTextToColumns(UITestCase): + + def test_text_to_columns_dot(self): + #_Dot_as_Separator + with self.ui_test.load_file(get_url_for_data_file("text_to_columns_dot.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + #Select A1:A5 on Sheet 'Dot_as_Separator' + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A5"})) + #Data - Text to Columns + with self.ui_test.execute_dialog_through_command(".uno:TextToColumns", close_button="") as xDialog: + #Untag Tab as separator and tag other. Put a dot into the input field next to the other checkbox + 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") + with self.ui_test.execute_blocking_action(xOK.executeAction, args=('CLICK', ()), close_button="yes"): + pass + + #Verify + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 0).getValue(), 1) + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 1).getValue(), 2) + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 2).getValue(), 3) + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 3).getValue(), 4) + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 4).getValue(), 5) + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 0).getValue(), 2) + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 1).getValue(), 2) + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 2).getValue(), 2) + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 3).getValue(), 2) + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 4).getValue(), 2) + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 0).getValue(), 3) + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 1).getValue(), 3) + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 2).getValue(), 3) + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 3).getValue(), 3) + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 4).getValue(), 3) + self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 0).getValue(), 4) + self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 1).getValue(), 4) + self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 2).getValue(), 4) + self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 3).getValue(), 4) + self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 4).getValue(), 4) + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 0).getValue(), 5) + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 1).getValue(), 5) + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 2).getValue(), 5) + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 3).getValue(), 5) + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 4).getValue(), 5) + self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 0).getValue(), 6) + self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 1).getValue(), 6) + self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 2).getValue(), 6) + self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 3).getValue(), 6) + self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 4).getValue(), 6) + self.assertEqual(get_cell_by_position(calc_doc, 0, 6, 0).getString(), "random content") + self.assertEqual(get_cell_by_position(calc_doc, 0, 6, 1).getValue(), 0) + self.assertEqual(get_cell_by_position(calc_doc, 0, 6, 2).getValue(), 0) + self.assertEqual(get_cell_by_position(calc_doc, 0, 6, 3).getValue(), 0) + self.assertEqual(get_cell_by_position(calc_doc, 0, 6, 4).getString(), "random content") + + def test_text_to_columns_comma(self): + #Comma as Separator + with self.ui_test.load_file(get_url_for_data_file("text_to_columns_comma.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + # Select A1:A5 + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A5"})) + # Data - Text to Columns + with self.ui_test.execute_dialog_through_command(".uno:TextToColumns", close_button="") as xDialog: + # 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") + with self.ui_test.execute_blocking_action(xOK.executeAction, args=('CLICK', ()), close_button="yes"): + pass + + #Verify + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 0).getValue(), 1) + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 1).getValue(), 2) + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 2).getValue(), 3) + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 3).getValue(), 4) + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 4).getValue(), 5) + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 0).getValue(), 2) + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 1).getValue(), 2) + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 2).getValue(), 2) + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 3).getValue(), 2) + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 4).getValue(), 2) + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 0).getValue(), 3) + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 1).getValue(), 3) + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 2).getValue(), 3) + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 3).getValue(), 3) + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 4).getValue(), 3) + self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 0).getValue(), 4) + self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 1).getValue(), 4) + self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 2).getValue(), 4) + self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 3).getValue(), 4) + self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 4).getValue(), 4) + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 0).getValue(), 5) + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 1).getValue(), 5) + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 2).getValue(), 5) + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 3).getValue(), 5) + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 4).getValue(), 5) + self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 0).getValue(), 6) + self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 1).getValue(), 6) + self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 2).getValue(), 6) + self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 3).getValue(), 6) + self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 4).getValue(), 6) + self.assertEqual(get_cell_by_position(calc_doc, 0, 6, 0).getString(), "random content") + self.assertEqual(get_cell_by_position(calc_doc, 0, 6, 1).getValue(), 0) + self.assertEqual(get_cell_by_position(calc_doc, 0, 6, 2).getValue(), 0) + self.assertEqual(get_cell_by_position(calc_doc, 0, 6, 3).getValue(), 0) + self.assertEqual(get_cell_by_position(calc_doc, 0, 6, 4).getString(), "random content") + + def test_text_to_columns_semicolon(self): + #Semicolon as Separator + with self.ui_test.load_file(get_url_for_data_file("text_to_columns_semicolon.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + # Select A1:A5 on Sheet + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A5"})) + # Data - Text to Columns + with self.ui_test.execute_dialog_through_command(".uno:TextToColumns", close_button="") as xDialog: + # 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") + with self.ui_test.execute_blocking_action(xOK.executeAction, args=('CLICK', ()), close_button="yes"): + pass + + #Verify + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 0).getValue(), 1) + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 1).getValue(), 2) + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 2).getValue(), 3) + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 3).getValue(), 4) + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 4).getValue(), 5) + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 0).getValue(), 2) + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 1).getValue(), 2) + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 2).getValue(), 2) + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 3).getValue(), 2) + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 4).getValue(), 2) + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 0).getValue(), 3) + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 1).getValue(), 3) + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 2).getValue(), 3) + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 3).getValue(), 3) + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 4).getValue(), 3) + self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 0).getValue(), 4) + self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 1).getValue(), 4) + self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 2).getValue(), 4) + self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 3).getValue(), 4) + self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 4).getValue(), 4) + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 0).getValue(), 5) + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 1).getValue(), 5) + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 2).getValue(), 5) + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 3).getValue(), 5) + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 4).getValue(), 5) + self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 0).getValue(), 6) + self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 1).getValue(), 6) + self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 2).getValue(), 6) + self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 3).getValue(), 6) + self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 4).getValue(), 6) + self.assertEqual(get_cell_by_position(calc_doc, 0, 6, 0).getString(), "random content") + self.assertEqual(get_cell_by_position(calc_doc, 0, 6, 1).getValue(), 0) + self.assertEqual(get_cell_by_position(calc_doc, 0, 6, 2).getValue(), 0) + self.assertEqual(get_cell_by_position(calc_doc, 0, 6, 3).getValue(), 0) + self.assertEqual(get_cell_by_position(calc_doc, 0, 6, 4).getString(), "random content") + + def test_text_to_columns_space(self): + #Space as Separator + with self.ui_test.load_file(get_url_for_data_file("text_to_columns_space.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + # Select A1:A5 on Sheet + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A5"})) + # Data - Text to Columns + with self.ui_test.execute_dialog_through_command(".uno:TextToColumns", close_button="") as xDialog: + # 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") + with self.ui_test.execute_blocking_action(xOK.executeAction, args=('CLICK', ()), close_button="yes"): + pass + + #Verify + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 0).getValue(), 1) + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 1).getValue(), 2) + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 2).getValue(), 3) + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 3).getValue(), 4) + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 4).getValue(), 5) + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 0).getValue(), 2) + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 1).getValue(), 2) + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 2).getValue(), 2) + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 3).getValue(), 2) + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 4).getValue(), 2) + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 0).getValue(), 3) + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 1).getValue(), 3) + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 2).getValue(), 3) + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 3).getValue(), 3) + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 4).getValue(), 3) + self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 0).getValue(), 4) + self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 1).getValue(), 4) + self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 2).getValue(), 4) + self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 3).getValue(), 4) + self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 4).getValue(), 4) + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 0).getValue(), 5) + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 1).getValue(), 5) + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 2).getValue(), 5) + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 3).getValue(), 5) + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 4).getValue(), 5) + self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 0).getValue(), 6) + self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 1).getValue(), 6) + self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 2).getValue(), 6) + self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 3).getValue(), 6) + self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 4).getValue(), 6) + self.assertEqual(get_cell_by_position(calc_doc, 0, 6, 0).getString(), "random content") + self.assertEqual(get_cell_by_position(calc_doc, 0, 6, 1).getValue(), 0) + self.assertEqual(get_cell_by_position(calc_doc, 0, 6, 2).getValue(), 0) + self.assertEqual(get_cell_by_position(calc_doc, 0, 6, 3).getValue(), 0) + self.assertEqual(get_cell_by_position(calc_doc, 0, 6, 4).getString(), "random content") + + def test_text_to_columns_pipe(self): + #Space as Separator + with self.ui_test.load_file(get_url_for_data_file("text_to_columns_pipe.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + # Select A1:A5 on Sheet + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A5"})) + # Data - Text to Columns + with self.ui_test.execute_dialog_through_command(".uno:TextToColumns", close_button="") as xDialog: + # Untag comma as separator and tag Semicolon + 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") + with self.ui_test.execute_blocking_action(xOK.executeAction, args=('CLICK', ()), close_button="yes"): + pass + + #Verify + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 0).getValue(), 1) + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 1).getValue(), 2) + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 2).getValue(), 3) + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 3).getValue(), 4) + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 4).getValue(), 5) + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 0).getValue(), 2) + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 1).getValue(), 2) + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 2).getValue(), 2) + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 3).getValue(), 2) + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 4).getValue(), 2) + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 0).getValue(), 3) + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 1).getValue(), 3) + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 2).getValue(), 3) + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 3).getValue(), 3) + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 4).getValue(), 3) + self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 0).getValue(), 4) + self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 1).getValue(), 4) + self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 2).getValue(), 4) + self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 3).getValue(), 4) + self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 4).getValue(), 4) + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 0).getValue(), 5) + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 1).getValue(), 5) + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 2).getValue(), 5) + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 3).getValue(), 5) + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 4).getValue(), 5) + self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 0).getValue(), 6) + self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 1).getValue(), 6) + self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 2).getValue(), 6) + self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 3).getValue(), 6) + self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 4).getValue(), 6) + self.assertEqual(get_cell_by_position(calc_doc, 0, 6, 0).getString(), "random content") + self.assertEqual(get_cell_by_position(calc_doc, 0, 6, 1).getValue(), 0) + self.assertEqual(get_cell_by_position(calc_doc, 0, 6, 2).getValue(), 0) + self.assertEqual(get_cell_by_position(calc_doc, 0, 6, 3).getValue(), 0) + self.assertEqual(get_cell_by_position(calc_doc, 0, 6, 4).getString(), "random content") + + def test_text_to_columns_pipespace(self): + #Space as Separator + with self.ui_test.load_file(get_url_for_data_file("text_to_columns_pipe_space.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + # Select A1:A5 on Sheet + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A5"})) + # Data - Text to Columns + with self.ui_test.execute_dialog_through_command(".uno:TextToColumns", close_button="") as xDialog: + 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") + with self.ui_test.execute_blocking_action(xOK.executeAction, args=('CLICK', ()), close_button="yes"): + pass + + #Verify + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 0).getValue(), 1) + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 1).getValue(), 2) + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 2).getValue(), 3) + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 3).getValue(), 4) + self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 4).getValue(), 5) + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 0).getValue(), 2) + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 1).getValue(), 2) + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 2).getValue(), 2) + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 3).getValue(), 2) + self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 4).getValue(), 2) + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 0).getValue(), 3) + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 1).getValue(), 3) + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 2).getValue(), 3) + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 3).getValue(), 3) + self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 4).getValue(), 3) + self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 0).getValue(), 4) + self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 1).getValue(), 4) + self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 2).getValue(), 4) + self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 3).getValue(), 4) + self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 4).getValue(), 4) + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 0).getValue(), 5) + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 1).getValue(), 5) + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 2).getValue(), 5) + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 3).getValue(), 5) + self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 4).getValue(), 5) + self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 0).getValue(), 6) + self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 1).getValue(), 6) + self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 2).getValue(), 6) + self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 3).getValue(), 6) + self.assertEqual(get_cell_by_position(calc_doc, 0, 5, 4).getValue(), 6) + self.assertEqual(get_cell_by_position(calc_doc, 0, 6, 0).getString(), "random content") + self.assertEqual(get_cell_by_position(calc_doc, 0, 6, 1).getValue(), 0) + self.assertEqual(get_cell_by_position(calc_doc, 0, 6, 2).getValue(), 0) + self.assertEqual(get_cell_by_position(calc_doc, 0, 6, 3).getValue(), 0) + self.assertEqual(get_cell_by_position(calc_doc, 0, 6, 4).getString(), "random content") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/validity/tdf137945.py b/sc/qa/uitest/validity/tdf137945.py new file mode 100644 index 0000000000..13370c9146 --- /dev/null +++ b/sc/qa/uitest/validity/tdf137945.py @@ -0,0 +1,30 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import select_pos +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file + +class Tdf137945(UITestCase): + + def test_tdf137945(self): + with self.ui_test.load_file(get_url_for_data_file("tdf137945.ods")): + + with self.ui_test.execute_dialog_through_command(".uno:Validation") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") + xInput = xDialog.getChild("inputhelp_text") + xTitle = xDialog.getChild("title") + + self.assertEqual("test", get_state_as_dict(xTitle)['Text']) + # Without the fix in place, this test would have failed with + # '1 2 3 4 5 10 end' != '1 2 3 4 5 10 end' + self.assertEqual("1 2 3 4 5 10 end", get_state_as_dict(xInput)['Text']) + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/validity/tdf138134.py b/sc/qa/uitest/validity/tdf138134.py new file mode 100644 index 0000000000..c16bdc8d06 --- /dev/null +++ b/sc/qa/uitest/validity/tdf138134.py @@ -0,0 +1,55 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.calc import enter_text_to_cell +from uitest.uihelper.common import select_by_text, select_pos + +from libreoffice.uno.propertyvalue import mkPropertyValues + + +class DetectiveCircle(UITestCase): + + def test_delete_circle_at_formula(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + enter_text_to_cell(gridwin, "A1", "1") + enter_text_to_cell(gridwin, "A2", "3") + enter_text_to_cell(gridwin, "A3", "=SUM(A1:A2)") + + #Select the cells to be validated + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) + #Apply Data > Validity ... > Whole Numbers + with self.ui_test.execute_dialog_through_command(".uno:Validation") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + xallow = xDialog.getChild("allow") + xallowempty = xDialog.getChild("allowempty") + xdata = xDialog.getChild("data") + xmin = xDialog.getChild("min") + + select_by_text(xallow, "Whole Numbers") + xallowempty.executeAction("CLICK", tuple()) + select_by_text(xdata, "equal") + xmin.executeAction("TYPE", mkPropertyValues({"TEXT":"5"})) + + self.xUITest.executeCommand(".uno:ShowInvalid") + + detectiveCircle1 = document.Sheets.getByName("Sheet1").DrawPage.getCount() + #There should be 1 detective circle object! + self.assertEqual(detectiveCircle1, 1) + + enter_text_to_cell(gridwin, "A1", "2") + + detectiveCircle2 = document.Sheets.getByName("Sheet1").DrawPage.getCount() + #There should not be a detective circle object! + self.assertEqual(detectiveCircle2, 0) + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/validity/tdf150098.py b/sc/qa/uitest/validity/tdf150098.py new file mode 100644 index 0000000000..5d29a4afaa --- /dev/null +++ b/sc/qa/uitest/validity/tdf150098.py @@ -0,0 +1,47 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.document import get_cell_by_position +from uitest.uihelper.common import select_by_text, select_pos + +from libreoffice.uno.propertyvalue import mkPropertyValues + + +class EvaluateFormulaInputs(UITestCase): + + def test_inputs_with_formula(self): + with self.ui_test.create_doc_in_start_center("calc") as document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + enter_text_to_cell(gridwin, "A1", "5") + enter_text_to_cell(gridwin, "A2", "7") + enter_text_to_cell(gridwin, "A3", "12") + + #Select the cells to be validated + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A4"})) + #Apply Data > Validity ... > Whole Numbers + with self.ui_test.execute_dialog_through_command(".uno:Validation") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + xallow = xDialog.getChild("allow") + xallowempty = xDialog.getChild("allowempty") + xdata = xDialog.getChild("data") + xmin = xDialog.getChild("min") + + select_by_text(xallow, "Whole Numbers") + xallowempty.executeAction("CLICK", tuple()) + select_by_text(xdata, "equal") + xmin.executeAction("TYPE", mkPropertyValues({"TEXT":"A3"})) + + enter_text_to_cell(gridwin, "A4", "=SUM(A1:A2)") + # without the fix in place, an error message would have appeared + self.assertEqual(get_cell_by_position(document, 0, 0, 3).getValue(), 12.0) + +# 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 0000000000..51b46ae317 --- /dev/null +++ b/sc/qa/uitest/validity/tdf53920.py @@ -0,0 +1,65 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import select_by_text, select_pos +from uitest.uihelper.calc import enter_text_to_cell + +from libreoffice.uno.propertyvalue import mkPropertyValues + + +# Bug 53920 - EDITING: Data Validity Cell Range not being applied to multiple selected cells +class tdf53920(UITestCase): + def test_tdf53920_validity_multiple_cells(self): + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + 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 + with self.ui_test.execute_dialog_through_command(".uno:Validation") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + xallow = xDialog.getChild("allow") + xmin = xDialog.getChild("min") + + select_by_text(xallow, "Cell range") + xmin.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$C$1:$C$3"})) + + #Expected behavior: All selected cells validate data. + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + with self.ui_test.execute_dialog_through_command(".uno:Validation") as xDialog: + 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") + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) + with self.ui_test.execute_dialog_through_command(".uno:Validation") as xDialog: + 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") + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A5"})) + with self.ui_test.execute_dialog_through_command(".uno:Validation") as xDialog: + 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") + + +# 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 0000000000..fe1a0fbc6f --- /dev/null +++ b/sc/qa/uitest/validity/tdf65686.py @@ -0,0 +1,50 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import select_by_text, select_pos + +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): + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + #- Data > Validity + #- Select Allow List + #- Enter Entries Aap Noot Mies + #- OK + with self.ui_test.execute_dialog_through_command(".uno:Validation") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + xallow = xDialog.getChild("allow") + minlist = xDialog.getChild("minlist") + + select_by_text(xallow, "List") + 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"})) + #- again open Data > Validity + #> there are empty lines in the list Entries + with self.ui_test.execute_dialog_through_command(".uno:Validation") as xDialog: + xallow = xDialog.getChild("allow") + minlist = xDialog.getChild("minlist") + + self.assertEqual(get_state_as_dict(xallow)["SelectEntryText"], "List") + self.assertEqual(get_state_as_dict(minlist)["Text"], "Aap\nNoot\nMies") + + + +# 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 0000000000..d25a5378f5 --- /dev/null +++ b/sc/qa/uitest/validity/tdf96698.py @@ -0,0 +1,98 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import select_by_text, select_pos + +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): + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + #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"})) + with self.ui_test.execute_dialog_through_command(".uno:Validation") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + xallow = xDialog.getChild("allow") + xmin = xDialog.getChild("min") + + select_by_text(xallow, "Custom") + xmin.executeAction("TYPE", mkPropertyValues({"TEXT":"ISERROR(FIND(\",\",B2))"})) + #verify + with self.ui_test.execute_dialog_through_command(".uno:Validation") as xDialog: + xallow = xDialog.getChild("allow") + xmin = xDialog.getChild("min") + + self.assertEqual(get_state_as_dict(xallow)["SelectEntryText"], "Custom") + self.assertEqual(get_state_as_dict(xmin)["Text"], "ISERROR(FIND(\",\",B2))") + + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"})) + with self.ui_test.execute_dialog_through_command(".uno:Validation") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + xallow = xDialog.getChild("allow") + xmin = xDialog.getChild("min") + + select_by_text(xallow, "Custom") + xmin.executeAction("TYPE", mkPropertyValues({"TEXT":"NOT(ISERROR(B3))"})) + #verify + with self.ui_test.execute_dialog_through_command(".uno:Validation") as xDialog: + xallow = xDialog.getChild("allow") + xmin = xDialog.getChild("min") + + self.assertEqual(get_state_as_dict(xallow)["SelectEntryText"], "Custom") + self.assertEqual(get_state_as_dict(xmin)["Text"], "NOT(ISERROR(B3))") + + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A7"})) + with self.ui_test.execute_dialog_through_command(".uno:Validation") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + xallow = xDialog.getChild("allow") + xmin = xDialog.getChild("min") + + select_by_text(xallow, "Custom") + xmin.executeAction("TYPE", mkPropertyValues({"TEXT":"ISERROR(FIND(\",\",A7))"})) + #verify + with self.ui_test.execute_dialog_through_command(".uno:Validation") as xDialog: + xallow = xDialog.getChild("allow") + xmin = xDialog.getChild("min") + + self.assertEqual(get_state_as_dict(xallow)["SelectEntryText"], "Custom") + self.assertEqual(get_state_as_dict(xmin)["Text"], "ISERROR(FIND(\",\",A7))") + + + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A8"})) + with self.ui_test.execute_dialog_through_command(".uno:Validation") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + xallow = xDialog.getChild("allow") + xmin = xDialog.getChild("min") + + select_by_text(xallow, "Custom") + xmin.executeAction("TYPE", mkPropertyValues({"TEXT":"NOT(ISERROR(A8))"})) + #verify + with self.ui_test.execute_dialog_through_command(".uno:Validation") as xDialog: + xallow = xDialog.getChild("allow") + xmin = xDialog.getChild("min") + + self.assertEqual(get_state_as_dict(xallow)["SelectEntryText"], "Custom") + self.assertEqual(get_state_as_dict(xmin)["Text"], "NOT(ISERROR(A8))") + + + +# 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 0000000000..3112b7afb9 --- /dev/null +++ b/sc/qa/uitest/validity/validity.py @@ -0,0 +1,114 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import select_by_text, select_pos + +from libreoffice.uno.propertyvalue import mkPropertyValues + + +class validity(UITestCase): + def test_validity_tab_criteria(self): + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + + with self.ui_test.execute_dialog_through_command(".uno:Validation") as xDialog: + 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") + + select_by_text(xallow, "Whole Numbers") + xallowempty.executeAction("CLICK", tuple()) + select_by_text(xdata, "valid range") + xmin.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) + xmax.executeAction("TYPE", mkPropertyValues({"TEXT":"2"})) + #reopen and verify + with self.ui_test.execute_dialog_through_command(".uno:Validation", close_button="cancel") as xDialog: + 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") + + + def test_validity_tab_inputHelp(self): + #validationhelptabpage.ui + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + + with self.ui_test.execute_dialog_through_command(".uno:Validation") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") + xtsbhelp = xDialog.getChild("tsbhelp") + xtitle = xDialog.getChild("title") + xinputhelp = xDialog.getChild("inputhelp_text") + + xtsbhelp.executeAction("CLICK", tuple()) + xtitle.executeAction("TYPE", mkPropertyValues({"TEXT":"A"})) + xinputhelp.executeAction("TYPE", mkPropertyValues({"TEXT":"B"})) + #reopen and verify + with self.ui_test.execute_dialog_through_command(".uno:Validation") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + xtsbhelp = xDialog.getChild("tsbhelp") + xtitle = xDialog.getChild("title") + xinputhelp = xDialog.getChild("inputhelp_text") + 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") + + + def test_validity_tab_errorAlert(self): + # erroralerttabpage.ui + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + + with self.ui_test.execute_dialog_through_command(".uno:Validation") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "2") + + xactionCB = xDialog.getChild("actionCB") + xerroralerttitle = xDialog.getChild("erroralert_title") + xerrorMsg = xDialog.getChild("errorMsg") + + select_by_text(xactionCB, "Warning") + xerroralerttitle.executeAction("TYPE", mkPropertyValues({"TEXT":"Warn"})) + xerrorMsg.executeAction("TYPE", mkPropertyValues({"TEXT":"Warn2"})) + #reopen and verify + with self.ui_test.execute_dialog_through_command(".uno:Validation") as xDialog: + 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") + + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: |