diff options
author | Andreas Heinisch <andreas.heinisch@yahoo.de> | 2021-08-02 19:48:35 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2021-08-09 19:41:46 +0200 |
commit | c2697c468c1441df61b2d590a7cb259d21b3ba60 (patch) | |
tree | 6a882ad86fda907699824be3f41464e01529b7dc /sc | |
parent | 7a5f12ea03e72749b2d3ccc99ed72edc3ff22d4b (diff) |
tdf#143582 - Clear return value of the method before calling it
Otherwise the function keeps a copy of its return value, which may be
used in an upcoming call.
Change-Id: I4977c39e1ce48cfd5ab067a4df4783f10505a9ae
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119905
Tested-by: Jenkins
Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120197
Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120211
Diffstat (limited to 'sc')
-rw-r--r-- | sc/qa/extras/macros-test.cxx | 30 | ||||
-rw-r--r-- | sc/qa/extras/testdocuments/tdf143582.ods | bin | 0 -> 12194 bytes |
2 files changed, 30 insertions, 0 deletions
diff --git a/sc/qa/extras/macros-test.cxx b/sc/qa/extras/macros-test.cxx index 9322a3eab7cd..557fdf5dd3d1 100644 --- a/sc/qa/extras/macros-test.cxx +++ b/sc/qa/extras/macros-test.cxx @@ -55,6 +55,7 @@ public: void testTdf43003(); void testTdf138646(); void testTdf90278(); + void testTdf143582(); CPPUNIT_TEST_SUITE(ScMacrosTest); CPPUNIT_TEST(testStarBasic); @@ -75,6 +76,7 @@ public: CPPUNIT_TEST(testTdf43003); CPPUNIT_TEST(testTdf138646); CPPUNIT_TEST(testTdf90278); + CPPUNIT_TEST(testTdf143582); CPPUNIT_TEST_SUITE_END(); }; @@ -869,6 +871,34 @@ void ScMacrosTest::testTdf43003() xCloseable->close(true); } +void ScMacrosTest::testTdf143582() +{ + OUString aFileName; + createFileURL(u"tdf143582.ods", aFileName); + auto xComponent = loadFromDesktop(aFileName, "com.sun.star.sheet.SpreadsheetDocument"); + + css::uno::Any aRet; + css::uno::Sequence<css::uno::Any> aParams; + css::uno::Sequence<css::uno::Any> aOutParam; + css::uno::Sequence<sal_Int16> aOutParamIndex; + + SfxObjectShell::CallXScript( + xComponent, + "vnd.sun.Star.script:Standard.Module1.TestScriptInvoke?language=Basic&location=document", + aParams, aRet, aOutParamIndex, aOutParam); + + OUString aReturnValue; + aRet >>= aReturnValue; + + // Without the fix in place, this test would have failed with + // - Expected: Test + // - Actual : TeTest + CPPUNIT_ASSERT_EQUAL(OUString("Test"), aReturnValue); + + css::uno::Reference<css::util::XCloseable> xCloseable(xComponent, css::uno::UNO_QUERY_THROW); + xCloseable->close(true); +} + void ScMacrosTest::testTdf138646() { OUString aFileName; diff --git a/sc/qa/extras/testdocuments/tdf143582.ods b/sc/qa/extras/testdocuments/tdf143582.ods Binary files differnew file mode 100644 index 000000000000..05f4f07cea2c --- /dev/null +++ b/sc/qa/extras/testdocuments/tdf143582.ods |