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
13 from libreoffice
.uno
.propertyvalue
import mkPropertyValues
16 # Bug 105544 - Manage Conditional Formatting is not able to edit a condition
17 class tdf105544(UITestCase
):
18 def test_tdf105544_Manage_Conditional_Formatting_edit_condition(self
):
20 with self
.ui_test
.load_file(get_url_for_data_file("tdf105544.ods")):
21 xCalcDoc
= self
.xUITest
.getTopFocusWindow()
22 gridwin
= xCalcDoc
.getChild("grid_window")
23 #2. select B3. Format> conditional formatting> manage
24 gridwin
.executeAction("SELECT", mkPropertyValues({"CELL": "B3"}))
25 with self
.ui_test
.execute_dialog_through_command(".uno:ConditionalFormatManagerDialog", close_button
="") as xCondFormatMgr
:
27 # check that we have exactly four conditional formats in the beginning
28 xList
= xCondFormatMgr
.getChild("CONTAINER")
29 list_state
= get_state_as_dict(xList
)
30 self
.assertEqual(list_state
['Children'], '4')
32 #select B3:B37 range and click edit, then click yes
33 xList
.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) #2nd position in the list
34 xEditBtn
= xCondFormatMgr
.getChild("edit")
35 with self
.ui_test
.execute_dialog_through_action(xEditBtn
, "CLICK", event_name
= "ModelessDialogVisible"):
38 # we need to get a pointer again as the old window has been deleted
39 xCondFormatMgr
= self
.xUITest
.getTopFocusWindow()
41 # check again that we still have 4 entry in the list
42 xList
= xCondFormatMgr
.getChild("CONTAINER")
43 list_state
= get_state_as_dict(xList
)
44 self
.assertEqual(list_state
['Children'], '4')
46 # close the conditional format manager
47 xOKBtn
= xCondFormatMgr
.getChild("ok")
48 self
.ui_test
.close_dialog_through_button(xOKBtn
)
50 # vim: set shiftwidth=4 softtabstop=4 expandtab: