From 178e3acd41225d2ba0c1bcca371c34770f1f30db Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Tue, 4 Aug 2020 16:50:39 +0200 Subject: tdf#128218: sc_macros_test: Add unittest Change-Id: Id0597de78873dccd7316c406364f1c4c2ae5bb93 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100120 Tested-by: Jenkins Reviewed-by: Xisco Fauli --- sc/qa/extras/macros-test.cxx | 33 +++++++++++++++++++++++++++++++ sc/qa/extras/testdocuments/tdf128218.ods | Bin 0 -> 8232 bytes 2 files changed, 33 insertions(+) create mode 100644 sc/qa/extras/testdocuments/tdf128218.ods (limited to 'sc') diff --git a/sc/qa/extras/macros-test.cxx b/sc/qa/extras/macros-test.cxx index 7289dcc75888..d158d8c412c5 100644 --- a/sc/qa/extras/macros-test.cxx +++ b/sc/qa/extras/macros-test.cxx @@ -46,6 +46,7 @@ public: void testTdf107902(); void testTdf131296_legacy(); void testTdf131296_new(); + void testTdf128218(); CPPUNIT_TEST_SUITE(ScMacrosTest); CPPUNIT_TEST(testStarBasic); @@ -60,6 +61,7 @@ public: CPPUNIT_TEST(testTdf107902); CPPUNIT_TEST(testTdf131296_legacy); CPPUNIT_TEST(testTdf131296_new); + CPPUNIT_TEST(testTdf128218); CPPUNIT_TEST_SUITE_END(); }; @@ -705,6 +707,37 @@ void ScMacrosTest::testTdf131296_new() xCloseable->close(true); } +void ScMacrosTest::testTdf128218() +{ + OUString aFileName; + createFileURL("tdf128218.ods", aFileName); + uno::Reference< css::lang::XComponent > xComponent = loadFromDesktop(aFileName, "com.sun.star.sheet.SpreadsheetDocument"); + + CPPUNIT_ASSERT_MESSAGE("Failed to load the doc", xComponent.is()); + + Any aRet; + Sequence< sal_Int16 > aOutParamIndex; + Sequence< Any > aOutParam; + Sequence< uno::Any > aParams; + + SfxObjectShell::CallXScript( + xComponent, + "vnd.sun.Star.script:Standard.Module1.TestRAND?language=Basic&location=document", + aParams, aRet, aOutParamIndex, aOutParam); + + OUString aReturnValue; + aRet >>= aReturnValue; + + // Without the fix in place, this test would have failed with + // - Expected: Double + // - Actual : Object() + + CPPUNIT_ASSERT_EQUAL(OUString("Double"), aReturnValue); + + css::uno::Reference xCloseable(xComponent, css::uno::UNO_QUERY_THROW); + xCloseable->close(true); +} + ScMacrosTest::ScMacrosTest() : UnoApiTest("/sc/qa/extras/testdocuments") { diff --git a/sc/qa/extras/testdocuments/tdf128218.ods b/sc/qa/extras/testdocuments/tdf128218.ods new file mode 100644 index 000000000000..9fa3e8b4ecbd Binary files /dev/null and b/sc/qa/extras/testdocuments/tdf128218.ods differ -- cgit