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
, get_url_for_data_file
14 class tdf137105(UITestCase
):
16 def test_tdf137105(self
):
17 with self
.ui_test
.create_doc_in_start_center("writer") as document
:
18 xWriterDoc
= self
.xUITest
.getTopFocusWindow()
19 text
= document
.getText()
20 cursor
= text
.createTextCursor()
21 textGraphic
= document
.createInstance('com.sun.star.text.TextGraphicObject')
22 provider
= self
.xContext
.ServiceManager
.createInstance('com.sun.star.graphic.GraphicProvider')
23 graphic
= provider
.queryGraphic( mkPropertyValues({"URL": get_url_for_data_file("LibreOffice.jpg")}))
24 textGraphic
.Graphic
= graphic
25 text
.insertTextContent(cursor
, textGraphic
, False)
27 document
.getCurrentController().select(document
.getDrawPage()[0])
29 xWriterEdit
= xWriterDoc
.getChild("writer_edit")
31 self
.xUITest
.executeCommand(".uno:Sidebar")
32 # Without the fix in place, this test would have crashed here
33 xWriterEdit
.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "InspectorTextPanel"}))
35 # if the image is selected, there is nothing in the panel
36 self
.assertEqual('0', get_state_as_dict(xWriterEdit
.getChild('listbox_fonts'))['Children'])
38 self
.xUITest
.executeCommand(".uno:Sidebar")
41 # vim: set shiftwidth=4 softtabstop=4 expandtab: