Avoid potential negative array index access to cached text.
[LibreOffice.git] / sc / qa / uitest / calc_tests2 / tdf46138.py
blob1a07bf9169bc76c63bef5ab4a0b0350e43d21204
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 libreoffice.calc.document import get_cell_by_position
11 from libreoffice.uno.propertyvalue import mkPropertyValues
12 #Bug 46138 - Calc Frozen after "undo" "Filling Series Number in a Column"
14 class tdf46138(UITestCase):
15 def test_tdf46138(self):
16 with self.ui_test.create_doc_in_start_center("calc") as document:
17 xCalcDoc = self.xUITest.getTopFocusWindow()
18 gridwin = xCalcDoc.getChild("grid_window")
19 #Choose a column,
20 gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
21 self.xUITest.executeCommand(".uno:SelectColumn")
22 #select 'edit'>'fill'>'series'>Starting Value '1' then "OK",
23 with self.ui_test.execute_dialog_through_command(".uno:FillSeries") as xDialog:
24 xStart = xDialog.getChild("startValue")
25 xStart.executeAction("TYPE", mkPropertyValues({"TEXT":"1"}))
26 self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "1")
27 #then "Ctrl+Z"/ undo
28 self.xUITest.executeCommand(".uno:Undo")
29 self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "")
31 # vim: set shiftwidth=4 softtabstop=4 expandtab: