tdf#130857 qt weld: Support mail merge "Server Auth" dialog
[LibreOffice.git] / sc / qa / uitest / conditional_format / tdf96453.py
blob453a9ff48eb5bb0c40832fc2ca4e2cd4e05e537e
1 # -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
3 # This file is part of the LibreOffice project.
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 from uitest.framework import UITestCase
11 from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
12 from libreoffice.calc.document import get_sheet_from_doc
13 from libreoffice.calc.conditional_format import get_conditional_format_from_sheet
15 class ConditionalFormatDlgTest(UITestCase):
17 def test_tdf96453(self):
19 with self.ui_test.load_file(get_url_for_data_file("tdf96453.ods")) as calc_doc:
21 sheet = get_sheet_from_doc(calc_doc, 0)
22 conditional_format_list = get_conditional_format_from_sheet(sheet)
23 self.assertEqual(conditional_format_list.getLength(), 2)
25 with self.ui_test.execute_dialog_through_command(".uno:ConditionalFormatManagerDialog", close_button="") as xCondFormatMgr:
28 # check that we have exactly two conditional formats in the beginning
29 xList = xCondFormatMgr.getChild("CONTAINER")
30 list_state = get_state_as_dict(xList)
31 self.assertEqual(list_state['Children'], '2')
33 # remove one conditional format
34 xRemoveBtn = xCondFormatMgr.getChild("remove")
35 xRemoveBtn.executeAction("CLICK", tuple())
37 # check that the table only shows one
38 # but the document still contains two
39 list_state = get_state_as_dict(xList)
40 self.assertEqual(list_state['Children'], '1')
42 self.assertEqual(conditional_format_list.getLength(), 2)
44 # add a new conditional format through the add button
45 xAddBtn = xCondFormatMgr.getChild("add")
46 with self.ui_test.execute_dialog_through_action(xAddBtn, "CLICK", event_name = "ModelessDialogVisible"):
47 pass
49 # we need to get a pointer again as the old window has been deleted
50 xCondFormatMgr = self.xUITest.getTopFocusWindow()
52 # check again that we now have 2 and not 3 entries in the list
53 # and still only 2 conditional formats in the document
54 xList = xCondFormatMgr.getChild("CONTAINER")
55 list_state = get_state_as_dict(xList)
56 self.assertEqual(list_state['Children'], '2')
58 self.assertEqual(conditional_format_list.getLength(), 2)
60 # close the conditional format manager
61 xCancelBtn = xCondFormatMgr.getChild("cancel")
62 self.ui_test.close_dialog_through_button(xCancelBtn)
64 # vim: set shiftwidth=4 softtabstop=4 expandtab: