1 # -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
3 # This Source Code Form is subject to the terms of the Mozilla Public
4 # License, v. 2.0. If a copy of the MPL was not distributed with this
5 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 from uitest
.framework
import UITestCase
8 from libreoffice
.uno
.propertyvalue
import mkPropertyValues
9 from uitest
.uihelper
.common
import get_state_as_dict
, type_text
10 from libreoffice
.calc
.document
import get_cell_by_position
12 from uitest
.debug
import sleep
13 import org
.libreoffice
.unotest
17 #Bug 91425 - CRASH - Calc Insert Columns Left
19 def get_url_for_data_file(file_name
):
20 return pathlib
.Path(org
.libreoffice
.unotest
.makeCopyFromTDOC(file_name
)).as_uri()
22 class tdf91425(UITestCase
):
23 def test_tdf91425_insert_columns_left(self
):
24 calc_doc
= self
.ui_test
.load_file(get_url_for_data_file("tdf91425.ods"))
25 xCalcDoc
= self
.xUITest
.getTopFocusWindow()
26 gridwin
= xCalcDoc
.getChild("grid_window")
27 document
= self
.ui_test
.get_component()
28 #1) Open test file provided in report
29 #2) Move mouse pointer over Column A header, the right mouse button click
30 gridwin
.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
31 #3) Insert columns left
32 self
.xUITest
.executeCommand(".uno:InsertColumnsBefore")
34 self
.assertEqual(get_cell_by_position(document
, 0, 3, 0).getString(), "C")
36 self
.xUITest
.executeCommand(".uno:Undo")
37 self
.assertEqual(get_cell_by_position(document
, 0, 2, 0).getString(), "C")
39 self
.xUITest
.executeCommand(".uno:Redo")
40 self
.assertEqual(get_cell_by_position(document
, 0, 3, 0).getString(), "C")
42 self
.ui_test
.close_doc()
43 # vim: set shiftwidth=4 softtabstop=4 expandtab: