core.git: pyuno/qa

2025-12-18 Thread Stephan Bergmann (via logerrit)
 pyuno/qa/pytests/embindtest.py |   33 +
 1 file changed, 9 insertions(+), 24 deletions(-)

New commits:
commit cf49d618f454e15e7df9eb1e580e3e0ae4c0df66
Author: Stephan Bergmann 
AuthorDate: Thu Dec 18 13:06:12 2025 +0100
Commit: Stephan Bergmann 
CommitDate: Thu Dec 18 15:45:25 2025 +0100

Use direct PyUNO calls in PythonTest_pyuno_pytests_embindtest

...after 507b6c2b907c54d37eea186ff07e340db6eed84a "tdf#169229: pyuno: Allow 
Any
when calling a method"

Change-Id: Ie91781abce253aece201605d0930344ddf8d1256
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195842
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/pyuno/qa/pytests/embindtest.py b/pyuno/qa/pytests/embindtest.py
index f0d60724eba0..341b15eacf80 100644
--- a/pyuno/qa/pytests/embindtest.py
+++ b/pyuno/qa/pytests/embindtest.py
@@ -603,8 +603,7 @@ class EmbindTest(unittest.TestCase):
 v = test.getAnyUnsignedShort()
 self.assertEqual(v, 54321)
 self.assertFalse(test.isAnyUnsignedShort(v)) # long
-self.assertTrue(uno.invoke(test, 'isAnyUnsignedShort', 
(uno.Any('unsigned short', 54321),)))
-#TODO: direct call?
+self.assertTrue(test.isAnyUnsignedShort(uno.Any('unsigned short', 
54321)))
 
 v = test.getAnyLong()
 self.assertEqual(v, -123456)
@@ -614,28 +613,22 @@ class EmbindTest(unittest.TestCase):
 v = test.getAnyUnsignedLong()
 self.assertEqual(v, 3456789012)
 self.assertFalse(test.isAnyUnsignedLong(v)) # hyper
-self.assertTrue(
-uno.invoke(test, 'isAnyUnsignedLong', (uno.Any('unsigned long', 
3456789012),)))
-#TODO: direct call?
+self.assertTrue(test.isAnyUnsignedLong(uno.Any('unsigned long', 
3456789012)))
 
 v = test.getAnyHyper()
 self.assertEqual(v, -123456789)
 self.assertFalse(test.isAnyHyper(v)) # long
-self.assertTrue(uno.invoke(test, 'isAnyHyper', (uno.Any('hyper', 
-123456789),)))
-#TODO: direct call?
+self.assertTrue(test.isAnyHyper(uno.Any('hyper', -123456789)))
 
 v = test.getAnyUnsignedHyper()
 self.assertEqual(v, 9876543210)
 self.assertFalse(test.isAnyUnsignedHyper(v)) # hyper
-self.assertTrue(
-uno.invoke(test, 'isAnyUnsignedHyper', (uno.Any('unsigned hyper', 
9876543210),)))
-#TODO: direct call?
+self.assertTrue(test.isAnyUnsignedHyper(uno.Any('unsigned hyper', 
9876543210)))
 
 v = test.getAnyFloat()
 self.assertEqual(v, -10.25)
 self.assertFalse(test.isAnyFloat(v)) # double
-self.assertTrue(uno.invoke(test, 'isAnyFloat', (uno.Any('float', 
-10.25),)))
-#TODO: direct call?
+self.assertTrue(test.isAnyFloat(uno.Any('float', -10.25)))
 
 v = test.getAnyDouble()
 self.assertEqual(v, 100.5)
@@ -660,10 +653,7 @@ class EmbindTest(unittest.TestCase):
 v = test.getAnySequence()
 self.assertEqual(v, ('foo', 'barr', 'bazzz'))
 self.assertFalse(test.isAnySequence(v)) # []any
-self.assertTrue(
-uno.invoke(
-test, 'isAnySequence', (uno.Any('[]string', ('foo', 'barr', 
'bazzz')),)))
-#TODO: direct call?
+self.assertTrue(test.isAnySequence(uno.Any('[]string', ('foo', 'barr', 
'bazzz'
 
 v = test.getAnyEnum()
 self.assertEqual(v, E_2)
@@ -707,10 +697,7 @@ class EmbindTest(unittest.TestCase):
 v = test.getAnyInterface()
 self.assertEqual(v, test)
 self.assertTrue(test.isAnyInterface(v))
-self.assertTrue(
-uno.invoke(
-test, 'isAnyInterface', 
(uno.Any('org.libreoffice.embindtest.XTest', test),)))
-#TODO: direct call?
+
self.assertTrue(test.isAnyInterface(uno.Any('org.libreoffice.embindtest.XTest', 
test)))
 
 v = test.getSequenceBoolean()
 self.assertEqual(v, (True, True, False))
@@ -787,10 +774,8 @@ class EmbindTest(unittest.TestCase):
 self.assertEqual(v, (-123456, None, (E_2, E3, E_10)))
 self.assertFalse(test.isSequenceAny(v)) # (long, void, []any)
 self.assertTrue(
-uno.invoke(
-test, 'isSequenceAny',
-((-123456, None, uno.Any('[]org.libreoffice.embindtest.Enum', 
(E_2, E3, E_10))),)))
-#TODO: direct call?
+test.isSequenceAny(
+(-123456, None, uno.Any('[]org.libreoffice.embindtest.Enum', 
(E_2, E3, E_10)
 
 v = test.getSequenceSequenceString()
 self.assertEqual(v, ((), ('foo', 'barr'), ('baz',)))


core.git: pyuno/qa unotest/source

2025-12-11 Thread Stephan Bergmann (via logerrit)
 pyuno/qa/pytests/embindtest.py   |  156 ++
 unotest/source/embindtest/embindtest.cxx |  182 +++
 2 files changed, 338 insertions(+)

New commits:
commit f53a339292569d763be77ce41169d5f3a9a34e28
Author: Stephan Bergmann 
AuthorDate: Thu Dec 11 08:57:12 2025 +0100
Commit: Stephan Bergmann 
CommitDate: Thu Dec 11 16:24:41 2025 +0100

More exhaustive testing of PyUNO type mapping based on embindtest

...by implementing all the getSequence... variants that were left out of
3320b5fe2e3c696f3e0f2e301c922d89108f5c12 "Add exhaustive testing of PyUNO 
type
mapping based on embindtest".

Change-Id: Ia0dde7362484f83923999db68d80f57c7baa914c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195426
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/pyuno/qa/pytests/embindtest.py b/pyuno/qa/pytests/embindtest.py
index 35c580edc3e6..783594a4cbd5 100644
--- a/pyuno/qa/pytests/embindtest.py
+++ b/pyuno/qa/pytests/embindtest.py
@@ -272,6 +272,162 @@ class Test(unohelper.Base, XTest):
 def isSequenceBoolean(self, value):
 return value == (True, True, False)
 
+def getSequenceByte(self):
+return (-12, 1, 12)
+
+def isSequenceByte(self, value):
+return value == b'\xF4\x01\x0C'
+
+def getSequenceShort(self):
+return (-1234, 1, 1234)
+
+def isSequenceShort(self, value):
+return value == (-1234, 1, 1234)
+
+def getSequenceUnsignedShort(self):
+return (1, 10, 54321)
+
+def isSequenceUnsignedShort(self, value):
+return value == (1, 10, 54321)
+
+def getSequenceLong(self):
+return (-123456, 1, 123456)
+
+def isSequenceLong(self, value):
+return value == (-123456, 1, 123456)
+
+def getSequenceUnsignedLong(self):
+return (1, 10, 3456789012)
+
+def isSequenceUnsignedLong(self, value):
+return value == (1, 10, 3456789012)
+
+def getSequenceHyper(self):
+return (-123456789, 1, 123456789)
+
+def isSequenceHyper(self, value):
+return value == (-123456789, 1, 123456789)
+
+def getSequenceUnsignedHyper(self):
+return (1, 10, 9876543210)
+
+def isSequenceUnsignedHyper(self, value):
+return value == (1, 10, 9876543210)
+
+def getSequenceFloat(self):
+return (-10.25, 1.5, 10.75)
+
+def isSequenceFloat(self, value):
+return value == (-10.25, 1.5, 10.75)
+
+def getSequenceDouble(self):
+return (-100.5, 1.25, 100.75)
+
+def isSequenceDouble(self, value):
+return value == (-100.5, 1.25, 100.75)
+
+def getSequenceChar(self):
+return ('a', 'B', 'Ö')
+
+def isSequenceChar(self, value):
+return value == ('a', 'B', 'Ö')
+
+def getSequenceString(self):
+return ('foo', 'barr', 'bazzz')
+
+def isSequenceString(self, value):
+return value == ('foo', 'barr', 'bazzz')
+
+def getSequenceType(self):
+return (
+uno.getTypeByName('long'), uno.getTypeByName('void'),
+uno.getTypeByName('[]org.libreoffice.embindtest.Enum'))
+
+def isSequenceType(self, value):
+return value == (
+uno.getTypeByName('long'), uno.getTypeByName('void'),
+uno.getTypeByName('[]org.libreoffice.embindtest.Enum'))
+
+def getSequenceAny(self):
+return (-123456, None, uno.Any('[]org.libreoffice.embindtest.Enum', 
(E_2, E3, E_10)))
+
+def isSequenceAny(self, value):
+return value == (-123456, None, (E_2, E3, E_10))
+
+def getSequenceSequenceString(self):
+return ((), ('foo', 'barr'), ('baz',))
+
+def isSequenceSequenceString(self, value):
+return value == ((), ('foo', 'barr'), ('baz',))
+
+def getSequenceEnum(self):
+return (E_2, E3, E_10)
+
+def isSequenceEnum(self, value):
+return value == (E_2, E3, E_10)
+
+def getSequenceStruct(self):
+return (
+Struct(
+True, -12, -1234, 1, -123456, 1, -123456789, 1, -10.25, 
-100.5, 'a', 'hä',
+uno.getTypeByName('long'), -123456, (), E_2, 
StructLong(-123456),
+uno.createUnoStruct(
+'org.libreoffice.embindtest.Template<'
+'any,org.libreoffice.embindtest.StructString>',
+StructString('foo'), -123456, -123456, 
StructString('barr')),
+self),
+Struct(
+True, 1, 1, 10, 1, 10, 1, 10, 1.5, 1.25, 'B', 'barr', 
uno.getTypeByName('void'),
+None, ('foo', 'barr'), E3, StructLong(1),
+uno.createUnoStruct(
+'org.libreoffice.embindtest.Template<'
+'any,org.libreoffice.embindtest.StructString>',
+StructString('baz'), 1, None, StructString('foo')),
+None),
+Struct(
+False, 12, 1234, 54321, 123456, 3456789012, 123456789, 
987

core.git: pyuno/qa

2025-12-10 Thread Stephan Bergmann (via logerrit)
 pyuno/qa/pytests/embindtest.py |   63 +
 1 file changed, 21 insertions(+), 42 deletions(-)

New commits:
commit 6057f92cb46b78424182bd54e5f6e856f0b80a93
Author: Stephan Bergmann 
AuthorDate: Wed Dec 10 09:25:09 2025 +0100
Commit: Stephan Bergmann 
CommitDate: Wed Dec 10 21:28:19 2025 +0100

Only use uno.Any when Runtime::pyObject2Any would produce the wrong result

Change-Id: I339f2c80383e59505cb68e3712e39b25df2636e1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195355
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/pyuno/qa/pytests/embindtest.py b/pyuno/qa/pytests/embindtest.py
index 796e57998af3..35c580edc3e6 100644
--- a/pyuno/qa/pytests/embindtest.py
+++ b/pyuno/qa/pytests/embindtest.py
@@ -427,25 +427,22 @@ class EmbindTest(unittest.TestCase):
 v = test.getAnyVoid()
 self.assertEqual(v, None)
 self.assertTrue(test.isAnyVoid(v))
-self.assertTrue(uno.invoke(test, 'isAnyVoid', (uno.Any('void', 
None),))) #TODO: direct call?
+self.assertTrue(test.isAnyVoid(None))
 
 v = test.getAnyBoolean()
 self.assertEqual(v, True)
 self.assertTrue(test.isAnyBoolean(v))
-self.assertTrue(uno.invoke(test, 'isAnyBoolean', (uno.Any('boolean', 
True),)))
-#TODO: direct call?
+self.assertTrue(test.isAnyBoolean(True))
 
 v = test.getAnyByte()
 self.assertEqual(v, -12)
 self.assertTrue(test.isAnyByte(v))
-self.assertTrue(uno.invoke(test, 'isAnyByte', (uno.Any('byte', -12),)))
-#TODO: direct call?
+self.assertTrue(test.isAnyByte(-12))
 
 v = test.getAnyShort()
 self.assertEqual(v, -1234)
 self.assertTrue(test.isAnyShort(v))
-self.assertTrue(uno.invoke(test, 'isAnyShort', (uno.Any('short', 
-1234),)))
-#TODO: direct call?
+self.assertTrue(test.isAnyShort(-1234))
 
 v = test.getAnyUnsignedShort()
 self.assertEqual(v, 54321)
@@ -456,8 +453,7 @@ class EmbindTest(unittest.TestCase):
 v = test.getAnyLong()
 self.assertEqual(v, -123456)
 self.assertTrue(test.isAnyLong(v))
-self.assertTrue(uno.invoke(test, 'isAnyLong', (uno.Any('long', 
-123456),)))
-#TODO: direct call?
+self.assertTrue(test.isAnyLong(-123456))
 
 v = test.getAnyUnsignedLong()
 self.assertEqual(v, 3456789012)
@@ -488,27 +484,22 @@ class EmbindTest(unittest.TestCase):
 v = test.getAnyDouble()
 self.assertEqual(v, 100.5)
 self.assertTrue(test.isAnyDouble(v))
-self.assertTrue(uno.invoke(test, 'isAnyDouble', (uno.Any('double', 
100.5),)))
-#TODO: direct call?
+self.assertTrue(test.isAnyDouble(100.5))
 
 v = test.getAnyChar()
 self.assertEqual(v, 'Ö')
 self.assertTrue(test.isAnyChar(v))
-self.assertTrue(uno.invoke(test, 'isAnyChar', (uno.Any('char', 'Ö'),)))
-#TODO: direct call?
+self.assertTrue(test.isAnyChar(uno.Char('Ö')))
 
 v = test.getAnyString()
 self.assertEqual(v, 'hä')
 self.assertTrue(test.isAnyString(v))
-self.assertTrue(uno.invoke(test, 'isAnyString', (uno.Any('string', 
'hä'),)))
-#TODO: direct call?
+self.assertTrue(test.isAnyString('hä'))
 
 v = test.getAnyType()
 self.assertEqual(v, uno.getTypeByName('long'))
 self.assertTrue(test.isAnyType(v))
-self.assertTrue(
-uno.invoke(test, 'isAnyType', (uno.Any('type', 
uno.getTypeByName('long')),)))
-#TODO: direct call?
+self.assertTrue(test.isAnyType(uno.getTypeByName('long')))
 
 v = test.getAnySequence()
 self.assertEqual(v, ('foo', 'barr', 'bazzz'))
@@ -521,9 +512,7 @@ class EmbindTest(unittest.TestCase):
 v = test.getAnyEnum()
 self.assertEqual(v, E_2)
 self.assertTrue(test.isAnyEnum(v))
-self.assertTrue(
-uno.invoke(test, 'isAnyEnum', 
(uno.Any('org.libreoffice.embindtest.Enum', E_2),)))
-#TODO: direct call?
+self.assertTrue(test.isAnyEnum(E_2))
 
 v = test.getAnyStruct()
 self.assertEqual(
@@ -539,20 +528,16 @@ class EmbindTest(unittest.TestCase):
 test))
 self.assertTrue(test.isAnyStruct(v))
 self.assertTrue(
-uno.invoke(
-test, 'isAnyStruct',
-(uno.Any(
-'org.libreoffice.embindtest.Struct',
-Struct(
-True, -12, -1234, 54321, -123456, 3456789012, 
-123456789, 9876543210,
--10.25, 100.5, 'Ö', 'hä', uno.getTypeByName('long'), 
-123456,
-('foo', 'barr', 'bazzz'), E_2, StructLong(-123456),
-uno.createUnoStruct(
-'org.libreoffice.embindtest.Template<'
-'any,org.libreof

core.git: pyuno/qa pyuno/source unotest/source

2025-12-09 Thread Stephan Bergmann (via logerrit)
 pyuno/qa/pytests/embindtest.py   |   15 ++-
 pyuno/source/module/pyuno_runtime.cxx|   18 ++
 unotest/source/embindtest/embindtest.cxx |4 ++--
 3 files changed, 34 insertions(+), 3 deletions(-)

New commits:
commit 7bdd020783f099069e7a0f11e89f8ecdef5985e3
Author: Stephan Bergmann 
AuthorDate: Tue Dec 9 23:33:08 2025 +0100
Commit: Stephan Bergmann 
CommitDate: Wed Dec 10 07:58:18 2025 +0100

Fix any2PyObject mapping of UNO exceptions

That

> // the exception base functions want to have an "args" tuple,
> // which contains the message

code is there ever since e80bdbafeba9af9b58aac81b999f4b299c9eecd6 "initial
checkin for the pyuno-0.9.2 release" for reasons that are not clear to me, 
but
at least in the "TODO" scenarios from 
3320b5fe2e3c696f3e0f2e301c922d89108f5c12
"Add exhaustive testing of PyUNO type mapping based on embindtest" and
1e2e9a20a4190140e32e6996ea5fd6c22c71e55f "More exhaustive testing of PyUNO 
type
mapping based on embindtest" (which are hereby fixed), that
PyObject_SetAttrString would cause a Python exception, cf.

> 
info:pyuno.runtime:1489432:1489432:pyuno/source/module/pyuno_runtime.cxx:533: 
setting exception args raised Python exception : 
AttributeError('args')

so at least catch that.  (And maybe that code is obsolete anyway it would 
make
even more sense to drop it altogether.)

Change-Id: Ic651d106f34e0b316cba59ae66d2402b8f86b0f8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195340
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/pyuno/qa/pytests/embindtest.py b/pyuno/qa/pytests/embindtest.py
index 1de36595ce1a..796e57998af3 100644
--- a/pyuno/qa/pytests/embindtest.py
+++ b/pyuno/qa/pytests/embindtest.py
@@ -554,7 +554,20 @@ class EmbindTest(unittest.TestCase):
 test)),)))
 #TODO: direct call?
 
-#TODO: v = test.getAnyException()
+v = test.getAnyException()
+self.assertTrue(v.Message.startswith('error')) #TODO: use Python 3.14 
assertStartsWith
+self.assertEqual(v.Context, None)
+self.assertEqual(v.m1, -123456)
+self.assertEqual(v.m2, 100.5)
+self.assertEqual(v.m3, 'hä')
+self.assertTrue(test.isAnyException(v))
+self.assertTrue(
+uno.invoke(
+test, 'isAnyException',
+(uno.Any(
+'org.libreoffice.embindtest.Exception',
+Exception('error', None, -123456, 100.5, 'hä')),)))
+#TODO: direct call?
 
 v = test.getAnyInterface()
 self.assertEqual(v, test)
diff --git a/pyuno/source/module/pyuno_runtime.cxx 
b/pyuno/source/module/pyuno_runtime.cxx
index 85bbc5039a67..5840b249618f 100644
--- a/pyuno/source/module/pyuno_runtime.cxx
+++ b/pyuno/source/module/pyuno_runtime.cxx
@@ -516,6 +516,24 @@ PyRef Runtime::any2PyObject (const Any &a ) const
 // the exception base functions want to have an "args" tuple,
 // which contains the message
 PyObject_SetAttrString( ret.get(), "args", args.get() );
+PyRef excType, excValue, excTraceback;
+PyErr_Fetch(
+reinterpret_cast(&excType), 
reinterpret_cast(&excValue),
+reinterpret_cast(&excTraceback));
+#if defined SAL_LOG_INFO
+if (excType.is()) {
+OUString more;
+if (excValue.is()) {
+PyRef valueRep(PyObject_Repr(excValue.get()), 
SAL_NO_ACQUIRE);
+more = ": " + pyString2ustring(valueRep.get());
+}
+PyRef typeRep(PyObject_Repr(excType.get()), SAL_NO_ACQUIRE);
+SAL_INFO(
+"pyuno.runtime",
+"setting exception args raised Python exception "
+<< pyString2ustring(typeRep.get()) << more);
+}
+#endif
 }
 return ret;
 }
diff --git a/unotest/source/embindtest/embindtest.cxx 
b/unotest/source/embindtest/embindtest.cxx
index 4e1293951b01..8a7ccf1bbab7 100644
--- a/unotest/source/embindtest/embindtest.cxx
+++ b/unotest/source/embindtest/embindtest.cxx
@@ -396,8 +396,8 @@ void 
doExecuteTest(css::uno::Reference cons
 {
 auto const val = test->getAnyException();
 verify(checkAnyException(val));
-//TODO: bool const ok = test->isAnyException(val);
-//TODO: verify(ok);
+bool const ok = test->isAnyException(val);
+verify(ok);
 }
 {
 auto const val = test->getAnyInterface();


core.git: pyuno/qa pyuno/source unotest/source

2025-12-09 Thread Stephan Bergmann (via logerrit)
 pyuno/qa/pytests/embindtest.py   |  123 ++
 pyuno/source/module/pyuno_adapter.cxx|2 
 unotest/source/embindtest/embindtest.cxx |  366 +++
 3 files changed, 401 insertions(+), 90 deletions(-)

New commits:
commit 1e2e9a20a4190140e32e6996ea5fd6c22c71e55f
Author: Stephan Bergmann 
AuthorDate: Tue Dec 9 12:01:59 2025 +0100
Commit: Stephan Bergmann 
CommitDate: Tue Dec 9 14:00:54 2025 +0100

More exhaustive testing of PyUNO type mapping based on embindtest

...by implementing all the getAny... variants that were left out of
5f05929fd1498e418618d7570192877055de2c80 "Add exhaustive testing of PyUNO 
type
mapping based on embindtest".

Which revealed that the code in Adapter::invoke (in
pyuno/source/module/pyuno_adapter.cxx) was apparently broken, and would 
cause
the C++ call in doExecuteTest (in unotest/source/embindtest/embindtest.cxx) 
of
the Python

> def getAnyByte(self):
> return uno.Any('byte', -12)

(in pyuno/qa/pytests/embindtest.py) to fail with a nonsensical

> uno.com.sun.star.uno.RuntimeException: uno.Any instance not accepted 
during method call, use uno.invoke instead at 
pyuno/source/module/pyuno_runtime.cxx:785 at 
stoc/source/invocation_adapterfactory/iafactory.cxx:203

In addition, there's two new places marked with TODO comments:

For one, executing C++

> bool const ok = test->isAnyException(val);

would cause an odd

> python.bin: Objects/typeobject.c:4745: PyObject 
*_PyType_Lookup(PyTypeObject *, PyObject *): Assertion `!PyErr_Occurred()' 
failed.

failure that needs further investigation.

And for another, executing Python

> return value == self

would always return false.  It appears that PyUNO_cmp (in
pyuno/source/module/pyuno.cxx isn't yet prepared to be called with `that` 
being
a native Python UNO-implemenation object (`class Test(unohelper.Base, 
XTest)`)
instead of a proxy for a binary/C++ UNO object.

Change-Id: I0289e1f5ee6dab53b589af783c0c53302989394c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195287
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/pyuno/qa/pytests/embindtest.py b/pyuno/qa/pytests/embindtest.py
index 88d9fb6e98d5..1de36595ce1a 100644
--- a/pyuno/qa/pytests/embindtest.py
+++ b/pyuno/qa/pytests/embindtest.py
@@ -12,6 +12,7 @@ import unittest
 import uno
 import unohelper
 from com.sun.star.uno import RuntimeException
+from org.libreoffice.embindtest import Exception
 from org.libreoffice.embindtest import Struct
 from org.libreoffice.embindtest import StructLong
 from org.libreoffice.embindtest import StructString
@@ -105,6 +106,128 @@ class Test(unohelper.Base, XTest):
 def isAnyVoid(self, value):
 return value == None
 
+def getAnyBoolean(self):
+return True
+
+def isAnyBoolean(self, value):
+return value == True
+
+def getAnyByte(self):
+return uno.Any('byte', -12)
+
+def isAnyByte(self, value):
+return value == -12
+
+def getAnyShort(self):
+return uno.Any('short', -1234)
+
+def isAnyShort(self, value):
+return value == -1234
+
+def getAnyUnsignedShort(self):
+return uno.Any('unsigned short', 54321)
+
+def isAnyUnsignedShort(self, value):
+return value == 54321
+
+def getAnyLong(self):
+return -123456
+
+def isAnyLong(self, value):
+return value == -123456
+
+def getAnyUnsignedLong(self):
+return uno.Any('unsigned long', 3456789012)
+
+def isAnyUnsignedLong(self, value):
+return value == 3456789012
+
+def getAnyHyper(self):
+return uno.Any('hyper', -123456789)
+
+def isAnyHyper(self, value):
+return value == -123456789
+
+def getAnyUnsignedHyper(self):
+return uno.Any('unsigned hyper', 9876543210)
+
+def isAnyUnsignedHyper(self, value):
+return value == 9876543210
+
+def getAnyFloat(self):
+return uno.Any('float', -10.25)
+
+def isAnyFloat(self, value):
+return value == -10.25
+
+def getAnyDouble(self):
+return 100.5
+
+def isAnyDouble(self, value):
+return value == 100.5
+
+def getAnyChar(self):
+return uno.Char('Ö')
+
+def isAnyChar(self, value):
+return value == 'Ö'
+
+def getAnyString(self):
+return 'hä'
+
+def isAnyString(self, value):
+return value == 'hä'
+
+def getAnyType(self):
+return uno.getTypeByName('long')
+
+def isAnyType(self, value):
+return value == uno.getTypeByName('long')
+
+def getAnySequence(self):
+return uno.Any('[]string', ('foo', 'barr', 'bazzz'))
+
+def isAnySequence(self, value):
+return value == ('foo', 'barr', 'bazzz')
+
+def getAnyEnum(self):
+return E_2
+
+def isAnyEnum(self, value):
+

[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 SdLink

[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* met

[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
[email protected]
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-02 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 uitest.debug import sleep
-from uitest.path import get_srcdir_url

[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
[email protected]
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
[email protected]
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')
-textTable.initialize(10, 10)
+text_table = getTextTableInstance(doc)
+text

[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', cell.CellName)
@@ -71,7 +71,7 @@ class TestXCellRange(CollectionsTestBas

[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 
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
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits