summaryrefslogtreecommitdiffstats
path: root/sc/qa/uitest/calc_tests7/tdf91425.py
blob: cacd967266467edee5eecdcbc128c69756d49245 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

from uitest.framework import UITestCase
from libreoffice.uno.propertyvalue import mkPropertyValues
from uitest.uihelper.common import get_state_as_dict, type_text
from libreoffice.calc.document import get_cell_by_position
import time
from uitest.debug import sleep
import org.libreoffice.unotest
import pathlib


#Bug 91425 - CRASH - Calc Insert Columns Left

def get_url_for_data_file(file_name):
    return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri()

class tdf91425(UITestCase):
   def test_tdf91425_insert_columns_left(self):
        calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf91425.ods"))
        xCalcDoc = self.xUITest.getTopFocusWindow()
        gridwin = xCalcDoc.getChild("grid_window")
        document = self.ui_test.get_component()
        #1) Open test file provided in report
        #2) Move mouse pointer over Column A header, the right mouse button click
        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
        #3) Insert columns left
        self.xUITest.executeCommand(".uno:InsertColumnsBefore")
        #verify
        self.assertEqual(get_cell_by_position(document, 0, 3, 0).getString(), "C")
        #undo
        self.xUITest.executeCommand(".uno:Undo")
        self.assertEqual(get_cell_by_position(document, 0, 2, 0).getString(), "C")
        #redo
        self.xUITest.executeCommand(".uno:Redo")
        self.assertEqual(get_cell_by_position(document, 0, 3, 0).getString(), "C")

        self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab: