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/.
8 from uitest
.framework
import UITestCase
9 from libreoffice
.uno
.propertyvalue
import mkPropertyValues
10 from uitest
.uihelper
.common
import get_state_as_dict
, type_text
11 from uitest
.debug
import sleep
13 class WriterInsertHorizontalLine(UITestCase
):
15 def test_insert_horizontal_line(self
):
16 self
.ui_test
.create_doc_in_start_center("writer")
17 xWriterDoc
= self
.xUITest
.getTopFocusWindow()
18 xWriterEdit
= xWriterDoc
.getChild("writer_edit")
20 type_text(xWriterEdit
, "Test horizontal line") #write the text
22 self
.xUITest
.executeCommand(".uno:StyleApply?Style:string=Horizontal%20Line&FamilyName:string=ParagraphStyles") #insert horizontal line
24 self
.ui_test
.execute_dialog_through_command(".uno:EditStyle") #open style dialog
25 xDialog
= self
.xUITest
.getTopFocusWindow()
26 xStyleNametxt
= xDialog
.getChild("namerw")
27 self
.assertEqual(get_state_as_dict(xStyleNametxt
)["Text"], "Horizontal Line") #check style name
28 xCancBtn
= xDialog
.getChild("cancel")
29 self
.ui_test
.close_dialog_through_button(xCancBtn
)
31 self
.xUITest
.executeCommand(".uno:Undo")
32 self
.xUITest
.executeCommand(".uno:Redo")
34 self
.ui_test
.execute_dialog_through_command(".uno:EditStyle") #open style dialog
35 xDialog
= self
.xUITest
.getTopFocusWindow()
36 xStyleNametxt
= xDialog
.getChild("namerw")
37 self
.assertEqual(get_state_as_dict(xStyleNametxt
)["Text"], "Horizontal Line") #check style name
38 xCancBtn
= xDialog
.getChild("cancel")
39 self
.ui_test
.close_dialog_through_button(xCancBtn
)
41 self
.ui_test
.close_doc()
42 # vim: set shiftwidth=4 softtabstop=4 expandtab: