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
.common
import select_by_text
, select_pos
12 from uitest
.uihelper
.calc
import enter_text_to_cell
14 from libreoffice
.uno
.propertyvalue
import mkPropertyValues
17 # Bug 53920 - EDITING: Data Validity Cell Range not being applied to multiple selected cells
18 class tdf53920(UITestCase
):
19 def test_tdf53920_validity_multiple_cells(self
):
20 with self
.ui_test
.create_doc_in_start_center("calc"):
21 xCalcDoc
= self
.xUITest
.getTopFocusWindow()
22 gridwin
= xCalcDoc
.getChild("grid_window")
23 gridwin
.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
24 #. Provide the desired values in a range of cells
25 enter_text_to_cell(gridwin
, "C1", "A")
26 enter_text_to_cell(gridwin
, "C2", "B")
27 enter_text_to_cell(gridwin
, "C3", "C")
28 #Select the cells to be validated
29 gridwin
.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
30 gridwin
.executeAction("SELECT", mkPropertyValues({"CELL": "A3", "EXTEND":"1"}))
31 gridwin
.executeAction("SELECT", mkPropertyValues({"CELL": "A5", "EXTEND":"1"}))
32 #Apply Data > Validity ... > Cell Range
33 with self
.ui_test
.execute_dialog_through_command(".uno:Validation") as xDialog
:
34 xTabs
= xDialog
.getChild("tabcontrol")
35 select_pos(xTabs
, "0")
36 xallow
= xDialog
.getChild("allow")
37 xmin
= xDialog
.getChild("min")
39 select_by_text(xallow
, "Cell range")
40 xmin
.executeAction("TYPE", mkPropertyValues({"TEXT":"$Sheet1.$C$1:$C$3"}))
42 #Expected behavior: All selected cells validate data.
43 gridwin
.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
44 with self
.ui_test
.execute_dialog_through_command(".uno:Validation") as xDialog
:
45 xallow
= xDialog
.getChild("allow")
46 xmin
= xDialog
.getChild("min")
47 self
.assertEqual(get_state_as_dict(xallow
)["SelectEntryText"], "Cell range")
48 self
.assertEqual(get_state_as_dict(xmin
)["Text"], "$Sheet1.$C$1:$C$3")
50 gridwin
.executeAction("SELECT", mkPropertyValues({"CELL": "A3"}))
51 with self
.ui_test
.execute_dialog_through_command(".uno:Validation") as xDialog
:
52 xallow
= xDialog
.getChild("allow")
53 xmin
= xDialog
.getChild("min")
54 self
.assertEqual(get_state_as_dict(xallow
)["SelectEntryText"], "Cell range")
55 self
.assertEqual(get_state_as_dict(xmin
)["Text"], "$Sheet1.$C$1:$C$3")
57 gridwin
.executeAction("SELECT", mkPropertyValues({"CELL": "A5"}))
58 with self
.ui_test
.execute_dialog_through_command(".uno:Validation") as xDialog
:
59 xallow
= xDialog
.getChild("allow")
60 xmin
= xDialog
.getChild("min")
61 self
.assertEqual(get_state_as_dict(xallow
)["SelectEntryText"], "Cell range")
62 self
.assertEqual(get_state_as_dict(xmin
)["Text"], "$Sheet1.$C$1:$C$3")
65 # vim: set shiftwidth=4 softtabstop=4 expandtab: