sc/qa/extras/macros-test.cxx | 36 ++++++++++++++++++++++++++++++ sc/qa/extras/testdocuments/tdf131562.xlsm |binary 2 files changed, 36 insertions(+)
New commits: commit b8ff69726959ee4d148c12866d64601d86635bcc Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Thu Jul 9 22:05:14 2020 +0200 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Thu Jul 9 23:21:54 2020 +0200 tdf131562: sc_macros_test: Add unittest Change-Id: I08e8dd0230a6c900d0a88a015d066bffc2e8e8b5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98475 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sc/qa/extras/macros-test.cxx b/sc/qa/extras/macros-test.cxx index ee1aa5c6fe27..8aa86fa4e50f 100644 --- a/sc/qa/extras/macros-test.cxx +++ b/sc/qa/extras/macros-test.cxx @@ -36,6 +36,7 @@ public: void testMSP(); void testPasswordProtectedStarBasic(); void testRowColumn(); + void testTdf131562(); void testPasswordProtectedUnicodeString(); void testTdf131296_legacy(); void testTdf131296_new(); @@ -46,6 +47,7 @@ public: CPPUNIT_TEST(testVba); CPPUNIT_TEST(testPasswordProtectedStarBasic); CPPUNIT_TEST(testRowColumn); + CPPUNIT_TEST(testTdf131562); CPPUNIT_TEST(testPasswordProtectedUnicodeString); CPPUNIT_TEST(testTdf131296_legacy); CPPUNIT_TEST(testTdf131296_new); @@ -393,6 +395,40 @@ void ScMacrosTest::testRowColumn() pDocSh->DoClose(); } +void ScMacrosTest::testTdf131562() +{ + OUString aFileName; + createFileURL("tdf131562.xlsm", 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* pFoundShell = SfxObjectShell::GetShellFromComponent(xComponent); + + CPPUNIT_ASSERT_MESSAGE("Failed to access document shell", pFoundShell); + ScDocShell* pDocSh = static_cast<ScDocShell*>(pFoundShell); + ScDocument& rDoc = pDocSh->GetDocument(); + + CPPUNIT_ASSERT_EQUAL(OUString("1"), rDoc.GetString(ScAddress(0,2,0))); + CPPUNIT_ASSERT_EQUAL(OUString(""), rDoc.GetString(ScAddress(0,3,0))); + + SfxObjectShell::CallXScript( + xComponent, + "vnd.sun.Star.script:VBAProject.Munka1.numberconcat?language=Basic&location=document", + aParams, aRet, aOutParamIndex, aOutParam); + + //Without the fix in place, the macro wouldn't have concatenated 1 and " ." + CPPUNIT_ASSERT_EQUAL(OUString("1 ."), rDoc.GetString(ScAddress(0,2,0))); + CPPUNIT_ASSERT_EQUAL(OUString("1 .cat"), rDoc.GetString(ScAddress(0,3,0))); + + pDocSh->DoClose(); +} + void ScMacrosTest::testPasswordProtectedUnicodeString() { const OUString sCorrectString(u"English Русский 中文"); diff --git a/sc/qa/extras/testdocuments/tdf131562.xlsm b/sc/qa/extras/testdocuments/tdf131562.xlsm new file mode 100644 index 000000000000..e56576ba4583 Binary files /dev/null and b/sc/qa/extras/testdocuments/tdf131562.xlsm differ _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits