tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / pyuno / qa / pytests / testofficehelper.py
blobbe2c99d8daf860456032db19f40bde297d9ca99d
1 import unittest
2 from officehelper import bootstrap, BootstrapException
5 class OfficeHelperTest(unittest.TestCase):
6 """officehelper.py must provide:
7 Support of Windows, Mac OS X & GNU/Linux distributions
8 Customizable connection with 'delays' **kwarg
9 Reporting to console with 'report' **kwarg
10 Memory cleanup from soffice service
11 extra features may be:
12 Python source documentation
13 """
14 def test_default_config(self):
15 # Check default timeout and number of attempts
16 # Stop LibreOffice running service
17 ctx = bootstrap() # Default settings suffice to initialize the service
18 #time.sleep(10) # gve
19 if ctx: # stop soffice as a service
20 smgr = ctx.getServiceManager()
21 desktop = smgr.createInstanceWithContext("com.sun.star.frame.Desktop", ctx)
22 desktop.terminate()
23 self.assertTrue(ctx) # check for failure
25 def test_kwargs(self):
26 # Wait differently for LO to start, request context 10 times
27 # Report processing in console
28 ctx = bootstrap(delays=[1,]*10, report=print)
29 if ctx: # stop soffice as a service
30 smgr = ctx.getServiceManager()
31 desktop = smgr.createInstanceWithContext("com.sun.star.frame.Desktop", ctx)
32 desktop.terminate()
33 self.assertTrue(ctx)
35 def test_exception(self):
36 # Raise BootstrapException and stop ALL PRESENT LibreOffice running services
37 with self.assertRaises(BootstrapException):
38 bootstrap(delays=[0,], report=print) # delays=[0,] must raise BootstrapException
41 if __name__ == "__main__":
43 unittest.main()
45 # ~ dir(__name__)
46 # ~ help(__name__)
47 # ~ help(bootstrap)
48 # ~ exit()
50 # vim: set shiftwidth=4 softtabstop=4 expandtab