summaryrefslogtreecommitdiff
path: root/sc/qa/unit/subsequent_filters-test.cxx
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2021-01-22 10:56:29 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2021-01-22 13:29:41 +0100
commit6220d619b42b18cca7280174daed56aad5c82fce (patch)
tree74b002c34b15bff167eeaa51481eeeec8a1e2283 /sc/qa/unit/subsequent_filters-test.cxx
parent1414bbf06f376cad4409ff23a635b0605b45ead3 (diff)
sc_subsequent_filters: factor out common code
Change-Id: Iaa5ed1b3f68b257ec94731c2873e6016c7988608 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109780 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sc/qa/unit/subsequent_filters-test.cxx')
-rw-r--r--sc/qa/unit/subsequent_filters-test.cxx75
1 files changed, 19 insertions, 56 deletions
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index 6635feb5e10b..3f76ede398be 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -488,6 +488,7 @@ public:
CPPUNIT_TEST_SUITE_END();
private:
+ void testImportCrash(std::u16string_view rFileName, sal_Int32 nFormat);
void testPassword_Impl(std::u16string_view rFileNameBase);
uno::Reference<uno::XInterface> m_xCalcComponent;
@@ -1869,6 +1870,17 @@ void ScFiltersTest::testRowIndex1BasedXLSX()
xDocSh->DoClose();
}
+void ScFiltersTest::testImportCrash(std::u16string_view rFileName, sal_Int32 nFormat)
+{
+ ScDocShellRef xDocSh =loadDoc(rFileName, nFormat);
+ CPPUNIT_ASSERT_MESSAGE(OString("Failed to load " + OUStringToOString(rFileName, RTL_TEXTENCODING_UTF8)).getStr(), xDocSh.is());
+
+ ScDocument& rDoc = xDocSh->GetDocument();
+ rDoc.CalcAll(); // perform hard re-calculation.
+
+ xDocSh->DoClose();
+}
+
void ScFiltersTest::testPassword_Impl(std::u16string_view aFileNameBase)
{
OUString aFileExtension(getFileFormats()[0].pName, strlen(getFileFormats()[0].pName), RTL_TEXTENCODING_UTF8 );
@@ -3846,74 +3858,32 @@ void ScFiltersTest::testTdf110440XLSX()
void ScFiltersTest::testTdf122643()
{
- // Would crash without the fix on loading
- ScDocShellRef xDocSh = loadDoc(u"tdf122643.", FORMAT_ODS);
- CPPUNIT_ASSERT_MESSAGE("Failed to open doc", xDocSh.is());
-
- ScDocument& rDoc = xDocSh->GetDocument();
- rDoc.CalcAll(); // perform hard re-calculation.
-
- xDocSh->DoClose();
+ testImportCrash(u"tdf122643.", FORMAT_ODS);
}
void ScFiltersTest::testTdf132278()
{
- // Would crash without the fix on loading
- ScDocShellRef xDocSh = loadDoc(u"tdf132278.", FORMAT_ODS);
- CPPUNIT_ASSERT_MESSAGE("Failed to open doc", xDocSh.is());
-
- ScDocument& rDoc = xDocSh->GetDocument();
- rDoc.CalcAll(); // perform hard re-calculation.
-
- xDocSh->DoClose();
+ testImportCrash(u"tdf132278.", FORMAT_ODS);
}
void ScFiltersTest::testTdf130959()
{
- // Would crash without the fix on loading
- ScDocShellRef xDocSh = loadDoc(u"tdf130959.", FORMAT_XLSX);
- CPPUNIT_ASSERT_MESSAGE("Failed to open doc", xDocSh.is());
-
- ScDocument& rDoc = xDocSh->GetDocument();
- rDoc.CalcAll(); // perform hard re-calculation.
-
- xDocSh->DoClose();
+ testImportCrash(u"tdf130959.", FORMAT_XLSX);
}
void ScFiltersTest::testTdf129410()
{
- // Would crash without the fix on loading
- ScDocShellRef xDocSh = loadDoc(u"tdf129410.", FORMAT_ODS);
- CPPUNIT_ASSERT_MESSAGE("Failed to open doc", xDocSh.is());
-
- ScDocument& rDoc = xDocSh->GetDocument();
- rDoc.CalcAll(); // perform hard re-calculation.
-
- xDocSh->DoClose();
+ testImportCrash(u"tdf129410.", FORMAT_ODS);
}
void ScFiltersTest::testTdf138507()
{
- // Would fail to load without the fix
- ScDocShellRef xDocSh = loadDoc(u"tdf138507.", FORMAT_ODS);
- CPPUNIT_ASSERT_MESSAGE("Failed to open doc", xDocSh.is());
-
- ScDocument& rDoc = xDocSh->GetDocument();
- rDoc.CalcAll(); // perform hard re-calculation.
-
- xDocSh->DoClose();
+ testImportCrash(u"tdf138507.", FORMAT_ODS);
}
void ScFiltersTest::testTdf131380()
{
- ScDocShellRef xDocSh = loadDoc(u"tdf131380.", FORMAT_XLSX);
- CPPUNIT_ASSERT_MESSAGE("Failed to open doc", xDocSh.is());
-
- // Would crash without the fix on recalculating
- ScDocument& rDoc = xDocSh->GetDocument();
- rDoc.CalcAll(); // perform hard re-calculation.
-
- xDocSh->DoClose();
+ testImportCrash(u"tdf131380.", FORMAT_XLSX);
}
void ScFiltersTest::testTdf129681()
@@ -3946,14 +3916,7 @@ void ScFiltersTest::testTdf129681()
void ScFiltersTest::testTdf111974XLSM()
{
- // Would crash without the fix on loading
- ScDocShellRef xDocSh = loadDoc(u"tdf111974.", FORMAT_XLSM);
- CPPUNIT_ASSERT_MESSAGE("Failed to open doc", xDocSh.is());
-
- ScDocument& rDoc = xDocSh->GetDocument();
- rDoc.CalcAll(); // perform hard re-calculation.
-
- xDocSh->DoClose();
+ testImportCrash(u"tdf111974.", FORMAT_XLSM);
}
void ScFiltersTest::testBnc762542()