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 select_pos
14 class insertCaption(UITestCase
):
16 def test_insert_caption(self
):
17 with self
.ui_test
.create_doc_in_start_center("writer") as document
:
18 with self
.ui_test
.execute_dialog_through_command(".uno:InsertFrame") as xDialogFr
:
20 xWidth
= xDialogFr
.getChild("width")
21 xWidth
.executeAction("UP", tuple())
22 xWidth
.executeAction("UP", tuple())
24 xHeight
= xDialogFr
.getChild("height")
25 xHeight
.executeAction("UP", tuple())
26 xHeight
.executeAction("UP", tuple())
29 self
.assertEqual(document
.TextFrames
.getCount(), 1)
31 with self
.ui_test
.execute_dialog_through_command(".uno:InsertCaptionDialog") as xDialogCaption
:
33 xCapt
= xDialogCaption
.getChild("caption_edit")
34 xCapt
.executeAction("TYPE", mkPropertyValues({"TEXT":"Caption"}))
37 self
.assertEqual(document
.TextFrames
[0].Text
.String
.replace('\r\n', '\n'), "\nText 1: Caption")
39 with self
.ui_test
.execute_dialog_through_command(".uno:InsertCaptionDialog") as xDialogCaption
:
40 xCapt
= xDialogCaption
.getChild("caption_edit")
41 xCapt
.executeAction("TYPE", mkPropertyValues({"TEXT":"Caption2"}))
42 xSep
= xDialogCaption
.getChild("separator_edit")
43 xSep
.executeAction("TYPE", mkPropertyValues({"TEXT":"-"}))
46 self
.assertEqual(document
.TextFrames
[0].Text
.String
.replace('\r\n', '\n'), "\nText 1: Caption\nText 2-: Caption2")
48 with self
.ui_test
.execute_dialog_through_command(".uno:InsertCaptionDialog") as xDialogCaption
:
49 xCapt
= xDialogCaption
.getChild("caption_edit")
50 xCapt
.executeAction("TYPE", mkPropertyValues({"TEXT":"Caption3"}))
51 xSep
= xDialogCaption
.getChild("separator_edit")
52 xSep
.executeAction("TYPE", mkPropertyValues({"TEXT":"-"}))
53 xPos
= xDialogCaption
.getChild("position")
57 self
.assertEqual(document
.TextFrames
[0].Text
.String
.replace('\r\n', '\n'), "\nText 1: Caption\nText 2-: Caption2\nText 3--: Caption3")
60 # vim: set shiftwidth=4 softtabstop=4 expandtab: