[Libreoffice-commits] core.git: basic/source sc/qa
Andreas Heinisch (via logerrit)
logerrit at kemper.freedesktop.org
Mon Dec 7 15:10:49 UTC 2020
basic/source/runtime/runtime.cxx | 10 ++--------
sc/qa/extras/macros-test.cxx | 26 ++++++++++++++++++++++++++
sc/qa/extras/testdocuments/tdf43003.ods |binary
3 files changed, 28 insertions(+), 8 deletions(-)
New commits:
commit 2538188ee85513cb80eb8aa8f925082d86ff711d
Author: Andreas Heinisch <andreas.heinisch at yahoo.de>
AuthorDate: Sat Dec 5 09:41:56 2020 +0100
Commit: Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Mon Dec 7 16:10:09 2020 +0100
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 at collabora.com>
diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx
index 6ac8168358be..5a64166b63a1 100644
--- a/basic/source/runtime/runtime.cxx
+++ b/basic/source/runtime/runtime.cxx
@@ -4177,14 +4177,8 @@ void SbiRuntime::StepPARAM( sal_uInt32 nOp1, sal_uInt32 nOp2 )
}
else if( eType != SbxVARIANT && static_cast<SbxDataType>(pVar->GetType() & 0x0FFF ) != eType )
{
- SbxVariable* q = new SbxVariable( eType );
- aRefSaved.emplace_back(q );
- *q = *pVar;
- pVar = q;
- if ( nIdx )
- {
- refParams->Put32( pVar, nIdx );
- }
+ // tdf#43003 - convert parameter to the requested type
+ pVar->Convert(eType);
}
SetupArgs( pVar, nOp1 );
PushVar( CheckArray( pVar ) );
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
new file mode 100644
index 000000000000..3c40deefa4db
Binary files /dev/null and b/sc/qa/extras/testdocuments/tdf43003.ods differ
More information about the Libreoffice-commits
mailing list