2 # This Source Code Form is subject to the terms of the Mozilla Public
3 # License, v. 2.0. If a copy of the MPL was not distributed with this
4 # 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
10 class WriterInsertBreakDialog(UITestCase
):
12 def launch_dialog_and_select_option(self
, child
):
14 self
.ui_test
.execute_dialog_through_command(".uno:InsertBreak")
15 xDialog
= self
.xUITest
.getTopFocusWindow()
17 xOption
= xDialog
.getChild(child
)
18 xOption
.executeAction("CLICK", tuple())
22 def getPages(self
, total
):
23 document
= self
.ui_test
.get_component()
25 xCursor
= document
.getCurrentController().getViewCursor()
26 xCursor
.jumpToLastPage()
28 self
.assertEqual(xCursor
.getPage(), total
)
30 def test_insert_line_break(self
):
32 self
.ui_test
.create_doc_in_start_center("writer")
34 xDialog
= self
.launch_dialog_and_select_option("linerb")
35 xOkBtn
= xDialog
.getChild("ok")
36 xOkBtn
.executeAction("CLICK", tuple())
40 self
.ui_test
.close_doc()
42 def test_insert_column_break(self
):
44 self
.ui_test
.create_doc_in_start_center("writer")
46 xDialog
= self
.launch_dialog_and_select_option("columnrb")
47 xOkBtn
= xDialog
.getChild("ok")
48 xOkBtn
.executeAction("CLICK", tuple())
52 self
.ui_test
.close_doc()
54 def test_insert_page_break(self
):
56 self
.ui_test
.create_doc_in_start_center("writer")
59 with self
.subTest(i
=i
):
60 xDialog
= self
.launch_dialog_and_select_option("pagerb")
62 xStyleList
= xDialog
.getChild("stylelb")
63 xStyleList
.executeAction("SELECT", mkPropertyValues({"POS": str(i
)}))
65 xOkBtn
= xDialog
.getChild("ok")
66 xOkBtn
.executeAction("CLICK", tuple())
70 self
.ui_test
.close_doc()
72 def test_cancel_button_insert_line_break_dialog(self
):
74 self
.ui_test
.create_doc_in_start_center("writer")
76 self
.ui_test
.execute_dialog_through_command(".uno:InsertBreak")
77 xDialog
= self
.xUITest
.getTopFocusWindow()
78 xCancelBtn
= xDialog
.getChild("cancel")
79 self
.ui_test
.close_dialog_through_button(xCancelBtn
)
83 self
.ui_test
.close_doc()
85 # vim: set shiftwidth=4 softtabstop=4 expandtab: