From a2baea7faff31d26459dab3668a39eae85e4991b Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 15 Apr 2024 11:27:30 +0200 Subject: Adding upstream version 4:24.2.1. Signed-off-by: Daniel Baumann --- sc/qa/extras/macros-test.cxx | 27 ++++++++++++++++++++ sc/qa/extras/testdocuments/tdf159412.fods | 41 +++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 sc/qa/extras/testdocuments/tdf159412.fods (limited to 'sc/qa/extras') 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 aOutParamIndex; + css::uno::Sequence aOutParam; + css::uno::Sequence 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 @@ + + + + + + + + + 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 + + + + + + + + + + + + + + \ No newline at end of file -- cgit v1.2.3