tdf#164995: only match keywords for requested locale and opcode
[LibreOffice.git] / sc / qa / uitest / chart / chartArea.py
blob520ab8e83a2da9749664501cff523727039227d1
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.common import change_measurement_unit, select_pos
11 from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
13 from libreoffice.uno.propertyvalue import mkPropertyValues
16 # Chart Area dialog
17 class chartArea(UITestCase):
18 def test_chart_area_dialog(self):
19 with self.ui_test.load_file(get_url_for_data_file("chartArea.ods")) as calc_doc:
21 with change_measurement_unit(self, "Centimeter"):
22 xCalcDoc = self.xUITest.getTopFocusWindow()
23 gridwin = xCalcDoc.getChild("grid_window")
25 xArea = calc_doc.Sheets[0].Charts[0].getEmbeddedObject().Area
26 self.assertEqual(xArea.LineWidth, 0)
27 self.assertEqual(xArea.LineTransparence, 0)
28 self.assertEqual(hex(xArea.FillColor), '0xffffff')
29 self.assertEqual(xArea.FillTransparence, 0)
31 gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
32 gridwin.executeAction("ACTIVATE", tuple())
33 xChartMainTop = self.xUITest.getTopFocusWindow()
34 xChartMain = xChartMainTop.getChild("chart_window")
35 xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
36 with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramArea"})) as xDialog:
37 #Click on tab "Borders".
38 tabcontrol = xDialog.getChild("tabcontrol")
39 select_pos(tabcontrol, "0")
41 xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
42 transparency = xDialog.getChild("MTR_LINE_TRANSPARENT")
44 xWidth.executeAction("UP", tuple())
45 transparency.executeAction("UP", tuple())
48 self.assertEqual(xArea.LineWidth, 100)
49 self.assertEqual(xArea.LineTransparence, 5)
50 self.assertEqual(hex(xArea.FillColor), '0xffffff')
51 self.assertEqual(xArea.FillTransparence, 0)
53 #reopen and verify tab "Borders".
54 gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
55 gridwin.executeAction("ACTIVATE", tuple())
56 xChartMainTop = self.xUITest.getTopFocusWindow()
57 xChartMain = xChartMainTop.getChild("chart_window")
58 xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
59 with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramArea"})) as xDialog:
61 tabcontrol = xDialog.getChild("tabcontrol")
62 select_pos(tabcontrol, "0")
63 xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
64 transparency = xDialog.getChild("MTR_LINE_TRANSPARENT")
66 self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm")
67 self.assertEqual(get_state_as_dict(transparency)["Text"], "5%")
69 #Click on tab "Area"
70 tabcontrol = xDialog.getChild("tabcontrol")
71 select_pos(tabcontrol, "1")
73 btncolor = xDialog.getChild("btncolor")
74 btncolor.executeAction("CLICK", tuple())
76 rCustom = xDialog.getChild("R_custom")
77 gCustom = xDialog.getChild("G_custom")
78 bCustom = xDialog.getChild("B_custom")
80 rCustom.executeAction("CLEAR", tuple())
81 rCustom.executeAction("TYPE", mkPropertyValues({"TEXT":"35"}))
82 rCustom.executeAction("UP", tuple())
83 rCustom.executeAction("DOWN", tuple()) #without this save data doesn't works
84 self.assertEqual(get_state_as_dict(rCustom)["Text"], "35")
85 gCustom.executeAction("CLEAR", tuple())
86 gCustom.executeAction("TYPE", mkPropertyValues({"TEXT":"169"}))
87 gCustom.executeAction("UP", tuple())
88 gCustom.executeAction("DOWN", tuple()) #without this save data doesn't works
89 bCustom.executeAction("CLEAR", tuple())
90 bCustom.executeAction("TYPE", mkPropertyValues({"TEXT":"211"}))
91 bCustom.executeAction("UP", tuple())
92 bCustom.executeAction("DOWN", tuple()) #without this save data doesn't works
94 self.assertEqual(xArea.LineWidth, 100)
95 self.assertEqual(xArea.LineTransparence, 5)
96 self.assertEqual(hex(xArea.FillColor), '0x23a9d3')
97 self.assertEqual(xArea.FillTransparence, 0)
99 #reopen and verify tab "Area".
100 gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
101 gridwin.executeAction("ACTIVATE", tuple())
102 xChartMainTop = self.xUITest.getTopFocusWindow()
103 xChartMain = xChartMainTop.getChild("chart_window")
104 xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
105 with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramArea"})) as xDialog:
107 tabcontrol = xDialog.getChild("tabcontrol")
108 select_pos(tabcontrol, "1")
110 rCustom = xDialog.getChild("R_custom")
111 gCustom = xDialog.getChild("G_custom")
112 bCustom = xDialog.getChild("B_custom")
114 self.assertEqual(get_state_as_dict(rCustom)["Text"], "35")
115 self.assertEqual(get_state_as_dict(gCustom)["Text"], "169")
116 self.assertEqual(get_state_as_dict(bCustom)["Text"], "211")
118 #change tab "Transparency"
119 select_pos(tabcontrol, "2")
120 transparency = xDialog.getChild("RBT_TRANS_LINEAR")
121 transparencyPercent = xDialog.getChild("MTR_TRANSPARENT") #51%
123 transparency.executeAction("CLICK", tuple())
124 transparencyPercent.executeAction("UP", tuple())
127 self.assertEqual(xArea.LineWidth, 100)
128 self.assertEqual(xArea.LineTransparence, 5)
129 self.assertEqual(hex(xArea.FillColor), '0x23a9d3')
130 self.assertEqual(xArea.FillTransparence, 51)
132 #reopen and verify tab "Transparency"
133 gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
134 gridwin.executeAction("ACTIVATE", tuple())
135 xChartMainTop = self.xUITest.getTopFocusWindow()
136 xChartMain = xChartMainTop.getChild("chart_window")
137 xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
138 with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramArea"})) as xDialog:
140 tabcontrol = xDialog.getChild("tabcontrol")
141 select_pos(tabcontrol, "2")
143 transparency = xDialog.getChild("RBT_TRANS_LINEAR")
144 transparencyPercent = xDialog.getChild("MTR_TRANSPARENT") #51%
146 self.assertEqual(get_state_as_dict(transparency)["Checked"], "true")
147 self.assertEqual(get_state_as_dict(transparencyPercent)["Text"], "51%")
150 self.assertEqual(xArea.LineWidth, 100)
151 self.assertEqual(xArea.LineTransparence, 5)
152 self.assertEqual(hex(xArea.FillColor), '0x23a9d3')
153 self.assertEqual(xArea.FillTransparence, 51)
155 # vim: set shiftwidth=4 softtabstop=4 expandtab: