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

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Fri Jul 10 13:07:00 UTC 2020


 sc/qa/extras/macros-test.cxx              |   40 ++++++++++++++++++++++++++++++
 sc/qa/extras/testdocuments/tdf107885.xlsm |binary
 2 files changed, 40 insertions(+)

New commits:
commit e58cab418349a43ea788d0a4f5ba26097b377d2c
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Fri Jul 10 11:31:39 2020 +0200
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Fri Jul 10 15:06:35 2020 +0200

    tdf#107885: sc_macros_test: Add unittest
    
    Change-Id: I059dc2ead51506098f37dbb3aaac0ab1436a17ec
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98482
    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 8aa86fa4e50f..502b9ba6d8ee 100644
--- a/sc/qa/extras/macros-test.cxx
+++ b/sc/qa/extras/macros-test.cxx
@@ -35,6 +35,7 @@ public:
     void testVba();
     void testMSP();
     void testPasswordProtectedStarBasic();
+    void testTdf107885();
     void testRowColumn();
     void testTdf131562();
     void testPasswordProtectedUnicodeString();
@@ -46,6 +47,7 @@ public:
     CPPUNIT_TEST(testMSP);
     CPPUNIT_TEST(testVba);
     CPPUNIT_TEST(testPasswordProtectedStarBasic);
+    CPPUNIT_TEST(testTdf107885);
     CPPUNIT_TEST(testRowColumn);
     CPPUNIT_TEST(testTdf131562);
     CPPUNIT_TEST(testPasswordProtectedUnicodeString);
@@ -358,6 +360,44 @@ void ScMacrosTest::testVba()
     }
 }
 
+void ScMacrosTest::testTdf107885()
+{
+    OUString aFileName;
+    createFileURL("tdf107885.xlsm", 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();
+
+    CPPUNIT_ASSERT(!rDoc.RowHidden(1,0));
+    CPPUNIT_ASSERT(!rDoc.RowHidden(2,0));
+    CPPUNIT_ASSERT(!rDoc.RowHidden(3,0));
+    CPPUNIT_ASSERT(!rDoc.RowHidden(4,0));
+
+    SfxObjectShell::CallXScript(
+        xComponent,
+        "vnd.sun.Star.script:VBAProject.Module1.AF?language=Basic&location=document",
+        aParams, aRet, aOutParamIndex, aOutParam);
+
+    //Without the fix in place, all rows in autofilter would have been hidden
+    CPPUNIT_ASSERT(rDoc.RowHidden(1,0));
+    CPPUNIT_ASSERT(!rDoc.RowHidden(2,0));
+    CPPUNIT_ASSERT(!rDoc.RowHidden(3,0));
+    CPPUNIT_ASSERT(!rDoc.RowHidden(4,0));
+
+    pDocSh->DoClose();
+}
+
 void ScMacrosTest::testRowColumn()
 {
     OUString aFileName;
diff --git a/sc/qa/extras/testdocuments/tdf107885.xlsm b/sc/qa/extras/testdocuments/tdf107885.xlsm
new file mode 100644
index 000000000000..9553ba9d88ca
Binary files /dev/null and b/sc/qa/extras/testdocuments/tdf107885.xlsm differ


More information about the Libreoffice-commits mailing list