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/.
9 from uitest
.framework
import UITestCase
10 from uitest
.uihelper
.calc
import enter_text_to_cell
11 from uitest
.uihelper
.common
import get_state_as_dict
, select_by_text
13 from libreoffice
.uno
.propertyvalue
import mkPropertyValues
16 # Bug 105351 - FORMATTING: Unable to change Data Bar conditional formatting
17 class tdf105351(UITestCase
):
18 def test_tdf105351_cond_format_data_bar(self
):
19 with self
.ui_test
.create_doc_in_start_center("calc"):
20 xCalcDoc
= self
.xUITest
.getTopFocusWindow()
21 gridwin
= xCalcDoc
.getChild("grid_window")
22 #2. Set the value of cell A1 to 5
23 enter_text_to_cell(gridwin
, "A1", "5")
24 #3. Select cell A1, then choose from the menus Format -> Conditional Formatting -> Data Bar
25 gridwin
.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
26 with self
.ui_test
.execute_modeless_dialog_through_command(".uno:DataBarFormatDialog") as xDialog
:
27 xcolscalemin
= xDialog
.getChild("colscalemin")
28 xedcolscalemin
= xDialog
.getChild("edcolscalemin")
29 xcolscalemax
= xDialog
.getChild("colscalemax")
30 xedcolscalemax
= xDialog
.getChild("edcolscalemax")
31 #4. In the conditional formatting window, select the dropdown on the left that says "Automatic"
32 #and change it to "Value". In the text field below it enter 0.
33 #5. Select the dropdown on the right that says "Automatic" and change it to "Value". In the text field below it enter 10
34 select_by_text(xcolscalemin
, "Value")
35 xedcolscalemin
.executeAction("TYPE", mkPropertyValues({"TEXT":"0"}))
37 select_by_text(xcolscalemax
, "Value")
38 xedcolscalemax
.executeAction("TYPE", mkPropertyValues({"TEXT":"10"}))
40 #Verify : The conditions set for cell A1 should be shown and editable.
41 with self
.ui_test
.execute_modeless_dialog_through_command(".uno:DataBarFormatDialog") as xDialog
:
42 xcolscalemin
= xDialog
.getChild("colscalemin")
43 xedcolscalemin
= xDialog
.getChild("edcolscalemin")
44 xcolscalemax
= xDialog
.getChild("colscalemax")
45 xedcolscalemax
= xDialog
.getChild("edcolscalemax")
47 self
.assertEqual(get_state_as_dict(xcolscalemin
)["SelectEntryText"], "Value")
48 self
.assertEqual(get_state_as_dict(xedcolscalemin
)["Text"], "0")
49 self
.assertEqual(get_state_as_dict(xcolscalemax
)["SelectEntryText"], "Value")
50 self
.assertEqual(get_state_as_dict(xedcolscalemax
)["Text"], "10")
51 #editable - change value and then verify
52 xedcolscalemax
.executeAction("TYPE", mkPropertyValues({"TEXT":"1"}))
53 self
.assertEqual(get_state_as_dict(xedcolscalemax
)["Text"], "110")
57 # vim: set shiftwidth=4 softtabstop=4 expandtab: