diff options
author | Michael Stahl <mstahl@redhat.com> | 2013-04-05 23:07:18 +0200 |
---|---|---|
committer | David Ostrovsky <David.Ostrovsky@gmx.de> | 2013-04-09 05:52:49 +0000 |
commit | ebeae438dbaa3e9f1cda33a17c4a6530feac80d9 (patch) | |
tree | 8506c0fc72da662187c11a00950ac17a240623eb /unotest | |
parent | 0e68bac85293e2d60fa6db3e46de8b74ab5d502b (diff) |
move Python tests in-process
This is nice to make them more easily debuggable.
A series of crude hacks are employed to bootstrap enough services from
python so the current tests run.
This is only tested with system python3 on Fedora.
Change-Id: I5e06741e55ead7fddec41ff776ff8ca5d2399469
Reviewed-on: https://gerrit.libreoffice.org/3215
Reviewed-by: David Ostrovsky <David.Ostrovsky@gmx.de>
Tested-by: David Ostrovsky <David.Ostrovsky@gmx.de>
Diffstat (limited to 'unotest')
-rw-r--r-- | unotest/source/python/org/libreoffice/unotest.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/unotest/source/python/org/libreoffice/unotest.py b/unotest/source/python/org/libreoffice/unotest.py index c5cfa596ee53..1f5f7d1c4202 100644 --- a/unotest/source/python/org/libreoffice/unotest.py +++ b/unotest/source/python/org/libreoffice/unotest.py @@ -161,6 +161,37 @@ class UnoConnection: finally: self.connection = None +class UnoNotConnection: + def __init__(self, args): + self.args = args + def getContext(self): + return self.xContext + def getDoc(self): + return self.xDoc + def setUp(self): + self.xContext = pyuno.getComponentContext() + pyuno.experimentalExtraMagic() + def openEmptyWriterDoc(self): + assert(self.xContext) + smgr = self.getContext().ServiceManager + desktop = smgr.createInstanceWithContext("com.sun.star.frame.Desktop", self.getContext()) + props = [("Hidden", True), ("ReadOnly", False)] + loadProps = tuple([mkPropertyValue(name, value) for (name, value) in props]) + self.xDoc = desktop.loadComponentFromURL("private:factory/swriter", "_blank", 0, loadProps) + assert(self.xDoc) + return self.xDoc + + def checkProperties(self, obj, dict, test): + for k,v in dict.items(): + obj.setPropertyValue(k, v) + value = obj.getPropertyValue(k) + test.assertEqual(value, v) + + def postTest(self): + assert(self.xContext) + def tearDown(self): + self.xDoc.close(True) + def simpleInvoke(connection, test): try: connection.preTest() |