Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / sd / qa / uitest / impress_tests / customSlideShow.py
blobf070a1ca1cdab14522c4a0dcc9e50422d57b8b85
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 libreoffice.uno.propertyvalue import mkPropertyValues
12 import importlib
13 from uitest.uihelper.common import select_pos
14 from uitest.uihelper.common import get_state_as_dict, type_text
16 class customSlideShow(UITestCase):
17 def test_customSlideShow(self):
18 with self.ui_test.create_doc_in_start_center("impress"):
19 MainWindow = self.xUITest.getTopFocusWindow()
20 TemplateDialog = self.xUITest.getTopFocusWindow()
21 cancel = TemplateDialog.getChild("close")
22 self.ui_test.close_dialog_through_button(cancel)
23 with self.ui_test.execute_dialog_through_command(".uno:CustomShowDialog") as CustomSlideShows:
24 new = CustomSlideShows.getChild("new")
26 with self.ui_test.execute_blocking_action(new.executeAction, args=('CLICK', ())) as DefineCustomSlideShow:
27 customname = DefineCustomSlideShow.getChild("customname")
28 customname.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"}))
29 customname.executeAction("TYPE", mkPropertyValues({"TEXT": "a"}))
30 customname.executeAction("TYPE", mkPropertyValues({"TEXT": "a"}))
31 pages = DefineCustomSlideShow.getChild("pages")
32 xEntry = pages.getChild("0")
33 xEntry.executeAction("SELECT", tuple())
34 add = DefineCustomSlideShow.getChild("add")
35 add.executeAction("CLICK",tuple())
37 #verify
38 with self.ui_test.execute_dialog_through_command(".uno:CustomShowDialog") as CustomSlideShows:
39 edit = CustomSlideShows.getChild("edit")
40 customshowlist = CustomSlideShows.getChild("customshowlist")
41 self.assertEqual(get_state_as_dict(customshowlist)["SelectionCount"], "1")
43 with self.ui_test.execute_blocking_action(edit.executeAction, args=('CLICK', ()), close_button="cancel") as DefineCustomSlideShow:
44 customname = DefineCustomSlideShow.getChild("customname")
45 self.assertEqual(get_state_as_dict(customname)["Text"], "aa")
46 custompages = DefineCustomSlideShow.getChild("custompages")
47 pages = DefineCustomSlideShow.getChild("pages")
48 remove = DefineCustomSlideShow.getChild("remove")
49 self.assertEqual(get_state_as_dict(custompages)["Children"], "1")
50 self.assertEqual(get_state_as_dict(pages)["Children"], "1")
51 xEntry = custompages.getChild("0")
52 xEntry.executeAction("SELECT", tuple())
53 # remove.executeAction("CLICK",tuple()) #tdf126951
54 self.assertEqual(get_state_as_dict(custompages)["Children"], "1")
55 self.assertEqual(get_state_as_dict(pages)["Children"], "1")
57 delete = CustomSlideShows.getChild("delete")
58 customshowlist = CustomSlideShows.getChild("customshowlist")
59 self.assertEqual(get_state_as_dict(customshowlist)["Children"], "1")
61 # delete.executeAction("CLICK",tuple())
62 # self.assertEqual(get_state_as_dict(customshowlist)["Children"], "0")
64 def test_tdf143125(self):
65 with self.ui_test.create_doc_in_start_center("impress"):
66 MainWindow = self.xUITest.getTopFocusWindow()
67 TemplateDialog = self.xUITest.getTopFocusWindow()
68 cancel = TemplateDialog.getChild("close")
69 self.ui_test.close_dialog_through_button(cancel)
70 with self.ui_test.execute_dialog_through_command(".uno:CustomShowDialog") as CustomSlideShows:
71 # Without the fix in place, this test would have crashed here
72 pass
74 # vim: set shiftwidth=4 softtabstop=4 expandtab: