diff options
author | David Ostrovsky <david@ostrovsky.org> | 2013-06-15 17:11:51 +0200 |
---|---|---|
committer | Noel Power <noel.power@suse.com> | 2013-06-18 09:23:20 +0000 |
commit | 6e8eb540c8cfe1bf663c8e4cc15e484f0d8ea0b2 (patch) | |
tree | ee49b38ac245c3209c82d85e5452c8cb2ac4acc1 /unotest | |
parent | b9155a663b767695c5d636e855765c209944cfd5 (diff) |
Migrate CheckFields unit test to python
Change-Id: Ia765b37888b4095a735015e792f06fc89201d1a3
Reviewed-on: https://gerrit.libreoffice.org/4294
Reviewed-by: Noel Power <noel.power@suse.com>
Tested-by: Noel Power <noel.power@suse.com>
Diffstat (limited to 'unotest')
-rw-r--r-- | unotest/source/python/org/libreoffice/unotest.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/unotest/source/python/org/libreoffice/unotest.py b/unotest/source/python/org/libreoffice/unotest.py index 3ec016adfda4..883d3a40e47e 100644 --- a/unotest/source/python/org/libreoffice/unotest.py +++ b/unotest/source/python/org/libreoffice/unotest.py @@ -31,6 +31,11 @@ except ImportError: print(" URE_BOOTSTRAP=file:///installation/opt/program/fundamentalrc") raise +try: + from urllib.parse import quote +except ImportError: + from urllib import quote + ### utilities ### def mkPropertyValue(name, value): @@ -181,6 +186,18 @@ class UnoInProcess: assert(self.xDoc) return self.xDoc + def openWriterTemplateDoc(self, file): + assert(self.xContext) + smgr = self.getContext().ServiceManager + desktop = smgr.createInstanceWithContext("com.sun.star.frame.Desktop", self.getContext()) + props = [("Hidden", True), ("ReadOnly", False), ("AsTemplate", True)] + loadProps = tuple([mkPropertyValue(name, value) for (name, value) in props]) + path = os.getenv("TDOC") + url = "file://" + quote(path) + "/" + quote(file) + self.xDoc = desktop.loadComponentFromURL(url, "_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) |