[Libreoffice-commits] core.git: pyuno/qa sd/inc sd/source

2023-07-11 Thread Szymon Kłos (via logerrit)
 pyuno/qa/pytests/testcollections_XNameAccess.py |   25 +-
 sd/inc/strings.hrc  |1 
 sd/source/ui/inc/unomodel.hxx   |   69 +
 sd/source/ui/unoidl/unomodel.cxx|  298 +++-
 4 files changed, 324 insertions(+), 69 deletions(-)

New commits:
commit e78f60a369146774ca2a38ca121f294b562b2be5
Author: Szymon Kłos 
AuthorDate: Tue May 30 14:09:25 2023 +0200
Commit: Szymon Kłos 
CommitDate: Wed Jul 12 07:56:37 2023 +0200

Categories for link targets in Impress

Writer and Calc presented possible link targets inside
documents as a Tree, with items under their categories.
This patch makes the same for Impress so we don't mix
master pages with regular pages.

Change-Id: Ifd98300b0d609c28d6c1880332fff7e750b5e1b2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152389
Reviewed-by: Gülşah Köse 
Tested-by: Jenkins CollaboraOffice 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153985
Tested-by: Jenkins
Reviewed-by: Szymon Kłos 

diff --git a/pyuno/qa/pytests/testcollections_XNameAccess.py 
b/pyuno/qa/pytests/testcollections_XNameAccess.py
index 79d66a2e1bc2..5c5ad6890be2 100644
--- a/pyuno/qa/pytests/testcollections_XNameAccess.py
+++ b/pyuno/qa/pytests/testcollections_XNameAccess.py
@@ -28,10 +28,14 @@ class TestXNameAccess(CollectionsTestBase):
 drw = self.createBlankDrawing()
 
 # When
-length = len(drw.Links)
+length_categories = len(drw.Links)
+length_slides = len(drw.Links['Slide'].Links)
+length_master = len(drw.Links['Master Page'].Links)
 
 # Then
-self.assertEqual(2, length)
+self.assertEqual(4, length_categories)
+self.assertEqual(1, length_slides)
+self.assertEqual(1, length_master)
 
 drw.close(True)
 
@@ -45,7 +49,7 @@ class TestXNameAccess(CollectionsTestBase):
 drw.DrawPages[0].Name = 'foo'
 
 # When
-link = drw.Links['foo']
+link = drw.Links['Slide'].Links['foo']
 
 # Then
 self.assertEqual('foo', link.getName())
@@ -62,7 +66,7 @@ class TestXNameAccess(CollectionsTestBase):
 
 # When / Then
 with self.assertRaises(KeyError):
-link = drw.Links['foo']
+link = drw.Links['Slide'].Links['foo']
 
 drw.close(True)
 
@@ -146,7 +150,7 @@ class TestXNameAccess(CollectionsTestBase):
 drw.DrawPages[0].Name = 'foo'
 
 # When
-present = 'foo' in drw.Links
+present = 'foo' in drw.Links['Slide'].Links
 
 # Then
 self.assertTrue(present)
@@ -161,17 +165,17 @@ class TestXNameAccess(CollectionsTestBase):
 # Given
 drw = self.createBlankDrawing()
 i = 0
-for name in drw.Links.getElementNames():
-drw.Links.getByName(name).Name = 'foo' + str(i)
+for name in drw.Links['Slide'].Links.getElementNames():
+drw.Links['Slide'].Links.getByName(name).Name = 'foo' + str(i)
 i += 1
 
 # When
 read_links = []
-for link in drw.Links:
+for link in drw.Links['Slide'].Links:
 read_links.append(link)
 
 # Then
-self.assertEqual(['foo0', 'foo1'], read_links)
+self.assertEqual(['foo0'], read_links)
 
 drw.close(True)
 
@@ -184,11 +188,10 @@ class TestXNameAccess(CollectionsTestBase):
 drw = self.createBlankDrawing()
 
 # When
-itr = iter(drw.Links)
+itr = iter(drw.Links['Slide'].Links)
 
 # Then
 self.assertIsNotNone(next(itr))
-self.assertIsNotNone(next(itr))
 with self.assertRaises(StopIteration):
 next(itr)
 
diff --git a/sd/inc/strings.hrc b/sd/inc/strings.hrc
index 3e1ddd1542e7..0d9303e18bea 100644
--- a/sd/inc/strings.hrc
+++ b/sd/inc/strings.hrc
@@ -95,6 +95,7 @@
 #define STR_VOC_FILENC_("STR_VOC_FILE", 
"Creative Labs Audio")
 #define STR_AIFF_FILE   NC_("STR_AIFF_FILE", 
"Apple/SGI Audio")
 #define STR_SVX_FILENC_("STR_SVX_FILE", 
"Amiga SVX Audio")
+#define STR_SD_PAGE NC_("STR_SD_PAGE", 
"Slide")
 #define STR_SD_PAGE_COUNT   
NC_("STR_SD_PAGE_COUNT", "Slide %1 of %2")
 #define STR_SD_PAGE_COUNT_CUSTOM
NC_("STR_SD_PAGE_COUNT_CUSTOM", "Slide %1 of %2 (%3)")
 #define STR_SD_PAGE_COUNT_DRAW  
NC_("STR_SD_PAGE_COUNT_DRAW", "Page %1 of %2")
diff --git a/sd/source/ui/inc/unomodel.hxx b/sd/source/ui/inc/unomodel.hxx
index f31d93b97420..eba78ce17fb7 100644
--- a/sd/source/ui/inc/unomodel.hxx
+++ b/sd/source/ui/inc/unomodel.hxx
@@ -380,11 +380,21 @@ public:
 *  *
 ***/
 
+enum 

[Libreoffice-commits] core.git: pyuno/qa uitest/libreoffice

2022-09-05 Thread Chenxiong Qi (via logerrit)
 pyuno/qa/pytests/insertremovecells.py |   12 ++--
 uitest/libreoffice/calc/document.py   |2 +-
 2 files changed, 7 insertions(+), 7 deletions(-)

New commits:
commit 9928f139e858768047b8dea0405720395beb18cd
Author: Chenxiong Qi 
AuthorDate: Thu Sep 1 08:44:20 2022 +0800
Commit: Noel Grandin 
CommitDate: Mon Sep 5 16:05:56 2022 +0200

tdf#97361 replace getCellByPosition with access by subscript

Signed-off-by: Chenxiong Qi 
Change-Id: I50d6e29c34e3cf72cdf0afc9f118fafc3c144eaf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139141
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/pyuno/qa/pytests/insertremovecells.py 
b/pyuno/qa/pytests/insertremovecells.py
index f1c0fa176113..1d850a65d9fd 100644
--- a/pyuno/qa/pytests/insertremovecells.py
+++ b/pyuno/qa/pytests/insertremovecells.py
@@ -57,19 +57,19 @@ class InsertRemoveCells(unittest.TestCase):
   (3, 3, '6', 6.0),
   (5, 1, '1', 1.0),
 )
-for pos in empty_cells:
-cell = sheet.getCellByPosition(*pos)
+for col, row in empty_cells:
+cell = sheet[row,col]
 self.assertEqual('EMPTY', cell.Type.value)
 
-for x, y, f, s, val in formula_cells:
-cell = sheet.getCellByPosition(x, y)
+for col, row, f, s, val in formula_cells:
+cell = sheet[row,col]
 self.assertEqual('FORMULA', cell.Type.value)
 self.assertEqual(f, cell.getFormula())
 self.assertEqual(s, cell.String)
 self.assertEqual(val, cell.Value)
 
-for x, y, s, val in value_cells:
-cell = sheet.getCellByPosition(x, y)
+for col, row, s, val in value_cells:
+cell = sheet[row,col]
 self.assertEqual(s, cell.String)
 self.assertEqual(val, cell.Value)
 
diff --git a/uitest/libreoffice/calc/document.py 
b/uitest/libreoffice/calc/document.py
index 40a2ec635e3c..b837bda72521 100644
--- a/uitest/libreoffice/calc/document.py
+++ b/uitest/libreoffice/calc/document.py
@@ -24,7 +24,7 @@ def get_cell_by_position(document, tab, column, row):
 row -- The 0-based row number
 """
 sheet = get_sheet_from_doc(document, tab)
-return sheet.getCellByPosition(column, row)
+return sheet[row,column]
 
 def get_column(document, column, tab = 0):
 """ Get the column object through the column index


[Libreoffice-commits] core.git: pyuno/qa

2022-09-05 Thread Chenxiong Qi (via logerrit)
 pyuno/qa/pytests/testcollections_XNameContainer.py |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 14cff82b314709db488d929b75c254fbb0355419
Author: Chenxiong Qi 
AuthorDate: Wed Aug 31 21:59:20 2022 +0800
Commit: Noel Grandin 
CommitDate: Mon Sep 5 16:05:28 2022 +0200

tdf#97361 replace getCellRangeByPosition with slices

Signed-off-by: Chenxiong Qi 
Change-Id: I4368adca1e9500c6f926ea1f28b0790b06fae739
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139140
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/pyuno/qa/pytests/testcollections_XNameContainer.py 
b/pyuno/qa/pytests/testcollections_XNameContainer.py
index c544ca9dd181..ac34049a79df 100644
--- a/pyuno/qa/pytests/testcollections_XNameContainer.py
+++ b/pyuno/qa/pytests/testcollections_XNameContainer.py
@@ -33,7 +33,7 @@ class TestXNameContainer(CollectionsTestBase):
 # Given
 spr = self.createBlankSpreadsheet()
 ranges = getSheetCellRangesInstance(spr)
-new_range = spr.Sheets[0].getCellRangeByPosition(1, 2, 1, 2)
+new_range = spr.Sheets[0][2:3,1:2]
 
 # When
 ranges['foo'] = new_range
@@ -51,7 +51,7 @@ class TestXNameContainer(CollectionsTestBase):
 # Given
 spr = self.createBlankSpreadsheet()
 ranges = getSheetCellRangesInstance(spr)
-new_range = spr.Sheets[0].getCellRangeByPosition(1, 2, 1, 2)
+new_range = spr.Sheets[0][2:3,1:2]
 
 # When / Then
 with self.assertRaises(TypeError):
@@ -65,8 +65,8 @@ class TestXNameContainer(CollectionsTestBase):
 # Given
 spr = self.createBlankSpreadsheet()
 ranges = getSheetCellRangesInstance(spr)
-new_range1 = spr.Sheets[0].getCellRangeByPosition(1, 2, 1, 2)
-new_range2 = spr.Sheets[0].getCellRangeByPosition(6, 6, 6, 6)
+new_range1 = spr.Sheets[0][2:3,1:2]
+new_range2 = spr.Sheets[0][6:7,6:7]
 
 # When
 ranges['foo'] = new_range1


[Libreoffice-commits] core.git: pyuno/qa sc/inc

2022-03-08 Thread Luboš Luňák (via logerrit)
 pyuno/qa/pytests/testcollections_XCellRange.py |4 ++--
 sc/inc/address.hxx |4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 4c5f8ccf0a2320432b8fe91add1dcadf54d9fd58
Author: Luboš Luňák 
AuthorDate: Tue Mar 8 12:44:49 2022 +0100
Commit: Luboš Luňák 
CommitDate: Wed Mar 9 08:25:44 2022 +0100

change default Calc number of columns to 16384 (tdf#50916)

All tests pass now, and I've also handled all significant bugreports
from tdf#133764. This commit is mainly meant to test this more
in practice and collect feedback. Depending on how this turns out,
there may be a backwards compatibility option or something similar,
but so far I see no significant need for it.

Change-Id: I1a946f4e0b51be5acf4e25dc773e7694c2b17b48
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131180
Tested-by: Jenkins
Reviewed-by: Luboš Luňák 

diff --git a/pyuno/qa/pytests/testcollections_XCellRange.py 
b/pyuno/qa/pytests/testcollections_XCellRange.py
index 3f610ca3485c..641482433375 100644
--- a/pyuno/qa/pytests/testcollections_XCellRange.py
+++ b/pyuno/qa/pytests/testcollections_XCellRange.py
@@ -348,7 +348,7 @@ class TestXCellRange(CollectionsTestBase):
 self.assertEqual(0, rng.RangeAddress.StartRow)
 self.assertEqual(0, rng.RangeAddress.StartColumn)
 self.assertEqual(0, rng.RangeAddress.EndRow)
-self.assertEqual(1023, rng.RangeAddress.EndColumn)
+self.assertEqual(16383, rng.RangeAddress.EndColumn)
 
 spr.close(True)
 
@@ -369,7 +369,7 @@ class TestXCellRange(CollectionsTestBase):
 self.assertEqual(0, rng.RangeAddress.StartRow)
 self.assertEqual(0, rng.RangeAddress.StartColumn)
 self.assertEqual(0, rng.RangeAddress.EndRow)
-self.assertEqual(1023, rng.RangeAddress.EndColumn)
+self.assertEqual(16383, rng.RangeAddress.EndColumn)
 
 spr.close(True)
 
diff --git a/sc/inc/address.hxx b/sc/inc/address.hxx
index 18bd11049e92..13cfd9c408c2 100644
--- a/sc/inc/address.hxx
+++ b/sc/inc/address.hxx
@@ -60,7 +60,7 @@ const SCSIZE   SCSIZE_MAX   = 
::std::numeric_limits::max();
 
 // Count values
 const SCROW   MAXROWCOUNT= 1048576;
-const SCCOL   MAXCOLCOUNT= 1024;
+const SCCOL   MAXCOLCOUNT= 16384;
 const SCCOL   INITIALCOLCOUNT = 64; // initial number of columns we 
allocate memory for
 /// limiting to 1 for now, problem with 32 bit builds for now
 const SCTAB   MAXTABCOUNT= 1;
@@ -82,7 +82,7 @@ const SCTAB   MAXINITTAB = 1024;
 const SCTAB   MININITTAB = 1;
 
 inline constexpr OUStringLiteral MAXROW_STRING(u"1048575");
-inline constexpr OUStringLiteral MAXCOL_STRING(u"AMJ");
+inline constexpr OUStringLiteral MAXCOL_STRING(u"XFD");
 inline constexpr OUStringLiteral MAXROW_JUMBO_STRING(u"16777215");
 inline constexpr OUStringLiteral MAXCOL_JUMBO_STRING(u"XFD");
 


[Libreoffice-commits] core.git: pyuno/qa pyuno/source sfx2/qa solenv/gbuild sw/qa test/source unotest/source

2018-09-06 Thread Libreoffice Gerrit user
 pyuno/qa/pytests/testcollections_XCellRange.py |   34 +
 pyuno/qa/pytests/testcollections_XEnumeration.py   |   11 +
 pyuno/qa/pytests/testcollections_XEnumerationAccess.py |   15 +++
 pyuno/qa/pytests/testcollections_XIndexAccess.py   |   24 
 pyuno/qa/pytests/testcollections_XIndexContainer.py|2 +
 pyuno/qa/pytests/testcollections_XIndexReplace.py  |   18 +
 pyuno/qa/pytests/testcollections_XNameAccess.py|   22 +++
 pyuno/qa/pytests/testcollections_XNameContainer.py |   12 ++
 pyuno/qa/pytests/testcollections_XNameReplace.py   |6 +++
 pyuno/qa/pytests/testcollections_misc.py   |8 
 pyuno/qa/pytests/testcollections_mixednameindex.py |2 +
 pyuno/source/module/pyuno_module.cxx   |   33 
 sfx2/qa/python/check_sidebar.py|3 -
 sfx2/qa/python/check_sidebar_registry.py   |1 
 solenv/gbuild/PythonTest.mk|7 ++-
 sw/qa/python/check_bookmarks.py|4 ++
 sw/qa/python/check_change_color.py |1 
 sw/qa/python/check_cross_references.py |4 ++
 sw/qa/python/check_fields.py   |8 ++--
 sw/qa/python/check_flies.py|8 ++--
 sw/qa/python/check_indexed_property_values.py  |1 
 sw/qa/python/check_named_property_values.py|1 
 sw/qa/python/check_table.py|4 ++
 sw/qa/python/get_expression.py |4 ++
 sw/qa/python/set_expression.py |4 +-
 sw/qa/python/text_portion_enumeration_test.py  |5 ++
 sw/qa/python/var_fields.py |3 -
 test/source/bootstrapfixture.cxx   |6 +++
 unotest/source/python/org/libreoffice/unittest.py  |   29 ++
 unotest/source/python/org/libreoffice/unotest.py   |7 +++
 30 files changed, 266 insertions(+), 21 deletions(-)

New commits:
commit e7a3329fd0a68c95f00e6cdfdc3e40e6afa5411c
Author: Stephan Bergmann 
AuthorDate: Thu Sep 6 17:13:54 2018 +0200
Commit: Stephan Bergmann 
CommitDate: Fri Sep 7 07:31:48 2018 +0200

DeInitVCL in PythonTest

After b9757f5cfdb62b24e79eeb4c0ef0c8b98056cecf "loplugin:useuniqueptr in
vcl/svdata" ASan/UBSan builds started to fail (like
) at the end of
PythonTest_dbaccess_python (and probably other PythonTests), when during 
exit
the static utl::ConfigManager instance already happens to be destroyed by 
the
time the static ImplSVData's mpSettingsConfigItem is destroyed (which would
normally be cleared during DeInitVCL, if PythonTests would call that, and 
which
in the past had thus simply been leaked in PythonTests when that
mpSettingsConfigItem was a plain pointer instead of std::unique_ptr).

So ensure that PythonTests that initialize VCL also call DeInitVCL, via a 
new
private_deinitTestEnvironment, complementing the existing
private_initTestEnvironment.

However, while private_initTestEnvironment is called once (typically via
UnoInProcess.setUp, which internally makes sure to only call it once) as 
soon as
the first executed test needs it, private_deinitTestEnvironment must be 
called
once after the lasts test needing it has executed.  The only way that I 
found to
do that is to override unittest.TextTestResult's stopTestRun method, which 
is
called once after all tests have been executed.  Hence a new test runner 
setup
in unotest/source/python/org/libreoffice/unittest.py that is now called from
solenv/gbuild/PythonTest.mk.

That revealed a few places in PythonTests that didn't yet close/delete 
documents
that they had opened, which has now been added.

One remaining problem then is that classes like SwXTextDocument and friends 
call
Application::GetSolarMutex from their dtors, via sw::UnoImplPtrDeleter (a 
"Smart
pointer class ensuring that the pointed object is deleted with a locked
SolarMutex", sw/inc/unobaseclass.hxx).  That means that any PyUNO proxies to
such C++ objects that remain alive after private_deinitTestEnvironment will
cause issues at exit, when Python does a final garbage collection of those
objects.  The ultimate fix will be to remove that unhelpful 
UnoImplPtrDeleter
and its locking of SolarMutex from the dtors of UNO objects; until then, the
Python code is now sprinkled with some HACKs to make sure all those PyUNO
proxies are released in a timely fashion (see the comment in
unotest/source/python/org/libreoffice/unittest.py for details).  (Also, it 
would
probably help if UnoInProcess didn't keep a local self.xDoc around 
referencing
(just) the last result of calling one of its open* 

[Libreoffice-commits] core.git: pyuno/qa

2018-04-05 Thread Stephan Bergmann
 pyuno/qa/pytests/insertremovecells.py |   13 +++--
 1 file changed, 3 insertions(+), 10 deletions(-)

New commits:
commit e21b2a61d64b697413c0fc9013746b9d358da4c6
Author: Stephan Bergmann 
Date:   Thu Apr 5 18:51:55 2018 +0200

Fix Python file URL construction on Windows

...after d76281864b0e83812c0edf7490b1e8271e89fff5 "Create temp copies of 
test
docs in Python/UITests"

Change-Id: I0f331ca9567e9a54842cc35b35628046d29b176d
Reviewed-on: https://gerrit.libreoffice.org/52470
Tested-by: Jenkins 
Reviewed-by: Stephan Bergmann 

diff --git a/pyuno/qa/pytests/insertremovecells.py 
b/pyuno/qa/pytests/insertremovecells.py
index e14717639d7e..f1c0fa176113 100644
--- a/pyuno/qa/pytests/insertremovecells.py
+++ b/pyuno/qa/pytests/insertremovecells.py
@@ -1,14 +1,9 @@
-import platform
+import pathlib
 import re
 import unittest
 
 from os import getenv, path
 
-try:
-from urllib.request import pathname2url
-except ImportError:
-from urllib import pathname2url
-
 from org.libreoffice.unotest import pyuno, mkPropertyValue, makeCopyFromTDOC
 
 
@@ -29,10 +24,8 @@ class InsertRemoveCells(unittest.TestCase):
   ('Hidden', True),
   ('ReadOnly', False)
 ))
-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
+tdoc_path = makeCopyFromTDOC('fdo74824.ods')
+url = pathlib.Path(tdoc_path).as_uri()
 doc = desktop.loadComponentFromURL(url, "_blank", 0, load_props)
 
 sheet = doc.Sheets.Sheet1
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: pyuno/qa sc/qa sc/UITest_autofilter.mk sc/UITest_calc_tests.mk solenv/gbuild sw/qa sw/UITest_writer_tests.mk uitest/manual_tests uitest/UITest_manual_tests.mk uitest/UI

2018-04-03 Thread Stephan Bergmann
 pyuno/qa/pytests/insertremovecells.py|5 +--
 sc/UITest_autofilter.mk  |5 +++
 sc/UITest_calc_tests.mk  |5 +++
 sc/qa/uitest/autofilter/autofilterBugs.py|6 ++-
 sc/qa/uitest/calc_tests/mergedRowsColumns.py |5 +--
 sc/qa/uitest/calc_tests/subtotals.py |5 +--
 sc/qa/uitest/calc_tests/tdf62267.py  |5 +--
 sc/qa/uitest/calc_tests/tdf65856.py  |5 +--
 sc/qa/uitest/calc_tests/tdf81351.py  |5 +--
 sc/qa/uitest/calc_tests/tdf86253.py  |5 +--
 sc/qa/uitest/calc_tests/tdf99386.py  |5 +--
 solenv/gbuild/UITest.mk  |2 -
 sw/UITest_writer_tests.mk|4 ++
 sw/qa/uitest/writer_tests/tdf108124.py   |5 +--
 sw/qa/uitest/writer_tests/tdf113284.py   |5 +--
 uitest/UITest_manual_tests.mk|5 +++
 uitest/UITest_writer_demo.mk |5 +++
 uitest/manual_tests/calc.py  |5 +--
 uitest/writer_tests/tdf104649.py |6 ++-
 unotest/source/python/org/libreoffice/unotest.py |   38 +--
 20 files changed, 94 insertions(+), 37 deletions(-)

New commits:
commit d76281864b0e83812c0edf7490b1e8271e89fff5
Author: Stephan Bergmann 
Date:   Thu Mar 29 18:35:54 2018 +0200

Create temp copies of test docs in Python/UITests

...where necessary, so the tests will succeed if SRCDIR is a read-only tree.

Change-Id: Iea4c52d5982d3eba079088ef1670ff557ce30c3f
Reviewed-on: https://gerrit.libreoffice.org/52122
Tested-by: Jenkins 
Reviewed-by: Stephan Bergmann 

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 

[Libreoffice-commits] core.git: pyuno/qa

2017-10-04 Thread Stephan Bergmann
 pyuno/qa/pytests/insertremovecells.py |   11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

New commits:
commit a35e532a2d16dce25854b7c3cf27cc3a96a00b8e
Author: Stephan Bergmann 
Date:   Tue Oct 3 18:01:54 2017 +0200

Fix PythonTest_pyuno_pytests_insertremovecells on Windows

...where the original code caused an "Unsupported URL " 
error,
while just using pathname2url instead of quote caused "Unsupported URL
", so had to add the silly re.sub.  Hopefully keeps working
with all sorts of Python 2 and 3 that we want to support.  (And is there 
really
no better way to convert a pathname to a file URL in Python?)

Change-Id: I43f450707fe5206a1e6b91918962d2d90a880463
Reviewed-on: https://gerrit.libreoffice.org/43092
Reviewed-by: Stephan Bergmann 
Tested-by: Stephan Bergmann 

diff --git a/pyuno/qa/pytests/insertremovecells.py 
b/pyuno/qa/pytests/insertremovecells.py
index 5e29f3256c7f..0d7979c4c8d1 100644
--- a/pyuno/qa/pytests/insertremovecells.py
+++ b/pyuno/qa/pytests/insertremovecells.py
@@ -1,11 +1,13 @@
+import platform
+import re
 import unittest
 
 from os import getenv, path
 
 try:
-from urllib.parse import quote
+from urllib.request import pathname2url
 except ImportError:
-from urllib import quote
+from urllib import pathname2url
 
 from org.libreoffice.unotest import pyuno, mkPropertyValue
 
@@ -28,7 +30,10 @@ class InsertRemoveCells(unittest.TestCase):
   ('ReadOnly', False)
 ))
 tdoc_dir = getenv('TDOC')
-url = 'file://' + quote(path.join(tdoc_dir, 'fdo74824.ods'))
+tdoc_path = pathname2url(path.join(tdoc_dir, 'fdo74824.ods'))
+if platform.system() == 'Windows':
+tdoc_path = re.sub(r'^//(/[A-Za-z]:/)/', r'\1', tdoc_path)
+url = 'file://' + tdoc_path
 doc = desktop.loadComponentFromURL(url, "_blank", 0, load_props)
 
 sheet = doc.Sheets.Sheet1
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: pyuno/qa

2017-09-26 Thread Stephan Bergmann
 pyuno/qa/pytests/testcollections_base.py |6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit 4bf3b4ee48c4e3556e257aa77940f68c13b05b54
Author: Stephan Bergmann 
Date:   Tue Sep 26 17:49:47 2017 +0200

Call pyuno.private_initTestEnvironment() only once

...instead of once for each class derived from CollectionsTestBase (as 
listed in
pyuno/PythonTest_pyuno_pytests_testcollections.mk), causing the

  assert(!pSVData->maDeInitHook.IsSet());

in Application::setDeInitHook (vcl/source/app/svapp.cxx) to fire.

This is probably far from being idiomatic Python code...

Change-Id: I8cd1470c085b16b7b82468a308cfd1dead2db034

diff --git a/pyuno/qa/pytests/testcollections_base.py 
b/pyuno/qa/pytests/testcollections_base.py
index b3fcd2eb92f8..d3e8068820cf 100644
--- a/pyuno/qa/pytests/testcollections_base.py
+++ b/pyuno/qa/pytests/testcollections_base.py
@@ -13,13 +13,17 @@ import uno
 from org.libreoffice.unotest import pyuno
 from com.sun.star.beans import PropertyValue
 
+testEnvironmentInitialized = False
 
 class CollectionsTestBase(unittest.TestCase):
 
 @classmethod
 def setUpClass(cls):
 cls.context = pyuno.getComponentContext()
-pyuno.private_initTestEnvironment()
+global testEnvironmentInitialized
+if not testEnvironmentInitialized:
+pyuno.private_initTestEnvironment()
+testEnvironmentInitialized = True
 
 def setUp(self):
 self._components = []
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: pyuno/qa

2016-12-12 Thread n5xgdh
 pyuno/qa/pytests/insertremovecells.py   |4 -
 pyuno/qa/pytests/testcollections_XCellRange.py  |   39 ++--
 pyuno/qa/pytests/testcollections_XIndexAccess.py|   57 +
 pyuno/qa/pytests/testcollections_XIndexContainer.py |   64 ++--
 pyuno/qa/pytests/testcollections_XIndexReplace.py   |   34 +-
 pyuno/qa/pytests/testcollections_XNameAccess.py |6 -
 pyuno/qa/pytests/testcollections_XNameContainer.py  |   30 +
 pyuno/qa/pytests/testcollections_XNameReplace.py|   22 +++---
 pyuno/qa/pytests/testcollections_base.py|8 +-
 pyuno/qa/pytests/testcollections_mixednameindex.py  |   18 ++---
 10 files changed, 150 insertions(+), 132 deletions(-)

New commits:
commit 9d67a5872ef7e4b38eb8158046e149a59d6af4f3
Author: n5xgdh 
Date:   Sun Dec 4 10:44:38 2016 -0800

tdf#97361: Changed naming convention to Python type, object factories 
implemented

Change-Id: Id42e9a2e2cfd7c95140411123e8702dfdb4054da
Reviewed-on: https://gerrit.libreoffice.org/31676
Reviewed-by: Björn Michaelsen 
Tested-by: Björn Michaelsen 

diff --git a/pyuno/qa/pytests/insertremovecells.py 
b/pyuno/qa/pytests/insertremovecells.py
index 5c2585a..5e29f32 100644
--- a/pyuno/qa/pytests/insertremovecells.py
+++ b/pyuno/qa/pytests/insertremovecells.py
@@ -23,13 +23,13 @@ class InsertRemoveCells(unittest.TestCase):
 
 smgr = ctxt.ServiceManager
 desktop = smgr.createInstanceWithContext('com.sun.star.frame.Desktop', 
ctxt)
-loadProps = tuple(mkPropertyValue(k, v) for (k, v) in (
+load_props = tuple(mkPropertyValue(k, v) for (k, v) in (
   ('Hidden', True),
   ('ReadOnly', False)
 ))
 tdoc_dir = getenv('TDOC')
 url = 'file://' + quote(path.join(tdoc_dir, 'fdo74824.ods'))
-doc = desktop.loadComponentFromURL(url, "_blank", 0, loadProps)
+doc = desktop.loadComponentFromURL(url, "_blank", 0, load_props)
 
 sheet = doc.Sheets.Sheet1
 area = sheet.getCellRangeByName('A2:B4')
diff --git a/pyuno/qa/pytests/testcollections_XCellRange.py 
b/pyuno/qa/pytests/testcollections_XCellRange.py
index 871f92d..6754ef5 100644
--- a/pyuno/qa/pytests/testcollections_XCellRange.py
+++ b/pyuno/qa/pytests/testcollections_XCellRange.py
@@ -14,6 +14,9 @@ from testcollections_base import CollectionsTestBase
 from com.sun.star.beans import PropertyValue
 from com.sun.star.table import CellAddress
 
+# TextTable instance factory
+def getTextTableInstance(doc):
+return doc.createInstance('com.sun.star.text.TextTable')
 
 # Tests behaviour of objects implementing XCellRange using the new-style
 # collection accessors
@@ -48,10 +51,10 @@ class TestXCellRange(CollectionsTestBase):
 def test_XCellRange_Table_Cell_00(self):
 # Given
 doc = self.createBlankTextDocument()
-textTable = doc.createInstance('com.sun.star.text.TextTable')
-textTable.initialize(10, 10)
+text_table = getTextTableInstance(doc)
+text_table.initialize(10, 10)
 cursor = doc.Text.createTextCursor()
-doc.Text.insertTextContent(cursor, textTable, False)
+doc.Text.insertTextContent(cursor, text_table, False)
 tbl = doc.TextTables.getByIndex(0)
 
 # When
@@ -86,10 +89,10 @@ class TestXCellRange(CollectionsTestBase):
 def test_XCellRange_Table_Cell_37(self):
 # Given
 doc = self.createBlankTextDocument()
-textTable = doc.createInstance('com.sun.star.text.TextTable')
-textTable.initialize(10, 10)
+text_table = getTextTableInstance(doc)
+text_table.initialize(10, 10)
 cursor = doc.Text.createTextCursor()
-doc.Text.insertTextContent(cursor, textTable, False)
+doc.Text.insertTextContent(cursor, text_table, False)
 tbl = doc.TextTables.getByIndex(0)
 
 # When
@@ -124,10 +127,10 @@ class TestXCellRange(CollectionsTestBase):
 def test_XCellRange_Table_Range_Index_Slice(self):
 # Given
 doc = self.createBlankTextDocument()
-textTable = doc.createInstance('com.sun.star.text.TextTable')
-textTable.initialize(10, 10)
+text_table = getTextTableInstance(doc)
+text_table.initialize(10, 10)
 cursor = doc.Text.createTextCursor()
-doc.Text.insertTextContent(cursor, textTable, False)
+doc.Text.insertTextContent(cursor, text_table, False)
 tbl = doc.TextTables.getByIndex(0)
 doc.lockControllers()
 tbl.DataArray = tuple(tuple(str(100 + y) for y in range(10*x, 10*x + 
10)) for x in range(10))
@@ -165,10 +168,10 @@ class TestXCellRange(CollectionsTestBase):
 def test_XCellRange_Table_Range_Slice_Index(self):
 # Given
 doc = self.createBlankTextDocument()
-textTable = doc.createInstance('com.sun.star.text.TextTable')
-  

[Libreoffice-commits] core.git: pyuno/qa

2016-02-23 Thread Kenneth Koski
 pyuno/qa/pytests/insertremovecells.py  |   28 
 pyuno/qa/pytests/testcollections_XCellRange.py |   53 -
 pyuno/qa/pytests/testcollections_XEnumeration.py   |2 
 pyuno/qa/pytests/testcollections_XEnumerationAccess.py |2 
 pyuno/qa/pytests/testcollections_XIndexAccess.py   |   22 +++
 pyuno/qa/pytests/testcollections_XIndexContainer.py|   40 ++--
 pyuno/qa/pytests/testcollections_XIndexReplace.py  |   39 ++--
 pyuno/qa/pytests/testcollections_XNameAccess.py|   13 +---
 pyuno/qa/pytests/testcollections_XNameContainer.py |   10 +--
 pyuno/qa/pytests/testcollections_XNameReplace.py   |2 
 pyuno/qa/pytests/testcollections_base.py   |3 
 pyuno/qa/pytests/testcollections_misc.py   |2 
 pyuno/qa/pytests/testcollections_mixednameindex.py |6 -
 pyuno/qa/pytests/testssl.py|4 -
 14 files changed, 111 insertions(+), 115 deletions(-)

New commits:
commit 4f6e3108d9b9b67f21d11d597f2e607acafabd72
Author: Kenneth Koski 
Date:   Fri Feb 19 19:55:31 2016 -0600

Running pep8 on pyuno unit test files

Change-Id: I5d35305386e1f520d1030776e2b7bcf7620eda04
Reviewed-on: https://gerrit.libreoffice.org/22514
Tested-by: Jenkins 
Reviewed-by: Samuel Mehrbrodt 

diff --git a/pyuno/qa/pytests/insertremovecells.py 
b/pyuno/qa/pytests/insertremovecells.py
index 9c521f2..5c2585a 100644
--- a/pyuno/qa/pytests/insertremovecells.py
+++ b/pyuno/qa/pytests/insertremovecells.py
@@ -9,6 +9,7 @@ except ImportError:
 
 from org.libreoffice.unotest import pyuno, mkPropertyValue
 
+
 class InsertRemoveCells(unittest.TestCase):
 
 @classmethod
@@ -16,10 +17,6 @@ class InsertRemoveCells(unittest.TestCase):
 cls.xContext = pyuno.getComponentContext()
 pyuno.private_initTestEnvironment()
 
-
-# no need for a tearDown(cls) method.
-
-
 def test_fdo74824_load(self):
 ctxt = self.xContext
 assert(ctxt)
@@ -35,12 +32,12 @@ class InsertRemoveCells(unittest.TestCase):
 doc = desktop.loadComponentFromURL(url, "_blank", 0, loadProps)
 
 sheet = doc.Sheets.Sheet1
-area = sheet.getCellRangeByName( 'A2:B4' )
+area = sheet.getCellRangeByName('A2:B4')
 addr = area.getRangeAddress()
 
 # 2 = intended to shift cells right, but I don't know where to find
 # the ENUM to put in its place.  Corrections welcome.
-sheet.insertCells( addr, 2 )
+sheet.insertCells(addr, 2)
 
 # basically, the insertCells call is the test: it should not crash
 # LibreOffice.  However, for completeness, we should test the cell
@@ -65,21 +62,22 @@ class InsertRemoveCells(unittest.TestCase):
 )
 for pos in empty_cells:
 cell = sheet.getCellByPosition(*pos)
-self.assertEqual( 'EMPTY', cell.Type.value )
+self.assertEqual('EMPTY', cell.Type.value)
+
 for x, y, f, s, val in formula_cells:
 cell = sheet.getCellByPosition(x, y)
-self.assertEqual( 'FORMULA', cell.Type.value )
-self.assertEqual( f, cell.getFormula() )
-self.assertEqual( s, cell.String )
-self.assertEqual( val, cell.Value )
+self.assertEqual('FORMULA', cell.Type.value)
+self.assertEqual(f, cell.getFormula())
+self.assertEqual(s, cell.String)
+self.assertEqual(val, cell.Value)
+
 for x, y, s, val in value_cells:
 cell = sheet.getCellByPosition(x, y)
-self.assertEqual( s, cell.String )
-self.assertEqual( val, cell.Value )
+self.assertEqual(s, cell.String)
+self.assertEqual(val, cell.Value)
 
-doc.close( True )
+doc.close(True)
 
 
 if __name__ == '__main__':
 unittest.main()
-
diff --git a/pyuno/qa/pytests/testcollections_XCellRange.py 
b/pyuno/qa/pytests/testcollections_XCellRange.py
index ad8819b..871f92d 100644
--- a/pyuno/qa/pytests/testcollections_XCellRange.py
+++ b/pyuno/qa/pytests/testcollections_XCellRange.py
@@ -33,7 +33,7 @@ class TestXCellRange(CollectionsTestBase):
 sht = spr.Sheets.getByIndex(0)
 
 # When
-cell = sht[0,0]
+cell = sht[0, 0]
 
 # Then
 self.assertEqual(0, cell.CellAddress.Sheet)
@@ -49,13 +49,13 @@ class TestXCellRange(CollectionsTestBase):
 # Given
 doc = self.createBlankTextDocument()
 textTable = doc.createInstance('com.sun.star.text.TextTable')
-textTable.initialize(10,10)
+textTable.initialize(10, 10)
 cursor = doc.Text.createTextCursor()
 doc.Text.insertTextContent(cursor, textTable, False)
 tbl = doc.TextTables.getByIndex(0)
 
 # When
-cell = tbl[0,0]
+cell = tbl[0, 0]
 
 # Then
 self.assertEqual('A1', 

[Libreoffice-commits] core.git: pyuno/qa

2014-04-24 Thread Caolán McNamara
 pyuno/qa/pytests/testssl.py |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit ca4a39eff66af3a27e1c02baff09aaab48f266e1
Author: Caolán McNamara caol...@redhat.com
Date:   Thu Apr 24 14:31:24 2014 +0100

as suspected

Change-Id: Idad0ba862da7317b5824f1bfb400d05cef105b7f

diff --git a/pyuno/qa/pytests/testssl.py b/pyuno/qa/pytests/testssl.py
index ed6c99c..f0a0a37 100644
--- a/pyuno/qa/pytests/testssl.py
+++ b/pyuno/qa/pytests/testssl.py
@@ -3,7 +3,7 @@ import unittest
 #I want to ensure that import ssl works on all platforms
 class SSLTest(unittest.TestCase):
 def test_ssl_import(self):
-import _ssl
+import ssl
 
 if __name__ == '__main__':
 unittest.main()
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits