Avoid potential negative array index access to cached text.
[LibreOffice.git] / sc / qa / uitest / calc_tests2 / tdf117367.py
blob382873a3cca08ecb6d79f770cf507721e917458b
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_state_as_dict
11 from uitest.uihelper.calc import enter_text_to_cell
12 from libreoffice.uno.propertyvalue import mkPropertyValues
13 #Bug 117367 - FORMATTING Merge cells dialog radio buttons cannot be unselected
15 class tdf117367(UITestCase):
16 def test_tdf117367_merge_cells_radio_buttons(self):
17 with self.ui_test.create_doc_in_start_center("calc"):
18 xCalcDoc = self.xUITest.getTopFocusWindow()
19 gridwin = xCalcDoc.getChild("grid_window")
21 enter_text_to_cell(gridwin, "A1", "AAA")
22 enter_text_to_cell(gridwin, "A2", "BBB")
23 gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B4"}))
25 #Right-click - Merge cells /Select all three options
26 with self.ui_test.execute_dialog_through_command(".uno:MergeCells") as xDialog:
27 xmoveCellsRadio = xDialog.getChild("move-cells-radio")
28 xemptyCellsRadio = xDialog.getChild("empty-cells-radio")
29 xkeepContentRadio = xDialog.getChild("keep-content-radio")
30 xmoveCellsRadio.executeAction("CLICK", tuple())
31 xmoveCellsRadio.executeAction("CLICK", tuple())
32 #Issue: I think these should be exclusive, not possible to select more than one. It is also impossible to uncheck any of the buttons.
33 self.assertEqual(get_state_as_dict(xmoveCellsRadio)["Checked"], "true")
34 self.assertEqual(get_state_as_dict(xemptyCellsRadio)["Checked"], "false")
35 self.assertEqual(get_state_as_dict(xkeepContentRadio)["Checked"], "false")
37 xemptyCellsRadio.executeAction("CLICK", tuple())
38 self.assertEqual(get_state_as_dict(xmoveCellsRadio)["Checked"], "false")
39 self.assertEqual(get_state_as_dict(xemptyCellsRadio)["Checked"], "true")
40 self.assertEqual(get_state_as_dict(xkeepContentRadio)["Checked"], "false")
42 xkeepContentRadio.executeAction("CLICK", tuple())
43 self.assertEqual(get_state_as_dict(xmoveCellsRadio)["Checked"], "false")
44 self.assertEqual(get_state_as_dict(xemptyCellsRadio)["Checked"], "false")
45 self.assertEqual(get_state_as_dict(xkeepContentRadio)["Checked"], "true")
49 # vim: set shiftwidth=4 softtabstop=4 expandtab: