Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / sd / qa / uitest / impress_tests / documentProperties.py
blob54ad2947b6bf5a7afdd3000f29e1798c6f32cf13
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
10 import time
11 from uitest.debug import sleep
12 from uitest.uihelper.common import select_pos
15 class ImpressDocumentProperties(UITestCase):
17 def test_open_document_properties_impress(self):
18 self.ui_test.create_doc_in_start_center("impress")
19 xTemplateDlg = self.xUITest.getTopFocusWindow()
20 xCancelBtn = xTemplateDlg.getChild("cancel")
21 self.ui_test.close_dialog_through_button(xCancelBtn)
23 self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties")
24 xDialog = self.xUITest.getTopFocusWindow()
25 xResetBtn = xDialog.getChild("reset")
26 xResetBtn.executeAction("CLICK", tuple())
27 xTabs = xDialog.getChild("tabcontrol")
29 select_pos(xTabs, "0") #first tab
30 xUserDataCheckbox = xDialog.getChild("userdatacb") # apply user data
31 xUserDataCheckbox.executeAction("CLICK", tuple())
32 xThumbSaveCheckbox = xDialog.getChild("thumbnailsavecb") # save preview image with document
33 xThumbSaveCheckbox.executeAction("CLICK", tuple())
35 #digital signature
36 xDigSignBtn = xDialog.getChild("signature")
37 def handle_sign_dlg(dialog):
38 xNoBtn = dialog.getChild("no")
39 self.ui_test.close_dialog_through_button(xNoBtn)
40 self.ui_test.execute_blocking_action(xDigSignBtn.executeAction, args=('CLICK', ()),
41 dialog_handler=handle_sign_dlg)
43 select_pos(xTabs, "1") #tab Description
45 xTitleText = xDialog.getChild("title")
46 xTitleText.executeAction("TYPE", mkPropertyValues({"TEXT":"Title text"}))
47 xSubjectText = xDialog.getChild("subject")
48 xSubjectText.executeAction("TYPE", mkPropertyValues({"TEXT":"Subject text"}))
49 xKeywordsText = xDialog.getChild("keywords")
50 xKeywordsText.executeAction("TYPE", mkPropertyValues({"TEXT":"Keywords text"}))
51 xCommentsText = xDialog.getChild("comments")
52 xCommentsText.executeAction("TYPE", mkPropertyValues({"TEXT":"Comments text"}))
54 #Font tab
55 select_pos(xTabs, "4") #tab Fonts
56 xFontEmbedCheckbox = xDialog.getChild("embedFonts")
57 xFontEmbedCheckbox.executeAction("CLICK", tuple())
59 #Security tab
60 select_pos(xTabs, "3") #tab Security
61 xReadOnlyCheckbox = xDialog.getChild("readonly")
62 xReadOnlyCheckbox.executeAction("CLICK", tuple())
64 select_pos(xTabs, "2") #tab Custom properties
65 #add custom properties ------>>>>>>>>>>> not supported
66 xAddBtn = xDialog.getChild("add")
67 xAddBtn.executeAction("CLICK", tuple())
69 xOkBtn = xDialog.getChild("ok")
70 xOkBtn.executeAction("CLICK", tuple())
72 #now open the dialog again and read the properties
73 self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties")
74 xDialog = self.xUITest.getTopFocusWindow()
75 xTitleText = xDialog.getChild("title")
76 xSubjectText = xDialog.getChild("subject")
77 xKeywordsText = xDialog.getChild("keywords")
78 xCommentsText = xDialog.getChild("comments")
79 xReadOnlyCheckbox = xDialog.getChild("readonly")
80 xRecordChangesCheckbox = xDialog.getChild("recordchanges")
81 xFontEmbedCheckbox = xDialog.getChild("embedFonts")
82 xUserDataCheckbox = xDialog.getChild("userdatacb")
83 xThumbSaveCheckbox = xDialog.getChild("thumbnailsavecb")
84 self.assertEqual(get_state_as_dict(xTitleText)["Text"], "Title text")
85 self.assertEqual(get_state_as_dict(xSubjectText)["Text"], "Subject text")
86 self.assertEqual(get_state_as_dict(xKeywordsText)["Text"], "Keywords text")
87 self.assertEqual(get_state_as_dict(xReadOnlyCheckbox)["Selected"], "true")
88 self.assertEqual(get_state_as_dict(xReadOnlyCheckbox)["Selected"], "true")
89 self.assertEqual(get_state_as_dict(xFontEmbedCheckbox)["Selected"], "true")
90 self.assertEqual(get_state_as_dict(xUserDataCheckbox)["Selected"], "false")
91 self.assertEqual(get_state_as_dict(xThumbSaveCheckbox)["Selected"], "false")
92 self.assertEqual(get_state_as_dict(xCommentsText)["Text"], "Comments text")
93 xResetBtn = xDialog.getChild("reset")
94 xResetBtn.executeAction("CLICK", tuple())
95 xCancBtn = xDialog.getChild("cancel")
96 xCancBtn.executeAction("CLICK", tuple())
98 self.ui_test.close_doc()
99 # vim: set shiftwidth=4 softtabstop=4 expandtab: