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/.
9 from uitest
.framework
import UITestCase
10 from uitest
.uihelper
.common
import get_url_for_data_file
11 from libreoffice
.calc
.document
import get_cell_by_position
12 from libreoffice
.uno
.propertyvalue
import mkPropertyValues
14 #Bug 31805 - Deleting a column or row from merged cells
16 class tdf31805(UITestCase
):
17 def test_tdf31805_delete_column_merged(self
):
18 with self
.ui_test
.load_file(get_url_for_data_file("tdf31805.ods")) as calc_doc
:
19 xCalcDoc
= self
.xUITest
.getTopFocusWindow()
20 gridwin
= xCalcDoc
.getChild("grid_window")
23 #3. Menu 'edit -> Delete Cell - Delete entire Column'
24 #expected: Column with cell containing "g" will be deleted,
25 # a merged cell range will remain left row 1
27 gridwin
.executeAction("SELECT", mkPropertyValues({"CELL": "G1"}))
28 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 2, 4).getIsMerged(), True)
29 self
.xUITest
.executeCommand(".uno:DeleteColumns")
30 #verify. C5:F11 should be merged
31 #isMerged returns true if this cell is merged with another cell.
32 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 2, 4).getIsMerged(), True) #C5
33 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 6, 4).getIsMerged(), False) #G5
34 gridwin
.executeAction("SELECT", mkPropertyValues({"CELL": "A11"}))
35 self
.xUITest
.executeCommand(".uno:DeleteRows")
36 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 2, 4).getIsMerged(), True) #C5
37 gridwin
.executeAction("SELECT", mkPropertyValues({"CELL": "D1"}))
38 self
.xUITest
.executeCommand(".uno:DeleteColumns")
39 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 2, 4).getIsMerged(), True) #C5
41 # vim: set shiftwidth=4 softtabstop=4 expandtab: