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 uitest
.debug
import sleep
10 from uitest
.path
import get_srcdir_url
11 from libreoffice
.uno
.propertyvalue
import mkPropertyValues
12 from uitest
.uihelper
.common
import get_state_as_dict
, type_text
16 class WriterInsertEnvelope(UITestCase
):
18 def test_insert_envelope(self
):
19 self
.ui_test
.create_doc_in_start_center("writer")
20 document
= self
.ui_test
.get_component()
21 self
.ui_test
.execute_dialog_through_command(".uno:InsertEnvelope")
23 xDialog
= self
.xUITest
.getTopFocusWindow()
25 xAddrTxt
= xDialog
.getChild("addredit")
26 xSenderTxt
= xDialog
.getChild("senderedit")
27 xSenderCheckBox
= xDialog
.getChild("sender")
29 xAddrTxt
.executeAction("SELECT", mkPropertyValues({"FROM": "1", "TO": "200"}))
30 xAddrTxt
.executeAction("BACKSPACE", tuple())
31 xAddrTxt
.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
32 xAddrTxt
.executeAction("BACKSPACE", tuple())
33 xAddrTxt
.executeAction("TYPE", mkPropertyValues({"TEXT":"Address"}))
35 xSenderTxt
.executeAction("SELECT", mkPropertyValues({"FROM": "1", "TO": "200"}))
36 xSenderTxt
.executeAction("BACKSPACE", tuple())
37 xSenderTxt
.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
38 xSenderTxt
.executeAction("BACKSPACE", tuple())
39 xSenderTxt
.executeAction("TYPE", mkPropertyValues({"TEXT":"Sender"}))
41 xInsBtn
= xDialog
.getChild("user")
42 xInsBtn
.executeAction("CLICK", tuple())
44 self
.ui_test
.execute_dialog_through_command(".uno:InsertEnvelope")
45 xDialog
= self
.xUITest
.getTopFocusWindow()
46 xAddrTxt
= xDialog
.getChild("addredit")
47 xSenderTxt
= xDialog
.getChild("senderedit")
48 self
.assertEqual(get_state_as_dict(xAddrTxt
)["Text"], "Address")
49 self
.assertEqual(get_state_as_dict(xSenderTxt
)["Text"], "Sender")
51 xcancelBtn
= xDialog
.getChild("cancel")
52 self
.ui_test
.close_dialog_through_button(xcancelBtn
)
54 self
.ui_test
.close_doc()
55 # vim: set shiftwidth=4 softtabstop=4 expandtab: