Version 6.4.0.3, tag libreoffice-6.4.0.3
[LibreOffice.git] / sc / qa / uitest / calc_tests7 / tdf31805.py
blob76d30cf221df9f9e3261f532d2432ae95a04925a
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 libreoffice.calc.document import get_cell_by_position
12 from libreoffice.uno.propertyvalue import mkPropertyValues
13 import org.libreoffice.unotest
14 import pathlib
16 #Bug 31805 - Deleting a column or row from merged cells
17 def get_url_for_data_file(file_name):
18 return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri()
20 class tdf31805(UITestCase):
21 def test_tdf31805_delete_column_merged(self):
22 calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf31805.ods"))
23 xCalcDoc = self.xUITest.getTopFocusWindow()
24 gridwin = xCalcDoc.getChild("grid_window")
25 document = self.ui_test.get_component()
26 #1. open "sample.ods"
27 #2. click 'G1'
28 #3. Menu 'edit -> Delete Cell - Delete entire Column'
29 #expected: Column with cell containing "g" will be deleted,
30 # a merged cell range will remain left row 1
32 gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "G1"}))
33 self.assertEqual(get_cell_by_position(document, 0, 2, 4).getIsMerged(), True)
34 self.xUITest.executeCommand(".uno:DeleteColumns")
35 #verify. C5:F11 should be merged
36 #isMerged returns true if this cell is merged with another cell.
37 self.assertEqual(get_cell_by_position(document, 0, 2, 4).getIsMerged(), True) #C5
38 self.assertEqual(get_cell_by_position(document, 0, 6, 4).getIsMerged(), False) #G5
39 gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A11"}))
40 self.xUITest.executeCommand(".uno:DeleteRows")
41 self.assertEqual(get_cell_by_position(document, 0, 2, 4).getIsMerged(), True) #C5
42 gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D1"}))
43 self.xUITest.executeCommand(".uno:DeleteColumns")
44 self.assertEqual(get_cell_by_position(document, 0, 2, 4).getIsMerged(), True) #C5
45 self.ui_test.close_doc()
47 # vim: set shiftwidth=4 softtabstop=4 expandtab: