Version 6.1.0.2, tag libreoffice-6.1.0.2
[LibreOffice.git] / sw / qa / uitest / writer_tests / insertCaption.py
blob6cf30022cf6419103e37efa18d8e57d2a4f66dbe
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 time
11 from uitest.debug import sleep
12 from uitest.uihelper.common import select_pos
14 class insertCaption(UITestCase):
16 def test_insert_caption(self):
17 self.ui_test.create_doc_in_start_center("writer")
18 document = self.ui_test.get_component()
19 self.ui_test.execute_dialog_through_command(".uno:InsertFrame") # insert frame
20 xDialogFr = self.xUITest.getTopFocusWindow()
22 xWidth = xDialogFr.getChild("width")
23 xWidth.executeAction("UP", tuple())
24 xWidth.executeAction("UP", tuple())
26 xHeight = xDialogFr.getChild("height")
27 xHeight.executeAction("UP", tuple())
28 xHeight.executeAction("UP", tuple())
30 xOkBtn=xDialogFr.getChild("ok")
31 xOkBtn.executeAction("CLICK", tuple())
33 self.assertEqual(document.TextFrames.getCount(), 1)
35 self.ui_test.execute_dialog_through_command(".uno:InsertCaptionDialog") # caption
36 xDialogCaption = self.xUITest.getTopFocusWindow()
38 xCapt = xDialogCaption.getChild("caption_edit")
39 xCapt.executeAction("TYPE", mkPropertyValues({"TEXT":"Caption"}))
41 xOkBtn=xDialogCaption.getChild("ok")
42 xOkBtn.executeAction("CLICK", tuple())
44 xFrame = document.TextFrames.getByIndex(0)
46 self.assertEqual(document.TextFrames.getByIndex(0).Text.String, "\nText 1: Caption")
48 self.ui_test.execute_dialog_through_command(".uno:InsertCaptionDialog") # 2nd caption
49 xDialogCaption = self.xUITest.getTopFocusWindow()
50 xCapt = xDialogCaption.getChild("caption_edit")
51 xCapt.executeAction("TYPE", mkPropertyValues({"TEXT":"Caption2"}))
52 xSep = xDialogCaption.getChild("separator_edit")
53 xSep.executeAction("TYPE", mkPropertyValues({"TEXT":"-"}))
55 xOkBtn=xDialogCaption.getChild("ok")
56 xOkBtn.executeAction("CLICK", tuple())
58 self.assertEqual(document.TextFrames.getByIndex(0).Text.String, "\nText 1: Caption\nText 2-: Caption2")
60 self.ui_test.execute_dialog_through_command(".uno:InsertCaptionDialog") # 3. caption
61 xDialogCaption = self.xUITest.getTopFocusWindow()
62 xCapt = xDialogCaption.getChild("caption_edit")
63 xCapt.executeAction("TYPE", mkPropertyValues({"TEXT":"Caption3"}))
64 xSep = xDialogCaption.getChild("separator_edit")
65 xSep.executeAction("TYPE", mkPropertyValues({"TEXT":"-"}))
66 xPos = xDialogCaption.getChild("position")
67 select_pos(xPos, "1")
69 xOkBtn=xDialogCaption.getChild("ok")
70 xOkBtn.executeAction("CLICK", tuple())
72 self.assertEqual(document.TextFrames.getByIndex(0).Text.String, "\nText 1: Caption\nText 2-: Caption2\nText 3--: Caption3")
74 self.ui_test.close_doc()
76 # vim: set shiftwidth=4 softtabstop=4 expandtab: