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
11 from uitest
.debug
import sleep
13 class insertEndnote(UITestCase
):
15 def test_insert_endnote(self
):
16 self
.ui_test
.create_doc_in_start_center("writer")
17 document
= self
.ui_test
.get_component()
18 xWriterDoc
= self
.xUITest
.getTopFocusWindow()
19 xWriterEdit
= xWriterDoc
.getChild("writer_edit")
21 self
.xUITest
.executeCommand(".uno:InsertEndnote")
23 type_text(xWriterEdit
, "LibreOffice")
25 self
.assertEqual(document
.Endnotes
.getByIndex(0).String
, "LibreOffice")
26 self
.assertEqual(document
.Endnotes
.getCount(), 1)
27 self
.xUITest
.executeCommand(".uno:Undo")
28 self
.assertEqual(document
.Endnotes
.getByIndex(0).String
, "")
29 self
.xUITest
.executeCommand(".uno:Undo")
30 self
.assertEqual(document
.Endnotes
.getCount(), 0)
31 self
.xUITest
.executeCommand(".uno:Redo")
32 self
.assertEqual(document
.Endnotes
.getByIndex(0).String
, "")
33 self
.assertEqual(document
.Endnotes
.getCount(), 1)
34 self
.xUITest
.executeCommand(".uno:Redo")
35 self
.assertEqual(document
.Endnotes
.getByIndex(0).String
, "LibreOffice")
37 self
.ui_test
.close_doc()
38 # vim: set shiftwidth=4 softtabstop=4 expandtab: