Avoid potential negative array index access to cached text.
[LibreOffice.git] / sc / qa / uitest / calc_tests7 / tdf91425.py
blobd8acdd8c16b8aaf9bf8940abefef2ae571e248be
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/.
10 from uitest.framework import UITestCase
11 from libreoffice.uno.propertyvalue import mkPropertyValues
12 from uitest.uihelper.common import get_url_for_data_file
13 from libreoffice.calc.document import get_cell_by_position
15 #Bug 91425 - CRASH - Calc Insert Columns Left
17 class tdf91425(UITestCase):
18 def test_tdf91425_insert_columns_left(self):
19 with self.ui_test.load_file(get_url_for_data_file("tdf91425.ods")) as calc_doc:
20 xCalcDoc = self.xUITest.getTopFocusWindow()
21 gridwin = xCalcDoc.getChild("grid_window")
22 #1) Open test file provided in report
23 #2) Move mouse pointer over Column A header, the right mouse button click
24 gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
25 #3) Insert columns left
26 self.xUITest.executeCommand(".uno:InsertColumnsBefore")
27 #verify
28 self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 0).getString(), "C")
29 #undo
30 self.xUITest.executeCommand(".uno:Undo")
31 self.assertEqual(get_cell_by_position(calc_doc, 0, 2, 0).getString(), "C")
32 #redo
33 self.xUITest.executeCommand(".uno:Redo")
34 self.assertEqual(get_cell_by_position(calc_doc, 0, 3, 0).getString(), "C")
36 # vim: set shiftwidth=4 softtabstop=4 expandtab: