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 123520 - Y axis - positioning tab, textbox "Cross other axis at" date changed
23 class tdf123520(UITestCase
):
24 def test_tdf123520_chart_y_cross_other_axis(self
):
25 calc_doc
= self
.ui_test
.load_file(get_url_for_data_file("tdf123520.ods"))
26 xCalcDoc
= self
.xUITest
.getTopFocusWindow()
27 gridwin
= xCalcDoc
.getChild("grid_window")
28 document
= self
.ui_test
.get_component()
30 gridwin
.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
31 gridwin
.executeAction("ACTIVATE", tuple())
32 xChartMainTop
= self
.xUITest
.getTopFocusWindow()
33 xChartMain
= xChartMainTop
.getChild("chart_window")
34 xSeriesObj
= xChartMain
.getChild("CID/D=0:CS=0:CT=0:Series=0")
35 self
.ui_test
.execute_dialog_through_action(xSeriesObj
, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisY"})) # Y Axis
36 xDialog
= self
.xUITest
.getTopFocusWindow()
37 #Click on tab "positioning".
38 tabcontrol
= xDialog
.getChild("tabcontrol")
39 select_pos(tabcontrol
, "1")
41 crossAxis
= xDialog
.getChild("LB_CROSSES_OTHER_AXIS_AT")
42 crossAxisValue
= xDialog
.getChild("EDT_CROSSES_OTHER_AXIS_AT") #only available when crossAxis = Value
43 placeLabels
= xDialog
.getChild("LB_PLACE_LABELS")
44 innerMajorTick
= xDialog
.getChild("CB_TICKS_INNER")
45 outerMajorTick
= xDialog
.getChild("CB_TICKS_OUTER")
46 innerMinorTick
= xDialog
.getChild("CB_MINOR_INNER")
47 outerMinorTick
= xDialog
.getChild("CB_MINOR_OUTER")
48 placeMarks
= xDialog
.getChild("LB_PLACE_TICKS")
49 crossAxisValue
.executeAction("CLEAR", tuple())
50 crossAxisValue
.executeAction("TYPE", mkPropertyValues({"TEXT":"01.01.2018"}))
51 #crossAxisValue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"TAB"}))
52 #TAB doesn't works- add "a" at the end of textbox
53 #workaround - edit another ui item, it should trigger leave of textbox
54 props2
= {"TEXT": "Outside start"}
55 actionProps2
= mkPropertyValues(props2
)
56 placeLabels
.executeAction("SELECT", actionProps2
)
57 xOKBtn
= xDialog
.getChild("ok")
58 self
.ui_test
.close_dialog_through_button(xOKBtn
)
60 #reopen and verify tab "positioning".
61 gridwin
.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
62 gridwin
.executeAction("ACTIVATE", tuple())
63 xChartMainTop
= self
.xUITest
.getTopFocusWindow()
64 xChartMain
= xChartMainTop
.getChild("chart_window")
65 xSeriesObj
= xChartMain
.getChild("CID/D=0:CS=0:CT=0:Series=0")
66 self
.ui_test
.execute_dialog_through_action(xSeriesObj
, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisY"}))
67 xDialog
= self
.xUITest
.getTopFocusWindow()
69 tabcontrol
= xDialog
.getChild("tabcontrol")
70 select_pos(tabcontrol
, "1")
72 crossAxis
= xDialog
.getChild("LB_CROSSES_OTHER_AXIS_AT")
73 crossAxisValue
= xDialog
.getChild("EDT_CROSSES_OTHER_AXIS_AT") #only available when crossAxis = Value
74 placeLabels
= xDialog
.getChild("LB_PLACE_LABELS")
75 innerMajorTick
= xDialog
.getChild("CB_TICKS_INNER")
76 outerMajorTick
= xDialog
.getChild("CB_TICKS_OUTER")
77 innerMinorTick
= xDialog
.getChild("CB_MINOR_INNER")
78 outerMinorTick
= xDialog
.getChild("CB_MINOR_OUTER")
79 placeMarks
= xDialog
.getChild("LB_PLACE_TICKS")
81 self
.assertEqual(get_state_as_dict(crossAxis
)["SelectEntryText"], "Value")
82 self
.assertEqual(get_state_as_dict(crossAxisValue
)["Text"], "01.01.2018")
83 self
.assertEqual(get_state_as_dict(placeLabels
)["SelectEntryText"], "Outside start")
85 xOKBtn
= xDialog
.getChild("ok")
86 self
.ui_test
.close_dialog_through_button(xOKBtn
)
88 self
.ui_test
.close_doc()
89 # vim: set shiftwidth=4 softtabstop=4 expandtab: