nss: upgrade to release 3.73
[LibreOffice.git] / sc / qa / uitest / chart / chartWall.py
blobff5586d964f3301272ef6159ac78a2643a2ebb77
1 # -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
3 # This Source Code Form is subject to the terms of the Mozilla Public
4 # License, v. 2.0. If a copy of the MPL was not distributed with this
5 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 from uitest.framework import UITestCase
8 from uitest.uihelper.common import get_state_as_dict
9 from uitest.uihelper.common import select_pos
10 from uitest.uihelper.common import change_measurement_unit
11 from uitest.uihelper.calc import enter_text_to_cell
12 from libreoffice.calc.document import get_cell_by_position
13 from libreoffice.uno.propertyvalue import mkPropertyValues
14 from uitest.uihelper.common import get_state_as_dict, type_text
15 import org.libreoffice.unotest
16 import pathlib
18 def get_url_for_data_file(file_name):
19 return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri()
21 #Chart Wall dialog
23 class chartWall(UITestCase):
24 def test_chart_wall_dialog(self):
25 calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf122398.ods"))
26 xCalcDoc = self.xUITest.getTopFocusWindow()
27 gridwin = xCalcDoc.getChild("grid_window")
28 document = self.ui_test.get_component()
30 change_measurement_unit(self, "Centimeter")
32 xWall = document.Sheets[0].Charts[0].getEmbeddedObject().getFirstDiagram().Wall
33 self.assertEqual(xWall.LineWidth, 0)
34 self.assertEqual(xWall.LineTransparence, 0)
35 self.assertEqual(hex(xWall.FillColor), '0xe6e6e6')
36 self.assertEqual(xWall.FillTransparence, 0)
38 gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
39 gridwin.executeAction("ACTIVATE", tuple())
40 xChartMainTop = self.xUITest.getTopFocusWindow()
41 xChartMain = xChartMainTop.getChild("chart_window")
42 xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
43 self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramWall"}))
44 xDialog = self.xUITest.getTopFocusWindow()
45 #Click on tab "Borders".
46 tabcontrol = xDialog.getChild("tabcontrol")
47 select_pos(tabcontrol, "0")
49 xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
50 transparency = xDialog.getChild("MTR_LINE_TRANSPARENT")
52 xWidth.executeAction("UP", tuple())
53 transparency.executeAction("UP", tuple())
55 xOKBtn = xDialog.getChild("ok")
56 self.ui_test.close_dialog_through_button(xOKBtn)
58 self.assertEqual(xWall.LineWidth, 100)
59 self.assertEqual(xWall.LineTransparence, 5)
60 self.assertEqual(hex(xWall.FillColor), '0xe6e6e6')
61 self.assertEqual(xWall.FillTransparence, 0)
63 #reopen and verify tab "Borders".
64 gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
65 gridwin.executeAction("ACTIVATE", tuple())
66 xChartMainTop = self.xUITest.getTopFocusWindow()
67 xChartMain = xChartMainTop.getChild("chart_window")
68 xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
69 self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramWall"}))
70 xDialog = self.xUITest.getTopFocusWindow()
72 tabcontrol = xDialog.getChild("tabcontrol")
73 select_pos(tabcontrol, "0")
74 xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
75 transparency = xDialog.getChild("MTR_LINE_TRANSPARENT")
77 self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm")
78 self.assertEqual(get_state_as_dict(transparency)["Text"], "5%")
80 self.assertEqual(xWall.LineWidth, 100)
81 self.assertEqual(xWall.LineTransparence, 5)
82 self.assertEqual(hex(xWall.FillColor), '0xe6e6e6')
83 self.assertEqual(xWall.FillTransparence, 0)
85 #Click on tab "Area"
86 tabcontrol = xDialog.getChild("tabcontrol")
87 select_pos(tabcontrol, "1")
89 btncolor = xDialog.getChild("btncolor")
90 btncolor.executeAction("CLICK", tuple())
92 rCustom = xDialog.getChild("R_custom")
93 gCustom = xDialog.getChild("G_custom")
94 bCustom = xDialog.getChild("B_custom")
96 rCustom.executeAction("CLEAR", tuple())
97 rCustom.executeAction("TYPE", mkPropertyValues({"TEXT":"35"}))
98 rCustom.executeAction("UP", tuple())
99 rCustom.executeAction("DOWN", tuple()) #without this save data doesn't works
100 self.assertEqual(get_state_as_dict(rCustom)["Text"], "35")
101 gCustom.executeAction("CLEAR", tuple())
102 gCustom.executeAction("TYPE", mkPropertyValues({"TEXT":"169"}))
103 gCustom.executeAction("UP", tuple())
104 gCustom.executeAction("DOWN", tuple()) #without this save data doesn't works
105 bCustom.executeAction("CLEAR", tuple())
106 bCustom.executeAction("TYPE", mkPropertyValues({"TEXT":"211"}))
107 bCustom.executeAction("UP", tuple())
108 bCustom.executeAction("DOWN", tuple()) #without this save data doesn't works
109 xOKBtn = xDialog.getChild("ok")
110 self.ui_test.close_dialog_through_button(xOKBtn)
112 self.assertEqual(xWall.LineWidth, 100)
113 self.assertEqual(xWall.LineTransparence, 5)
114 self.assertEqual(hex(xWall.FillColor), '0x23a9d3')
115 self.assertEqual(xWall.FillTransparence, 0)
117 #reopen and verify tab "Area".
118 gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
119 gridwin.executeAction("ACTIVATE", tuple())
120 xChartMainTop = self.xUITest.getTopFocusWindow()
121 xChartMain = xChartMainTop.getChild("chart_window")
122 xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
123 self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramWall"}))
124 xDialog = self.xUITest.getTopFocusWindow()
126 tabcontrol = xDialog.getChild("tabcontrol")
127 select_pos(tabcontrol, "1")
129 rCustom = xDialog.getChild("R_custom")
130 gCustom = xDialog.getChild("G_custom")
131 bCustom = xDialog.getChild("B_custom")
133 self.assertEqual(get_state_as_dict(rCustom)["Text"], "35")
134 self.assertEqual(get_state_as_dict(gCustom)["Text"], "169")
135 self.assertEqual(get_state_as_dict(bCustom)["Text"], "211")
137 self.assertEqual(xWall.LineWidth, 100)
138 self.assertEqual(xWall.LineTransparence, 5)
139 self.assertEqual(hex(xWall.FillColor), '0x23a9d3')
140 self.assertEqual(xWall.FillTransparence, 0)
142 #change tab "Transparency"
143 select_pos(tabcontrol, "2")
144 transparency = xDialog.getChild("RBT_TRANS_LINEAR")
145 transparencyPercent = xDialog.getChild("MTR_TRANSPARENT") #51%
147 transparency.executeAction("CLICK", tuple())
148 transparencyPercent.executeAction("UP", tuple())
150 xOKBtn = xDialog.getChild("ok")
151 self.ui_test.close_dialog_through_button(xOKBtn)
153 self.assertEqual(xWall.LineWidth, 100)
154 self.assertEqual(xWall.LineTransparence, 5)
155 self.assertEqual(hex(xWall.FillColor), '0x23a9d3')
156 self.assertEqual(xWall.FillTransparence, 51)
158 #reopen and verify tab "Transparency"
159 gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
160 gridwin.executeAction("ACTIVATE", tuple())
161 xChartMainTop = self.xUITest.getTopFocusWindow()
162 xChartMain = xChartMainTop.getChild("chart_window")
163 xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
164 self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramWall"}))
165 xDialog = self.xUITest.getTopFocusWindow()
167 tabcontrol = xDialog.getChild("tabcontrol")
168 select_pos(tabcontrol, "2")
170 transparency = xDialog.getChild("RBT_TRANS_LINEAR")
171 transparencyPercent = xDialog.getChild("MTR_TRANSPARENT") #51%
173 self.assertEqual(get_state_as_dict(transparency)["Checked"], "true")
174 self.assertEqual(get_state_as_dict(transparencyPercent)["Text"], "51%")
176 self.assertEqual(xWall.LineWidth, 100)
177 self.assertEqual(xWall.LineTransparence, 5)
178 self.assertEqual(hex(xWall.FillColor), '0x23a9d3')
179 self.assertEqual(xWall.FillTransparence, 51)
181 xOKBtn = xDialog.getChild("ok")
182 self.ui_test.close_dialog_through_button(xOKBtn)
184 self.assertEqual(xWall.LineWidth, 100)
185 self.assertEqual(xWall.LineTransparence, 5)
186 self.assertEqual(hex(xWall.FillColor), '0x23a9d3')
187 self.assertEqual(xWall.FillTransparence, 51)
189 self.ui_test.close_doc()
190 # vim: set shiftwidth=4 softtabstop=4 expandtab: