Use o3tl::convert in Math
[LibreOffice.git] / pyuno / qa / pytests / testcollections_base.py
blobd3e8068820cf8aece61c1eb3bab17b1fbaa8ece2
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
11 import uno
13 from org.libreoffice.unotest import pyuno
14 from com.sun.star.beans import PropertyValue
16 testEnvironmentInitialized = False
18 class CollectionsTestBase(unittest.TestCase):
20 @classmethod
21 def setUpClass(cls):
22 cls.context = pyuno.getComponentContext()
23 global testEnvironmentInitialized
24 if not testEnvironmentInitialized:
25 pyuno.private_initTestEnvironment()
26 testEnvironmentInitialized = True
28 def setUp(self):
29 self._components = []
31 def tearDown(self):
32 for component in self._components:
33 try:
34 component.close(True)
35 except Exception:
36 pass
38 def createHiddenWindow(self, url):
39 service_manager = self.context.ServiceManager
40 desktop = service_manager.createInstanceWithContext('com.sun.star.frame.Desktop', self.context)
41 load_props = (
42 PropertyValue(Name='Hidden', Value=True),
43 PropertyValue(Name='ReadOnly', Value=False)
45 component = desktop.loadComponentFromURL(url, '_blank', 0, load_props)
46 return component
48 def createBlankTextDocument(self):
49 component = self.createHiddenWindow('private:factory/swriter')
50 self._components.append(component)
51 return component
53 def createBlankSpreadsheet(self):
54 component = self.createHiddenWindow('private:factory/scalc')
55 self._components.append(component)
56 return component
58 def createBlankDrawing(self):
59 component = self.createHiddenWindow('private:factory/sdraw')
60 self._components.append(component)
61 return component
63 # vim:set shiftwidth=4 softtabstop=4 expandtab: