diff options
Diffstat (limited to 'sc/qa/uitest/calc_tests3')
-rw-r--r-- | sc/qa/uitest/calc_tests3/clearCells.py | 260 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests3/insertQrCodeGen.py | 35 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests3/tdf102506.py | 46 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests3/tdf139974.py | 49 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests3/tdf77509.py | 72 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests3/tdf79983.py | 66 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests3/tdf80693.py | 44 |
7 files changed, 572 insertions, 0 deletions
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: |