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/.
8 from libreoffice
.uno
.propertyvalue
import mkPropertyValues
10 from uitest
.framework
import UITestCase
14 class CalcChartEditUIDemo(UITestCase
):
16 def add_content_to_cell(self
, gridwin
, cell
, content
):
17 selectProps
= mkPropertyValues({"CELL": cell
})
18 gridwin
.executeAction("SELECT", selectProps
)
20 contentProps
= mkPropertyValues({"TEXT": content
})
21 gridwin
.executeAction("TYPE", contentProps
)
23 def fill_spreadsheet(self
):
24 xCalcDoc
= self
.xUITest
.getTopFocusWindow()
25 xGridWindow
= xCalcDoc
.getChild("grid_window")
27 self
.add_content_to_cell(xGridWindow
, "A1", "col1")
28 self
.add_content_to_cell(xGridWindow
, "B1", "col2")
29 self
.add_content_to_cell(xGridWindow
, "C1", "col3")
30 self
.add_content_to_cell(xGridWindow
, "A2", "1")
31 self
.add_content_to_cell(xGridWindow
, "B2", "3")
32 self
.add_content_to_cell(xGridWindow
, "C2", "5")
34 xGridWindow
.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C2"}))
36 def test_select_secondary_axis(self
):
38 self
.ui_test
.create_doc_in_start_center("calc")
40 self
.fill_spreadsheet()
42 xCalcDoc
= self
.xUITest
.getTopFocusWindow()
43 xGridWindow
= xCalcDoc
.getChild("grid_window")
45 self
.ui_test
.execute_dialog_through_command(".uno:InsertObjectChart")
47 xChartDlg
= self
.xUITest
.getTopFocusWindow()
49 xNextBtn
= xChartDlg
.getChild("finish")
50 xNextBtn
.executeAction("CLICK", tuple())
52 xGridWindow
.executeAction("DESELECT", mkPropertyValues({"OBJECT": ""}))
54 xGridWindow
.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
56 xGridWindow
.executeAction("ACTIVATE", tuple())
58 xChartMainTop
= self
.xUITest
.getTopFocusWindow()
59 xChartMain
= xChartMainTop
.getChild("chart_window")
61 xSeriesObj
= xChartMain
.getChild("CID/D=0:CS=0:CT=0:Series=0")
62 self
.ui_test
.execute_dialog_through_action(xSeriesObj
, "COMMAND", mkPropertyValues({"COMMAND": "FormatDataSeries"}))
64 xSeriesFormatDlg
= self
.xUITest
.getTopFocusWindow()
65 xAxis2
= xSeriesFormatDlg
.getChild("RBT_OPT_AXIS_2")
66 xAxis2
.executeAction("CLICK", tuple())
68 xCancelBtn
= xSeriesFormatDlg
.getChild("ok")
69 xCancelBtn
.executeAction("CLICK", tuple())
71 xGridWindow
.executeAction("DESELECT", mkPropertyValues({"OBJECT": ""}))
73 self
.ui_test
.close_doc()
75 # vim: set shiftwidth=4 softtabstop=4 expandtab: