Avoid potential negative array index access to cached text.
[LibreOffice.git] / sc / qa / uitest / calc_tests7 / tdf125030.py
blobcc49edd210c9f68e8dfd469026bcdb73bcdb0c8d
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.uno.propertyvalue import mkPropertyValues
11 from libreoffice.calc.document import get_cell_by_position
12 from uitest.uihelper.calc import enter_text_to_cell
14 #Bug 125030 - nice crash by repeating apply style (Ctrl+Shft+Y)
16 class tdf125030(UITestCase):
17 def test_tdf125030_repeat_crash(self):
18 with self.ui_test.create_doc_in_start_center("calc") as document:
19 xCalcDoc = self.xUITest.getTopFocusWindow()
20 gridwin = xCalcDoc.getChild("grid_window")
21 #enter data
22 enter_text_to_cell(gridwin, "A1", "aaaa")
23 enter_text_to_cell(gridwin, "B1", "bbbb")
24 #select A1
25 gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
26 self.xUITest.executeCommand(".uno:StyleApply?Style:string=Heading%201&FamilyName:string=CellStyles")
27 #focus on A2
28 gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A2"}))
29 #repeat (Ctrl+Shft+Y)
30 self.xUITest.executeCommand(".uno:Repeat")
31 self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "aaaa")
33 # vim: set shiftwidth=4 softtabstop=4 expandtab: