diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 09:29:03 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 09:29:03 +0000 |
commit | 5a7157d319477830426797532e02ac39d3b859f4 (patch) | |
tree | 3773f5ce209bee14a5643e98672e0f3828c71434 /sc/qa/extras | |
parent | Releasing progress-linux version 4:24.2.0-3~progress7.99u1. (diff) | |
download | libreoffice-5a7157d319477830426797532e02ac39d3b859f4.tar.xz libreoffice-5a7157d319477830426797532e02ac39d3b859f4.zip |
Merging upstream version 4:24.2.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sc/qa/extras')
-rw-r--r-- | sc/qa/extras/macros-test.cxx | 27 | ||||
-rw-r--r-- | sc/qa/extras/testdocuments/tdf159412.fods | 41 |
2 files changed, 68 insertions, 0 deletions
diff --git a/sc/qa/extras/macros-test.cxx b/sc/qa/extras/macros-test.cxx index 4494f3f65b..92878cf2be 100644 --- a/sc/qa/extras/macros-test.cxx +++ b/sc/qa/extras/macros-test.cxx @@ -897,6 +897,33 @@ CPPUNIT_TEST_FIXTURE(ScMacrosTest, testTdf116127) CPPUNIT_ASSERT_EQUAL(Any(true), aRet); } +CPPUNIT_TEST_FIXTURE(ScMacrosTest, testTdf159412) +{ + // Run a macro, that itself calls two other functions using invoke, + // passing a small integer value to agruments of types Long and Double + createScDoc("tdf159412.fods"); + + css::uno::Any aRet; + css::uno::Sequence<sal_Int16> aOutParamIndex; + css::uno::Sequence<css::uno::Any> aOutParam; + css::uno::Sequence<css::uno::Any> aParams; + + SfxObjectShell::CallXScript( + mxComponent, + "vnd.sun.Star.script:Standard.Module1.TestInvoke?language=Basic&location=document", + aParams, aRet, aOutParamIndex, aOutParam); + + OUString aReturnValue; + aRet >>= aReturnValue; + + // Without the fix in place, this test would have failed with + // - Expected: 1 Long/2 Double + // - Actual : 0 Long/0 Double + // i.e., the passed 1 and 2 values were lost. + + CPPUNIT_ASSERT_EQUAL(u"1 Long/2 Double"_ustr, aReturnValue); +} + ScMacrosTest::ScMacrosTest() : ScModelTestBase("/sc/qa/extras/testdocuments") { diff --git a/sc/qa/extras/testdocuments/tdf159412.fods b/sc/qa/extras/testdocuments/tdf159412.fods new file mode 100644 index 0000000000..ec537dd061 --- /dev/null +++ b/sc/qa/extras/testdocuments/tdf159412.fods @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.spreadsheet"> + <office:scripts> + <office:script script:language="ooo:Basic"> + <ooo:libraries> + <ooo:library-embedded ooo:name="Standard"> + <ooo:module ooo:name="Module1"> + <ooo:source-code>REM ***** BASIC ***** + +Function TestInvoke + script = ThisComponent.scriptProvider.getScript("vnd.sun.star.script:Standard.Module1.S_Ref_Long?language=Basic&location=document") + ret = script.invoke(Array(1), Array(), Array()) + + script = ThisComponent.scriptProvider.getScript("vnd.sun.star.script:Standard.Module1.S_Ref_Dbl?language=Basic&location=document") + ret = ret & "/" & script.invoke(Array(2), Array(), Array()) + + TestInvoke = ret +End Function + +Function S_Ref_Long(n As Long) + S_Ref_Long = CStr(n) & " " & TypeName(n) +End Function + +Function S_Ref_Dbl(n As Double) + S_Ref_Dbl = CStr(n) & " " & TypeName(n) +End Function + + + </ooo:source-code> + </ooo:module> + </ooo:library-embedded> + </ooo:libraries> + </office:script> + </office:scripts> + <office:body> + <office:spreadsheet> + <table:table table:name="Sheet1"/> + </office:spreadsheet> + </office:body> +</office:document>
\ No newline at end of file |