Get the style color and number just once
[LibreOffice.git] / sw / qa / uitest / writer_tests3 / insertFootEndnote.py
blobe398a356769c21b6b618e893fdb8f87257067452
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
13 class insertFootEndnote(UITestCase):
15 def test_insert_foot_endnote(self):
16 with self.ui_test.create_doc_in_start_center("writer") as document:
18 #Automatic - Footnote
19 with self.ui_test.execute_dialog_through_command(".uno:InsertFootnoteDialog"):
20 pass
22 self.assertEqual(len(document.Footnotes), 1)
23 self.xUITest.executeCommand(".uno:Undo")
24 self.assertEqual(len(document.Footnotes), 0)
25 #Automatic - Endnote
26 with self.ui_test.execute_dialog_through_command(".uno:InsertFootnoteDialog") as xDialog:
27 xEndnote = xDialog.getChild("endnote")
28 xEndnote.executeAction("CLICK", tuple())
30 self.assertEqual(len(document.Endnotes), 1)
31 self.xUITest.executeCommand(".uno:Undo")
32 self.assertEqual(len(document.Endnotes), 0)
33 #Character - Footnote
34 with self.ui_test.execute_dialog_through_command(".uno:InsertFootnoteDialog") as xDialog:
35 xChar = xDialog.getChild("character")
36 xChar.executeAction("CLICK", tuple())
37 xCharentry = xDialog.getChild("characterentry")
38 xCharentry.executeAction("TYPE", mkPropertyValues({"TEXT":"A"}))
40 self.assertEqual(len(document.Footnotes), 1)
41 self.xUITest.executeCommand(".uno:Undo")
42 self.assertEqual(len(document.Footnotes), 0)
44 #Character - Endnote
45 with self.ui_test.execute_dialog_through_command(".uno:InsertFootnoteDialog") as xDialog:
46 xChar = xDialog.getChild("character")
47 xChar.executeAction("CLICK", tuple())
48 xCharentry = xDialog.getChild("characterentry")
49 xCharentry.executeAction("TYPE", mkPropertyValues({"TEXT":"A"}))
51 xEndnote = xDialog.getChild("endnote")
52 xEndnote.executeAction("CLICK", tuple())
54 self.assertEqual(len(document.Endnotes), 1)
55 self.xUITest.executeCommand(".uno:Undo")
56 self.assertEqual(len(document.Endnotes), 0)
58 #Cancel button
59 with self.ui_test.execute_dialog_through_command(".uno:InsertFootnoteDialog", close_button="cancel"):
60 pass
62 # vim: set shiftwidth=4 softtabstop=4 expandtab: