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 #Bug 65686 - EDITING Data > Validity broken (for list entries at least)
14 class tdf65686(UITestCase
):
15 def test_tdf65686_validity_list(self
):
16 calc_doc
= self
.ui_test
.create_doc_in_start_center("calc")
17 xCalcDoc
= self
.xUITest
.getTopFocusWindow()
18 gridwin
= xCalcDoc
.getChild("grid_window")
19 document
= self
.ui_test
.get_component()
20 gridwin
.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
23 #- Enter Entries Aap Noot Mies
25 self
.ui_test
.execute_dialog_through_command(".uno:Validation")
26 xDialog
= self
.xUITest
.getTopFocusWindow()
27 xTabs
= xDialog
.getChild("tabcontrol")
28 select_pos(xTabs
, "0")
29 xallow
= xDialog
.getChild("allow")
30 xallowempty
= xDialog
.getChild("allowempty")
31 minlist
= xDialog
.getChild("minlist")
33 props
= {"TEXT": "List"}
34 actionProps
= mkPropertyValues(props
)
35 xallow
.executeAction("SELECT", actionProps
)
36 minlist
.executeAction("TYPE", mkPropertyValues({"TEXT":"Aap"}))
37 minlist
.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
38 minlist
.executeAction("TYPE", mkPropertyValues({"TEXT":"Noot"}))
39 minlist
.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
40 minlist
.executeAction("TYPE", mkPropertyValues({"TEXT":"Mies"}))
41 xOKBtn
= xDialog
.getChild("ok")
42 self
.ui_test
.close_dialog_through_button(xOKBtn
)
43 #- again open Data > Validity
44 #> there are empty lines in the list Entries
45 self
.ui_test
.execute_dialog_through_command(".uno:Validation")
46 xDialog
= self
.xUITest
.getTopFocusWindow()
47 xallow
= xDialog
.getChild("allow")
48 xallowempty
= xDialog
.getChild("allowempty")
49 minlist
= xDialog
.getChild("minlist")
51 self
.assertEqual(get_state_as_dict(xallow
)["SelectEntryText"], "List")
52 self
.assertEqual(get_state_as_dict(minlist
)["Text"], "Aap\nNoot\nMies")
54 xOKBtn
= xDialog
.getChild("ok")
55 self
.ui_test
.close_dialog_through_button(xOKBtn
)
57 self
.ui_test
.close_doc()
59 # vim: set shiftwidth=4 softtabstop=4 expandtab: