[Libreoffice-commits] core.git: sc/qa

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Tue Aug 4 20:00:20 UTC 2020


 sc/qa/extras/macros-test.cxx             |   33 +++++++++++++++++++++++++++++++
 sc/qa/extras/testdocuments/tdf128218.ods |binary
 2 files changed, 33 insertions(+)

New commits:
commit 178e3acd41225d2ba0c1bcca371c34770f1f30db
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Tue Aug 4 16:50:39 2020 +0200
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Tue Aug 4 21:59:38 2020 +0200

    tdf#128218: sc_macros_test: Add unittest
    
    Change-Id: Id0597de78873dccd7316c406364f1c4c2ae5bb93
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100120
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/sc/qa/extras/macros-test.cxx b/sc/qa/extras/macros-test.cxx
index 7289dcc75888..d158d8c412c5 100644
--- a/sc/qa/extras/macros-test.cxx
+++ b/sc/qa/extras/macros-test.cxx
@@ -46,6 +46,7 @@ public:
     void testTdf107902();
     void testTdf131296_legacy();
     void testTdf131296_new();
+    void testTdf128218();
 
     CPPUNIT_TEST_SUITE(ScMacrosTest);
     CPPUNIT_TEST(testStarBasic);
@@ -60,6 +61,7 @@ public:
     CPPUNIT_TEST(testTdf107902);
     CPPUNIT_TEST(testTdf131296_legacy);
     CPPUNIT_TEST(testTdf131296_new);
+    CPPUNIT_TEST(testTdf128218);
 
     CPPUNIT_TEST_SUITE_END();
 };
@@ -705,6 +707,37 @@ void ScMacrosTest::testTdf131296_new()
     xCloseable->close(true);
 }
 
+void ScMacrosTest::testTdf128218()
+{
+    OUString aFileName;
+    createFileURL("tdf128218.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::CallXScript(
+        xComponent,
+        "vnd.sun.Star.script:Standard.Module1.TestRAND?language=Basic&location=document",
+        aParams, aRet, aOutParamIndex, aOutParam);
+
+    OUString aReturnValue;
+    aRet >>= aReturnValue;
+
+    // Without the fix in place, this test would have failed with
+    // - Expected: Double
+    // - Actual  : Object()
+
+    CPPUNIT_ASSERT_EQUAL(OUString("Double"), aReturnValue);
+
+    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/tdf128218.ods b/sc/qa/extras/testdocuments/tdf128218.ods
new file mode 100644
index 000000000000..9fa3e8b4ecbd
Binary files /dev/null and b/sc/qa/extras/testdocuments/tdf128218.ods differ


More information about the Libreoffice-commits mailing list