Avoid potential negative array index access to cached text.
[LibreOffice.git] / sc / qa / uitest / calc_tests9 / tdf137446.py
blob94bb7c0c97c4fcb7a6c94d58d7091d1bd166f181
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 change_measurement_unit
11 from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
12 from libreoffice.uno.propertyvalue import mkPropertyValues
14 class tdf137446(UITestCase):
16 def test_tdf137446(self):
18 with self.ui_test.load_file(get_url_for_data_file("tdf137446.ods")):
20 with change_measurement_unit(self, "Centimeter"):
21 xCalcDoc = self.xUITest.getTopFocusWindow()
22 gridwin = xCalcDoc.getChild("grid_window")
24 gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "lineObject"}))
26 with self.ui_test.execute_dialog_through_command(".uno:TransformDialog") as xDialog:
29 self.assertEqual('10', get_state_as_dict(xDialog.getChild('MTR_FLD_WIDTH'))['Value'])
30 self.assertEqual('0', get_state_as_dict(xDialog.getChild('MTR_FLD_HEIGHT'))['Value'])
31 self.assertEqual('5.51', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_X'))['Value'])
32 self.assertEqual('2.55', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_Y'))['Value'])
33 self.assertEqual('0', get_state_as_dict(xDialog.getChild('NF_ANGLE'))['Value'])
36 xDialog.getChild('MTR_FLD_WIDTH').executeAction("UP", tuple())
39 with self.ui_test.execute_dialog_through_command(".uno:TransformDialog") as xDialog:
42 self.assertEqual('10.1', get_state_as_dict(xDialog.getChild('MTR_FLD_WIDTH'))['Value'])
43 self.assertEqual('0', get_state_as_dict(xDialog.getChild('MTR_FLD_HEIGHT'))['Value'])
44 self.assertEqual('5.51', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_X'))['Value'])
45 self.assertEqual('2.55', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_Y'))['Value'])
47 # Without the fix in place, this test would have failed with AssertionError: '0' != '180'
48 self.assertEqual('0', get_state_as_dict(xDialog.getChild('NF_ANGLE'))['Value'])
51 # vim: set shiftwidth=4 softtabstop=4 expandtab: