Avoid potential negative array index access to cached text.
[LibreOffice.git] / sc / qa / uitest / calc_tests7 / tdf137397.py
blobf1d84bf37a63ab97932032283522f0aa859c872d
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 libreoffice.uno.propertyvalue import mkPropertyValues
12 from uitest.uihelper.common import change_measurement_unit
14 class tdf137397(UITestCase):
16 def test_tdf137397(self):
18 with self.ui_test.load_file(get_url_for_data_file("tdf137397.ods")):
20 with change_measurement_unit(self, 'Centimeter'):
22 xCalcDoc = self.xUITest.getTopFocusWindow()
23 xGridWin = xCalcDoc.getChild("grid_window")
25 xGridWin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Shape"}))
27 self.xUITest.executeCommand(".uno:Sidebar")
28 xGridWin.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "TextPropertyPanel"}))
30 xChild = self.ui_test.wait_until_child_is_available('selectwidth')
31 self.assertEqual(get_state_as_dict(xChild)['Text'], '6.00 cm')
33 # Without the fix in place, this test would have failed with
34 # AssertionError: '-14,585,309.84 cm' != '2.00 cm'
35 xChild = self.ui_test.wait_until_child_is_available('selectheight')
36 self.assertEqual(get_state_as_dict(xChild)['Text'], '2.00 cm')
39 self.xUITest.executeCommand(".uno:Sidebar")
41 # vim: set shiftwidth=4 softtabstop=4 expandtab: