314 Commits
Author SHA1 Message Date
Neil Roberts aed5ae5d21 tdf#173114 pyuno: Add unit test for objects with XInvocation
Adds a service to embindtest that implements XInvocation to handle all
possible method names and returns the name as a string. A Python unit
test then uses this. Without the fix pyuno would throw an exception when
it tries to use the XInvocation object that doesn’t also implement
XInvocation2 and return a valid reference for getIntrospection.

Change-Id: Icb3359c788acd5eda37980252e5fc5c956b38100
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209087
Tested-by: Jenkins
Reviewed-by: Neil Roberts <nroberts@libreoffice.org>
2026-08-13 12:43:09 +02:00
Neil Roberts d2429a3c46 pyuno: Reuse wrapped object when converting Python obj through UNO and back
When any2PyObject is given an interface which is actually an adapter for
a Python object, it now returns the original Python object instead of a
new wrapper for the object. This means that calling methods on the
returned object will be faster because they won’t involve UNO bridging.
It also means that Python implementations of UNO interfaces can detect
when they are given Python objects as a parameter and take advantage of
any internal private data attached to the object.

Change-Id: Ie13d0612f48e70973bd523e68710ec33a7875a16
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/207507
Tested-by: Jenkins
Reviewed-by: Neil Roberts <nroberts@libreoffice.org>
2026-07-15 09:09:22 +02:00
Neil Roberts 8b022d0d0d pyuno: Add a unit test for singletons
As with the test for services, this uses the embindtest framework to
hide it behind --enable-embindtest-uno.

Change-Id: Ie64848926d21ca5c3edd449de85f4fed16b3b2aa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199220
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@collabora.com>
2026-03-04 13:53:40 +01:00
Neil Roberts 2cd17a1148 Add a PythonTest for service constructors in pyuno
This leverages the existing framework for embindtest to add interfaces
and services to test with. Hopefully that means the tests will run on
the CI without ending up in the final release builds because they are
only enabled with --enable-embindtest-uno.

Change-Id: Idd394e616ad14943cecd60bf3a3e228d93166e34
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199105
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@collabora.com>
2026-03-04 13:53:05 +01:00
Gabor Kelemen 0bdcfc2900 tdf#146619 Use more forward declarations in include/unotools/
This shaves off some 40M of input

Change-Id: I12e10deb87ceea1f7a23f3de4ea624befe187c3f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198238
Reviewed-by: Gabor Kelemen <gabor.kelemen@collabora.com>
Tested-by: Jenkins
2026-02-05 17:35:46 +01:00
Stephan Bergmann b0f189160c Prevent int vs. sal_Int32 mismatch
...as caused build issues for e.g. 32-bit Wasm

Change-Id: Iec2964dd73b29cca8b1acbe297cdf0aee27cf77a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196620
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@collabora.com>
2026-01-06 22:13:48 +01:00
Stephan Bergmann 82413eb1f9 Improve PyUNO_cmp
...for cases where one operand is a PyUNO Adapter of the other (i.e., one
operand is a Python object that got passed out and back in again, and the other
operand is that same Python object).  This fixes the second "TODO" from
1e2e9a20a4 "More exhaustive testing of PyUNO type
mapping based on embindtest".

Change-Id: I0fc938db5c464ed56adee3b428537925fff0fc81
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195392
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@collabora.com>
2025-12-11 21:24:20 +01:00
Stephan Bergmann 6b5d527c33 Reorder code blocks in doExecuteTest
...so that they match org.libreoffice.embindtest.XTest

Change-Id: I479af0607fc379be9b5f3ca477dd09bb943713b2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195425
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@collabora.com>
2025-12-11 17:21:06 +01:00
Stephan Bergmann f53a339292 More exhaustive testing of PyUNO type mapping based on embindtest
...by implementing all the getSequence... variants that were left out of
3320b5fe2e "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 <stephan.bergmann@collabora.com>
2025-12-11 16:24:41 +01:00
Stephan Bergmann 7bdd020783 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 e80bdbafeb "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 3320b5fe2e
"Add exhaustive testing of PyUNO type mapping based on embindtest" and
1e2e9a20a4 "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 <class 'AttributeError'>: 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 <stephan.bergmann@collabora.com>
2025-12-10 07:58:18 +01:00
Stephan Bergmann 1e2e9a20a4 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 <stephan.bergmann@collabora.com>
2025-12-09 14:00:54 +01:00
Stephan Bergmann 3320b5fe2e Add exhaustive testing of PyUNO type mapping based on embindtest
...in preparation for doing fixes for tdf#169229 "PyUNO: Hard to create null UNO
interface references, to use in a method invocation" etc.  (Basing it on
embindtest means it requires --enable-embindtest-uno, at least for now.)

Various places in pyuno/qa/pytests/embindtest.py are marked with TODO comments.
(Executing

>         v = test.getAnyException()

would cause an odd

> Fatal Python error: _Py_CheckFunctionResult: a function returned a result with an exception set

failure that needs further investigation.)

To not only test calls from PyUNO to binary (C++) UNO, but also from binary
(C++) UNO to PyUNO, add an executeTest method to the
org.libreoffice.embindtest.XTest interface.  For now, it only does those tests
that were already done by the org.libreoffice.embindtest.BridgeTest service
implementation, but the plan is to extend those (e.g., don't just only test
getAnyVoid, but all the getAny... variants).  And the corresponding Test class
implementation in pyuno/qa/pytests/embindtest.py for now only defines those
methods that are actually called, and will need to be extended as well.

Change-Id: I0dd66b9aed14cc7e679da78b86d0dc657625fe94
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195238
Reviewed-by: Stephan Bergmann <stephan.bergmann@collabora.com>
Tested-by: Jenkins
2025-12-08 21:28:43 +01:00
Gabor Kelemen c244774744 tdf#146619 Run IWYU again on include/u*
Change-Id: Iaa4b507049ae33fb300a86075b69534bb0588c17
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193918
Reviewed-by: Gabor Kelemen <gabor.kelemen@collabora.com>
Tested-by: Jenkins
2025-11-30 18:26:00 +01:00
Bogdan Buzea 65dcbf095d tdf#158803 imported but unused
Change-Id: I165e6a07b35bfd8fd5b0c8cfa3c033c8219d8a05
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190300
Reviewed-by: Samuel Mehrbrodt <samuel.mehrbrodt@collabora.com>
Tested-by: Jenkins
2025-10-02 09:50:10 +02:00
Caolán McNamara 7841de4bf7 drop outdated coverity directives
Change-Id: Icbe3f0bb9433cfcf08efd28bc4eab1ba82efab74
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189850
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2025-08-18 12:40:58 +02:00
Stephan Bergmann 85933f0473 Skip dubious LOKit SolarMutex acquire for Emscripten
Otherwise, running the embindtest code in a LOKit-based scenario (analogously to
how it is run under certain circumstances via

  --post-js $(SRCDIR)/unotest/source/embindtest/embindtest.js

in desktop/Executable_soffice_bin.mk) would cause a deadlock when
TestThread::execute (in unotest/source/embindtest/embindtest.cxx) calls

  SolarMutexGuard g;

on that additional thread, but the main thread never released the SolarMutex
because of that acquire in lo_runLoop.

The code in lo_runLoop had originally been added with
b693fb5cf1 "We apparently need to drop the Solar
Mutex when exiting lo_runLoop() on iOS" (curiously using explicit calls to
acquire and release, instead of using an additional SolarMutexGuard; the
difference being that a SolarMutexGuard would automatically be released upon an
exception, which skips the explicit call to release), originally only for iOS,
then extended to Android with 0abdf307ea "android:
Unregistering in runLoop() is important even on Android", then extended to
Emscripten with 1e421b30e2 "Attempt to add ifdefs
for WASM (Emscripten) for LOKit-based code" for no apparent reason.

I have no idea how the Android and iOS scenarios are meant to cope with
soffice_main being called with SolarMutex being acquired twice, so that no other
threads could ever acquire it (except thanks to temporary uses of
SolarMutexReleaser, which might explain things).

However, what happens in the Emscripten scenario is that executing soffice_main
leads to a call to emscripten_set_main_loop_arg in SvpSalInstance::DoExecute
(vcl/headless/svpinst.cxx), which quits by throwing an exception all the way to
the JS event loop, so that in lo_runLoop the inner SolarMutexGuard automatically
gets released, while the outer explicit call to release got skipped, leaving the
SolarMutex locked forever on the main thread.

As there is no apparent reason why the Emscripten scenario should have this
double locking here (and the call to vcl::lok::unregisterPollCallbacks at the
bottom of lo_runLoop would never be executed in the Emscripten scenario, anyway,
thanks to the exception being thrown from emscripten_set_main_loop_arg), and
1e421b30e2 "Attempt to add ifdefs for WASM
(Emscripten) for LOKit-based code" maybe just added it in a blind copy/paste,
lets just skip it.

(And add a DBG_TESTNOTSOLARMUTEX to the embindtest code, to document that code's
assumptions.)

Change-Id: Ibae0d1d8b5f29f08d30829251ed2bb58413ea4e5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188973
Reviewed-by: Stephan Bergmann <stephan.bergmann@collabora.com>
Tested-by: Jenkins
2025-08-06 07:55:38 +02:00
Mike Kaganski 3a4961af43 Use o3tl::{get,set}Environment instead of resp. osl_* functions
Simplifies the code, and avoids OUString internals access.
Also replace some getenv calls.

Change-Id: I5f7dc492fe87ea1fbaad6a61bc54e21f0f0c5aef
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187974
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2025-07-17 07:03:19 +02:00
Mike Kaganski 6566fdd608 Use osl_getEnvironment to simplify GPG test initialization
Change-Id: Ief5f8c1838643c05f045ca8e58822ee27ff9c7b7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187943
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2025-07-16 12:35:45 +02:00
Mike Kaganski a5ea37cbc5 Use osl_getEnvironment to simplify Directories initialization
Change-Id: Ie2bc87fac14ee60972c1f8ffc70bfa3c45f11de7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187940
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2025-07-16 09:43:17 +02:00
Mike Kaganski 3d80b47851 Avoid double slashes in unit test paths / URLs
Like file:///C:/lo/core//sw/qa/extras/rtfexport/data//tabs.rtf

Reimplement Directories::get{URL,Path}From{Src,Workdir} to check
and insert missing / remove excessive slashes as needed.

Change-Id: Ibd3657b0557bf1712c2de9ac74db0977754a2ed9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187932
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins
2025-07-16 07:14:22 +02:00
Stephan Bergmann 8bc1db4d29 Some loplugin warning fixes in (Emscripten-only) embindtest.cxx
...for loplugin:unoany, loplugin:fakebool, and loplugin:refcounting

Change-Id: Ib3278b126c3ea792c93cbf57f2414fd316278b88
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186560
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2025-06-16 17:19:14 +02:00
Stephan Bergmann a6c5e17177 Implement XServiceInfo for (Emscripten-only) embindtest.Test
...so that CppunitTest_services wouldn't fail with

> postprocess/qa/services.cxx:341:(anonymous namespace)::Test::test
> assertion failed
> - Expression: info.is()
> - instantiating "org.libreoffice.comp.embindtest.Test" via "org.libreoffice.embindtest.Test" does not provide XServiceInfo

Change-Id: I83721006bfd8b71b488b15c41e81df9c5d0d755e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186559
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2025-06-16 15:12:50 +02:00
Stephan Bergmann d64d8bd8bc Instances of salhelper::Thread must not be allocated on the stack
...as salhelper::Thread::onTerminated() calls
salhelper::SimpleReferenceObject::release() calls delete this

Change-Id: I3d64882dab014e270806fcc12461f816bc9d101d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181631
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2025-02-13 22:48:35 +01:00
Stephan Bergmann 10a5c3162a Include the org.libreoffice.embindtest infrastructure in all Emscripten builds
...not just --enable-dbgutil ones, which gives more flexibility in using that
infrastructure downstream.  (The unotest/source/embindtest/embindtest.js code is
still only included in desktop/Executable_soffice_bin.mk for --enable-dbgutil
builds, though.)

Building unotest/source/embindtest/embindtest.cxx also outside of
--enable-dbgutil, and thus implicitly --enable-assert-always-abort, builds
required moving from assert() to some hand-crafted verify().

Change-Id: I3f0fa00feee25b4ea6e7866c22a5b4a4d40cb3d0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178361
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-12-12 16:02:22 +01:00
Michael Stahl 654e3134ad unotest,sw: introduce queryDispatchStatus()
... and reset the view options that are toggled in
testHiddenParagraphFollowFrame and testHiddenParagraphFlys.

Backporting these tests to the libreoffice-24-8 branch broke 2 unrelated
tests because of the changed view settings:

Test name: (anonymous namespace)::testHiddenSectionPageDescs::TestBody
equality assertion failed
- Expected: 532
- Actual  : 798
- In <>, attribute 'height' of '/root/page[2]/body/section[1]/infos/bounds' incorrect value.

xmltesttools.cxx:203:Assertion
Test name: (anonymous namespace)::testTable0HeightRows::TestBody
equality assertion failed
- Expected: 28
- Actual  : 22
- In <>, XPath '/root/page[1]/body/tab/row' number of nodes is incorrect

Change-Id: Ie58242348fecabe163e54048f3896c6d427d2608
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177691
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
2024-12-02 18:46:39 +01:00
Noel Grandin ed0b12f4ea no need to take a copy of the getProcessComponentContext return value
we can just take a "const &".

(found by running clang-tidy with the
performance-unnecessary-copy-initialization warning)

Change-Id: I20fd208c65303da78170b1ac06c638fdf3aa094b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176267
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
2024-11-08 15:23:52 +01:00
Caolán McNamara cfc0fcd729 cid#1619687 Not restoring ostream format
Change-Id: Id47cdffca6e597f3bf60ac9def5e92916443b117
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173967
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-09-26 13:39:16 +02:00
Caolán McNamara cd5dcc6e43 cid#1619687 Not restoring ostream format
Change-Id: Id46d2317a0eeef612836fc58dc9da18cf7ee99a1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173894
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-09-25 15:37:15 +02:00
Stephan Bergmann a446bfd0f3 Surround printed struct/exception members with {...}
Change-Id: I41d661e5d89c784715e4e07a3c7f7f27737ba3e8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173831
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-09-24 07:55:00 +02:00
Stephan Bergmann 7ccfc0277a Best effort to print more details about caught UNO exception
Change-Id: Ia8f098e4e441b6aba0d76d7184dc6cec2210f793
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173813
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-09-23 21:17:44 +02:00
Stephan Bergmann b418f3d8d3 Demonstrate that Embind is not multi-threading capable
Enabling the line commented out with "TODO" in embindtest.js would fail with
something like

> Aborted(Assertion failed: invalid handle: 8)
> worker.js onmessage() captured an uncaught exception: RuntimeError: unreachable
> RuntimeError: unreachable
>     at soffice.wasm.__trap (http://localhost:6931/soffice.wasm:wasm-function[446445]:0x8f952b3)
>     at ___trap (blob:http://localhost:6931/7e945427-df90-49c0-a2b5-28c5ecfbe1a5:16657:54)
>     at abort (blob:http://localhost:6931/7e945427-df90-49c0-a2b5-28c5ecfbe1a5:1091:5)
>     at assert (blob:http://localhost:6931/7e945427-df90-49c0-a2b5-28c5ecfbe1a5:731:5)
>     at HandleAllocator.get (blob:http://localhost:6931/7e945427-df90-49c0-a2b5-28c5ecfbe1a5:7212:11)
>     at Object.toValue (blob:http://localhost:6931/7e945427-df90-49c0-a2b5-28c5ecfbe1a5:7270:30)
>     at __emval_call_void_method (blob:http://localhost:6931/7e945427-df90-49c0-a2b5-28c5ecfbe1a5:10183:22)
>     at soffice.wasm.the_wrappers::com::sun::star::task::XJobExecutor::trigger(rtl::OUString const&) (http://localhost:6931/soffice.wasm:wasm-function[77042]:0xafbb24)
>     at soffice.wasm.(anonymous namespace)::JobExecutorThread::execute() (http://localhost:6931/soffice.wasm:wasm-function[243534]:0x43250b5)
>     at soffice.wasm.non-virtual thunk to salhelper::Thread::run() (http://localhost:6931/soffice.wasm:wasm-function[87641]:0xdff5cf)

Change-Id: I4e35dc19c5c0f97de7158bf9c07fd31716ffff84
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173132
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-09-10 19:52:15 +02:00
Stephan Bergmann a3a71ed916 'use strict' is of no use here...
...in snippets that are included with --pre-js/--post-js

Change-Id: I928aa16b78284314796a0645479dce0dfc7b42cc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172383
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
Tested-by: Jenkins
2024-08-26 16:29:28 +02:00
Stephan Bergmann 50cd19debb Emscripten: Clean up SolarMutex
...before disappearing through the QApplication::exec() hole, or else the
SolarMutex would remain locked forever on the application's main thread.

This requires changing SalInstance::ReleaseYieldMutexAll() to
SalInstance::ReleaseYieldMutex(bool all).  (Further recursive locking of the
SolarMutex via SolarMutexGuard instances that would be present on the call stack
leading up to the call to QApplication::exec() would be released during the
stack unwinding, so just undo the one acquiring done in InitVCL, not all of
them.)

Change-Id: I9ef57abb7da7f840999700e4eaeeefd2da784645
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171956
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-08-18 15:10:00 +02:00
Stephan Bergmann 38b9d5e86d Those XTest::is... methods return boolean, not any
Change-Id: Ie76e3551cac714fee56a087aed6aa851c4569209
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171957
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-08-18 15:09:36 +02:00
Michael Stahl 8ed755cfb0 pyuno,unotest,xmlsecurity: copy GPG test files for UITtest
The problem was that running UITest_xmlsecurity_gpg changed the files in
test/signing-keys/ ... prevent that by copying the directory in that
test, which is more complicated than initially expected.

Change-Id: Ie3be922e0b2e9dae49f9a70e35ad5270c90b4fc4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171322
Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Tested-by: Jenkins
2024-08-01 11:18:30 +02:00
Stephan Bergmann 0bf2e317ac More exhaustive org.libreoffice.embindtest.Struct
Change-Id: I91085ef8cd7cd80852c0d0ab4f87fd3226a10a00
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171236
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-07-30 14:15:58 +02:00
Stephan Bergmann f504bd1ac9 Embind: Missing support for UNO polymorphic struct types
Change-Id: I6bb29a951e6e5a3ed7d825172ba7b92ef95a5619
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171228
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-07-30 11:00:49 +02:00
Ilmari Lauhakangas d7628892b0 testtools, uitest, unotest: fix issues found by Ruff linter
Change-Id: I4a848b0f1f114d1262b5242786e088eb50a33cef
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171145
Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
Tested-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
Tested-by: Jenkins
2024-07-29 10:34:57 +02:00
Stephan Bergmann 4d18fa7694 In embindtest, also test Any included in Struct
Change-Id: Id268692c750873629c1ceaf232e1e61912164872
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171078
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-07-27 18:33:59 +02:00
Stephan Bergmann ac175a43c9 Add a toDelete parameter to Module.throwUnoException
...as there can be situations (cf. the newly added test code in embindtest.js)
where objects that need to be deleted are passed as payload of the exception
value to be thrown.  So there now is a (mandatory, as Embind doesn't allow to
implicitly pass undefined) third parameter now that must be an array of objects
on which to call .delete().

(75fe059974 "Embind: throwUnoException from JS"
had deliberately made throwUnoException take two arguments, because if it
"directly took a css::uno::Any argument, JS client code would need to create one
with `new Module.uno_Any(...)` and call .delete() on it, but there is no place
where it could call .delete()".  There now would be such a place, but it would
probably still be tedious most of the time to explicitly construct a new uno_Any
to pass into throwUnoException both as the exception and in the toDelete array.
So keep that design decision to have throwUnoException take individual type and
value arguments.)

Change-Id: Idec029d9e500457b02d20d899b9a2328cd7a5d7e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171024
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
Tested-by: Jenkins
2024-07-25 22:39:23 +02:00
Stephan Bergmann 91bedcab61 Change from Module.intiUno() to Module.uno_init promise
...that is resolved from within C++ Desktop::InitApplicationServiceManager once
UNO is fully initialized, so client code can trigger on
Module.uno_init.then(...)

Change-Id: I2d4c542d9729d09f434502e3f966e9ee474e926c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170683
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-07-18 15:55:12 +02:00
Noel Grandin 3519027515 make date/time single-arg constructors explicit
Change-Id: I943f755d95b90ef8aeb7d5b339f617ff50db4e29
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170673
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-07-18 10:27:41 +02:00
Stephan Bergmann f10d51709d Embind: Implement UNO interface attributes as JS accessor properties
Change-Id: I39b1f5676b2e5ba6071b39bf031c10d9c85f1ad1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170566
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-07-16 12:48:49 +02:00
Stephan Bergmann e8e6a5f795 Add test code for UNO attributes implemented in JS
Change-Id: I74f5ef53e7850ab783ae4cd94525a55c63512bd3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170544
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-07-16 12:48:40 +02:00
Stephan Bergmann d2550cf131 Test calling directly from JS a UNO method implemented in JS
Change-Id: I46855474d2c183db9204bfea68cac94112e7766a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170543
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
Tested-by: Jenkins
2024-07-16 12:48:29 +02:00
Stephan Bergmann a0f3225984 Turn org.libreoffice.embindtest.Test from singleton to service
...so that testing its StringAttribute stars out with a known state.  And which
revealed that the test code in unotest/source/embindtest/embindtest.js was
actually wrong in assuming that that UNO attribute would be represented by a JS
accessor property, when actually it is represented by a pair of
get-/setStringAttribute member functions.

Change-Id: I1a6e7c9f26e9a08cd089b7972a23f4c608c6b1bc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170414
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-07-12 19:36:46 +02:00
Stephan Bergmann 74829f2a64 Fully implement the Wasm UNO bridge cpp2uno direction
...after 875997c896 "Properly implement
cppu::throwException for Emscripten" had implemented only those parts that were
absolutely necessary for that exception throwing.  As detailed in the commit
message there, wasmcallgen has been extended to additionally generate all the
required vtable slot call trampoline code (which cannot be generated on the fly
for Wasm, as would be done for other platforms).  Consequently, some of the
"callvirtualfunction"-centric file names have been changed to "generated" as the
output of wasmcallgen is now more general.  (And wasmcallgen itself should also
be renamed, in a follow-up commit.  And when adding to the wasmcallgen code
here, some existing parts of its implementation have been cleaned up, too.)

There is no direct way to test this half of the Wasm UNO bridge directly from
unotest/source/embindtest/embindtest.js, so a new
org.libreoffice.embindtest.BridgeTest singleton has been added, which triggers
new test code in unotest/source/embindtest/embindtest.cxx that tests the bridge
in a way similar to testtools' bridgetest machinery.

Change-Id: I521a1d6c2160aedc814f7603b0b99861e5fbd1eb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170374
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-07-11 17:16:17 +02:00
Andrea Gelmini 16d58ad8d3 Fix "lets" -> "let's"
Change-Id: Ibe6cbbd618aab5c145913235dc90fec3c98cd504
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169723
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Julien Nabet <serval2412@yahoo.fr>
2024-06-28 22:23:17 +02:00
Stephan Bergmann eedbe966bb Embind: Fix C++ UNO exception catching
...with a new Module.catchUnoException JS function that can be used in a JS
catch block to provide the thrown UNO exception as an Any.  (For a non-C++
exception, it rethrows the exception, and for a non-UNO C++ exception it maps it
to css.uno.RuntimeException.)

The implementation reuses parts of bridges/source/cpp_uno/gcc3_wasm/, which have
been moved to a new StaticLibrary_emscriptencxxabi.

Change-Id: I708fe6121c43a1b9736de5dff449f6c4f32a45f3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169325
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-06-21 11:29:59 +02:00
Stephan Bergmann 81ac964986 Consistently 'use strict' for JS code
Change-Id: I6f6e06ad32ffa87242f5a0f41c176149b754e2ea
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169187
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
2024-06-19 12:29:47 +02:00