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
, type_text
10 from libreoffice
.uno
.propertyvalue
import mkPropertyValues
12 class insertSignatureLine(UITestCase
):
14 def test_insert_signature_line(self
):
15 self
.ui_test
.create_doc_in_start_center("writer")
16 document
= self
.ui_test
.get_component()
17 xWriterDoc
= self
.xUITest
.getTopFocusWindow()
18 xWriterEdit
= xWriterDoc
.getChild("writer_edit")
20 self
.ui_test
.execute_dialog_through_command(".uno:InsertSignatureLine")
21 xDialog
= self
.xUITest
.getTopFocusWindow()
23 xName
= xDialog
.getChild("edit_name")
24 xTitle
= xDialog
.getChild("edit_title")
25 xEmail
= xDialog
.getChild("edit_email")
26 xComment
= xDialog
.getChild("checkbox_can_add_comments")
27 xInstructions
= xDialog
.getChild("edit_instructions")
29 xName
.executeAction("TYPE", mkPropertyValues({"TEXT":"Name"})) #set the signature line
30 xTitle
.executeAction("TYPE", mkPropertyValues({"TEXT":"Title"}))
31 xEmail
.executeAction("TYPE", mkPropertyValues({"TEXT":"Email"}))
32 xComment
.executeAction("CLICK", tuple())
33 xInstructions
.executeAction("TYPE", mkPropertyValues({"TEXT":"Instructions"}))
34 xOKBtn
= xDialog
.getChild("ok")
35 xOKBtn
.executeAction("CLICK", tuple())
37 #check the signature Line in the document
38 self
.assertEqual(document
.DrawPage
.getByIndex(0).SignatureLineSuggestedSignerName
, "Name")
39 self
.assertEqual(document
.DrawPage
.getByIndex(0).SignatureLineSuggestedSignerTitle
, "Title")
40 self
.assertEqual(document
.DrawPage
.getByIndex(0).SignatureLineSuggestedSignerEmail
, "Email")
41 self
.assertEqual(document
.DrawPage
.getByIndex(0).SignatureLineSuggestedSignerTitle
, "Title")
42 self
.assertEqual(document
.DrawPage
.getByIndex(0).SignatureLineCanAddComment
, False)
43 self
.assertEqual(document
.DrawPage
.getByIndex(0).SignatureLineShowSignDate
, True)
44 self
.assertEqual(document
.DrawPage
.getByIndex(0).SignatureLineSigningInstructions
, "Instructions")
46 self
.ui_test
.close_doc()
48 def test_insert_signature_line2(self
):
49 self
.ui_test
.create_doc_in_start_center("writer")
50 document
= self
.ui_test
.get_component()
51 xWriterDoc
= self
.xUITest
.getTopFocusWindow()
52 xWriterEdit
= xWriterDoc
.getChild("writer_edit")
54 self
.ui_test
.execute_dialog_through_command(".uno:InsertSignatureLine")
55 xDialog
= self
.xUITest
.getTopFocusWindow()
57 xName
= xDialog
.getChild("edit_name")
58 xTitle
= xDialog
.getChild("edit_title")
59 xEmail
= xDialog
.getChild("edit_email")
60 xComment
= xDialog
.getChild("checkbox_can_add_comments")
61 xDate
= xDialog
.getChild("checkbox_show_sign_date")
62 xInstructions
= xDialog
.getChild("edit_instructions")
64 xName
.executeAction("TYPE", mkPropertyValues({"TEXT":"Name"})) #set the signature line
65 xTitle
.executeAction("TYPE", mkPropertyValues({"TEXT":"Title"}))
66 xEmail
.executeAction("TYPE", mkPropertyValues({"TEXT":"Email"}))
67 xDate
.executeAction("CLICK", tuple())
68 xComment
.executeAction("CLICK", tuple())
69 xInstructions
.executeAction("TYPE", mkPropertyValues({"TEXT":"Instructions"}))
70 xOKBtn
= xDialog
.getChild("ok")
71 xOKBtn
.executeAction("CLICK", tuple())
73 #check the signature Line in the document
74 self
.assertEqual(document
.DrawPage
.getByIndex(0).SignatureLineSuggestedSignerName
, "Name")
75 self
.assertEqual(document
.DrawPage
.getByIndex(0).SignatureLineSuggestedSignerTitle
, "Title")
76 self
.assertEqual(document
.DrawPage
.getByIndex(0).SignatureLineSuggestedSignerEmail
, "Email")
77 self
.assertEqual(document
.DrawPage
.getByIndex(0).SignatureLineSuggestedSignerTitle
, "Title")
78 self
.assertEqual(document
.DrawPage
.getByIndex(0).SignatureLineCanAddComment
, False)
79 self
.assertEqual(document
.DrawPage
.getByIndex(0).SignatureLineShowSignDate
, False)
80 self
.assertEqual(document
.DrawPage
.getByIndex(0).SignatureLineSigningInstructions
, "Instructions")
82 self
.ui_test
.close_doc()
83 # vim: set shiftwidth=4 softtabstop=4 expandtab: