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>
diff --git a/sc/qa/extras/macros-test.cxx b/sc/qa/extras/macros-test.cxx
index 06f921c..fa58d7e5 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 0000000..0ea77ee
--- /dev/null
+++ b/sc/qa/extras/testdocuments/tdf105558.ods
Binary files differ