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
.calc
import enter_text_to_cell
11 from libreoffice
.calc
.document
import get_cell_by_position
12 from libreoffice
.uno
.propertyvalue
import mkPropertyValues
13 from uitest
.uihelper
.common
import get_state_as_dict
, type_text
14 from uitest
.debug
import sleep
15 import org
.libreoffice
.unotest
18 def get_url_for_data_file(file_name
):
19 return pathlib
.Path(org
.libreoffice
.unotest
.makeCopyFromTDOC(file_name
)).as_uri()
21 #Bug 123013 - Can not change Trendline name in charts
23 class tdf123013(UITestCase
):
24 def test_tdf96432_chart_trendline_name(self
):
25 calc_doc
= self
.ui_test
.load_file(get_url_for_data_file("tdf123013.ods"))
26 xCalcDoc
= self
.xUITest
.getTopFocusWindow()
27 gridwin
= xCalcDoc
.getChild("grid_window")
28 document
= self
.ui_test
.get_component()
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:CT=0:Series=0")
34 self
.ui_test
.execute_dialog_through_action(xSeriesObj
, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"}))
35 xDialog
= self
.xUITest
.getTopFocusWindow()
37 tabcontrol
= xDialog
.getChild("tabcontrol")
38 select_pos(tabcontrol
, "0")
40 xentryname
= xDialog
.getChild("entry_name")
41 xentryname
.executeAction("TYPE", mkPropertyValues({"TEXT":"Tline"}))
42 xOKBtn
= xDialog
.getChild("ok")
43 self
.ui_test
.close_dialog_through_button(xOKBtn
)
46 gridwin
.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
47 gridwin
.executeAction("ACTIVATE", tuple())
48 xChartMainTop
= self
.xUITest
.getTopFocusWindow()
49 xChartMain
= xChartMainTop
.getChild("chart_window")
51 #Right-click on the chart; from the pop-up menu select "Format Y bars
52 # The program presents dialog "Format Y bars", tab "Line".
53 xSeriesObj
= xChartMain
.getChild("CID/D=0:CS=0:CT=0:Series=0")
54 self
.ui_test
.execute_dialog_through_action(xSeriesObj
, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"}))
55 xDialog
= self
.xUITest
.getTopFocusWindow()
57 tabcontrol
= xDialog
.getChild("tabcontrol")
58 select_pos(tabcontrol
, "0")
60 xentryname
= xDialog
.getChild("entry_name")
61 self
.assertEqual(get_state_as_dict(xentryname
)["Text"], "Tline")
62 xOKBtn
= xDialog
.getChild("ok")
63 self
.ui_test
.close_dialog_through_button(xOKBtn
)
65 self
.ui_test
.close_doc()
66 # vim: set shiftwidth=4 softtabstop=4 expandtab: