[Libreoffice-commits] core.git: dbaccess/PythonTest_dbaccess_python.mk dbaccess/qa unotest/source
Lionel Elie Mamane
lionel at mamane.lu
Tue Feb 3 05:24:56 PST 2015
dbaccess/PythonTest_dbaccess_python.mk | 6 ++++++
dbaccess/qa/python/fdo84315.py | 6 +++++-
unotest/source/python/org/libreoffice/unotest.py | 11 +++++++++++
3 files changed, 22 insertions(+), 1 deletion(-)
New commits:
commit 3e8c54916e10e046b55931d70eaa1a9473d608c1
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date: Sun Feb 1 15:55:17 2015 +0100
copy test file to workdir to avoid overwriting
Change-Id: I2acc5cd6a57bb6a18f3f20177b3bcf2b8469a834
Reviewed-on: https://gerrit.libreoffice.org/14272
Reviewed-by: Lionel Elie Mamane <lionel at mamane.lu>
Tested-by: Lionel Elie Mamane <lionel at mamane.lu>
diff --git a/dbaccess/PythonTest_dbaccess_python.mk b/dbaccess/PythonTest_dbaccess_python.mk
index 7954cbc..874dac9 100644
--- a/dbaccess/PythonTest_dbaccess_python.mk
+++ b/dbaccess/PythonTest_dbaccess_python.mk
@@ -17,4 +17,10 @@ $(eval $(call gb_PythonTest_add_modules,dbaccess_python,$(SRCDIR)/dbaccess/qa/py
fdo84315 \
))
+$(call gb_PythonTest_get_target,dbaccess_python) : $(WORKDIR)/CppunitTest/fdo84315.odb
+$(WORKDIR)/CppunitTest/fdo84315.odb : $(SRCDIR)/dbaccess/qa/extras/testdocuments/fdo84315.odb
+ mkdir -p $(dir $@)
+ cp -P -f "$<" "$@"
+.PHONY: $(WORKDIR)/CppunitTest/fdo84315.odb
+
# vim: set noet sw=4 ts=4:
diff --git a/dbaccess/qa/python/fdo84315.py b/dbaccess/qa/python/fdo84315.py
index 0670f66..e3a98c1 100644
--- a/dbaccess/qa/python/fdo84315.py
+++ b/dbaccess/qa/python/fdo84315.py
@@ -7,8 +7,10 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
+import os
import unittest
from collections import deque
+import unohelper
from org.libreoffice.unotest import UnoInProcess
class Fdo84315(unittest.TestCase):
@@ -19,11 +21,13 @@ class Fdo84315(unittest.TestCase):
def setUpClass(cls):
cls._uno = UnoInProcess()
cls._uno.setUp()
- cls._xDoc = cls._uno.openBaseDoc('fdo84315.odb')
+ workdir = os.environ[ "WORKDIR_FOR_BUILD" ]
+ cls._xDoc = cls._uno.openDoc(os.path.join(workdir, "CppunitTest/fdo84315.odb"))
@classmethod
def tearDownClass(cls):
cls._uno.tearDown()
+ xCon.dispose()
def test_fdo84315(self):
xDoc = self.__class__._xDoc
diff --git a/unotest/source/python/org/libreoffice/unotest.py b/unotest/source/python/org/libreoffice/unotest.py
index 4ae21c1..0acf05a 100644
--- a/unotest/source/python/org/libreoffice/unotest.py
+++ b/unotest/source/python/org/libreoffice/unotest.py
@@ -218,6 +218,17 @@ class UnoInProcess:
assert(self.xDoc)
return self.xDoc
+ def openDoc(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])
+ url = "file://" + 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)
More information about the Libreoffice-commits
mailing list