diff options
-rw-r--r-- | basic/source/runtime/runtime.cxx | 10 | ||||
-rw-r--r-- | sc/qa/extras/macros-test.cxx | 26 | ||||
-rw-r--r-- | sc/qa/extras/testdocuments/tdf43003.ods | bin | 0 -> 12604 bytes |
3 files changed, 28 insertions, 8 deletions
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 Binary files differnew file mode 100644 index 000000000000..3c40deefa4db --- /dev/null +++ b/sc/qa/extras/testdocuments/tdf43003.ods |