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_url_for_data_file
, get_state_as_dict
, select_by_text
14 class tdf153244(UITestCase
):
16 def test_tdf153244(self
):
17 with self
.ui_test
.create_doc_in_start_center("writer") as document
:
18 text
= document
.getText()
19 cursor
= text
.createTextCursor()
20 textGraphic
= document
.createInstance('com.sun.star.text.TextGraphicObject')
21 provider
= self
.xContext
.ServiceManager
.createInstance('com.sun.star.graphic.GraphicProvider')
22 graphic
= provider
.queryGraphic( mkPropertyValues({"URL": get_url_for_data_file("LibreOffice.jpg")}))
23 textGraphic
.Graphic
= graphic
24 text
.insertTextContent(cursor
, textGraphic
, False)
26 document
.getCurrentController().select(document
.getDrawPage()[0])
28 with self
.ui_test
.execute_dialog_through_command(".uno:InsertCaptionDialog") as xCaptionDialog
:
30 xOptionsBtn
= xCaptionDialog
.getChild("options")
31 with self
.ui_test
.execute_blocking_action(xOptionsBtn
.executeAction
, args
=('CLICK', ())) as xOptionsDialog
:
32 xSeparator
= xOptionsDialog
.getChild("separator")
33 xLevel
= xOptionsDialog
.getChild("level")
34 self
.assertEqual("[None]", get_state_as_dict(xLevel
)["DisplayText"])
35 self
.assertEqual(".", get_state_as_dict(xSeparator
)["Text"])
37 select_by_text(xLevel
, "1")
38 xSeparator
.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
39 xSeparator
.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
40 xSeparator
.executeAction("TYPE", mkPropertyValues({"TEXT":"x"}))
42 with self
.ui_test
.execute_blocking_action(xOptionsBtn
.executeAction
, args
=('CLICK', ())) as xOptionsDialog
:
43 xSeparator
= xOptionsDialog
.getChild("separator")
44 xLevel
= xOptionsDialog
.getChild("level")
46 # Without the fix in place, this test would have failed with
47 # AssertionError: '1' != '[None]'
48 self
.assertEqual("1", get_state_as_dict(xLevel
)["DisplayText"])
49 self
.assertEqual("x", get_state_as_dict(xSeparator
)["Text"])
51 # vim: set shiftwidth=4 softtabstop=4 expandtab: