Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / uitest / writer_tests / customizeDialog.py
blob9d2311eb46a64a7f7643768f890e933ea3d1c4e2
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 import time
9 from uitest.framework import UITestCase
10 from libreoffice.uno.propertyvalue import mkPropertyValues
11 from uitest.uihelper.common import get_state_as_dict
12 from uitest.uihelper.common import select_pos
13 from uitest.debug import sleep
15 class ConfigureDialog(UITestCase):
17 def test_open_ConfigureDialog_writer(self):
19 self.ui_test.create_doc_in_start_center("writer")
20 self.ui_test.execute_dialog_through_command(".uno:ConfigureDialog")
21 xDialog = self.xUITest.getTopFocusWindow()
23 xcancBtn = xDialog.getChild("cancel")
24 xcancBtn.executeAction("CLICK", tuple())
26 self.ui_test.close_doc()
28 def test_search_filter(self):
29 self.ui_test.create_doc_in_start_center("writer")
30 self.ui_test.execute_dialog_through_command(".uno:ConfigureDialog")
31 xDialog = self.xUITest.getTopFocusWindow()
33 xfunc = xDialog.getChild("functions")
34 xSearch = xDialog.getChild("searchEntry")
36 initialEntryCount = get_state_as_dict(xfunc)["Children"]
37 self.assertTrue(initialEntryCount is not 0)
39 xSearch.executeAction("SET", mkPropertyValues({"TEXT":"format"}))
41 # Wait for the search/filter op to be completed
42 time.sleep(1)
44 filteredEntryCount = get_state_as_dict(xfunc)["Children"]
45 self.assertTrue(filteredEntryCount < initialEntryCount)
47 xSearch.executeAction("CLEAR", tuple())
49 # Wait for the search/filter op to be completed
50 time.sleep(1)
52 finalEntryCount = get_state_as_dict(xfunc)["Children"]
53 self.assertEqual(initialEntryCount, finalEntryCount)
56 xcancBtn = xDialog.getChild("cancel") #button Cancel
57 xcancBtn.executeAction("CLICK", tuple()) #click the button
59 self.ui_test.close_doc()
61 def test_category_listbox(self):
62 self.ui_test.create_doc_in_start_center("writer")
63 self.ui_test.execute_dialog_through_command(".uno:ConfigureDialog")
64 xDialog = self.xUITest.getTopFocusWindow()
66 xFunc = xDialog.getChild("functions")
67 xCategory = xDialog.getChild("commandcategorylist")
69 initialEntryCount = get_state_as_dict(xFunc)["Children"]
70 self.assertTrue(initialEntryCount is not 0)
72 select_pos(xCategory, "1")
73 filteredEntryCount = get_state_as_dict(xFunc)["Children"]
74 self.assertTrue(filteredEntryCount < initialEntryCount)
76 select_pos(xCategory, "0")
77 finalEntryCount = get_state_as_dict(xFunc)["Children"]
78 self.assertEqual(initialEntryCount, finalEntryCount)
80 xcancBtn = xDialog.getChild("cancel") #button Cancel
81 xcancBtn.executeAction("CLICK", tuple()) #click the button
83 self.ui_test.close_doc()
85 # vim: set shiftwidth=4 softtabstop=4 expandtab: