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 select_pos
9 from uitest
.uihelper
.common
import change_measurement_unit
10 from libreoffice
.uno
.propertyvalue
import mkPropertyValues
11 import org
.libreoffice
.unotest
14 def get_url_for_data_file(file_name
):
15 return pathlib
.Path(org
.libreoffice
.unotest
.makeCopyFromTDOC(file_name
)).as_uri()
17 class tdf133630(UITestCase
):
19 def test_tdf133630(self
):
21 calc_doc
= self
.ui_test
.load_file(get_url_for_data_file("chartArea.ods"))
22 xCalcDoc
= self
.xUITest
.getTopFocusWindow()
23 gridwin
= xCalcDoc
.getChild("grid_window")
24 document
= self
.ui_test
.get_component()
26 change_measurement_unit(self
, "Centimeter")
28 xCS
= document
.Sheets
[0].Charts
[0].getEmbeddedObject().getFirstDiagram().CoordinateSystems
[0]
29 self
.assertEqual(0, xCS
.getAxisByDimension(0, 0).LineWidth
)
30 self
.assertEqual(80, xCS
.ChartTypes
[0].DataSeries
[0].LineWidth
)
32 # First change the line width of one element
33 gridwin
.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
34 gridwin
.executeAction("ACTIVATE", tuple())
35 xChartMainTop
= self
.xUITest
.getTopFocusWindow()
36 xChartMain
= xChartMainTop
.getChild("chart_window")
37 xSeriesObj
= xChartMain
.getChild("CID/D=0:CS=0:Axis=0,0")
38 self
.ui_test
.execute_dialog_through_action(xSeriesObj
, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"}))
40 xDialog
= self
.xUITest
.getTopFocusWindow()
41 tabcontrol
= xDialog
.getChild("tabcontrol")
42 select_pos(tabcontrol
, "2")
44 xWidth
= xDialog
.getChild("MTR_FLD_LINE_WIDTH")
45 xWidth
.executeAction("UP", tuple())
47 xOKBtn
= xDialog
.getChild("ok")
48 self
.ui_test
.close_dialog_through_button(xOKBtn
)
50 self
.assertEqual(100, xCS
.getAxisByDimension(0, 0).LineWidth
)
51 self
.assertEqual(80, xCS
.ChartTypes
[0].DataSeries
[0].LineWidth
)
53 # Now change the line width of another element
54 xSeriesObj
= xChartMain
.getChild("CID/D=0:CS=0:CT=0:Series=0")
55 self
.ui_test
.execute_dialog_through_action(xSeriesObj
, "COMMAND", mkPropertyValues({"COMMAND": "FormatDataSeries"}))
57 xDialog
= self
.xUITest
.getTopFocusWindow()
58 tabcontrol
= xDialog
.getChild("tabcontrol")
59 select_pos(tabcontrol
, "1")
61 xWidth
= xDialog
.getChild("MTR_FLD_LINE_WIDTH")
62 xWidth
.executeAction("UP", tuple())
64 # Without the fix in place, this test would have crashed here
65 xOKBtn
= xDialog
.getChild("ok")
66 self
.ui_test
.close_dialog_through_button(xOKBtn
)
68 self
.assertEqual(100, xCS
.getAxisByDimension(0, 0).LineWidth
)
69 self
.assertEqual(100, xCS
.ChartTypes
[0].DataSeries
[0].LineWidth
)
71 self
.ui_test
.close_doc()
72 # vim: set shiftwidth=4 softtabstop=4 expandtab: