summaryrefslogtreecommitdiff
path: root/sc/qa
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2021-01-26 16:46:45 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2021-01-26 18:24:21 +0100
commit14b155fdfa0cd2a15e61c6ad040518902625d0d3 (patch)
tree7f7aced2b91077130d3dfff41a6225d3264e5c4c /sc/qa
parentf3c85aa4423ce896402d16de6c757db410787c74 (diff)
tdf#46119: sc_macros_test: Add unittest
Change-Id: Ie3a9f663b1957a82f482c131d3f25e8389835f71 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109963 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sc/qa')
-rw-r--r--sc/qa/extras/macros-test.cxx46
-rw-r--r--sc/qa/extras/testdocuments/tdf46119.odsbin0 -> 17398 bytes
2 files changed, 46 insertions, 0 deletions
diff --git a/sc/qa/extras/macros-test.cxx b/sc/qa/extras/macros-test.cxx
index 7efa20e5f60f..771b71edf399 100644
--- a/sc/qa/extras/macros-test.cxx
+++ b/sc/qa/extras/macros-test.cxx
@@ -49,6 +49,7 @@ public:
void testTdf107902();
void testTdf131296_legacy();
void testTdf131296_new();
+ void testTdf46119();
void testTdf128218();
void testTdf71271();
void testTdf43003();
@@ -69,6 +70,8 @@ public:
CPPUNIT_TEST(testTdf107902);
CPPUNIT_TEST(testTdf131296_legacy);
CPPUNIT_TEST(testTdf131296_new);
+ CPPUNIT_TEST(testTdf46119);
+ CPPUNIT_TEST(testTdf128218);
CPPUNIT_TEST(testTdf128218);
CPPUNIT_TEST(testTdf71271);
CPPUNIT_TEST(testTdf43003);
@@ -782,6 +785,49 @@ void ScMacrosTest::testTdf131296_new()
xCloseable->close(true);
}
+void ScMacrosTest::testTdf46119()
+{
+ OUString aFileName;
+ createFileURL(u"tdf46119.ods", 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();
+
+ SfxObjectShell::CallXScript(
+ xComponent,
+ "vnd.sun.Star.script:Standard.Module1.Main?language=Basic&location=document",
+ aParams, aRet, aOutParamIndex, aOutParam);
+
+ CPPUNIT_ASSERT_EQUAL(OUString("0.074"), rDoc.GetString(ScAddress(2, 24, 0)));
+ CPPUNIT_ASSERT_EQUAL(OUString("0.067"), rDoc.GetString(ScAddress(2, 25, 0)));
+ CPPUNIT_ASSERT_EQUAL(OUString("0.273"), rDoc.GetString(ScAddress(2, 26, 0)));
+ CPPUNIT_ASSERT_EQUAL(OUString("0.259"), rDoc.GetString(ScAddress(2, 27, 0)));
+
+ CPPUNIT_ASSERT_EQUAL(OUString("0.097"), rDoc.GetString(ScAddress(3, 24, 0)));
+ CPPUNIT_ASSERT_EQUAL(OUString("0.087"), rDoc.GetString(ScAddress(3, 25, 0)));
+ CPPUNIT_ASSERT_EQUAL(OUString("0.311"), rDoc.GetString(ScAddress(3, 26, 0)));
+ CPPUNIT_ASSERT_EQUAL(OUString("0.296"), rDoc.GetString(ScAddress(3, 27, 0)));
+
+ CPPUNIT_ASSERT_EQUAL(OUString("0.149"), rDoc.GetString(ScAddress(4, 24, 0)));
+ CPPUNIT_ASSERT_EQUAL(OUString("0.134"), rDoc.GetString(ScAddress(4, 25, 0)));
+ CPPUNIT_ASSERT_EQUAL(OUString("0.386"), rDoc.GetString(ScAddress(4, 26, 0)));
+ CPPUNIT_ASSERT_EQUAL(OUString("0.366"), rDoc.GetString(ScAddress(4, 27, 0)));
+
+ css::uno::Reference<css::util::XCloseable> xCloseable(xComponent, css::uno::UNO_QUERY_THROW);
+ xCloseable->close(true);
+}
+
void ScMacrosTest::testTdf128218()
{
OUString aFileName;
diff --git a/sc/qa/extras/testdocuments/tdf46119.ods b/sc/qa/extras/testdocuments/tdf46119.ods
new file mode 100644
index 000000000000..953f75d648d9
--- /dev/null
+++ b/sc/qa/extras/testdocuments/tdf46119.ods
Binary files differ