summaryrefslogtreecommitdiff
path: root/unotest
diff options
context:
space:
mode:
authorBjoern Michaelsen <bjoern.michaelsen@canonical.com>2014-09-30 15:25:42 +0200
committerBjoern Michaelsen <bjoern.michaelsen@canonical.com>2014-10-07 16:16:46 +0200
commit6dbb6275ebd1a4299099c3b6bc82ec4ee0e1fb86 (patch)
tree26e0c3c7cb7f976f1659ceace0220055119a33ba /unotest
parent45b876555073990a490bf2c9e174bce803f12eea (diff)
fdo84315: add integration test for basic LibreOffice Base functionality
Thanks to Stephan for helping with the test environment setup: sbergman@redhat.com: Do the same "set UserInstallation to user profile dir in test/user-template" in UnoInProcess's setUp as is done in test::BootstrapFixtureBase::setUp (unotest/source/cpp/bootstrapfixturebase.cxx) for CppunitTests. That way, these tests all use the workdir/unittest/ UserInstallation concurrently, but they at least do not run into the gotcha in SubstitutePathVariables::SetPredefinedPathVariables (framework/source/services/substitutepathvars.cxx) to only set the PREDEFVAR_USERPATH if PATH_EXISTS. Change-Id: Iad058098a4c69cb567e2d3222af3c7d4ba993271
Diffstat (limited to 'unotest')
-rw-r--r--unotest/source/python/org/libreoffice/unotest.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/unotest/source/python/org/libreoffice/unotest.py b/unotest/source/python/org/libreoffice/unotest.py
index 6a7f8143cdd2..1991b79d29da 100644
--- a/unotest/source/python/org/libreoffice/unotest.py
+++ b/unotest/source/python/org/libreoffice/unotest.py
@@ -174,6 +174,15 @@ class UnoInProcess:
def getDoc(self):
return self.xDoc
def setUp(self):
+ # set UserInstallation to user profile dir in test/user-template:
+ path = os.getenv("WORKDIR")
+ if os.name == "nt":
+ # do not quote drive letter - it must be "X:"
+ url = "file:///" + path
+ else:
+ url = "file://" + quote(path)
+ os.putenv("UserInstallation", url + "/unittest")
+
self.xContext = pyuno.getComponentContext()
pyuno.private_initTestEnvironment()
def openEmptyWriterDoc(self):
@@ -202,6 +211,22 @@ class UnoInProcess:
assert(self.xDoc)
return self.xDoc
+ def openBaseDoc(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", False)]
+ loadProps = tuple([mkPropertyValue(name, value) for (name, value) in props])
+ path = os.getenv("TDOC")
+ if os.name == "nt":
+ #do not quote drive letter - it must be "X:"
+ url = "file:///" + path + "/" + quote(file)
+ else:
+ 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)