diff options
author | Andreas Heinisch <andreas.heinisch@yahoo.de> | 2020-12-05 09:41:56 +0100 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2020-12-07 16:10:09 +0100 |
commit | 2538188ee85513cb80eb8aa8f925082d86ff711d (patch) | |
tree | 8186d65716e8ae5554bcfd9601a764990c657b03 /sc | |
parent | 039a87fb1022fe4d6e66e1540e7fb49cb154f08a (diff) |
tdf#43003 - convert parameter to the requested type
In StepPARAM convert parameters to the requested type, otherwise it
loses possible references which leads to an error where the results of a
macro has no effect on the caller.
Change-Id: I8347eab658e037a29cd04be9c00edd6a4d1b31c3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107249
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/qa/extras/macros-test.cxx | 26 | ||||
-rw-r--r-- | sc/qa/extras/testdocuments/tdf43003.ods | bin | 0 -> 12604 bytes |
2 files changed, 26 insertions, 0 deletions
diff --git a/sc/qa/extras/macros-test.cxx b/sc/qa/extras/macros-test.cxx index cf7d46ace3bb..2970a587ecc5 100644 --- a/sc/qa/extras/macros-test.cxx +++ b/sc/qa/extras/macros-test.cxx @@ -51,6 +51,7 @@ public: void testTdf131296_new(); void testTdf128218(); void testTdf71271(); + void testTdf43003(); CPPUNIT_TEST_SUITE(ScMacrosTest); CPPUNIT_TEST(testStarBasic); @@ -68,6 +69,7 @@ public: CPPUNIT_TEST(testTdf131296_new); CPPUNIT_TEST(testTdf128218); CPPUNIT_TEST(testTdf71271); + CPPUNIT_TEST(testTdf43003); CPPUNIT_TEST_SUITE_END(); }; @@ -838,6 +840,30 @@ void ScMacrosTest::testTdf71271() xCloseable->close(true); } +void ScMacrosTest::testTdf43003() +{ + OUString aFileName; + createFileURL("tdf43003.ods", aFileName); + auto xComponent = loadFromDesktop(aFileName, "com.sun.star.sheet.SpreadsheetDocument"); + CPPUNIT_ASSERT(xComponent); + + SfxObjectShell* pFoundShell = SfxObjectShell::GetShellFromComponent(xComponent); + CPPUNIT_ASSERT(pFoundShell); + + ScDocShellRef xDocSh = dynamic_cast<ScDocShell*>(pFoundShell); + CPPUNIT_ASSERT(xDocSh); + + ScDocument& rDoc = xDocSh->GetDocument(); + + // Without the fix in place, the values of the specified cells won't be changed + rDoc.SetValue(ScAddress(0, 0, 0), 2); + CPPUNIT_ASSERT_EQUAL(3.0, rDoc.GetValue(ScAddress(1, 0, 0))); + CPPUNIT_ASSERT_EQUAL(4.0, rDoc.GetValue(ScAddress(2, 0, 0))); + + css::uno::Reference<css::util::XCloseable> xCloseable(xComponent, css::uno::UNO_QUERY_THROW); + xCloseable->close(true); +} + ScMacrosTest::ScMacrosTest() : UnoApiTest("/sc/qa/extras/testdocuments") { diff --git a/sc/qa/extras/testdocuments/tdf43003.ods b/sc/qa/extras/testdocuments/tdf43003.ods Binary files differnew file mode 100644 index 000000000000..3c40deefa4db --- /dev/null +++ b/sc/qa/extras/testdocuments/tdf43003.ods |