Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / cui / qa / uitest / dialogs / pastedlg.py
blobccd33e02d11ee6f06ff07145947b09996083b8d8
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 libreoffice.uno.propertyvalue import mkPropertyValues
8 from uitest.framework import UITestCase
9 from uitest.uihelper.common import get_state_as_dict
12 # Test for SvPasteObjectDialog.
13 class Test(UITestCase):
15 def testGetFormat(self):
16 # Copy a string in Impress.
17 self.ui_test.create_doc_in_start_center("impress")
18 template = self.xUITest.getTopFocusWindow()
19 self.ui_test.close_dialog_through_button(template.getChild("cancel"))
20 doc = self.xUITest.getTopFocusWindow()
21 editWin = doc.getChild("impress_win")
22 # Select the title shape.
23 editWin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"}))
24 editWin.executeAction("TYPE", mkPropertyValues({"TEXT": "t"}))
25 self.xUITest.executeCommand(".uno:SelectAll")
26 self.xUITest.executeCommand(".uno:Copy")
28 # Now use paste special to see what formats are offered.
29 self.ui_test.execute_dialog_through_command(".uno:PasteSpecial")
30 pasteSpecial = self.xUITest.getTopFocusWindow()
31 formats = pasteSpecial.getChild("list")
32 entryCount = int(get_state_as_dict(formats)["Children"])
33 items = []
34 for index in range(entryCount):
35 entry = formats.getChild(str(index))
36 entry.executeAction("SELECT", tuple())
37 items.append(get_state_as_dict(formats)["SelectEntryText"])
39 # Make sure there is no RTF vs Richtext duplication.
40 self.assertTrue("Rich text formatting (RTF)" in items)
41 self.assertFalse("Rich text formatting (Richtext)" in items)
43 # Close the dialog and the document.
44 self.ui_test.close_dialog_through_button(pasteSpecial.getChild("cancel"))
45 self.ui_test.close_doc()
47 # vim: set shiftwidth=4 softtabstop=4 expandtab: