diff options
author | rounak <rounak.modi06@gmail.com> | 2021-04-06 10:30:16 +0530 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2021-04-09 14:40:53 +0200 |
commit | 7a3a21657bbbf7c4187fc4ff6a45dda5512951a2 (patch) | |
tree | 4e7cbd1a43bf7d1ea73b6c502219dfbcb715bc31 /sc/qa/extras | |
parent | 1369ce4aadc9cdce9a25992b1f4e2aa7230c0b91 (diff) |
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 <xiscofauli@libreoffice.org>
Diffstat (limited to 'sc/qa/extras')
-rw-r--r-- | sc/qa/extras/macros-test.cxx | 26 | ||||
-rw-r--r-- | sc/qa/extras/testdocuments/tdf105558.ods | bin | 0 -> 9459 bytes |
2 files changed, 26 insertions, 0 deletions
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 Binary files differnew file mode 100644 index 000000000000..0ea77ee66888 --- /dev/null +++ b/sc/qa/extras/testdocuments/tdf105558.ods |