From 6dbb6275ebd1a4299099c3b6bc82ec4ee0e1fb86 Mon Sep 17 00:00:00 2001 From: Bjoern Michaelsen Date: Tue, 30 Sep 2014 15:25:42 +0200 Subject: 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 --- unotest/source/python/org/libreoffice/unotest.py | 25 ++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'unotest') 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) -- cgit v1.2.3