diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2020-07-10 11:31:39 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2020-07-10 15:06:35 +0200 |
commit | e58cab418349a43ea788d0a4f5ba26097b377d2c (patch) | |
tree | 90006db16c5414c26a6a06a1a712377a0ce4b170 | |
parent | b55f56ca0417105f1e10131503d5560fb6c7e452 (diff) |
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@libreoffice.org>
-rw-r--r-- | sc/qa/extras/macros-test.cxx | 40 | ||||
-rw-r--r-- | sc/qa/extras/testdocuments/tdf107885.xlsm | bin | 0 -> 7917 bytes |
2 files changed, 40 insertions, 0 deletions
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 Binary files differnew file mode 100644 index 000000000000..9553ba9d88ca --- /dev/null +++ b/sc/qa/extras/testdocuments/tdf107885.xlsm |