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 | 103 | ||||
-rw-r--r-- | sc/qa/uitest/conditional_format/tdf105351.py | 67 | ||||
-rw-r--r-- | sc/qa/uitest/conditional_format/tdf105411.py | 35 | ||||
-rw-r--r-- | sc/qa/uitest/conditional_format/tdf105466.py | 35 | ||||
-rw-r--r-- | sc/qa/uitest/conditional_format/tdf105544.py | 61 | ||||
-rw-r--r-- | sc/qa/uitest/conditional_format/tdf118206.py | 48 | ||||
-rw-r--r-- | sc/qa/uitest/conditional_format/tdf81696.py | 51 | ||||
-rw-r--r-- | sc/qa/uitest/conditional_format/tdf96453.py | 89 |
9 files changed, 489 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..5d6c95126 --- /dev/null +++ b/sc/qa/uitest/conditional_format/tdf100793.py @@ -0,0 +1,103 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +import os +from uitest.uihelper.common import get_state_as_dict +from libreoffice.calc.document import get_sheet_from_doc +from libreoffice.calc.conditional_format import get_conditional_format_from_sheet +from libreoffice.uno.propertyvalue import mkPropertyValues + +import org.libreoffice.unotest +import pathlib +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +#Bug 100793 - FORMATTING - conditional formatting gets corrupted upon copy/paste/insert +class tdf100793(UITestCase): + def test_tdf100793(self): + + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf100793.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + sheet = get_sheet_from_doc(calc_doc, 2) + conditional_format_list = get_conditional_format_from_sheet(sheet) + self.assertEqual(conditional_format_list.getLength(), 1) + #2) Go to sheet "plan" + gridwin.executeAction("SELECT", mkPropertyValues({"TABLE": "2"})) + #3) Open the conditional formatting management dialog-> The indicated range should be G18:K29,F18,F20:F29 + self.ui_test.execute_dialog_through_command(".uno:ConditionalFormatManagerDialog") + + xCondFormatMgr = self.xUITest.getTopFocusWindow() + + # check that we have exactly one conditional formats in the beginning + xList = xCondFormatMgr.getChild("CONTAINER") + list_state = get_state_as_dict(xList) + self.assertEqual(list_state['Children'], '1') + + #3) Click Edit & try to change to intended one, F18:K33 + xEditBtn = xCondFormatMgr.getChild("edit") + self.ui_test.execute_dialog_through_action(xEditBtn, "CLICK", event_name = "ModelessDialogVisible") + xCondFormatDlg = self.xUITest.getTopFocusWindow() + + #modify textbox + xedassign = xCondFormatDlg.getChild("edassign") + #go at the beginning + xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "END"})) + xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "HOME"})) + # 11x right + xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"})) + xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"})) + xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"})) + xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"})) + xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"})) + xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"})) + xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"})) + xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"})) + xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"})) + xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"})) + xedassign.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"})) + #now I'm at F18 - write :K33 + xedassign.executeAction("TYPE", mkPropertyValues({"TEXT":":K33"})) + + xCondFormatOkBtn = xCondFormatDlg.getChild("ok") + self.ui_test.close_dialog_through_button(xCondFormatOkBtn) + + # we need to get a pointer again as the old window has been deleted + xCondFormatMgr = self.xUITest.getTopFocusWindow() + + # check again that we still have 1 entry in the list + # and still only 1 conditional format in the document + xList = xCondFormatMgr.getChild("CONTAINER") + list_state = get_state_as_dict(xList) + self.assertEqual(list_state['Children'], '1') + + self.assertEqual(conditional_format_list.getLength(), 1) + + # close the conditional format manager + xOKBtn = xCondFormatMgr.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + #verify - reopen, check range + self.ui_test.execute_dialog_through_command(".uno:ConditionalFormatManagerDialog") + xCondFormatMgr = self.xUITest.getTopFocusWindow() + xEditBtn = xCondFormatMgr.getChild("edit") + self.ui_test.execute_dialog_through_action(xEditBtn, "CLICK", event_name = "ModelessDialogVisible") + xCondFormatDlg = self.xUITest.getTopFocusWindow() + xedassign = xCondFormatDlg.getChild("edassign") + self.assertEqual(get_state_as_dict(xedassign)["Text"], "G18:K29,F18:K33,F20:F29") + xCondFormatOkBtn = xCondFormatDlg.getChild("ok") + self.ui_test.close_dialog_through_button(xCondFormatOkBtn) + xCondFormatMgr = self.xUITest.getTopFocusWindow() + xCancelBtn = xCondFormatMgr.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/conditional_format/tdf105351.py b/sc/qa/uitest/conditional_format/tdf105351.py new file mode 100644 index 000000000..2f9d55ff5 --- /dev/null +++ b/sc/qa/uitest/conditional_format/tdf105351.py @@ -0,0 +1,67 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import select_pos +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.debug import sleep +#Bug 105351 - FORMATTING: Unable to change Data Bar conditional formatting +class tdf105351(UITestCase): + def test_tdf105351_cond_format_data_bar(self): + calc_doc = self.ui_test.create_doc_in_start_center("calc") + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #2. Set the value of cell A1 to 5 + enter_text_to_cell(gridwin, "A1", "5") + #3. Select cell A1, then choose from the menus Format -> Conditional Formatting -> Data Bar + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + self.ui_test.execute_modeless_dialog_through_command(".uno:DataBarFormatDialog") + xDialog = self.xUITest.getTopFocusWindow() + xcolscalemin = xDialog.getChild("colscalemin") + xedcolscalemin = xDialog.getChild("edcolscalemin") + xcolscalemax = xDialog.getChild("colscalemax") + xedcolscalemax = xDialog.getChild("edcolscalemax") + #4. In the conditional formatting window, select the dropdown on the left that says "Automatic" + #and change it to "Value". In the text field below it enter 0. + #5. Select the dropdown on the right that says "Automatic" and change it to "Value". In the text field below it enter 10 + props = {"TEXT": "Value"} + actionProps = mkPropertyValues(props) + xcolscalemin.executeAction("SELECT", actionProps) + xedcolscalemin.executeAction("TYPE", mkPropertyValues({"TEXT":"0"})) + + props2 = {"TEXT": "Value"} + actionProps2 = mkPropertyValues(props2) + xcolscalemax.executeAction("SELECT", actionProps2) + xedcolscalemax.executeAction("TYPE", mkPropertyValues({"TEXT":"10"})) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + #Verify : The conditions set for cell A1 should be shown and editable. + self.ui_test.execute_modeless_dialog_through_command(".uno:DataBarFormatDialog") + xDialog = self.xUITest.getTopFocusWindow() + xcolscalemin = xDialog.getChild("colscalemin") + xedcolscalemin = xDialog.getChild("edcolscalemin") + xcolscalemax = xDialog.getChild("colscalemax") + xedcolscalemax = xDialog.getChild("edcolscalemax") + + self.assertEqual(get_state_as_dict(xcolscalemin)["SelectEntryText"], "Value") + self.assertEqual(get_state_as_dict(xedcolscalemin)["Text"], "0") + self.assertEqual(get_state_as_dict(xcolscalemax)["SelectEntryText"], "Value") + self.assertEqual(get_state_as_dict(xedcolscalemax)["Text"], "10") + #editable - change value and then verify + xedcolscalemax.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) + self.assertEqual(get_state_as_dict(xedcolscalemax)["Text"], "110") + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/conditional_format/tdf105411.py b/sc/qa/uitest/conditional_format/tdf105411.py new file mode 100644 index 000000000..8f08c2f22 --- /dev/null +++ b/sc/qa/uitest/conditional_format/tdf105411.py @@ -0,0 +1,35 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase + +class tdf105411(UITestCase): + + def test_delete_conditional_format(self): + + self.ui_test.create_doc_in_start_center("calc") + + self.ui_test.execute_modeless_dialog_through_command(".uno:ConditionalFormatDialog") + + xCondFormatDlg = self.xUITest.getTopFocusWindow() + + xDeleteBtn = xCondFormatDlg.getChild("delete") + xDeleteBtn.executeAction("CLICK", tuple()) + + xCondFormatDlg = self.xUITest.getTopFocusWindow() + + xDeleteBtn = xCondFormatDlg.getChild("add") + xDeleteBtn.executeAction("CLICK", tuple()) + + xCondFormatDlg = self.xUITest.getTopFocusWindow() + + xOkBtn = xCondFormatDlg.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/conditional_format/tdf105466.py b/sc/qa/uitest/conditional_format/tdf105466.py new file mode 100644 index 000000000..fa7db7e49 --- /dev/null +++ b/sc/qa/uitest/conditional_format/tdf105466.py @@ -0,0 +1,35 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues + +import unittest + +class tdf105466(UITestCase): + + @unittest.skip("issue with floating windows") + def test_changing_conditional_format(self): + + self.ui_test.create_doc_in_start_center("calc") + + self.ui_test.execute_modeless_dialog_through_command(".uno:ConditionalFormatDialog") + + for i in range(0,4): + with self.subTest(i = i): + xCondFormatDlg = self.xUITest.getTopFocusWindow() + xTypeLstBox = xCondFormatDlg.getChild("type") + xTypeLstBox.executeAction("SELECT", mkPropertyValues({"POS": str(i)})) + + xCondFormatDlg = self.xUITest.getTopFocusWindow() + xOkBtn = xCondFormatDlg.getChild("ok") + self.ui_test.close_dialog_through_button(xOkBtn) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: + diff --git a/sc/qa/uitest/conditional_format/tdf105544.py b/sc/qa/uitest/conditional_format/tdf105544.py new file mode 100644 index 000000000..828807e90 --- /dev/null +++ b/sc/qa/uitest/conditional_format/tdf105544.py @@ -0,0 +1,61 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +import os +from uitest.uihelper.common import get_state_as_dict +from libreoffice.calc.document import get_sheet_from_doc +from libreoffice.calc.conditional_format import get_conditional_format_from_sheet +from libreoffice.uno.propertyvalue import mkPropertyValues + +import org.libreoffice.unotest +import pathlib +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +#Bug 105544 - Manage Conditional Formatting is not able to edit a condition +class tdf105544(UITestCase): + def test_tdf105544_Manage_Conditional_Formatting_edit_condition(self): + + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf105544.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + #2. select B3. Format> conditional formatting> manage + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B3"})) + self.ui_test.execute_dialog_through_command(".uno:ConditionalFormatManagerDialog") + xCondFormatMgr = self.xUITest.getTopFocusWindow() + + # check that we have exactly four conditional formats in the beginning + xList = xCondFormatMgr.getChild("CONTAINER") + list_state = get_state_as_dict(xList) + self.assertEqual(list_state['Children'], '4') + + #select B3:B37 range and click edit, then click yes + xList.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) #2nd position in the list + xEditBtn = xCondFormatMgr.getChild("edit") + self.ui_test.execute_dialog_through_action(xEditBtn, "CLICK", event_name = "ModelessDialogVisible") + xCondFormatDlg = self.xUITest.getTopFocusWindow() + + xCondFormatOkBtn = xCondFormatDlg.getChild("ok") + self.ui_test.close_dialog_through_button(xCondFormatOkBtn) + + # we need to get a pointer again as the old window has been deleted + xCondFormatMgr = self.xUITest.getTopFocusWindow() + + # check again that we still have 4 entry in the list + xList = xCondFormatMgr.getChild("CONTAINER") + list_state = get_state_as_dict(xList) + self.assertEqual(list_state['Children'], '4') + + # close the conditional format manager + xOKBtn = xCondFormatMgr.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/conditional_format/tdf118206.py b/sc/qa/uitest/conditional_format/tdf118206.py new file mode 100644 index 000000000..015af9f7a --- /dev/null +++ b/sc/qa/uitest/conditional_format/tdf118206.py @@ -0,0 +1,48 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import select_pos +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.debug import sleep +import org.libreoffice.unotest +import pathlib +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +#Bug 118206 - [GTK3] Calc hangs copying/cutting a conditional format column +class tdf118206(UITestCase): + def test_tdf118206(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf118206.xlsx")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) + self.xUITest.executeCommand(".uno:SelectColumn") + self.xUITest.executeCommand(".uno:Copy") + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B1"})) + self.xUITest.executeCommand(".uno:SelectColumn") + self.xUITest.executeCommand(".uno:Paste") + + #verify + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "On Back Order") + self.assertEqual(get_cell_by_position(document, 0, 1, 1).getValue(), 0) + self.assertEqual(get_cell_by_position(document, 0, 1, 7).getValue(), 1) + + #Undo + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "On Back Order") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 0) + self.assertEqual(get_cell_by_position(document, 0, 0, 7).getValue(), 1) + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "") + self.assertEqual(get_cell_by_position(document, 0, 1, 1).getString(), "") + self.assertEqual(get_cell_by_position(document, 0, 1, 7).getString(), "") + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/conditional_format/tdf81696.py b/sc/qa/uitest/conditional_format/tdf81696.py new file mode 100644 index 000000000..9036e6376 --- /dev/null +++ b/sc/qa/uitest/conditional_format/tdf81696.py @@ -0,0 +1,51 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import select_pos +from uitest.uihelper.calc import enter_text_to_cell +from libreoffice.calc.document import get_sheet_from_doc +from libreoffice.calc.conditional_format import get_conditional_format_from_sheet +from uitest.debug import sleep +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues +#Bug 81696 - CRASH while sorting cells with conditional formatting + +import org.libreoffice.unotest +import pathlib + +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +class tdf81696(UITestCase): + + def test_tdf81696_sort_cell_conditional_formatting(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf81696.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B3"})) + #Open sort dialog by DATA - SORT,Just sort it by Column A, ascending. (it's default) + self.ui_test.execute_dialog_through_command(".uno:DataSort") + xDialog = self.xUITest.getTopFocusWindow() + xTabs = xDialog.getChild("tabcontrol") + xleftright = xDialog.getChild("leftright") + select_pos(xTabs, "0") + + xOK = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOK) + #verify + self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "A") + self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "B") + self.assertEqual(get_cell_by_position(document, 0, 0, 1).getValue(), 1) + self.assertEqual(get_cell_by_position(document, 0, 1, 1).getValue(), 2) + self.assertEqual(get_cell_by_position(document, 0, 0, 2).getValue(), 2) + self.assertEqual(get_cell_by_position(document, 0, 1, 2).getValue(), 1) + + self.ui_test.close_doc() +# vim: set shiftwidth=4 softtabstop=4 expandtab:
\ No newline at end of file diff --git a/sc/qa/uitest/conditional_format/tdf96453.py b/sc/qa/uitest/conditional_format/tdf96453.py new file mode 100644 index 000000000..696fff87d --- /dev/null +++ b/sc/qa/uitest/conditional_format/tdf96453.py @@ -0,0 +1,89 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase + +import os + +from uitest.uihelper.common import get_state_as_dict +from uitest.path import get_srcdir_url + +from libreoffice.calc.document import get_sheet_from_doc +from libreoffice.calc.conditional_format import get_conditional_format_from_sheet + +def get_url_for_data_file(file_name): + return get_srcdir_url() + "/uitest/calc_tests/data/" + file_name + +class ConditionalFormatDlgTest(UITestCase): + + def test_simple_open_manager(self): + + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf96453.ods")) + + self.ui_test.execute_dialog_through_command(".uno:ConditionalFormatManagerDialog") + + xCondFormatMgr = self.xUITest.getTopFocusWindow() + + xCancelBtn = xCondFormatMgr.getChild("cancel") + xCancelBtn.executeAction("CLICK", tuple()) + + self.ui_test.close_doc() + + def test_tdf96453(self): + + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf96453.ods")) + + sheet = get_sheet_from_doc(calc_doc, 0) + conditional_format_list = get_conditional_format_from_sheet(sheet) + self.assertEqual(conditional_format_list.getLength(), 2) + + self.ui_test.execute_dialog_through_command(".uno:ConditionalFormatManagerDialog") + + xCondFormatMgr = self.xUITest.getTopFocusWindow() + + # check that we have exactly two conditional formats in the beginning + xList = xCondFormatMgr.getChild("CONTAINER") + list_state = get_state_as_dict(xList) + self.assertEqual(list_state['Children'], '2') + + # remove one conditional format + xRemoveBtn = xCondFormatMgr.getChild("remove") + xRemoveBtn.executeAction("CLICK", tuple()) + + # check that the table only shows one + # but the document still contains two + list_state = get_state_as_dict(xList) + self.assertEqual(list_state['Children'], '1') + + self.assertEqual(conditional_format_list.getLength(), 2) + + # add a new conditional format through the add button + xAddBtn = xCondFormatMgr.getChild("add") + self.ui_test.execute_dialog_through_action(xAddBtn, "CLICK", event_name = "ModelessDialogVisible") + + xCondFormatDlg = self.xUITest.getTopFocusWindow() + xCondFormatOkBtn = xCondFormatDlg.getChild("ok") + self.ui_test.close_dialog_through_button(xCondFormatOkBtn) + + # we need to get a pointer again as the old window has been deleted + xCondFormatMgr = self.xUITest.getTopFocusWindow() + + # check again that we now have 2 and not 3 entries in the list + # and still only 2 conditional formats in the document + xList = xCondFormatMgr.getChild("CONTAINER") + list_state = get_state_as_dict(xList) + self.assertEqual(list_state['Children'], '2') + + self.assertEqual(conditional_format_list.getLength(), 2) + + # close the conditional format manager + xCancelBtn = xCondFormatMgr.getChild("cancel") + self.ui_test.close_dialog_through_button(xCancelBtn) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: |