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
10 import org
.libreoffice
.unotest
13 from uitest
.debug
import sleep
15 def get_url_for_data_file(file_name
):
16 return pathlib
.Path(org
.libreoffice
.unotest
.makeCopyFromTDOC(file_name
)).as_uri()
18 class tdf108124(UITestCase
):
20 def test_tdf108124(self
):
21 writer_doc
= self
.ui_test
.load_file(get_url_for_data_file("tdf108124.odt"))
22 xWriterDoc
= self
.xUITest
.getTopFocusWindow()
23 xWriterEdit
= xWriterDoc
.getChild("writer_edit")
24 document
= self
.ui_test
.get_component()
26 self
.assertEqual(document
.GraphicObjects
.getCount(), 2) #nr. of images
28 xWriterEdit
.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+a"})) # select all
29 xWriterEdit
.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+c"})) # copy
30 xWriterEdit
.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+v"})) # paste
31 self
.assertEqual(document
.GraphicObjects
.getCount(), 4)
32 self
.xUITest
.executeCommand(".uno:Undo") #Undo
33 self
.assertEqual(document
.GraphicObjects
.getCount(), 2)
34 self
.xUITest
.executeCommand(".uno:Redo") #Redo
35 self
.assertEqual(document
.GraphicObjects
.getCount(), 4)
37 self
.ui_test
.close_doc()
38 # vim: set shiftwidth=4 softtabstop=4 expandtab: