tdf#154285 Check upper bound of arguments in SbRtl_Minute function
[LibreOffice.git] / sc / qa / uitest / validity / validity.py
blob158b3905eabaf86b2583f9c065fcd98318373473
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
13 from libreoffice.uno.propertyvalue import mkPropertyValues
16 class validity(UITestCase):
17 def test_validity_tab_criteria(self):
18 with self.ui_test.create_doc_in_start_center("calc"):
19 xCalcDoc = self.xUITest.getTopFocusWindow()
20 gridwin = xCalcDoc.getChild("grid_window")
21 gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
23 with self.ui_test.execute_dialog_through_command(".uno:Validation") as xDialog:
24 xTabs = xDialog.getChild("tabcontrol")
25 select_pos(xTabs, "0")
26 xallow = xDialog.getChild("allow")
27 xallowempty = xDialog.getChild("allowempty")
28 xdata = xDialog.getChild("data")
29 xmin = xDialog.getChild("min")
30 xmax = xDialog.getChild("max")
32 select_by_text(xallow, "Integer")
33 xallowempty.executeAction("CLICK", tuple())
34 select_by_text(xdata, "valid range")
35 xmin.executeAction("TYPE", mkPropertyValues({"TEXT":"1"}))
36 xmax.executeAction("TYPE", mkPropertyValues({"TEXT":"2"}))
37 #reopen and verify
38 with self.ui_test.execute_dialog_through_command(".uno:Validation", close_button="cancel") as xDialog:
39 xallow = xDialog.getChild("allow")
40 xallowempty = xDialog.getChild("allowempty")
41 xdata = xDialog.getChild("data")
42 xmin = xDialog.getChild("min")
43 xmax = xDialog.getChild("max")
45 self.assertEqual(get_state_as_dict(xallow)["SelectEntryText"], "Integer")
46 self.assertEqual(get_state_as_dict(xallowempty)["Selected"], "false")
47 self.assertEqual(get_state_as_dict(xdata)["SelectEntryText"], "valid range")
48 self.assertEqual(get_state_as_dict(xmin)["Text"], "1")
49 self.assertEqual(get_state_as_dict(xmax)["Text"], "2")
52 def test_validity_tab_inputHelp(self):
53 #validationhelptabpage.ui
54 with self.ui_test.create_doc_in_start_center("calc"):
55 xCalcDoc = self.xUITest.getTopFocusWindow()
56 gridwin = xCalcDoc.getChild("grid_window")
57 gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
59 with self.ui_test.execute_dialog_through_command(".uno:Validation") as xDialog:
60 xTabs = xDialog.getChild("tabcontrol")
61 select_pos(xTabs, "1")
62 xtsbhelp = xDialog.getChild("tsbhelp")
63 xtitle = xDialog.getChild("title")
64 xinputhelp = xDialog.getChild("inputhelp_text")
66 xtsbhelp.executeAction("CLICK", tuple())
67 xtitle.executeAction("TYPE", mkPropertyValues({"TEXT":"A"}))
68 xinputhelp.executeAction("TYPE", mkPropertyValues({"TEXT":"B"}))
69 #reopen and verify
70 with self.ui_test.execute_dialog_through_command(".uno:Validation") as xDialog:
71 xTabs = xDialog.getChild("tabcontrol")
72 xtsbhelp = xDialog.getChild("tsbhelp")
73 xtitle = xDialog.getChild("title")
74 xinputhelp = xDialog.getChild("inputhelp_text")
75 select_pos(xTabs, "1")
76 self.assertEqual(get_state_as_dict(xtsbhelp)["Selected"], "true")
77 self.assertEqual(get_state_as_dict(xtitle)["Text"], "A")
78 self.assertEqual(get_state_as_dict(xinputhelp)["Text"], "B")
81 def test_validity_tab_errorAlert(self):
82 # erroralerttabpage.ui
83 with self.ui_test.create_doc_in_start_center("calc"):
84 xCalcDoc = self.xUITest.getTopFocusWindow()
85 gridwin = xCalcDoc.getChild("grid_window")
86 gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
88 with self.ui_test.execute_dialog_through_command(".uno:Validation") as xDialog:
89 xTabs = xDialog.getChild("tabcontrol")
90 select_pos(xTabs, "2")
92 xactionCB = xDialog.getChild("actionCB")
93 xerroralerttitle = xDialog.getChild("erroralert_title")
94 xerrorMsg = xDialog.getChild("errorMsg")
96 select_by_text(xactionCB, "Warning")
97 xerroralerttitle.executeAction("TYPE", mkPropertyValues({"TEXT":"Warn"}))
98 xerrorMsg.executeAction("TYPE", mkPropertyValues({"TEXT":"Warn2"}))
99 #reopen and verify
100 with self.ui_test.execute_dialog_through_command(".uno:Validation") as xDialog:
101 xTabs = xDialog.getChild("tabcontrol")
102 select_pos(xTabs, "2")
104 xactionCB = xDialog.getChild("actionCB")
105 xerroralerttitle = xDialog.getChild("erroralert_title")
106 xerrorMsg = xDialog.getChild("errorMsg")
108 self.assertEqual(get_state_as_dict(xactionCB)["SelectEntryText"], "Warning")
109 self.assertEqual(get_state_as_dict(xerroralerttitle)["Text"], "Warn")
110 self.assertEqual(get_state_as_dict(xerrorMsg)["Text"], "Warn2")
114 # vim: set shiftwidth=4 softtabstop=4 expandtab: