Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / sd / qa / uitest / impress_tests / autocorrectOptions.py
blobd291b67969afce1fb4218486859731ab1b3fd1d1
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 libreoffice.uno.propertyvalue import mkPropertyValues
9 from uitest.uihelper.common import get_state_as_dict
10 import time
11 from uitest.config import MAX_WAIT
12 from uitest.debug import sleep
13 from uitest.uihelper.common import select_pos
15 class autocorrectOptions(UITestCase):
17 def test_autocorrect_options_impress(self):
18 self.ui_test.create_doc_in_start_center("impress")
19 xTemplateDlg = self.xUITest.getTopFocusWindow()
20 xCancelBtn = xTemplateDlg.getChild("cancel")
21 self.ui_test.close_dialog_through_button(xCancelBtn)
22 document = self.ui_test.get_component()
24 self.ui_test.execute_dialog_through_command(".uno:AutoCorrectDlg", maxWait=10*MAX_WAIT)
25 xDialog = self.xUITest.getTopFocusWindow()
26 xTabs = xDialog.getChild("tabcontrol")
27 select_pos(xTabs, "0") #tab replace
28 origtext = xDialog.getChild("origtext")
29 newtext = xDialog.getChild("newtext")
30 xnew = xDialog.getChild("new")
31 xdelete = xDialog.getChild("delete")
32 xtabview = xDialog.getChild("tabview")
33 xreset = xDialog.getChild("reset")
34 nrRows = get_state_as_dict(xtabview)["VisibleCount"]
36 #add new rule
37 origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
38 origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
39 origtext.executeAction("TYPE", mkPropertyValues({"TEXT":"::::"}))
40 newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
41 newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
42 newtext.executeAction("TYPE", mkPropertyValues({"TEXT":"dvojtecky"}))
43 xnew.executeAction("CLICK", tuple())
44 nrRowsNew = get_state_as_dict(xtabview)["VisibleCount"]
45 nrRowsDiff = int(nrRowsNew) - int(nrRows)
46 self.assertEqual(nrRowsDiff, 1) #we have +1 rule
47 #delete rule
48 origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
49 origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
50 origtext.executeAction("TYPE", mkPropertyValues({"TEXT":"::::"}))
51 newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
52 newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
53 newtext.executeAction("TYPE", mkPropertyValues({"TEXT":"dvojtecky"}))
54 xdelete.executeAction("CLICK", tuple())
55 self.assertEqual(get_state_as_dict(xtabview)["VisibleCount"], nrRows) #we have default nr of rules
57 select_pos(xTabs, "1") #tab Exceptions
58 #abbreviations
59 abbrev = xDialog.getChild("abbrev")
60 newabbrev = xDialog.getChild("newabbrev")
61 delabbrev = xDialog.getChild("delabbrev")
62 abbrevlist = xDialog.getChild("abbrevlist")
64 nrRowsAbb = get_state_as_dict(abbrevlist)["Children"]
65 abbrev.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
66 abbrev.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
67 abbrev.executeAction("TYPE", mkPropertyValues({"TEXT":"qqqqq"}))
68 newabbrev.executeAction("CLICK", tuple())
69 nrRowsAbbNew = get_state_as_dict(abbrevlist)["Children"]
70 nrRowsAbbDiff = int(nrRowsAbbNew) - int(nrRowsAbb)
71 self.assertEqual(nrRowsAbbDiff, 1) #we have +1 rule
72 delabbrev.executeAction("CLICK", tuple())
73 self.assertEqual(get_state_as_dict(abbrevlist)["Children"], nrRowsAbb) #we have default nr of rules
75 #words with two initial capitals
76 double = xDialog.getChild("double")
77 newdouble = xDialog.getChild("newdouble")
78 deldouble = xDialog.getChild("deldouble")
79 doublelist = xDialog.getChild("doublelist")
81 nrRowsDouble = get_state_as_dict(doublelist)["Children"]
82 double.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
83 double.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
84 double.executeAction("TYPE", mkPropertyValues({"TEXT":"QQqqq"}))
85 newdouble.executeAction("CLICK", tuple())
86 nrRowsDoubleNew = get_state_as_dict(doublelist)["Children"]
87 nrRowsDoubleDiff = int(nrRowsDoubleNew) - int(nrRowsDouble) #convert string and
88 self.assertEqual(nrRowsDoubleDiff, 1) #we have +1 rule
89 deldouble.executeAction("CLICK", tuple())
90 self.assertEqual(get_state_as_dict(doublelist)["Children"], nrRowsDouble) #we have default nr of rules
92 xCancelButton = xDialog.getChild("cancel")
93 xCancelButton.executeAction("CLICK", tuple())
95 self.ui_test.close_doc()
97 # vim: set shiftwidth=4 softtabstop=4 expandtab: