diff options
-rw-r--r-- | pyuno/qa/pytests/insertremovecells.py | 5 | ||||
-rw-r--r-- | sc/UITest_autofilter.mk | 5 | ||||
-rw-r--r-- | sc/UITest_calc_tests.mk | 5 | ||||
-rw-r--r-- | sc/qa/uitest/autofilter/autofilterBugs.py | 6 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests/mergedRowsColumns.py | 5 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests/subtotals.py | 5 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests/tdf62267.py | 5 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests/tdf65856.py | 5 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests/tdf81351.py | 5 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests/tdf86253.py | 5 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests/tdf99386.py | 5 | ||||
-rw-r--r-- | solenv/gbuild/UITest.mk | 2 | ||||
-rw-r--r-- | sw/UITest_writer_tests.mk | 4 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests/tdf108124.py | 5 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests/tdf113284.py | 5 | ||||
-rw-r--r-- | uitest/UITest_manual_tests.mk | 5 | ||||
-rw-r--r-- | uitest/UITest_writer_demo.mk | 5 | ||||
-rw-r--r-- | uitest/manual_tests/calc.py | 5 | ||||
-rw-r--r-- | uitest/writer_tests/tdf104649.py | 6 | ||||
-rw-r--r-- | unotest/source/python/org/libreoffice/unotest.py | 38 |
20 files changed, 94 insertions, 37 deletions
diff --git a/pyuno/qa/pytests/insertremovecells.py b/pyuno/qa/pytests/insertremovecells.py index 0d7979c4c8d1..e14717639d7e 100644 --- a/pyuno/qa/pytests/insertremovecells.py +++ b/pyuno/qa/pytests/insertremovecells.py @@ -9,7 +9,7 @@ try: except ImportError: from urllib import pathname2url -from org.libreoffice.unotest import pyuno, mkPropertyValue +from org.libreoffice.unotest import pyuno, mkPropertyValue, makeCopyFromTDOC class InsertRemoveCells(unittest.TestCase): @@ -29,8 +29,7 @@ class InsertRemoveCells(unittest.TestCase): ('Hidden', True), ('ReadOnly', False) )) - tdoc_dir = getenv('TDOC') - tdoc_path = pathname2url(path.join(tdoc_dir, 'fdo74824.ods')) + tdoc_path = pathname2url(makeCopyFromTDOC('fdo74824.ods')) if platform.system() == 'Windows': tdoc_path = re.sub(r'^//(/[A-Za-z]:/)/', r'\1', tdoc_path) url = 'file://' + tdoc_path diff --git a/sc/UITest_autofilter.mk b/sc/UITest_autofilter.mk index 93bf17200bb1..a6dc24cffbfb 100644 --- a/sc/UITest_autofilter.mk +++ b/sc/UITest_autofilter.mk @@ -12,4 +12,9 @@ $(eval $(call gb_UITest_UITest,autofilter)) $(eval $(call gb_UITest_add_modules,autofilter,$(SRCDIR)/sc/qa/uitest,\ autofilter/ \ )) + +$(eval $(call gb_UITest_set_defs,autofilter, \ + TDOC="$(SRCDIR)/sc/qa/uitest/autofilter/data" \ +)) + # vim: set noet sw=4 ts=4: diff --git a/sc/UITest_calc_tests.mk b/sc/UITest_calc_tests.mk index c9a4e5c3f44b..e316574a97bb 100644 --- a/sc/UITest_calc_tests.mk +++ b/sc/UITest_calc_tests.mk @@ -12,4 +12,9 @@ $(eval $(call gb_UITest_UITest,calc_tests)) $(eval $(call gb_UITest_add_modules,calc_tests,$(SRCDIR)/sc/qa/uitest,\ calc_tests/ \ )) + +$(eval $(call gb_UITest_set_defs,calc_tests, \ + TDOC="$(SRCDIR)/sc/qa/uitest/calc_tests/data" \ +)) + # vim: set noet sw=4 ts=4: diff --git a/sc/qa/uitest/autofilter/autofilterBugs.py b/sc/qa/uitest/autofilter/autofilterBugs.py index 370af59d8a5c..e216d7994d8c 100644 --- a/sc/qa/uitest/autofilter/autofilterBugs.py +++ b/sc/qa/uitest/autofilter/autofilterBugs.py @@ -10,12 +10,14 @@ from uitest.uihelper.common import get_state_as_dict import time from uitest.debug import sleep from uitest.uihelper.common import select_pos -from uitest.path import get_srcdir_url from uitest.uihelper.calc import enter_text_to_cell from libreoffice.calc.document import get_cell_by_position +import org.libreoffice.unotest +import pathlib + def get_url_for_data_file(file_name): - return get_srcdir_url() + "/sc/qa/uitest/autofilter/data/" + file_name + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() class autofilter(UITestCase): diff --git a/sc/qa/uitest/calc_tests/mergedRowsColumns.py b/sc/qa/uitest/calc_tests/mergedRowsColumns.py index 2f081e6355cd..1302c7b64bd5 100644 --- a/sc/qa/uitest/calc_tests/mergedRowsColumns.py +++ b/sc/qa/uitest/calc_tests/mergedRowsColumns.py @@ -8,14 +8,15 @@ from libreoffice.uno.propertyvalue import mkPropertyValues from uitest.framework import UITestCase from libreoffice.calc.document import get_column +import org.libreoffice.unotest +import pathlib import time from uitest.debug import sleep -from uitest.path import get_srcdir_url from libreoffice.calc.document import get_cell_by_position from uitest.uihelper.common import get_state_as_dict def get_url_for_data_file(file_name): - return get_srcdir_url() + "/sc/qa/uitest/calc_tests/data/" + file_name + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() class mergedRowsColumns(UITestCase): diff --git a/sc/qa/uitest/calc_tests/subtotals.py b/sc/qa/uitest/calc_tests/subtotals.py index fa1e4f5602cf..c18dd8ba4af0 100644 --- a/sc/qa/uitest/calc_tests/subtotals.py +++ b/sc/qa/uitest/calc_tests/subtotals.py @@ -8,16 +8,17 @@ from libreoffice.uno.propertyvalue import mkPropertyValues from uitest.framework import UITestCase from libreoffice.calc.document import get_column -from uitest.path import get_srcdir_url from uitest.uihelper.calc import enter_text_to_cell from libreoffice.calc.document import get_cell_by_position from uitest.uihelper.common import select_pos from uitest.uihelper.common import get_state_as_dict +import org.libreoffice.unotest +import pathlib import time from uitest.debug import sleep def get_url_for_data_file(file_name): - return get_srcdir_url() + "/sc/qa/uitest/calc_tests/data/" + file_name + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() class Subtotals(UITestCase): diff --git a/sc/qa/uitest/calc_tests/tdf62267.py b/sc/qa/uitest/calc_tests/tdf62267.py index 7d3e00048403..5671028ec5fb 100644 --- a/sc/qa/uitest/calc_tests/tdf62267.py +++ b/sc/qa/uitest/calc_tests/tdf62267.py @@ -5,9 +5,10 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. # from uitest.framework import UITestCase +import org.libreoffice.unotest import os +import pathlib from uitest.uihelper.common import get_state_as_dict -from uitest.path import get_srcdir_url from libreoffice.calc.document import get_sheet_from_doc from libreoffice.calc.conditional_format import get_conditional_format_from_sheet from uitest.debug import sleep @@ -18,7 +19,7 @@ from libreoffice.uno.propertyvalue import mkPropertyValues #numbers and dates the formatting is lost. Undo do not recover the conditional formatting. def get_url_for_data_file(file_name): - return get_srcdir_url() + "/sc/qa/uitest/calc_tests/data/" + file_name + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() class tdf62267(UITestCase): diff --git a/sc/qa/uitest/calc_tests/tdf65856.py b/sc/qa/uitest/calc_tests/tdf65856.py index 3c4432951574..c3e03ec7a95c 100644 --- a/sc/qa/uitest/calc_tests/tdf65856.py +++ b/sc/qa/uitest/calc_tests/tdf65856.py @@ -5,9 +5,10 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. # from uitest.framework import UITestCase +import org.libreoffice.unotest import os +import pathlib from uitest.uihelper.common import get_state_as_dict -from uitest.path import get_srcdir_url from libreoffice.calc.document import get_sheet_from_doc from libreoffice.calc.conditional_format import get_conditional_format_from_sheet from uitest.debug import sleep @@ -15,7 +16,7 @@ from libreoffice.uno.propertyvalue import mkPropertyValues from libreoffice.calc.document import get_cell_by_position def get_url_for_data_file(file_name): - return get_srcdir_url() + "/sc/qa/uitest/calc_tests/data/" + file_name + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() class tdf65856(UITestCase): diff --git a/sc/qa/uitest/calc_tests/tdf81351.py b/sc/qa/uitest/calc_tests/tdf81351.py index 0886ab7b4b16..520f1c3c64c8 100644 --- a/sc/qa/uitest/calc_tests/tdf81351.py +++ b/sc/qa/uitest/calc_tests/tdf81351.py @@ -9,12 +9,13 @@ from libreoffice.uno.propertyvalue import mkPropertyValues from uitest.framework import UITestCase from libreoffice.calc.document import get_column -from uitest.path import get_srcdir_url from libreoffice.calc.document import get_cell_by_position +import org.libreoffice.unotest +import pathlib import time def get_url_for_data_file(file_name): - return get_srcdir_url() + "/sc/qa/uitest/calc_tests/data/" + file_name + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() class tdf81351(UITestCase): diff --git a/sc/qa/uitest/calc_tests/tdf86253.py b/sc/qa/uitest/calc_tests/tdf86253.py index 2f29c2a398ec..c9c512c8d359 100644 --- a/sc/qa/uitest/calc_tests/tdf86253.py +++ b/sc/qa/uitest/calc_tests/tdf86253.py @@ -5,16 +5,17 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. # from uitest.framework import UITestCase +import org.libreoffice.unotest import os +import pathlib from uitest.uihelper.common import get_state_as_dict -from uitest.path import get_srcdir_url from libreoffice.calc.document import get_sheet_from_doc from libreoffice.calc.conditional_format import get_conditional_format_from_sheet from uitest.debug import sleep from libreoffice.uno.propertyvalue import mkPropertyValues def get_url_for_data_file(file_name): - return get_srcdir_url() + "/sc/qa/uitest/calc_tests/data/" + file_name + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() class tdf86253(UITestCase): diff --git a/sc/qa/uitest/calc_tests/tdf99386.py b/sc/qa/uitest/calc_tests/tdf99386.py index 46c77631219e..ff9286b61288 100644 --- a/sc/qa/uitest/calc_tests/tdf99386.py +++ b/sc/qa/uitest/calc_tests/tdf99386.py @@ -10,12 +10,13 @@ from uitest.uihelper.common import get_state_as_dict from libreoffice.uno.propertyvalue import mkPropertyValues from uitest.debug import sleep from uitest.uihelper.calc import enter_text_to_cell -from uitest.path import get_srcdir_url from libreoffice.calc.document import get_cell_by_position +import org.libreoffice.unotest +import pathlib import time def get_url_for_data_file(file_name): - return get_srcdir_url() + "/sc/qa/uitest/calc_tests/data/" + file_name + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() class tdf99386(UITestCase): diff --git a/solenv/gbuild/UITest.mk b/solenv/gbuild/UITest.mk index 10bddcb677cf..b71b125e8949 100644 --- a/solenv/gbuild/UITest.mk +++ b/solenv/gbuild/UITest.mk @@ -91,7 +91,7 @@ endif # always use udkapi and URE services define gb_UITest_UITest -$(call gb_UITest_get_target,$(1)) : PYPATH := $(SRCDIR)/uitest$$(gb_CLASSPATHSEP)$(INSTROOT)/$(LIBO_LIB_PYUNO_FOLDER)$(if $(filter-out $(LIBO_LIB_PYUNO_FOLDER),$(LIBO_LIB_FOLDER)),$(gb_CLASSPATHSEP)$(INSTROOT)/$(LIBO_LIB_FOLDER)) +$(call gb_UITest_get_target,$(1)) : PYPATH := $(SRCDIR)/uitest$$(gb_CLASSPATHSEP)$(SRCDIR)/unotest/source/python$$(gb_CLASSPATHSEP)$(INSTROOT)/$(LIBO_LIB_PYUNO_FOLDER)$(if $(filter-out $(LIBO_LIB_PYUNO_FOLDER),$(LIBO_LIB_FOLDER)),$(gb_CLASSPATHSEP)$(INSTROOT)/$(LIBO_LIB_FOLDER)) $(call gb_UITest_get_target,$(1)) : MODULES := $(eval $(call gb_Module_register_target,$(call gb_UITest_get_target,$(1)),$(call gb_UITest_get_clean_target,$(1)))) diff --git a/sw/UITest_writer_tests.mk b/sw/UITest_writer_tests.mk index 3205991d0429..ccf169aea098 100644 --- a/sw/UITest_writer_tests.mk +++ b/sw/UITest_writer_tests.mk @@ -10,3 +10,7 @@ $(eval $(call gb_UITest_UITest,writer_tests)) $(eval $(call gb_UITest_add_modules,writer_tests,$(SRCDIR)/sw/qa/uitest,\ writer_tests/ \ )) + +$(eval $(call gb_UITest_set_defs,writer_tests, \ + TDOC="$(SRCDIR)/sw/qa/uitest/writer_tests/data" \ +)) diff --git a/sw/qa/uitest/writer_tests/tdf108124.py b/sw/qa/uitest/writer_tests/tdf108124.py index 3dae7080bc11..168f51bff33a 100644 --- a/sw/qa/uitest/writer_tests/tdf108124.py +++ b/sw/qa/uitest/writer_tests/tdf108124.py @@ -7,12 +7,13 @@ from uitest.framework import UITestCase from libreoffice.uno.propertyvalue import mkPropertyValues from uitest.uihelper.common import get_state_as_dict +import org.libreoffice.unotest +import pathlib import time from uitest.debug import sleep -from uitest.path import get_srcdir_url def get_url_for_data_file(file_name): - return get_srcdir_url() + "/sw/qa/uitest/writer_tests/data/" + file_name + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() class tdf108124(UITestCase): diff --git a/sw/qa/uitest/writer_tests/tdf113284.py b/sw/qa/uitest/writer_tests/tdf113284.py index 1ab5462f997a..11c867ecea14 100644 --- a/sw/qa/uitest/writer_tests/tdf113284.py +++ b/sw/qa/uitest/writer_tests/tdf113284.py @@ -6,12 +6,13 @@ from uitest.framework import UITestCase from libreoffice.uno.propertyvalue import mkPropertyValues from uitest.uihelper.common import get_state_as_dict +import org.libreoffice.unotest +import pathlib import time -from uitest.path import get_srcdir_url from uitest.debug import sleep def get_url_for_data_file(file_name): - return get_srcdir_url() + "/sw/qa/uitest/writer_tests/data/" + file_name + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() class tdf113284(UITestCase): diff --git a/uitest/UITest_manual_tests.mk b/uitest/UITest_manual_tests.mk index d9ac95a513c3..187ab8317b5f 100644 --- a/uitest/UITest_manual_tests.mk +++ b/uitest/UITest_manual_tests.mk @@ -12,4 +12,9 @@ $(eval $(call gb_UITest_UITest,manual_tests)) $(eval $(call gb_UITest_add_modules,manual_tests,$(SRCDIR)/uitest,\ manual_tests/ \ )) + +$(eval $(call gb_UITest_set_defs,manual_tests, \ + TDOC="$(SRCDIR)/uitest/manual_tests/data" \ +)) + # vim: set noet sw=4 ts=4: diff --git a/uitest/UITest_writer_demo.mk b/uitest/UITest_writer_demo.mk index a95fbd17128e..51b12feda607 100644 --- a/uitest/UITest_writer_demo.mk +++ b/uitest/UITest_writer_demo.mk @@ -12,4 +12,9 @@ $(eval $(call gb_UITest_UITest,writer_demo)) $(eval $(call gb_UITest_add_modules,writer_demo,$(SRCDIR)/uitest,\ writer_tests/ \ )) + +$(eval $(call gb_UITest_set_defs,writer_demo, \ + TDOC="$(SRCDIR)/uitest/writer_tests/data" \ +)) + # vim: set noet sw=4 ts=4: diff --git a/uitest/manual_tests/calc.py b/uitest/manual_tests/calc.py index 2f4524134f77..9c86b6c3e6d9 100644 --- a/uitest/manual_tests/calc.py +++ b/uitest/manual_tests/calc.py @@ -12,12 +12,13 @@ from libreoffice.calc.document import get_cell_by_position from uitest.uihelper.common import get_state_as_dict, type_text from uitest.uihelper.calc import enter_text_to_cell -from uitest.path import get_srcdir_url +import org.libreoffice.unotest +import pathlib import time def get_url_for_data_file(file_name): - return get_srcdir_url() + "/uitest/manual_tests/data/" + file_name + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() class ManualCalcTests(UITestCase): diff --git a/uitest/writer_tests/tdf104649.py b/uitest/writer_tests/tdf104649.py index a1593d387339..f6541feee5a4 100644 --- a/uitest/writer_tests/tdf104649.py +++ b/uitest/writer_tests/tdf104649.py @@ -5,10 +5,12 @@ # from uitest.framework import UITestCase -from uitest.path import get_srcdir_url + +import org.libreoffice.unotest +import pathlib def get_url_for_data_file(file_name): - return get_srcdir_url() + "/uitest/writer_tests/data/" + file_name + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() class tdf104649(UITestCase): diff --git a/unotest/source/python/org/libreoffice/unotest.py b/unotest/source/python/org/libreoffice/unotest.py index a6a927ca881c..1d0beb737ccb 100644 --- a/unotest/source/python/org/libreoffice/unotest.py +++ b/unotest/source/python/org/libreoffice/unotest.py @@ -14,6 +14,9 @@ import time import uuid import argparse import os +import shutil +import urllib.parse +import urllib.request try: import pyuno @@ -210,20 +213,15 @@ class UnoInProcess: return self.openDocFromTDOC(file, True) def openDocFromTDOC(self, file, asTemplate = False): - 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) - return self.openDocFromURL(url, asTemplate) + path = makeCopyFromTDOC(file) + return self.openDocFromAbsolutePath(path, asTemplate) - def openDocFromAbsolutePath(self, file): + def openDocFromAbsolutePath(self, file, asTemplate = False): if os.name == "nt": url = "file:///" + file else: url = "file://" + file - return self.openDocFromURL(url) + return self.openDocFromURL(url, asTemplate) def openDocFromURL(self, url, asTemplate = False): props = [("Hidden", True), ("ReadOnly", False), ("AsTemplate", asTemplate)] @@ -285,6 +283,28 @@ def runConnectionTests(connection, invoker, tests): finally: connection.tearDown() +def makeCopyFromTDOC(file): + src = os.getenv("TDOC") + assert(src is not None) + src = os.path.join(src, file) + dst = os.getenv("TestUserDir") + assert(dst is not None) + uri = urllib.parse.urlparse(dst) + assert(uri.scheme.casefold() == "file") + assert(uri.netloc == "" or uri.netloc.casefold() == "localhost") + assert(uri.params == "") + assert(uri.query == "") + assert(uri.fragment == "") + dst = urllib.request.url2pathname(uri.path) + dst = os.path.join(dst, "tmp", file) + os.makedirs(os.path.dirname(dst), exist_ok=True) + try: + os.remove(dst) + except FileNotFoundError: + pass + shutil.copyfile(src, dst) + return dst + ### tests ### if __name__ == "__main__": |