nss: upgrade to release 3.73
[LibreOffice.git] / sc / qa / uitest / validity / tdf96698.py
blobc219e044478d58ff3338832cb733545be257a7b9
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 96698 - Data => Validity => Custom (like Excel) is missing
14 class tdf96698(UITestCase):
15 def test_tdf96698_validity_custom_formula(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()
21 #A general validity check for the entered new content of the active cell - especially for text
22 #with a custom formula like in Excel is not possible.
23 gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A2"}))
24 self.ui_test.execute_dialog_through_command(".uno:Validation")
25 xDialog = self.xUITest.getTopFocusWindow()
26 xTabs = xDialog.getChild("tabcontrol")
27 select_pos(xTabs, "0")
28 xallow = xDialog.getChild("allow")
29 xallowempty = xDialog.getChild("allowempty")
30 xmin = xDialog.getChild("min")
32 props = {"TEXT": "Custom"}
33 actionProps = mkPropertyValues(props)
34 xallow.executeAction("SELECT", actionProps)
35 xmin.executeAction("TYPE", mkPropertyValues({"TEXT":"ISERROR(FIND(\",\",B2))"}))
36 xOKBtn = xDialog.getChild("ok")
37 self.ui_test.close_dialog_through_button(xOKBtn)
38 #verify
39 self.ui_test.execute_dialog_through_command(".uno:Validation")
40 xDialog = self.xUITest.getTopFocusWindow()
41 xallow = xDialog.getChild("allow")
42 xallowempty = xDialog.getChild("allowempty")
43 xmin = xDialog.getChild("min")
45 self.assertEqual(get_state_as_dict(xallow)["SelectEntryText"], "Custom")
46 self.assertEqual(get_state_as_dict(xmin)["Text"], "ISERROR(FIND(\",\",B2))")
48 xOKBtn = xDialog.getChild("ok")
49 self.ui_test.close_dialog_through_button(xOKBtn)
51 gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A3"}))
52 self.ui_test.execute_dialog_through_command(".uno:Validation")
53 xDialog = self.xUITest.getTopFocusWindow()
54 xTabs = xDialog.getChild("tabcontrol")
55 select_pos(xTabs, "0")
56 xallow = xDialog.getChild("allow")
57 xallowempty = xDialog.getChild("allowempty")
58 xmin = xDialog.getChild("min")
60 props = {"TEXT": "Custom"}
61 actionProps = mkPropertyValues(props)
62 xallow.executeAction("SELECT", actionProps)
63 xmin.executeAction("TYPE", mkPropertyValues({"TEXT":"NOT(ISERROR(B3))"}))
64 xOKBtn = xDialog.getChild("ok")
65 self.ui_test.close_dialog_through_button(xOKBtn)
66 #verify
67 self.ui_test.execute_dialog_through_command(".uno:Validation")
68 xDialog = self.xUITest.getTopFocusWindow()
69 xallow = xDialog.getChild("allow")
70 xallowempty = xDialog.getChild("allowempty")
71 xmin = xDialog.getChild("min")
73 self.assertEqual(get_state_as_dict(xallow)["SelectEntryText"], "Custom")
74 self.assertEqual(get_state_as_dict(xmin)["Text"], "NOT(ISERROR(B3))")
76 xOKBtn = xDialog.getChild("ok")
77 self.ui_test.close_dialog_through_button(xOKBtn)
79 gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A7"}))
80 self.ui_test.execute_dialog_through_command(".uno:Validation")
81 xDialog = self.xUITest.getTopFocusWindow()
82 xTabs = xDialog.getChild("tabcontrol")
83 select_pos(xTabs, "0")
84 xallow = xDialog.getChild("allow")
85 xallowempty = xDialog.getChild("allowempty")
86 xmin = xDialog.getChild("min")
88 props = {"TEXT": "Custom"}
89 actionProps = mkPropertyValues(props)
90 xallow.executeAction("SELECT", actionProps)
91 xmin.executeAction("TYPE", mkPropertyValues({"TEXT":"ISERROR(FIND(\",\",A7))"}))
92 xOKBtn = xDialog.getChild("ok")
93 self.ui_test.close_dialog_through_button(xOKBtn)
94 #verify
95 self.ui_test.execute_dialog_through_command(".uno:Validation")
96 xDialog = self.xUITest.getTopFocusWindow()
97 xallow = xDialog.getChild("allow")
98 xallowempty = xDialog.getChild("allowempty")
99 xmin = xDialog.getChild("min")
101 self.assertEqual(get_state_as_dict(xallow)["SelectEntryText"], "Custom")
102 self.assertEqual(get_state_as_dict(xmin)["Text"], "ISERROR(FIND(\",\",A7))")
104 xOKBtn = xDialog.getChild("ok")
105 self.ui_test.close_dialog_through_button(xOKBtn)
107 gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A8"}))
108 self.ui_test.execute_dialog_through_command(".uno:Validation")
109 xDialog = self.xUITest.getTopFocusWindow()
110 xTabs = xDialog.getChild("tabcontrol")
111 select_pos(xTabs, "0")
112 xallow = xDialog.getChild("allow")
113 xallowempty = xDialog.getChild("allowempty")
114 xmin = xDialog.getChild("min")
116 props = {"TEXT": "Custom"}
117 actionProps = mkPropertyValues(props)
118 xallow.executeAction("SELECT", actionProps)
119 xmin.executeAction("TYPE", mkPropertyValues({"TEXT":"NOT(ISERROR(A8))"}))
120 xOKBtn = xDialog.getChild("ok")
121 self.ui_test.close_dialog_through_button(xOKBtn)
122 #verify
123 self.ui_test.execute_dialog_through_command(".uno:Validation")
124 xDialog = self.xUITest.getTopFocusWindow()
125 xallow = xDialog.getChild("allow")
126 xallowempty = xDialog.getChild("allowempty")
127 xmin = xDialog.getChild("min")
129 self.assertEqual(get_state_as_dict(xallow)["SelectEntryText"], "Custom")
130 self.assertEqual(get_state_as_dict(xmin)["Text"], "NOT(ISERROR(A8))")
132 xOKBtn = xDialog.getChild("ok")
133 self.ui_test.close_dialog_through_button(xOKBtn)
135 self.ui_test.close_doc()
137 # vim: set shiftwidth=4 softtabstop=4 expandtab: