sc/qa/extras/macros-test.cxx | 26 ++++++++++++++++++++++++++ sc/qa/extras/testdocuments/tdf105558.ods |binary 2 files changed, 26 insertions(+)
New commits: commit 7a3a21657bbbf7c4187fc4ff6a45dda5512951a2 Author: rounak <rounak.mod...@gmail.com> AuthorDate: Tue Apr 6 10:30:16 2021 +0530 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Fri Apr 9 14:40:53 2021 +0200 tdf#105558: sc_macros: Add unittest to check BASIC currency format returns as a number instead of as a text string Change-Id: Ic618f49aa2a2641cde9ebc9e1c694397a74c4a40 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113621 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 06f921ca35e9..fa58d7e51f33 100644 --- a/sc/qa/extras/macros-test.cxx +++ b/sc/qa/extras/macros-test.cxx @@ -56,6 +56,7 @@ public: void testTdf133887(); void testTdf133889(); void testTdf138646(); + void testTdf105558(); CPPUNIT_TEST_SUITE(ScMacrosTest); CPPUNIT_TEST(testStarBasic); @@ -79,6 +80,7 @@ public: CPPUNIT_TEST(testTdf133887); CPPUNIT_TEST(testTdf133889); CPPUNIT_TEST(testTdf138646); + CPPUNIT_TEST(testTdf105558); CPPUNIT_TEST_SUITE_END(); }; @@ -1024,6 +1026,30 @@ void ScMacrosTest::testTdf138646() pDocSh->DoClose(); } +void ScMacrosTest::testTdf105558() +{ + OUString aFileName; + createFileURL(u"tdf105558.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, this test would have failed with + // - Expected: 5.5 + // - Actual : 0 + CPPUNIT_ASSERT_EQUAL(5.5, rDoc.GetValue(ScAddress(0, 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/tdf105558.ods b/sc/qa/extras/testdocuments/tdf105558.ods new file mode 100644 index 000000000000..0ea77ee66888 Binary files /dev/null and b/sc/qa/extras/testdocuments/tdf105558.ods differ _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits