Avoid potential negative array index access to cached text.
[LibreOffice.git] / sc / qa / uitest / calc_tests4 / tdf88999.py
blob466a8559aba8066caa88855c3e709ea106427dbd
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
11 from uitest.uihelper.common import select_pos
12 from uitest.uihelper.calc import enter_text_to_cell
13 from libreoffice.uno.propertyvalue import mkPropertyValues
14 #Bug 88999 - UI: Scientific format: unable to modify number of decimal places through Sidebar or Format > Cells
16 class tdf88999(UITestCase):
17 def test_tdf88999_scientific_format_decimal_value(self):
18 #numberingformatpage.ui
19 with self.ui_test.create_doc_in_start_center("calc"):
20 xCalcDoc = self.xUITest.getTopFocusWindow()
21 gridwin = xCalcDoc.getChild("grid_window")
22 enter_text_to_cell(gridwin, "A1", "1e-2")
23 gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B1"}))
24 #select cell A1
25 gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
26 #format - cell
27 with self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog") as xDialog:
28 xTabs = xDialog.getChild("tabcontrol")
29 select_pos(xTabs, "0") #tab Numbers
30 xliststore1 = xDialog.getChild("categorylb") #1st list / Category
31 xdecimalsed = xDialog.getChild("decimalsed")
32 xleadzerosed = xDialog.getChild("leadzerosed")
33 xformatted = xDialog.getChild("formatted")
35 self.assertEqual(get_state_as_dict(xliststore1)["SelectEntryText"], "Scientific")
36 self.assertEqual(get_state_as_dict(xdecimalsed)["Text"], "2")
37 self.assertEqual(get_state_as_dict(xdecimalsed)["Enabled"], "true")
38 self.assertEqual(get_state_as_dict(xleadzerosed)["Text"], "1")
39 self.assertEqual(get_state_as_dict(xformatted)["Text"], "0.00E+00")
42 # vim: set shiftwidth=4 softtabstop=4 expandtab: