Version 6.4.0.3, tag libreoffice-6.4.0.3
[LibreOffice.git] / sc / qa / uitest / calc_tests2 / tdf118189.py
blobed33b20bcbee71fe2dbe7c97510c77fc0d44f267
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 uitest.uihelper.common import get_state_as_dict
9 from uitest.uihelper.common import select_pos
10 from uitest.uihelper.calc import enter_text_to_cell
11 from uitest.debug import sleep
12 from libreoffice.calc.document import get_cell_by_position
13 from libreoffice.uno.propertyvalue import mkPropertyValues
14 import org.libreoffice.unotest
15 import pathlib
17 def get_url_for_data_file(file_name):
18 return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri()
20 #Bug 118189 - EDITING Crashes on Undo after Cut conditional formatting data
22 class tdf118189(UITestCase):
23 def test_tdf118189(self):
24 calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf118189.xlsx"))
25 xCalcDoc = self.xUITest.getTopFocusWindow()
26 gridwin = xCalcDoc.getChild("grid_window")
27 document = self.ui_test.get_component()
28 #1. Open attached document
29 #2. Copy Column A
30 gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
31 self.xUITest.executeCommand(".uno:SelectColumn")
32 self.xUITest.executeCommand(".uno:Copy")
33 #3. New Spreadsheet
34 calc_doc2 = self.ui_test.load_file(get_url_for_data_file("emptyFile.ods"))
35 gridwin2 = xCalcDoc.getChild("grid_window")
36 document2 = self.ui_test.get_component()
38 frames = self.ui_test.get_frames()
39 frames[1].activate()
40 #4. Paste it
41 gridwin2.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
42 self.xUITest.executeCommand(".uno:Paste")
43 #5. Cut it
44 self.xUITest.executeCommand(".uno:Cut")
45 #6. Undo
46 self.xUITest.executeCommand(".uno:Undo")
48 #-> CRASH
49 self.assertEqual(get_cell_by_position(document2, 0, 0, 0).getString(), "")
51 self.ui_test.close_doc()
53 # vim: set shiftwidth=4 softtabstop=4 expandtab: