tdf#154285 Check upper bound of arguments in SbRtl_Minute function
[LibreOffice.git] / sw / qa / uitest / writer_tests2 / tdf146375.py
blob7abc7db852153cf7375ccad13304d9e4de2103f5
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/.
10 from uitest.framework import UITestCase
11 from uitest.uihelper.common import get_state_as_dict, select_by_text
12 from libreoffice.uno.propertyvalue import mkPropertyValues
13 import random
14 import string
16 class Tdf146375(UITestCase):
18 def test_tdf146375(self):
19 with self.ui_test.create_doc_in_start_center("writer"):
21 count = 0
22 # Use a random name
23 categoryName = ''.join(random.choice(string.ascii_lowercase) for i in range(15))
24 renamedCategory = categoryName + "-renamed"
26 with self.ui_test.execute_dialog_through_command(".uno:NewDoc", close_button="close") as xDialog:
27 xFilterFolder = xDialog.getChild("filter_folder")
28 self.assertEqual("All Categories", get_state_as_dict(xFilterFolder)["SelectEntryText"])
29 count = int(get_state_as_dict(xFilterFolder)["EntryCount"])
31 xActionMenu = xDialog.getChild("action_menu")
33 # Create a new category
34 with self.ui_test.execute_blocking_action(
35 xActionMenu.executeAction, args=('OPENFROMLIST', mkPropertyValues({"POS": "0"}))) as xNameDialog:
36 xEntry = xNameDialog.getChild("entry")
37 xEntry.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
38 xEntry.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
39 xEntry.executeAction("TYPE", mkPropertyValues({"TEXT": categoryName}))
41 self.assertEqual(count + 1, int(get_state_as_dict(xFilterFolder)["EntryCount"]))
43 select_by_text(xFilterFolder, categoryName)
44 self.assertEqual(categoryName, get_state_as_dict(xFilterFolder)["SelectEntryText"])
46 # Rename the category
47 with self.ui_test.execute_blocking_action(
48 xActionMenu.executeAction, args=('OPENFROMLIST', mkPropertyValues({"POS": "1"}))) as xNameDialog:
49 xEntry = xNameDialog.getChild("entry")
50 xEntry.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
51 xEntry.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
52 xEntry.executeAction("TYPE", mkPropertyValues({"TEXT": renamedCategory}))
54 self.assertEqual(count + 1, int(get_state_as_dict(xFilterFolder)["EntryCount"]))
55 self.assertEqual(renamedCategory, get_state_as_dict(xFilterFolder)["SelectEntryText"])
57 with self.ui_test.execute_dialog_through_command(".uno:NewDoc", close_button="close") as xDialog:
58 xFilterFolder = xDialog.getChild("filter_folder")
59 self.assertEqual(count + 1, int(get_state_as_dict(xFilterFolder)["EntryCount"]))
61 select_by_text(xFilterFolder, renamedCategory)
63 # Without the fix in place, this test would have failed with
64 # AssertionError: 'zwpyzgwuwleanap-renamed' != 'All Categories'
65 self.assertEqual(renamedCategory, get_state_as_dict(xFilterFolder)["SelectEntryText"])
67 xActionMenu = xDialog.getChild("action_menu")
69 # Delete the category
70 with self.ui_test.execute_blocking_action(
71 xActionMenu.executeAction, args=('OPENFROMLIST', mkPropertyValues({"POS": "2"})), close_button="yes") as xNameDialog:
72 pass
74 self.assertEqual(count, int(get_state_as_dict(xFilterFolder)["EntryCount"]))
76 # vim: set shiftwidth=4 softtabstop=4 expandtab: