diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2020-07-09 22:05:14 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2020-07-09 23:21:54 +0200 |
commit | b8ff69726959ee4d148c12866d64601d86635bcc (patch) | |
tree | 564bad39abd9f9f50f9808902ae39754eb9fe518 /sc | |
parent | ebb48db9ddd393ec9280cd5d50cb3ddd2793226d (diff) |
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 <xiscofauli@libreoffice.org>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/qa/extras/macros-test.cxx | 36 | ||||
-rw-r--r-- | sc/qa/extras/testdocuments/tdf131562.xlsm | bin | 0 -> 13203 bytes |
2 files changed, 36 insertions, 0 deletions
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 Binary files differnew file mode 100644 index 000000000000..e56576ba4583 --- /dev/null +++ b/sc/qa/extras/testdocuments/tdf131562.xlsm |