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 from uitest
.uihelper
.common
import get_state_as_dict
14 class customSlideShow(UITestCase
):
15 def test_customSlideShow(self
):
16 with self
.ui_test
.create_doc_in_start_center("impress"):
17 TemplateDialog
= self
.xUITest
.getTopFocusWindow()
18 cancel
= TemplateDialog
.getChild("close")
19 self
.ui_test
.close_dialog_through_button(cancel
)
20 with self
.ui_test
.execute_dialog_through_command(".uno:CustomShowDialog") as CustomSlideShows
:
21 new
= CustomSlideShows
.getChild("new")
23 with self
.ui_test
.execute_blocking_action(new
.executeAction
, args
=('CLICK', ())) as DefineCustomSlideShow
:
24 customname
= DefineCustomSlideShow
.getChild("customname")
25 customname
.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"}))
26 customname
.executeAction("TYPE", mkPropertyValues({"TEXT": "a"}))
27 customname
.executeAction("TYPE", mkPropertyValues({"TEXT": "a"}))
28 pages
= DefineCustomSlideShow
.getChild("pages")
29 xEntry
= pages
.getChild("0")
30 xEntry
.executeAction("SELECT", tuple())
31 add
= DefineCustomSlideShow
.getChild("add")
32 add
.executeAction("CLICK",tuple())
35 with self
.ui_test
.execute_dialog_through_command(".uno:CustomShowDialog") as CustomSlideShows
:
36 edit
= CustomSlideShows
.getChild("edit")
37 customshowlist
= CustomSlideShows
.getChild("customshowlist")
38 self
.assertEqual(get_state_as_dict(customshowlist
)["SelectionCount"], "1")
40 with self
.ui_test
.execute_blocking_action(edit
.executeAction
, args
=('CLICK', ()), close_button
="cancel") as DefineCustomSlideShow
:
41 customname
= DefineCustomSlideShow
.getChild("customname")
42 self
.assertEqual(get_state_as_dict(customname
)["Text"], "aa")
43 custompages
= DefineCustomSlideShow
.getChild("custompages")
44 pages
= DefineCustomSlideShow
.getChild("pages")
45 self
.assertEqual(get_state_as_dict(custompages
)["Children"], "1")
46 self
.assertEqual(get_state_as_dict(pages
)["Children"], "1")
47 xEntry
= custompages
.getChild("0")
48 xEntry
.executeAction("SELECT", tuple())
49 self
.assertEqual(get_state_as_dict(custompages
)["Children"], "1")
50 self
.assertEqual(get_state_as_dict(pages
)["Children"], "1")
52 customshowlist
= CustomSlideShows
.getChild("customshowlist")
53 self
.assertEqual(get_state_as_dict(customshowlist
)["Children"], "1")
55 def test_tdf143125(self
):
56 with self
.ui_test
.create_doc_in_start_center("impress"):
57 TemplateDialog
= self
.xUITest
.getTopFocusWindow()
58 cancel
= TemplateDialog
.getChild("close")
59 self
.ui_test
.close_dialog_through_button(cancel
)
60 with self
.ui_test
.execute_dialog_through_command(".uno:CustomShowDialog"):
61 # Without the fix in place, this test would have crashed here
64 # vim: set shiftwidth=4 softtabstop=4 expandtab: