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 select_pos
, get_url_for_data_file
11 from uitest
.uihelper
.common
import change_measurement_unit
12 from libreoffice
.uno
.propertyvalue
import mkPropertyValues
14 class tdf133630(UITestCase
):
16 def test_tdf133630(self
):
18 with self
.ui_test
.load_file(get_url_for_data_file("chartArea.ods")) as calc_doc
:
20 with
change_measurement_unit(self
, "Centimeter"):
21 xCalcDoc
= self
.xUITest
.getTopFocusWindow()
22 gridwin
= xCalcDoc
.getChild("grid_window")
24 xCS
= calc_doc
.Sheets
[0].Charts
[0].getEmbeddedObject().getFirstDiagram().CoordinateSystems
[0]
25 self
.assertEqual(0, xCS
.getAxisByDimension(0, 0).LineWidth
)
26 self
.assertEqual(80, xCS
.ChartTypes
[0].DataSeries
[0].LineWidth
)
28 # First change the line width of one element
29 gridwin
.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
30 gridwin
.executeAction("ACTIVATE", tuple())
31 xChartMainTop
= self
.xUITest
.getTopFocusWindow()
32 xChartMain
= xChartMainTop
.getChild("chart_window")
33 xSeriesObj
= xChartMain
.getChild("CID/D=0:CS=0:Axis=0,0")
34 with self
.ui_test
.execute_dialog_through_action(xSeriesObj
, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) as xDialog
:
36 tabcontrol
= xDialog
.getChild("tabcontrol")
37 select_pos(tabcontrol
, "2")
39 xWidth
= xDialog
.getChild("MTR_FLD_LINE_WIDTH")
40 xWidth
.executeAction("UP", tuple())
43 self
.assertEqual(100, xCS
.getAxisByDimension(0, 0).LineWidth
)
44 self
.assertEqual(80, xCS
.ChartTypes
[0].DataSeries
[0].LineWidth
)
46 # Now change the line width of another element
47 xSeriesObj
= xChartMain
.getChild("CID/D=0:CS=0:CT=0:Series=0")
48 with self
.ui_test
.execute_dialog_through_action(xSeriesObj
, "COMMAND", mkPropertyValues({"COMMAND": "FormatDataSeries"})) as xDialog
:
50 tabcontrol
= xDialog
.getChild("tabcontrol")
51 select_pos(tabcontrol
, "1")
53 xWidth
= xDialog
.getChild("MTR_FLD_LINE_WIDTH")
54 xWidth
.executeAction("UP", tuple())
56 # Without the fix in place, this test would have crashed here
58 self
.assertEqual(100, xCS
.getAxisByDimension(0, 0).LineWidth
)
59 self
.assertEqual(100, xCS
.ChartTypes
[0].DataSeries
[0].LineWidth
)
61 # vim: set shiftwidth=4 softtabstop=4 expandtab: