Debian Codegraph @

sd/qa/uitest/impress_tests/renameSlide.py

raw
1 # -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
2 #
3 # This file is part of the LibreOffice project.
4 #
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/.
8 #
9
10 from uitest.framework import UITestCase
11 from libreoffice.uno.propertyvalue import mkPropertyValues
12 from uitest.uihelper.common import get_state_as_dict
13
14 class renameSlide(UITestCase):
15
16 def test_rename_slide(self):
17 with self.ui_test.create_doc_in_start_center("impress"):
18 xTemplateDlg = self.xUITest.getTopFocusWindow()
19 xCancelBtn = xTemplateDlg.getChild("close")
20 self.ui_test.close_dialog_through_button(xCancelBtn)
21
22 with self.ui_test.execute_dialog_through_command(".uno:RenamePage") as xDialog:
23
24 name_entry = xDialog.getChild("name_entry")
25 name_entry.executeAction("TYPE", mkPropertyValues({"TEXT":"NewName"}))
26
27
28 #verify
29 with self.ui_test.execute_dialog_through_command(".uno:RenamePage") as xDialog:
30
31 name_entry = xDialog.getChild("name_entry")
32 self.assertEqual(get_state_as_dict(name_entry)["Text"], "NewName")
33
34 self.xUITest.executeCommand(".uno:InsertPage")
35
36 with self.ui_test.execute_dialog_through_command(".uno:RenamePage", close_button="cancel") as xDialog:
37
38 xOKBtn = xDialog.getChild("ok")
39 self.assertEqual("true", get_state_as_dict(xOKBtn)['Enabled'])
40
41 name_entry = xDialog.getChild("name_entry")
42 name_entry.executeAction("TYPE", mkPropertyValues({"TEXT":"NewName"}))
43
44 self.assertEqual("false", get_state_as_dict(xOKBtn)['Enabled'])
45
46
47 # vim: set shiftwidth=4 softtabstop=4 expandtab: