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 from uitest
.framework
import UITestCase
8 from libreoffice
.uno
.propertyvalue
import mkPropertyValues
9 from uitest
.uihelper
.common
import get_state_as_dict
, type_text
12 from uitest
.debug
import sleep
14 class insertFootEndnote(UITestCase
):
16 def test_insert_foot_endnote(self
):
17 self
.ui_test
.create_doc_in_start_center("writer")
18 document
= self
.ui_test
.get_component()
19 xWriterDoc
= self
.xUITest
.getTopFocusWindow()
20 xWriterEdit
= xWriterDoc
.getChild("writer_edit")
23 self
.ui_test
.execute_dialog_through_command(".uno:InsertFootnoteDialog")
24 xDialog
= self
.xUITest
.getTopFocusWindow()
25 xOkBtn
= xDialog
.getChild("ok")
26 xOkBtn
.executeAction("CLICK", tuple())
27 self
.assertEqual(document
.Footnotes
.getCount(), 1)
28 self
.xUITest
.executeCommand(".uno:Undo")
29 self
.assertEqual(document
.Footnotes
.getCount(), 0)
31 self
.ui_test
.execute_dialog_through_command(".uno:InsertFootnoteDialog")
32 xDialog
= self
.xUITest
.getTopFocusWindow()
34 xEndnote
= xDialog
.getChild("endnote")
35 xEndnote
.executeAction("CLICK", tuple())
37 xOkBtn
= xDialog
.getChild("ok")
38 xOkBtn
.executeAction("CLICK", tuple())
39 self
.assertEqual(document
.Endnotes
.getCount(), 1)
40 self
.xUITest
.executeCommand(".uno:Undo")
41 self
.assertEqual(document
.Endnotes
.getCount(), 0)
43 self
.ui_test
.execute_dialog_through_command(".uno:InsertFootnoteDialog")
44 xDialog
= self
.xUITest
.getTopFocusWindow()
46 xChar
= xDialog
.getChild("character")
47 xChar
.executeAction("CLICK", tuple())
48 xCharentry
= xDialog
.getChild("characterentry")
49 xCharentry
.executeAction("TYPE", mkPropertyValues({"TEXT":"A"}))
51 xOkBtn
= xDialog
.getChild("ok")
52 xOkBtn
.executeAction("CLICK", tuple())
53 self
.assertEqual(document
.Footnotes
.getCount(), 1)
54 self
.xUITest
.executeCommand(".uno:Undo")
55 self
.assertEqual(document
.Footnotes
.getCount(), 0)
58 self
.ui_test
.execute_dialog_through_command(".uno:InsertFootnoteDialog")
59 xDialog
= self
.xUITest
.getTopFocusWindow()
61 xChar
= xDialog
.getChild("character")
62 xChar
.executeAction("CLICK", tuple())
63 xCharentry
= xDialog
.getChild("characterentry")
64 xCharentry
.executeAction("TYPE", mkPropertyValues({"TEXT":"A"}))
66 xEndnote
= xDialog
.getChild("endnote")
67 xEndnote
.executeAction("CLICK", tuple())
69 xOkBtn
= xDialog
.getChild("ok")
70 xOkBtn
.executeAction("CLICK", tuple())
71 self
.assertEqual(document
.Endnotes
.getCount(), 1)
72 self
.xUITest
.executeCommand(".uno:Undo")
73 self
.assertEqual(document
.Endnotes
.getCount(), 0)
75 self
.ui_test
.close_doc()
76 # vim: set shiftwidth=4 softtabstop=4 expandtab: