tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / pyuno / qa / pytests / testcollections_base.py
blob4dd3f26ea0590ba8be6a7771b01e29d5c1d2cf73
1 #!/usr/bin/env python
3 # This file is part of the LibreOffice project.
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 import unittest
12 from org.libreoffice.unotest import pyuno
13 from com.sun.star.beans import PropertyValue
15 testEnvironmentInitialized = False
17 class CollectionsTestBase(unittest.TestCase):
19 @classmethod
20 def setUpClass(cls):
21 cls.context = pyuno.getComponentContext()
22 global testEnvironmentInitialized
23 if not testEnvironmentInitialized:
24 pyuno.private_initTestEnvironment()
25 testEnvironmentInitialized = True
27 def setUp(self):
28 self._components = []
30 def tearDown(self):
31 for component in self._components:
32 try:
33 component.close(True)
34 except Exception:
35 pass
37 def createHiddenWindow(self, url):
38 service_manager = self.context.ServiceManager
39 desktop = service_manager.createInstanceWithContext('com.sun.star.frame.Desktop', self.context)
40 load_props = (
41 PropertyValue(Name='Hidden', Value=True),
42 PropertyValue(Name='ReadOnly', Value=False)
44 component = desktop.loadComponentFromURL(url, '_blank', 0, load_props)
45 return component
47 def createBlankTextDocument(self):
48 component = self.createHiddenWindow('private:factory/swriter')
49 self._components.append(component)
50 return component
52 def createBlankSpreadsheet(self):
53 component = self.createHiddenWindow('private:factory/scalc')
54 self._components.append(component)
55 return component
57 def createBlankDrawing(self):
58 component = self.createHiddenWindow('private:factory/sdraw')
59 self._components.append(component)
60 return component
62 # vim:set shiftwidth=4 softtabstop=4 expandtab: