diff options
Diffstat (limited to 'sc/qa/uitest/conditional_format')
-rw-r--r-- | sc/qa/uitest/conditional_format/__init__.py | 0 | ||||
-rw-r--r-- | sc/qa/uitest/conditional_format/tdf100793.py | 87 | ||||
-rw-r--r-- | sc/qa/uitest/conditional_format/tdf104026.py | 45 | ||||
-rw-r--r-- | sc/qa/uitest/conditional_format/tdf105351.py | 57 | ||||
-rw-r--r-- | sc/qa/uitest/conditional_format/tdf105411.py | 32 | ||||
-rw-r--r-- | sc/qa/uitest/conditional_format/tdf105466.py | 32 | ||||
-rw-r--r-- | sc/qa/uitest/conditional_format/tdf105544.py | 50 | ||||
-rw-r--r-- | sc/qa/uitest/conditional_format/tdf117899.py | 65 | ||||
-rw-r--r-- | sc/qa/uitest/conditional_format/tdf118206.py | 43 | ||||
-rw-r--r-- | sc/qa/uitest/conditional_format/tdf119178.py | 58 | ||||
-rw-r--r-- | sc/qa/uitest/conditional_format/tdf124412.py | 36 | ||||
-rw-r--r-- | sc/qa/uitest/conditional_format/tdf81696.py | 38 | ||||
-rw-r--r-- | sc/qa/uitest/conditional_format/tdf96453.py | 64 |
13 files changed, 607 insertions, 0 deletions
diff --git a/sc/qa/uitest/conditional_format/__init__.py b/sc/qa/uitest/conditional_format/__init__.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/sc/qa/uitest/conditional_format/__init__.py diff --git a/sc/qa/uitest/conditional_format/tdf100793.py b/sc/qa/uitest/conditional_format/tdf100793.py new file mode 100644 index 000000000..692c3c810 --- /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 000000000..2d8c5fc66 --- /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 000000000..42d2c5b20 --- /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 000000000..69362f4c3 --- /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 000000000..1790575fd --- /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 000000000..b172d4067 --- /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 000000000..4176afc00 --- /dev/null +++ b/sc/qa/uitest/conditional_format/tdf117899.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/. +# +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})) + + self.ui_test.wait_until_file_is_available(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 000000000..efbebdd60 --- /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 000000000..04a30fc51 --- /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 000000000..3a2b45712 --- /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 000000000..0c03d6fcd --- /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 000000000..453a9ff48 --- /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: |