Version 6.4.0.3, tag libreoffice-6.4.0.3
[LibreOffice.git] / sc / qa / uitest / signatureLine / insertSignatureLine.py
blob51a321b34a648614586526c23386472ba7be1d62
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
11 from com.sun.star.lang import IndexOutOfBoundsException
13 #Bug 117903 - Allow signature lines in Calc
15 class insertSignatureLineCalc(UITestCase):
17 def test_insert_signature_line_calc(self):
18 calc_doc = self.ui_test.create_doc_in_start_center("calc")
19 xCalcDoc = self.xUITest.getTopFocusWindow()
20 gridwin = xCalcDoc.getChild("grid_window")
21 document = self.ui_test.get_component()
23 # cancel the dialog without doing anything
24 self.ui_test.execute_dialog_through_command(".uno:InsertSignatureLine")
25 xDialog = self.xUITest.getTopFocusWindow()
27 xName = xDialog.getChild("edit_name")
28 xName.executeAction("TYPE", mkPropertyValues({"TEXT":"Name"})) #set the signature line
30 xCloseBtn = xDialog.getChild("cancel")
31 self.ui_test.close_dialog_through_button(xCloseBtn)
32 with self.assertRaises(IndexOutOfBoundsException):
33 document.Sheets.getByIndex(0).DrawPage.getByIndex(0)
35 # set the signature line
36 self.ui_test.execute_dialog_through_command(".uno:InsertSignatureLine")
37 xDialog = self.xUITest.getTopFocusWindow()
39 xName = xDialog.getChild("edit_name")
40 xTitle = xDialog.getChild("edit_title")
41 xEmail = xDialog.getChild("edit_email")
42 xComment = xDialog.getChild("checkbox_can_add_comments")
43 xInstructions = xDialog.getChild("edit_instructions")
45 xName.executeAction("TYPE", mkPropertyValues({"TEXT":"Name"})) #set the signature line
46 xTitle.executeAction("TYPE", mkPropertyValues({"TEXT":"Title"}))
47 xEmail.executeAction("TYPE", mkPropertyValues({"TEXT":"Email"}))
48 xComment.executeAction("CLICK", tuple())
49 xInstructions.executeAction("TYPE", mkPropertyValues({"TEXT":"Instructions"}))
50 xOKBtn = xDialog.getChild("ok")
51 xOKBtn.executeAction("CLICK", tuple())
53 #check the signature Line in the document
54 self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineSuggestedSignerName, "Name")
55 self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineSuggestedSignerTitle, "Title")
56 self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineSuggestedSignerEmail, "Email")
57 self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineSuggestedSignerTitle, "Title")
58 self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineCanAddComment, False)
59 self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineShowSignDate, True)
60 self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineSigningInstructions, "Instructions")
62 self.ui_test.close_doc()
64 def test_insert_signature_line2_calc(self):
65 calc_doc = self.ui_test.create_doc_in_start_center("calc")
66 xCalcDoc = self.xUITest.getTopFocusWindow()
67 gridwin = xCalcDoc.getChild("grid_window")
68 document = self.ui_test.get_component()
70 self.ui_test.execute_dialog_through_command(".uno:InsertSignatureLine")
71 xDialog = self.xUITest.getTopFocusWindow()
73 xName = xDialog.getChild("edit_name")
74 xTitle = xDialog.getChild("edit_title")
75 xEmail = xDialog.getChild("edit_email")
76 xComment = xDialog.getChild("checkbox_can_add_comments")
77 xDate = xDialog.getChild("checkbox_show_sign_date")
78 xInstructions = xDialog.getChild("edit_instructions")
80 xName.executeAction("TYPE", mkPropertyValues({"TEXT":"Name"})) #set the signature line
81 xTitle.executeAction("TYPE", mkPropertyValues({"TEXT":"Title"}))
82 xEmail.executeAction("TYPE", mkPropertyValues({"TEXT":"Email"}))
83 xDate.executeAction("CLICK", tuple())
84 xComment.executeAction("CLICK", tuple())
85 xInstructions.executeAction("TYPE", mkPropertyValues({"TEXT":"Instructions"}))
86 xOKBtn = xDialog.getChild("ok")
87 xOKBtn.executeAction("CLICK", tuple())
89 #check the signature Line in the document
90 self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineSuggestedSignerName, "Name")
91 self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineSuggestedSignerTitle, "Title")
92 self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineSuggestedSignerEmail, "Email")
93 self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineSuggestedSignerTitle, "Title")
94 self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineCanAddComment, False)
95 self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineShowSignDate, False)
96 self.assertEqual(document.Sheets.getByIndex(0).DrawPage.getByIndex(0).SignatureLineSigningInstructions, "Instructions")
98 self.ui_test.close_doc()
99 # vim: set shiftwidth=4 softtabstop=4 expandtab: