Avoid potential negative array index access to cached text.
[LibreOffice.git] / sc / qa / uitest / chart2 / tdf124111.py
blob91fac95e0ab4bfb616cb85eabb98850077988746
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 get_state_as_dict, get_url_for_data_file
11 from uitest.uihelper.common import select_pos
13 from libreoffice.uno.propertyvalue import mkPropertyValues
16 # Bug 124111 - Cannot enter negative number for cross other axis at value
17 class tdf124111(UITestCase):
18 def test_tdf124111_chart_x_negative_cross(self):
19 with self.ui_test.load_file(get_url_for_data_file("tdf124111.ods")):
20 xCalcDoc = self.xUITest.getTopFocusWindow()
21 gridwin = xCalcDoc.getChild("grid_window")
23 gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
24 gridwin.executeAction("ACTIVATE", tuple())
25 xChartMainTop = self.xUITest.getTopFocusWindow()
26 xChartMain = xChartMainTop.getChild("chart_window")
27 xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
28 with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) as xDialog:
29 #Click on tab "positioning".
30 tabcontrol = xDialog.getChild("tabcontrol")
31 select_pos(tabcontrol, "1")
33 crossAxisValue = xDialog.getChild("EDT_CROSSES_OTHER_AXIS_AT") #only available when crossAxis = Value
34 crossAxisValue.executeAction("DOWN", tuple()) #-1
36 #reopen and verify tab "positioning".
37 gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
38 gridwin.executeAction("ACTIVATE", tuple())
39 xChartMainTop = self.xUITest.getTopFocusWindow()
40 xChartMain = xChartMainTop.getChild("chart_window")
41 xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0")
42 with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) as xDialog:
44 tabcontrol = xDialog.getChild("tabcontrol")
45 select_pos(tabcontrol, "1")
47 crossAxis = xDialog.getChild("LB_CROSSES_OTHER_AXIS_AT")
48 crossAxisValue = xDialog.getChild("EDT_CROSSES_OTHER_AXIS_AT") #only available when crossAxis = Value
50 self.assertEqual(get_state_as_dict(crossAxis)["SelectEntryText"], "Value")
51 self.assertEqual(get_state_as_dict(crossAxisValue)["Text"], "-1")
53 # vim: set shiftwidth=4 softtabstop=4 expandtab: