sc/qa/unit/copy_paste_test.cxx          |    1 
 sc/qa/unit/pivottable_filters_test.cxx  |  170 +++----
 sc/qa/unit/scshapetest.cxx              |   25 -
 sc/qa/unit/subsequent_export_test.cxx   |   48 +-
 sc/qa/unit/subsequent_export_test2.cxx  |   93 ++-
 sc/qa/unit/subsequent_export_test3.cxx  |  752 ++++++++++++++++----------------
 sc/qa/unit/subsequent_export_test4.cxx  |   56 +-
 sc/qa/unit/subsequent_filters_test.cxx  |  128 ++---
 sc/qa/unit/subsequent_filters_test2.cxx |  231 ++++-----
 sc/qa/unit/subsequent_filters_test3.cxx |   62 +-
 sc/qa/unit/subsequent_filters_test4.cxx |   49 +-
 sc/qa/unit/uicalc/uicalc.cxx            |  103 ++--
 sc/qa/unit/uicalc/uicalc2.cxx           |    2 
 13 files changed, 929 insertions(+), 791 deletions(-)

New commits:
commit e0c2618364e5dd0a3a8ebf7e147d559949d97f78
Author:     Xisco Fauli <[email protected]>
AuthorDate: Mon Feb 9 12:49:32 2026 +0100
Commit:     Xisco Fauli <[email protected]>
CommitDate: Tue Feb 10 13:42:37 2026 +0100

    sc: only load one document per test
    
    Change-Id: I8efc0653f922e1809decb255783a5bf90c731f1c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198974
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <[email protected]>

diff --git a/sc/qa/unit/copy_paste_test.cxx b/sc/qa/unit/copy_paste_test.cxx
index 10ed9786889b..5cdf27482087 100644
--- a/sc/qa/unit/copy_paste_test.cxx
+++ b/sc/qa/unit/copy_paste_test.cxx
@@ -92,6 +92,7 @@ void ScCopyPasteTest::testCopyPasteXLS()
     pViewShell->GetViewData().GetView()->CopyToClip(&aClipDoc, false, false, 
false, false);
 
     // Open a new document
+    dispose();
     createScDoc();
 
     pViewShell = getViewShell();
diff --git a/sc/qa/unit/pivottable_filters_test.cxx 
b/sc/qa/unit/pivottable_filters_test.cxx
index 10109452dc3a..7eab9dee1ab1 100644
--- a/sc/qa/unit/pivottable_filters_test.cxx
+++ b/sc/qa/unit/pivottable_filters_test.cxx
@@ -2355,55 +2355,44 @@ CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, 
testTdf124772NumFmt)
                 "formatCode", u"\$#,##0");
 }
 
-CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testTdf124810)
+CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testTdf124810_pivotDark)
 {
-    {
-        // First, test that we roundtrip existing pivot table style 
information from XLSX.
-        createScDoc("xlsx/pivot_dark1.xlsx");
-
-        save(TestFilter::XLSX);
-        xmlDocUniquePtr pTable = 
parseExport(u"xl/pivotTables/pivotTable1.xml"_ustr);
-        CPPUNIT_ASSERT(pTable);
-
-        // All attributes must have been roundtripped correctly (testdoc uses 
some non-default values)
-        assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo", 
"name",
-                    u"PivotStyleDark1");
-        assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo", 
"showRowHeaders",
-                    u"1");
-        assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo", 
"showColHeaders",
-                    u"1");
-        assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo", 
"showRowStripes",
-                    u"1");
-        assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo", 
"showColStripes",
-                    u"0");
-        assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo", 
"showLastColumn",
-                    u"0");
-    }
+    // First, test that we roundtrip existing pivot table style information 
from XLSX.
+    createScDoc("xlsx/pivot_dark1.xlsx");
 
-    {
-        // Now check that we export default style information when there's no 
such information in
-        // original document. Just use some ODS as source. This might be 
changed when we start
-        // exporting better pivot table style information.
-        createScDoc("ods/tdf124651_simplePivotTable.ods");
-
-        save(TestFilter::XLSX);
-        xmlDocUniquePtr pTable = 
parseExport(u"xl/pivotTables/pivotTable1.xml"_ustr);
-        CPPUNIT_ASSERT(pTable);
-
-        // The default style for pivot tables in Excel 2007 through 2016 is 
PivotStyleLight16
-        assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo", 
"name",
-                    u"PivotStyleLight16");
-        assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo", 
"showRowHeaders",
-                    u"1");
-        assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo", 
"showColHeaders",
-                    u"1");
-        assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo", 
"showRowStripes",
-                    u"0");
-        assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo", 
"showColStripes",
-                    u"0");
-        assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo", 
"showLastColumn",
-                    u"1");
-    }
+    save(TestFilter::XLSX);
+    xmlDocUniquePtr pTable = 
parseExport(u"xl/pivotTables/pivotTable1.xml"_ustr);
+    CPPUNIT_ASSERT(pTable);
+
+    // All attributes must have been roundtripped correctly (testdoc uses some 
non-default values)
+    assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo", 
"name",
+                u"PivotStyleDark1");
+    assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo", 
"showRowHeaders", u"1");
+    assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo", 
"showColHeaders", u"1");
+    assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo", 
"showRowStripes", u"1");
+    assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo", 
"showColStripes", u"0");
+    assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo", 
"showLastColumn", u"0");
+}
+
+CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testTdf124810_simplePivotTable)
+{
+    // Now check that we export default style information when there's no such 
information in
+    // original document. Just use some ODS as source. This might be changed 
when we start
+    // exporting better pivot table style information.
+    createScDoc("ods/tdf124651_simplePivotTable.ods");
+
+    save(TestFilter::XLSX);
+    xmlDocUniquePtr pTable = 
parseExport(u"xl/pivotTables/pivotTable1.xml"_ustr);
+    CPPUNIT_ASSERT(pTable);
+
+    // The default style for pivot tables in Excel 2007 through 2016 is 
PivotStyleLight16
+    assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo", 
"name",
+                u"PivotStyleLight16");
+    assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo", 
"showRowHeaders", u"1");
+    assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo", 
"showColHeaders", u"1");
+    assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo", 
"showRowStripes", u"0");
+    assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo", 
"showColStripes", u"0");
+    assertXPath(pTable, "/x:pivotTableDefinition/x:pivotTableStyleInfo", 
"showLastColumn", u"1");
 }
 
 CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testTdf124883)
@@ -2570,67 +2559,76 @@ CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, 
testPivotTableCompactLayoutXLSX)
     testThis(*getScDoc());
 }
 
-CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest,
-                     
testPivotTableXLSX_OutOfSyncPivotTableCachedDefinitionImport)
-{
-    // This tests that a out-of-sync sheet data and pivot table cached 
definitions
-    // still get imported correctly as expected.
+// This tests that a out-of-sync sheet data and pivot table cached definitions
+// still get imported correctly as expected.
 
-    // It is perfectly valid that the sheet data and pivot table are 
out-of-sync,
-    // but even if the sheet data is heavily modified, the pivot table should 
still
-    // be imported.
+// It is perfectly valid that the sheet data and pivot table are out-of-sync,
+// but even if the sheet data is heavily modified, the pivot table should still
+// be imported.
 
-    // The test document has columns named A-K where only A and K are used in 
the
-    // pivot table. The columns B-J were removed in the sheet data, but the 
pivot table
-    // was not updated, so the cached data still has those and the pivot table
-    // description still relies on those columns to be present.
+// The test document has columns named A-K where only A and K are used in the
+// pivot table. The columns B-J were removed in the sheet data, but the pivot 
table
+// was not updated, so the cached data still has those and the pivot table
+// description still relies on those columns to be present.
 
-    auto testThis = [](ScDocument& rDocument) {
-        ScDPCollection* pDPs = rDocument.GetDPCollection();
-        CPPUNIT_ASSERT_MESSAGE("Failed to get a live ScDPCollection 
instance.", pDPs);
-        CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be exactly one pivot table 
instance.", size_t(1),
-                                     pDPs->GetCount());
+static void testPivotTable(ScDocument& rDocument)
+{
+    ScDPCollection* pDPs = rDocument.GetDPCollection();
+    CPPUNIT_ASSERT_MESSAGE("Failed to get a live ScDPCollection instance.", 
pDPs);
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be exactly one pivot table 
instance.", size_t(1),
+                                 pDPs->GetCount());
 
-        const ScDPObject* pDPObj = &(*pDPs)[0];
-        CPPUNIT_ASSERT(pDPObj);
-        ScDPSaveData* pSaveData = pDPObj->GetSaveData();
-        CPPUNIT_ASSERT(pSaveData);
+    const ScDPObject* pDPObj = &(*pDPs)[0];
+    CPPUNIT_ASSERT(pDPObj);
+    ScDPSaveData* pSaveData = pDPObj->GetSaveData();
+    CPPUNIT_ASSERT(pSaveData);
 
-        // Do we have a dim named "A"
-        ScDPSaveDimension* pSaveDimA = 
pSaveData->GetExistingDimensionByName(u"A");
-        CPPUNIT_ASSERT(pSaveDimA);
+    // Do we have a dim named "A"
+    ScDPSaveDimension* pSaveDimA = pSaveData->GetExistingDimensionByName(u"A");
+    CPPUNIT_ASSERT(pSaveDimA);
 
-        // Do we have a dim named "K"
-        ScDPSaveDimension* pSaveDimK = 
pSaveData->GetExistingDimensionByName(u"K");
-        CPPUNIT_ASSERT(pSaveDimK);
+    // Do we have a dim named "K"
+    ScDPSaveDimension* pSaveDimK = pSaveData->GetExistingDimensionByName(u"K");
+    CPPUNIT_ASSERT(pSaveDimK);
 
-        // Check the headers
-        CPPUNIT_ASSERT_EQUAL(u"K"_ustr, rDocument.GetString(ScAddress(0, 2, 
0))); // A3
-        CPPUNIT_ASSERT_EQUAL(u"Sum of A"_ustr, 
rDocument.GetString(ScAddress(1, 2, 0))); //B3
+    // Check the headers
+    CPPUNIT_ASSERT_EQUAL(u"K"_ustr, rDocument.GetString(ScAddress(0, 2, 0))); 
// A3
+    CPPUNIT_ASSERT_EQUAL(u"Sum of A"_ustr, rDocument.GetString(ScAddress(1, 2, 
0))); //B3
 
-        // Check the values
-        CPPUNIT_ASSERT_EQUAL(u"1"_ustr, rDocument.GetString(ScAddress(0, 3, 
0))); //A4
-        CPPUNIT_ASSERT_EQUAL(u"2"_ustr, rDocument.GetString(ScAddress(0, 4, 
0))); //A5
-        CPPUNIT_ASSERT_EQUAL(u"5"_ustr, rDocument.GetString(ScAddress(1, 3, 
0))); //B4
-        CPPUNIT_ASSERT_EQUAL(u"5"_ustr, rDocument.GetString(ScAddress(1, 4, 
0))); //B5
-    };
+    // Check the values
+    CPPUNIT_ASSERT_EQUAL(u"1"_ustr, rDocument.GetString(ScAddress(0, 3, 0))); 
//A4
+    CPPUNIT_ASSERT_EQUAL(u"2"_ustr, rDocument.GetString(ScAddress(0, 4, 0))); 
//A5
+    CPPUNIT_ASSERT_EQUAL(u"5"_ustr, rDocument.GetString(ScAddress(1, 3, 0))); 
//B4
+    CPPUNIT_ASSERT_EQUAL(u"5"_ustr, rDocument.GetString(ScAddress(1, 4, 0))); 
//B5
+}
 
+CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest,
+                     
testPivotTableXLSX_OutOfSyncPivotTableCachedDefinitionImport)
+{
     // test document with sheet data and pivot table in sync
     createScDoc("xlsx/PivotTable_CachedDefinitionAndDataInSync.xlsx");
-    testThis(*getScDoc());
+    testPivotTable(*getScDoc());
+}
 
+CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest,
+                     
testPivotTableXLSX_OutOfSyncPivotTableCachedDefinitionImport2)
+{
     // test document with sheet data and pivot table in out-of-sync - B-J 
columns removed,
     // but the pivot table cache still has all the data
     createScDoc(
         
"xlsx/PivotTable_CachedDefinitionAndDataNotInSync_SheetColumnsRemoved_WithCacheData.xlsx");
-    testThis(*getScDoc());
+    testPivotTable(*getScDoc());
+}
 
+CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest,
+                     
testPivotTableXLSX_OutOfSyncPivotTableCachedDefinitionImport3)
+{
     // test document with sheet data and pivot table in out-of-sync - B-J 
columns removed,
     // but the pivot table cache is not saved, only the cached definitions are 
available
     createScDoc("xlsx/"
                 
"PivotTable_CachedDefinitionAndDataNotInSync_SheetColumnsRemoved_WithoutCacheData."
                 "xlsx");
-    testThis(*getScDoc());
+    testPivotTable(*getScDoc());
 }
 
 CPPUNIT_TEST_FIXTURE(ScPivotTableFiltersTest, testFirstHeaderRowZero)
diff --git a/sc/qa/unit/scshapetest.cxx b/sc/qa/unit/scshapetest.cxx
index 2d2b8c9fc78a..c9085999e54c 100644
--- a/sc/qa/unit/scshapetest.cxx
+++ b/sc/qa/unit/scshapetest.cxx
@@ -1231,10 +1231,10 @@ CPPUNIT_TEST_FIXTURE(ScShapeTest, 
testTdf160003_copy_page_anchored)
     dispatchCommand(mxComponent, u".uno:Copy"_ustr, {});
 
     // close document and create new one
+    dispose();
     createScDoc();
 
     // paste clipboard
-    goToCell(u"$Sheet1.$A$1"_ustr);
     dispatchCommand(mxComponent, u".uno:Paste"_ustr, {});
 
     // Make sure the chart object exists.
@@ -1244,7 +1244,7 @@ CPPUNIT_TEST_FIXTURE(ScShapeTest, 
testTdf160003_copy_page_anchored)
     CPPUNIT_ASSERT_EQUAL(size_t(1), pPage->GetObjCount());
 }
 
-CPPUNIT_TEST_FIXTURE(ScShapeTest, testTdf160369_groupshape)
+CPPUNIT_TEST_FIXTURE(ScShapeTest, testTdf160369_groupshape_save)
 {
     // The document contains a group spanning range C5:F12. It is currently 
anchored to page to
     // make sure its position does not change. When the group was anchored 'To 
Cell' and rows or
@@ -1285,26 +1285,35 @@ CPPUNIT_TEST_FIXTURE(ScShapeTest, 
testTdf160369_groupshape)
     CPPUNIT_ASSERT_EQUAL(aOrigStart, aAfterStart);
     CPPUNIT_ASSERT_EQUAL(aOrigEnd, aAfterEnd);
     CPPUNIT_ASSERT_RECTANGLE_EQUAL_WITH_TOLERANCE(aOrigRect, aAfterRect, 1);
+}
 
+CPPUNIT_TEST_FIXTURE(ScShapeTest, testTdf160369_groupshape_saveAndReload)
+{
     // The same but with saveAndReload.
     createScDoc("ods/tdf160369_groupshape.ods");
-    pDoc = getScDoc();
-    pObj = lcl_getSdrObjectWithAssert(*pDoc, 0);
+    ScDocument* pDoc = getScDoc();
+    SdrObject* pObj = lcl_getSdrObjectWithAssert(*pDoc, 0);
     ScDrawLayer::SetCellAnchoredFromPosition(*pObj, *pDoc, 0 /*SCTAB*/, true 
/*bResizeWithCell*/);
     pDoc->SetRowHidden(2, 3, 0, true);
     pDoc->SetDrawPageSize(0); // trigger recalcpos, otherwise shapes are not 
changed
     pDoc->SetColHidden(3, 3, 0, true);
     pDoc->SetDrawPageSize(0);
 
+    // Get geometry of the group
+    ScDrawObjData* pObjData = ScDrawLayer::GetObjData(pObj);
+    ScAddress aOrigStart = (*pObjData).maStart;
+    ScAddress aOrigEnd = (*pObjData).maEnd;
+    tools::Rectangle aOrigRect = pObj->GetSnapRect();
+
     saveAndReload(TestFilter::ODS);
 
     // Verify geometry is same as before save
     pDoc = getScDoc();
     pObj = lcl_getSdrObjectWithAssert(*pDoc, 0);
-    pAfterObjData = ScDrawLayer::GetObjData(pObj);
-    aAfterStart = (*pAfterObjData).maStart;
-    aAfterEnd = (*pAfterObjData).maEnd;
-    aAfterRect = pObj->GetSnapRect();
+    ScDrawObjData* pAfterObjData = ScDrawLayer::GetObjData(pObj);
+    ScAddress aAfterStart = (*pAfterObjData).maStart;
+    ScAddress aAfterEnd = (*pAfterObjData).maEnd;
+    tools::Rectangle aAfterRect = pObj->GetSnapRect();
 
     // verify Orig equals After
     CPPUNIT_ASSERT_EQUAL(aOrigStart, aAfterStart);
diff --git a/sc/qa/unit/subsequent_export_test.cxx 
b/sc/qa/unit/subsequent_export_test.cxx
index 1bcf70cff0eb..03a7a742648f 100644
--- a/sc/qa/unit/subsequent_export_test.cxx
+++ b/sc/qa/unit/subsequent_export_test.cxx
@@ -228,26 +228,50 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, testTdf111876)
     CPPUNIT_ASSERT(sTarget != "../xls/bug-fixes.xls");
 }
 
-CPPUNIT_TEST_FIXTURE(ScExportTest, testPasswordExport)
+CPPUNIT_TEST_FIXTURE(ScExportTest, testPasswordExport_ODS)
 {
-    std::vector<TestFilter> aFilterNames{ TestFilter::ODS, TestFilter::XLS, 
TestFilter::XLSX };
+    createScDoc();
 
-    for (size_t i = 0; i < aFilterNames.size(); ++i)
-    {
-        createScDoc();
+    ScDocument* pDoc = getScDoc();
 
-        ScDocument* pDoc = getScDoc();
+    pDoc->SetValue(0, 0, 0, 1.0);
+
+    saveAndReload(TestFilter::ODS, /*rParams*/ {}, /*pPassword*/ "test");
+
+    pDoc = getScDoc();
+    double aVal = pDoc->GetValue(0, 0, 0);
+    ASSERT_DOUBLES_EQUAL(1.0, aVal);
+}
 
-        pDoc->SetValue(0, 0, 0, 1.0);
+CPPUNIT_TEST_FIXTURE(ScExportTest, testPasswordExport_XLS)
+{
+    createScDoc();
 
-        saveAndReload(aFilterNames[i], /*rParams*/ {}, /*pPassword*/ "test");
+    ScDocument* pDoc = getScDoc();
 
-        pDoc = getScDoc();
-        double aVal = pDoc->GetValue(0, 0, 0);
-        ASSERT_DOUBLES_EQUAL(1.0, aVal);
-    }
+    pDoc->SetValue(0, 0, 0, 1.0);
+
+    saveAndReload(TestFilter::XLS, /*rParams*/ {}, /*pPassword*/ "test");
+
+    pDoc = getScDoc();
+    double aVal = pDoc->GetValue(0, 0, 0);
+    ASSERT_DOUBLES_EQUAL(1.0, aVal);
 }
 
+CPPUNIT_TEST_FIXTURE(ScExportTest, testPasswordExport_XLSX)
+{
+    createScDoc();
+
+    ScDocument* pDoc = getScDoc();
+
+    pDoc->SetValue(0, 0, 0, 1.0);
+
+    saveAndReload(TestFilter::XLSX, /*rParams*/ {}, /*pPassword*/ "test");
+
+    pDoc = getScDoc();
+    double aVal = pDoc->GetValue(0, 0, 0);
+    ASSERT_DOUBLES_EQUAL(1.0, aVal);
+}
 CPPUNIT_TEST_FIXTURE(ScExportTest, testTdf134332)
 {
     createScDoc("ods/tdf134332.ods");
diff --git a/sc/qa/unit/subsequent_export_test2.cxx 
b/sc/qa/unit/subsequent_export_test2.cxx
index 1200ea4d42d4..65361c12aba3 100644
--- a/sc/qa/unit/subsequent_export_test2.cxx
+++ b/sc/qa/unit/subsequent_export_test2.cxx
@@ -208,12 +208,15 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, 
testRefStringConfigXLSX)
     CPPUNIT_ASSERT_EQUAL_MESSAGE("String ref syntax doesn't match",
                                  formula::FormulaGrammar::CONV_OOO,
                                  aConfig.meStringRefAddressSyntax);
+}
 
+CPPUNIT_TEST_FIXTURE(ScExportTest2, testNoRefStringConfigXLSX)
+{
     // this doc has no entry for ref syntax
     createScDoc("xlsx/empty-noconf.xlsx");
 
-    pDoc = getScDoc();
-    aConfig = pDoc->GetCalcConfig();
+    ScDocument* pDoc = getScDoc();
+    ScCalcConfig aConfig = pDoc->GetCalcConfig();
     // therefore after import, ref syntax should be set to CalcA1 | ExcelA1
     CPPUNIT_ASSERT_EQUAL_MESSAGE("String ref syntax doesn't match",
                                  formula::FormulaGrammar::CONV_A1_XL_A1,
@@ -641,39 +644,36 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, 
testAutofilterColorsODF)
 
 CPPUNIT_TEST_FIXTURE(ScExportTest2, testAutofilterColorsOOXML)
 {
-    {
-        createScDoc("xlsx/autofilter-colors.xlsx");
-        save(TestFilter::XLSX);
-        xmlDocUniquePtr pTable1 = parseExport(u"xl/tables/table1.xml"_ustr);
-        CPPUNIT_ASSERT(pTable1);
-        sal_Int32 nDxfId
-            = getXPath(pTable1, 
"/x:table/x:autoFilter/x:filterColumn/x:colorFilter", "dxfId")
-                  .toInt32()
-              + 1;
-
-        xmlDocUniquePtr pStyles = parseExport(u"xl/styles.xml"_ustr);
-        CPPUNIT_ASSERT(pStyles);
-        OString sDxfXPath("/x:styleSheet/x:dxfs/x:dxf[" + 
OString::number(nDxfId)
-                          + "]/x:fill/x:patternFill/x:fgColor");
-        assertXPath(pStyles, sDxfXPath, "rgb", u"FFFFD7D7");
-    }
+    createScDoc("xlsx/autofilter-colors.xlsx");
+    save(TestFilter::XLSX);
+    xmlDocUniquePtr pTable1 = parseExport(u"xl/tables/table1.xml"_ustr);
+    CPPUNIT_ASSERT(pTable1);
+    sal_Int32 nDxfId
+        = getXPath(pTable1, 
"/x:table/x:autoFilter/x:filterColumn/x:colorFilter", "dxfId").toInt32()
+          + 1;
 
-    {
-        createScDoc("xlsx/autofilter-colors-fg.xlsx");
-        save(TestFilter::XLSX);
-        xmlDocUniquePtr pTable1 = parseExport(u"xl/tables/table1.xml"_ustr);
-        CPPUNIT_ASSERT(pTable1);
-        sal_Int32 nDxfId
-            = getXPath(pTable1, 
"/x:table/x:autoFilter/x:filterColumn/x:colorFilter", "dxfId")
-                  .toInt32()
-              + 1;
-
-        xmlDocUniquePtr pStyles = parseExport(u"xl/styles.xml"_ustr);
-        CPPUNIT_ASSERT(pStyles);
-        OString sDxfXPath("/x:styleSheet/x:dxfs/x:dxf[" + 
OString::number(nDxfId)
-                          + "]/x:fill/x:patternFill/x:fgColor");
-        assertXPath(pStyles, sDxfXPath, "rgb", u"FF3465A4");
-    }
+    xmlDocUniquePtr pStyles = parseExport(u"xl/styles.xml"_ustr);
+    CPPUNIT_ASSERT(pStyles);
+    OString sDxfXPath("/x:styleSheet/x:dxfs/x:dxf[" + OString::number(nDxfId)
+                      + "]/x:fill/x:patternFill/x:fgColor");
+    assertXPath(pStyles, sDxfXPath, "rgb", u"FFFFD7D7");
+}
+
+CPPUNIT_TEST_FIXTURE(ScExportTest2, testAutofilterColorsOOXML2)
+{
+    createScDoc("xlsx/autofilter-colors-fg.xlsx");
+    save(TestFilter::XLSX);
+    xmlDocUniquePtr pTable1 = parseExport(u"xl/tables/table1.xml"_ustr);
+    CPPUNIT_ASSERT(pTable1);
+    sal_Int32 nDxfId
+        = getXPath(pTable1, 
"/x:table/x:autoFilter/x:filterColumn/x:colorFilter", "dxfId").toInt32()
+          + 1;
+
+    xmlDocUniquePtr pStyles = parseExport(u"xl/styles.xml"_ustr);
+    CPPUNIT_ASSERT(pStyles);
+    OString sDxfXPath("/x:styleSheet/x:dxfs/x:dxf[" + OString::number(nDxfId)
+                      + "]/x:fill/x:patternFill/x:fgColor");
+    assertXPath(pStyles, sDxfXPath, "rgb", u"FF3465A4");
 }
 
 CPPUNIT_TEST_FIXTURE(ScExportTest2, testAutofilterTop10XLSX)
@@ -893,8 +893,7 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, 
testOpenDocumentAsReadOnly)
     ScDocShell* pDocSh = getScDocShell();
     CPPUNIT_ASSERT(pDocSh->IsSecurityOptOpenReadOnly());
 
-    save(TestFilter::XLSX);
-    loadWithParams(maTempFile.GetURL(), aParams);
+    saveAndReload(TestFilter::XLSX, aParams);
 
     pDocSh = getScDocShell();
     CPPUNIT_ASSERT(pDocSh->IsSecurityOptOpenReadOnly());
@@ -1084,7 +1083,7 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, 
testTdf169072_illegalDates)
     assertXPath(pXmlCore, "/cp:coreProperties/cp:lastPrinted", 0); // was 
1600-12-31T00:00:52Z
 }
 
-CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf165180_date1904)
+CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf165180_date1904_XLSX_2007)
 {
     // given a hand-modified document (which added dateCompatibility="0")
     // with an earliest date of 1904 (Excel-for-mac null-date)
@@ -1108,14 +1107,29 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, 
testTdf165180_date1904)
     xmlDocUniquePtr pWorkbook = parseExport(u"xl/workbook.xml"_ustr);
     // dateCompatibility is ignored: make sure that date1904=true is 
round-tripped
     assertXPath(pWorkbook, "/x:workbook/x:workbookPr", "date1904", u"true");
+}
+
+CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf165180_date1904_XLSX)
+{
+    // given a hand-modified document (which added dateCompatibility="0")
+    // with an earliest date of 1904 (Excel-for-mac null-date)
 
+    // ensure en-US locale for expected date formatting
+    SvtSysLocaleOptions aOptions;
+    OUString sLocaleConfigString = aOptions.GetLanguageTag().getBcp47();
+    aOptions.SetLocaleConfigString(u"en-US"_ustr);
+    aOptions.Commit();
+    comphelper::ScopeGuard g([&aOptions, &sLocaleConfigString] {
+        aOptions.SetLocaleConfigString(sLocaleConfigString);
+        aOptions.Commit();
+    });
     createScDoc("xlsx/tdf165180_date1904.xlsx");
     saveAndReload(TestFilter::XLSX);
 
-    pDoc = getScDoc();
+    ScDocument* pDoc = getScDoc();
     CPPUNIT_ASSERT_EQUAL(u"Tuesday, March 1, 1904"_ustr, pDoc->GetString(0, 0, 
0));
 
-    pWorkbook = parseExport(u"xl/workbook.xml"_ustr);
+    xmlDocUniquePtr pWorkbook = parseExport(u"xl/workbook.xml"_ustr);
     // dateCompatibility is ignored: make sure that date1904=true is 
round-tripped
     assertXPath(pWorkbook, "/x:workbook/x:workbookPr", "date1904", u"true");
 }
@@ -1220,6 +1234,7 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, 
testValidationCopyPaste)
     pDoc->CopyToClip(aClipParam, &aClipDoc, &aMark, false, false);
 
     // Create second document, paste B1 from clip
+    dispose();
     createScDoc();
     pDoc = getScDoc();
     ScRange aDstRange(1, 0, 0);
diff --git a/sc/qa/unit/subsequent_export_test3.cxx 
b/sc/qa/unit/subsequent_export_test3.cxx
index 2f4dd4796dde..3bd62d693fc9 100644
--- a/sc/qa/unit/subsequent_export_test3.cxx
+++ b/sc/qa/unit/subsequent_export_test3.cxx
@@ -48,6 +48,9 @@ public:
 protected:
     void testCeilingFloor(TestFilter eFormatType);
     void testFunctionsExcel2010(TestFilter eFormatType);
+    void testSwappedOutImageExport(TestFilter eFormatType);
+    void testLinkedGraphicRT(TestFilter eFormatType);
+    void testImageWithSpecialID(TestFilter eFormatType);
 };
 
 CPPUNIT_TEST_FIXTURE(ScExportTest3, testBordersExchangeXLSX)
@@ -270,183 +273,179 @@ static OUString toString(const ScBigRange& rRange)
            + OUString::number(rRange.aEnd.Tab()) + ")";
 }
 
-CPPUNIT_TEST_FIXTURE(ScExportTest3, testTrackChangesSimpleXLSX)
+namespace
+{
+struct CheckItem
+{
+    sal_uLong mnActionId;
+    ScChangeActionType meType;
+
+    sal_Int32 mnStartCol;
+    sal_Int32 mnStartRow;
+    sal_Int32 mnStartTab;
+    sal_Int32 mnEndCol;
+    sal_Int32 mnEndRow;
+    sal_Int32 mnEndTab;
+
+    bool mbRowInsertedAtBottom;
+};
+
+bool checkRange(ScChangeActionType eType, const ScBigRange& rExpected, const 
ScBigRange& rActual)
 {
-    struct CheckItem
+    ScBigRange aExpected(rExpected), aActual(rActual);
+
+    switch (eType)
     {
-        sal_uLong mnActionId;
-        ScChangeActionType meType;
+        case SC_CAT_INSERT_ROWS:
+        {
+            // Ignore columns.
+            aExpected.aStart.SetCol(0);
+            aExpected.aEnd.SetCol(0);
+            aActual.aStart.SetCol(0);
+            aActual.aEnd.SetCol(0);
+        }
+        break;
+        default:;
+    }
 
-        sal_Int32 mnStartCol;
-        sal_Int32 mnStartRow;
-        sal_Int32 mnStartTab;
-        sal_Int32 mnEndCol;
-        sal_Int32 mnEndRow;
-        sal_Int32 mnEndTab;
+    return aExpected == aActual;
+}
 
-        bool mbRowInsertedAtBottom;
+bool check(ScDocument& rDoc)
+{
+    static const CheckItem aChecks[] = {
+        { 1, SC_CAT_CONTENT, 1, 1, 0, 1, 1, 0, false },
+        { 2, SC_CAT_INSERT_ROWS, 0, 2, 0, 0, 2, 0, true },
+        { 3, SC_CAT_CONTENT, 1, 2, 0, 1, 2, 0, false },
+        { 4, SC_CAT_INSERT_ROWS, 0, 3, 0, 0, 3, 0, true },
+        { 5, SC_CAT_CONTENT, 1, 3, 0, 1, 3, 0, false },
+        { 6, SC_CAT_INSERT_ROWS, 0, 4, 0, 0, 4, 0, true },
+        { 7, SC_CAT_CONTENT, 1, 4, 0, 1, 4, 0, false },
+        { 8, SC_CAT_INSERT_ROWS, 0, 5, 0, 0, 5, 0, true },
+        { 9, SC_CAT_CONTENT, 1, 5, 0, 1, 5, 0, false },
+        { 10, SC_CAT_INSERT_ROWS, 0, 6, 0, 0, 6, 0, true },
+        { 11, SC_CAT_CONTENT, 1, 6, 0, 1, 6, 0, false },
+        { 12, SC_CAT_INSERT_ROWS, 0, 7, 0, 0, 7, 0, true },
+        { 13, SC_CAT_CONTENT, 1, 7, 0, 1, 7, 0, false },
     };
 
-    struct
+    ScChangeTrack* pCT = rDoc.GetChangeTrack();
+    if (!pCT)
     {
-        bool checkRange(ScChangeActionType eType, const ScBigRange& rExpected,
-                        const ScBigRange& rActual)
-        {
-            ScBigRange aExpected(rExpected), aActual(rActual);
+        std::cerr << "Change track instance doesn't exist." << std::endl;
+        return false;
+    }
 
-            switch (eType)
-            {
-                case SC_CAT_INSERT_ROWS:
-                {
-                    // Ignore columns.
-                    aExpected.aStart.SetCol(0);
-                    aExpected.aEnd.SetCol(0);
-                    aActual.aStart.SetCol(0);
-                    aActual.aEnd.SetCol(0);
-                }
-                break;
-                default:;
-            }
+    sal_uLong nActionMax = pCT->GetActionMax();
+    if (nActionMax != 13)
+    {
+        std::cerr << "Unexpected highest action ID value." << std::endl;
+        return false;
+    }
 
-            return aExpected == aActual;
+    for (const auto& rCheck : aChecks)
+    {
+        sal_uInt16 nActId = rCheck.mnActionId;
+        const ScChangeAction* pAction = pCT->GetAction(nActId);
+        if (!pAction)
+        {
+            std::cerr << "No action for action number " << nActId << " found." 
<< std::endl;
+            return false;
         }
 
-        bool check(ScDocument& rDoc)
+        if (pAction->GetType() != rCheck.meType)
         {
-            static const CheckItem aChecks[] = {
-                { 1, SC_CAT_CONTENT, 1, 1, 0, 1, 1, 0, false },
-                { 2, SC_CAT_INSERT_ROWS, 0, 2, 0, 0, 2, 0, true },
-                { 3, SC_CAT_CONTENT, 1, 2, 0, 1, 2, 0, false },
-                { 4, SC_CAT_INSERT_ROWS, 0, 3, 0, 0, 3, 0, true },
-                { 5, SC_CAT_CONTENT, 1, 3, 0, 1, 3, 0, false },
-                { 6, SC_CAT_INSERT_ROWS, 0, 4, 0, 0, 4, 0, true },
-                { 7, SC_CAT_CONTENT, 1, 4, 0, 1, 4, 0, false },
-                { 8, SC_CAT_INSERT_ROWS, 0, 5, 0, 0, 5, 0, true },
-                { 9, SC_CAT_CONTENT, 1, 5, 0, 1, 5, 0, false },
-                { 10, SC_CAT_INSERT_ROWS, 0, 6, 0, 0, 6, 0, true },
-                { 11, SC_CAT_CONTENT, 1, 6, 0, 1, 6, 0, false },
-                { 12, SC_CAT_INSERT_ROWS, 0, 7, 0, 0, 7, 0, true },
-                { 13, SC_CAT_CONTENT, 1, 7, 0, 1, 7, 0, false },
-            };
+            std::cerr << "Unexpected action type for action number " << nActId 
<< "." << std::endl;
+            return false;
+        }
 
-            ScChangeTrack* pCT = rDoc.GetChangeTrack();
-            if (!pCT)
-            {
-                std::cerr << "Change track instance doesn't exist." << 
std::endl;
-                return false;
-            }
+        const ScBigRange& rRange = pAction->GetBigRange();
+        ScBigRange aCheck(rCheck.mnStartCol, rCheck.mnStartRow, 
rCheck.mnStartTab, rCheck.mnEndCol,
+                          rCheck.mnEndRow, rCheck.mnEndTab);
 
-            sal_uLong nActionMax = pCT->GetActionMax();
-            if (nActionMax != 13)
-            {
-                std::cerr << "Unexpected highest action ID value." << 
std::endl;
-                return false;
-            }
+        if (!checkRange(pAction->GetType(), aCheck, rRange))
+        {
+            std::cerr << "Unexpected range for action number " << nActId
+                      << ": expected=" << toString(aCheck) << " actual=" << 
toString(rRange)
+                      << std::endl;
+            return false;
+        }
 
-            for (const auto& rCheck : aChecks)
+        switch (pAction->GetType())
+        {
+            case SC_CAT_INSERT_ROWS:
             {
-                sal_uInt16 nActId = rCheck.mnActionId;
-                const ScChangeAction* pAction = pCT->GetAction(nActId);
-                if (!pAction)
-                {
-                    std::cerr << "No action for action number " << nActId << " 
found." << std::endl;
-                    return false;
-                }
-
-                if (pAction->GetType() != rCheck.meType)
-                {
-                    std::cerr << "Unexpected action type for action number " 
<< nActId << "."
-                              << std::endl;
-                    return false;
-                }
-
-                const ScBigRange& rRange = pAction->GetBigRange();
-                ScBigRange aCheck(rCheck.mnStartCol, rCheck.mnStartRow, 
rCheck.mnStartTab,
-                                  rCheck.mnEndCol, rCheck.mnEndRow, 
rCheck.mnEndTab);
-
-                if (!checkRange(pAction->GetType(), aCheck, rRange))
+                const ScChangeActionIns* p = static_cast<const 
ScChangeActionIns*>(pAction);
+                if (p->IsEndOfList() != rCheck.mbRowInsertedAtBottom)
                 {
-                    std::cerr << "Unexpected range for action number " << 
nActId
-                              << ": expected=" << toString(aCheck) << " 
actual=" << toString(rRange)
+                    std::cerr << "Unexpected end-of-list flag for action 
number " << nActId << "."
                               << std::endl;
                     return false;
                 }
-
-                switch (pAction->GetType())
-                {
-                    case SC_CAT_INSERT_ROWS:
-                    {
-                        const ScChangeActionIns* p = static_cast<const 
ScChangeActionIns*>(pAction);
-                        if (p->IsEndOfList() != rCheck.mbRowInsertedAtBottom)
-                        {
-                            std::cerr << "Unexpected end-of-list flag for 
action number " << nActId
-                                      << "." << std::endl;
-                            return false;
-                        }
-                    }
-                    break;
-                    default:;
-                }
             }
-
-            return true;
+            break;
+            default:;
         }
+    }
 
-        bool checkRevisionUserAndTime(ScDocument& rDoc, std::u16string_view 
rOwnerName)
-        {
-            ScChangeTrack* pCT = rDoc.GetChangeTrack();
-            if (!pCT)
-            {
-                std::cerr << "Change track instance doesn't exist." << 
std::endl;
-                return false;
-            }
+    return true;
+}
 
-            ScChangeAction* pAction = pCT->GetLast();
-            if (pAction->GetUser() != "Kohei Yoshida")
-            {
-                std::cerr << "Wrong user name." << std::endl;
-                return false;
-            }
+bool checkRevisionUserAndTime(ScDocument& rDoc, std::u16string_view rOwnerName)
+{
+    ScChangeTrack* pCT = rDoc.GetChangeTrack();
+    if (!pCT)
+    {
+        std::cerr << "Change track instance doesn't exist." << std::endl;
+        return false;
+    }
 
-            DateTime aDT = pAction->GetDateTime();
-            if (aDT.GetYear() != 2014 || aDT.GetMonth() != 7 || aDT.GetDay() 
!= 11)
-            {
-                std::cerr << "Wrong time stamp." << std::endl;
-                return false;
-            }
+    ScChangeAction* pAction = pCT->GetLast();
+    if (pAction->GetUser() != "Kohei Yoshida")
+    {
+        std::cerr << "Wrong user name." << std::endl;
+        return false;
+    }
 
-            // Insert a new record to make sure the user and date-time are 
correct.
-            rDoc.SetString(ScAddress(1, 8, 0), u"New String"_ustr);
-            ScCellValue aEmpty;
-            pCT->AppendContent(ScAddress(1, 8, 0), aEmpty);
-            pAction = pCT->GetLast();
-            if (!pAction)
-            {
-                std::cerr << "Failed to retrieve last revision." << std::endl;
-                return false;
-            }
+    DateTime aDT = pAction->GetDateTime();
+    if (aDT.GetYear() != 2014 || aDT.GetMonth() != 7 || aDT.GetDay() != 11)
+    {
+        std::cerr << "Wrong time stamp." << std::endl;
+        return false;
+    }
 
-            if (rOwnerName != pAction->GetUser())
-            {
-                std::cerr << "Wrong user name." << std::endl;
-                return false;
-            }
+    // Insert a new record to make sure the user and date-time are correct.
+    rDoc.SetString(ScAddress(1, 8, 0), u"New String"_ustr);
+    ScCellValue aEmpty;
+    pCT->AppendContent(ScAddress(1, 8, 0), aEmpty);
+    pAction = pCT->GetLast();
+    if (!pAction)
+    {
+        std::cerr << "Failed to retrieve last revision." << std::endl;
+        return false;
+    }
 
-            DateTime aDTNew = pAction->GetDateTime();
-            if (aDTNew <= aDT)
-            {
-                std::cerr
-                    << "Time stamp of the new revision should be more recent 
than that of the "
-                       "last revision."
-                    << std::endl;
-                return false;
-            }
+    if (rOwnerName != pAction->GetUser())
+    {
+        std::cerr << "Wrong user name." << std::endl;
+        return false;
+    }
 
-            return true;
-        }
+    DateTime aDTNew = pAction->GetDateTime();
+    if (aDTNew <= aDT)
+    {
+        std::cerr << "Time stamp of the new revision should be more recent 
than that of the "
+                     "last revision."
+                  << std::endl;
+        return false;
+    }
 
-    } aTest;
+    return true;
+}
+} //namespace
 
+CPPUNIT_TEST_FIXTURE(ScExportTest3, testTrackChangesSimpleXLS)
+{
     SvtUserOptions& rUserOpt = ScModule::get()->GetUserOptions();
     rUserOpt.SetToken(UserOptToken::FirstName, u"Export"_ustr);
     rUserOpt.SetToken(UserOptToken::LastName, u"Test"_ustr);
@@ -457,12 +456,12 @@ CPPUNIT_TEST_FIXTURE(ScExportTest3, 
testTrackChangesSimpleXLSX)
 
     createScDoc("xls/track-changes/simple-cell-changes.xls");
     ScDocument* pDoc = getScDoc();
-    bool bGood = aTest.check(*pDoc);
+    bool bGood = check(*pDoc);
     CPPUNIT_ASSERT_MESSAGE("Initial check failed (xls).", bGood);
 
     saveAndReload(TestFilter::XLS);
     pDoc = getScDoc();
-    bGood = aTest.check(*pDoc);
+    bGood = check(*pDoc);
     CPPUNIT_ASSERT_MESSAGE("Check after reload failed (xls).", bGood);
 
     // fdo#81445 : Check the blank value string to make sure it's "<empty>".
@@ -474,22 +473,28 @@ CPPUNIT_TEST_FIXTURE(ScExportTest3, 
testTrackChangesSimpleXLSX)
     CPPUNIT_ASSERT_EQUAL(u"Cell B2 changed from '<empty>' to '1'"_ustr, aDesc);
 
     pDoc = getScDoc();
-    bGood = aTest.checkRevisionUserAndTime(*pDoc, aOwnerName);
+    bGood = checkRevisionUserAndTime(*pDoc, aOwnerName);
     CPPUNIT_ASSERT_MESSAGE("Check revision and time failed after reload 
(xls).", bGood);
+}
 
-    // Now, test the xlsx variant the same way.
+CPPUNIT_TEST_FIXTURE(ScExportTest3, testTrackChangesSimpleXLSX)
+{
+    SvtUserOptions& rUserOpt = ScModule::get()->GetUserOptions();
+    rUserOpt.SetToken(UserOptToken::FirstName, u"Export"_ustr);
+    rUserOpt.SetToken(UserOptToken::LastName, u"Test"_ustr);
 
+    OUString aOwnerName = rUserOpt.GetFirstName() + " " + 
rUserOpt.GetLastName();
     createScDoc("xlsx/track-changes/simple-cell-changes.xlsx");
-    pDoc = getScDoc();
-    aTest.check(*pDoc);
+    ScDocument* pDoc = getScDoc();
+    bool bGood = check(*pDoc);
     CPPUNIT_ASSERT_MESSAGE("Initial check failed (xlsx).", bGood);
 
     saveAndReload(TestFilter::XLSX);
     pDoc = getScDoc();
-    bGood = aTest.check(*pDoc);
+    bGood = check(*pDoc);
     CPPUNIT_ASSERT_MESSAGE("Check after reload failed (xlsx).", bGood);
 
-    bGood = aTest.checkRevisionUserAndTime(*pDoc, aOwnerName);
+    bGood = checkRevisionUserAndTime(*pDoc, aOwnerName);
     CPPUNIT_ASSERT_MESSAGE("Check revision and time failed after reload 
(xlsx).", bGood);
 }
 
@@ -1110,66 +1115,76 @@ CPPUNIT_TEST_FIXTURE(ScExportTest3, 
testSheetProtectionODS)
     testSheetProtection_Impl(*pDoc);
 }
 
-CPPUNIT_TEST_FIXTURE(ScExportTest3, testSwappedOutImageExport)
+CPPUNIT_TEST_FIXTURE(ScExportTest3, testSwappedOutImageExport_ODS)
 {
-    std::vector<TestFilter> aFilterNames{ TestFilter::ODS, TestFilter::XLS, 
TestFilter::XLSX };
+    testSwappedOutImageExport(TestFilter::ODS);
+}
 
-    for (size_t i = 0; i < aFilterNames.size(); ++i)
-    {
-        // Check whether the export code swaps in the image which was swapped 
out before.
-        createScDoc("ods/document_with_two_images.ods");
+CPPUNIT_TEST_FIXTURE(ScExportTest3, testSwappedOutImageExport_XLS)
+{
+    testSwappedOutImageExport(TestFilter::XLS);
+}
+
+CPPUNIT_TEST_FIXTURE(ScExportTest3, testSwappedOutImageExport_XLSX)
+{
+    testSwappedOutImageExport(TestFilter::XLSX);
+}
 
-        const OString sFailedMessage
-            = OString::Concat("Failed on filter: ") + 
TestFilterNames.at(aFilterNames[i]).toUtf8();
+void ScExportTest3::testSwappedOutImageExport(TestFilter eFormatType)
+{
+    // Check whether the export code swaps in the image which was swapped out 
before.
+    createScDoc("ods/document_with_two_images.ods");
 
-        // Export the document and import again for a check
-        saveAndReload(aFilterNames[i]);
+    const OString sFailedMessage
+        = OString::Concat("Failed on filter: ") + 
TestFilterNames.at(eFormatType).toUtf8();
 
-        // Check whether graphic exported well after it was swapped out
-        uno::Reference<sheet::XSpreadsheetDocument> xDoc(mxComponent, 
UNO_QUERY_THROW);
-        uno::Reference<container::XIndexAccess> xIA(xDoc->getSheets(), 
UNO_QUERY_THROW);
-        uno::Reference<drawing::XDrawPageSupplier> 
xDrawPageSupplier(xIA->getByIndex(0),
-                                                                     
UNO_QUERY_THROW);
-        uno::Reference<container::XIndexAccess> 
xDraws(xDrawPageSupplier->getDrawPage(),
-                                                       UNO_QUERY_THROW);
-        CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), 
static_cast<sal_Int32>(2),
-                                     xDraws->getCount());
+    // Export the document and import again for a check
+    saveAndReload(eFormatType);
 
-        uno::Reference<drawing::XShape> xImage(xDraws->getByIndex(0), 
uno::UNO_QUERY);
-        uno::Reference<beans::XPropertySet> XPropSet(xImage, 
uno::UNO_QUERY_THROW);
+    // Check whether graphic exported well after it was swapped out
+    uno::Reference<sheet::XSpreadsheetDocument> xDoc(mxComponent, 
UNO_QUERY_THROW);
+    uno::Reference<container::XIndexAccess> xIA(xDoc->getSheets(), 
UNO_QUERY_THROW);
+    uno::Reference<drawing::XDrawPageSupplier> 
xDrawPageSupplier(xIA->getByIndex(0),
+                                                                 
UNO_QUERY_THROW);
+    uno::Reference<container::XIndexAccess> 
xDraws(xDrawPageSupplier->getDrawPage(),
+                                                   UNO_QUERY_THROW);
+    CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), 
static_cast<sal_Int32>(2),
+                                 xDraws->getCount());
 
-        // Check Graphic, Size
-        {
-            uno::Reference<graphic::XGraphic> xGraphic;
-            XPropSet->getPropertyValue(u"Graphic"_ustr) >>= xGraphic;
-            CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), xGraphic.is());
-            CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(),
-                                   xGraphic->getType() != 
graphic::GraphicType::EMPTY);
-            uno::Reference<awt::XBitmap> xBitmap(xGraphic, uno::UNO_QUERY);
-            CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), xBitmap.is());
-            CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), 
static_cast<sal_Int32>(610),
-                                         xBitmap->getSize().Width);
-            CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), 
static_cast<sal_Int32>(381),
-                                         xBitmap->getSize().Height);
-        }
-        // Second Image
-        xImage.set(xDraws->getByIndex(1), uno::UNO_QUERY);
-        XPropSet.set(xImage, uno::UNO_QUERY_THROW);
+    uno::Reference<drawing::XShape> xImage(xDraws->getByIndex(0), 
uno::UNO_QUERY);
+    uno::Reference<beans::XPropertySet> XPropSet(xImage, uno::UNO_QUERY_THROW);
 
-        // Check Graphic, Size
-        {
-            uno::Reference<graphic::XGraphic> xGraphic;
-            XPropSet->getPropertyValue(u"Graphic"_ustr) >>= xGraphic;
-            CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), xGraphic.is());
-            CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(),
-                                   xGraphic->getType() != 
graphic::GraphicType::EMPTY);
-            uno::Reference<awt::XBitmap> xBitmap(xGraphic, uno::UNO_QUERY);
-            CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), xBitmap.is());
-            CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), 
static_cast<sal_Int32>(900),
-                                         xBitmap->getSize().Width);
-            CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), 
static_cast<sal_Int32>(600),
-                                         xBitmap->getSize().Height);
-        }
+    // Check Graphic, Size
+    {
+        uno::Reference<graphic::XGraphic> xGraphic;
+        XPropSet->getPropertyValue(u"Graphic"_ustr) >>= xGraphic;
+        CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), xGraphic.is());
+        CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(),
+                               xGraphic->getType() != 
graphic::GraphicType::EMPTY);
+        uno::Reference<awt::XBitmap> xBitmap(xGraphic, uno::UNO_QUERY);
+        CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), xBitmap.is());
+        CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), 
static_cast<sal_Int32>(610),
+                                     xBitmap->getSize().Width);
+        CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), 
static_cast<sal_Int32>(381),
+                                     xBitmap->getSize().Height);
+    }
+    // Second Image
+    xImage.set(xDraws->getByIndex(1), uno::UNO_QUERY);
+    XPropSet.set(xImage, uno::UNO_QUERY_THROW);
+
+    // Check Graphic, Size
+    {
+        uno::Reference<graphic::XGraphic> xGraphic;
+        XPropSet->getPropertyValue(u"Graphic"_ustr) >>= xGraphic;
+        CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), xGraphic.is());
+        CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(),
+                               xGraphic->getType() != 
graphic::GraphicType::EMPTY);
+        uno::Reference<awt::XBitmap> xBitmap(xGraphic, uno::UNO_QUERY);
+        CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), xBitmap.is());
+        CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), 
static_cast<sal_Int32>(900),
+                                     xBitmap->getSize().Width);
+        CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), 
static_cast<sal_Int32>(600),
+                                     xBitmap->getSize().Height);
     }
 }
 
@@ -1191,104 +1206,123 @@ CPPUNIT_TEST_FIXTURE(ScExportTest3, 
testSupBookVirtualPathXLS)
                                  aFormula);
 }
 
-CPPUNIT_TEST_FIXTURE(ScExportTest3, testLinkedGraphicRT)
+CPPUNIT_TEST_FIXTURE(ScExportTest3, testLinkedGraphicRT_ODS)
 {
-    // Problem was with linked images
-    std::vector<TestFilter> aFilterNames{ TestFilter::ODS, TestFilter::XLS, 
TestFilter::XLSX };
+    testLinkedGraphicRT(TestFilter::ODS);
+}
 
-    for (size_t i = 0; i < aFilterNames.size(); ++i)
-    {
-        // Load the original file with one image
-        createScDoc("ods/document_with_linked_graphic.ods");
-        const OString sFailedMessage
-            = OString::Concat("Failed on filter: ") + 
TestFilterNames.at(aFilterNames[i]).toUtf8();
+CPPUNIT_TEST_FIXTURE(ScExportTest3, testLinkedGraphicRT_XLS)
+{
+    testLinkedGraphicRT(TestFilter::XLS);
+}
 
-        // Export the document and import again for a check
-        saveAndReload(aFilterNames[i]);
+CPPUNIT_TEST_FIXTURE(ScExportTest3, testLinkedGraphicRT_XLSX)
+{
+    testLinkedGraphicRT(TestFilter::XLSX);
+}
 
-        // Check whether graphic imported well after export
-        ScDocument* pDoc = getScDoc();
-        ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer();
-        CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), pDrawLayer != nullptr);
-        const SdrPage* pPage = pDrawLayer->GetPage(0);
-        CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), pPage != nullptr);
-        SdrGrafObj* pObject = dynamic_cast<SdrGrafObj*>(pPage->GetObj(0));
-        CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), pObject != nullptr);
-        if (aFilterNames[i] == TestFilter::XLSX)
-        {
-            // FIXME: tdf#152036
-            CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), 
!pObject->IsLinkedGraphic());
-        }
-        else
-            CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), 
pObject->IsLinkedGraphic());
-
-        const GraphicObject& rGraphicObj = pObject->GetGraphicObject(true);
-        CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), 
int(GraphicType::Bitmap),
-                                     int(rGraphicObj.GetGraphic().GetType()));
-        CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), 
sal_uLong(864900),
-                                     rGraphicObj.GetGraphic().GetSizeBytes());
+void ScExportTest3::testLinkedGraphicRT(TestFilter eFormatType)
+{
+    // Load the original file with one image
+    createScDoc("ods/document_with_linked_graphic.ods");
+    const OString sFailedMessage
+        = OString::Concat("Failed on filter: ") + 
TestFilterNames.at(eFormatType).toUtf8();
+
+    // Export the document and import again for a check
+    saveAndReload(eFormatType);
+
+    // Check whether graphic imported well after export
+    ScDocument* pDoc = getScDoc();
+    ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer();
+    CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), pDrawLayer != nullptr);
+    const SdrPage* pPage = pDrawLayer->GetPage(0);
+    CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), pPage != nullptr);
+    SdrGrafObj* pObject = dynamic_cast<SdrGrafObj*>(pPage->GetObj(0));
+    CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), pObject != nullptr);
+    if (eFormatType == TestFilter::XLSX)
+    {
+        // FIXME: tdf#152036
+        CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), 
!pObject->IsLinkedGraphic());
     }
+    else
+        CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), 
pObject->IsLinkedGraphic());
+
+    const GraphicObject& rGraphicObj = pObject->GetGraphicObject(true);
+    CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), 
int(GraphicType::Bitmap),
+                                 int(rGraphicObj.GetGraphic().GetType()));
+    CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), sal_uLong(864900),
+                                 rGraphicObj.GetGraphic().GetSizeBytes());
 }
 
-CPPUNIT_TEST_FIXTURE(ScExportTest3, testImageWithSpecialID)
+CPPUNIT_TEST_FIXTURE(ScExportTest3, testImageWithSpecialID_ODS)
 {
-    std::vector<TestFilter> aFilterNames{ TestFilter::ODS, TestFilter::XLS, 
TestFilter::XLSX };
+    testImageWithSpecialID(TestFilter::ODS);
+}
 
-    for (size_t i = 0; i < aFilterNames.size(); ++i)
-    {
-        createScDoc("ods/images_with_special_IDs.ods");
+CPPUNIT_TEST_FIXTURE(ScExportTest3, testImageWithSpecialID_XLS)
+{
+    testImageWithSpecialID(TestFilter::XLSX);
+}
 
-        const OString sFailedMessage
-            = OString::Concat("Failed on filter: ") + 
TestFilterNames.at(aFilterNames[i]).toUtf8();
+CPPUNIT_TEST_FIXTURE(ScExportTest3, testImageWithSpecialID_XLSX)
+{
+    testImageWithSpecialID(TestFilter::XLSX);
+}
 
-        // Export the document and import again for a check
-        saveAndReload(aFilterNames[i]);
+void ScExportTest3::testImageWithSpecialID(TestFilter eFormatType)
+{
+    createScDoc("ods/images_with_special_IDs.ods");
 
-        // Check whether graphic was exported well
-        uno::Reference<sheet::XSpreadsheetDocument> xDoc(mxComponent, 
UNO_QUERY_THROW);
-        uno::Reference<container::XIndexAccess> xIA(xDoc->getSheets(), 
UNO_QUERY_THROW);
-        uno::Reference<drawing::XDrawPageSupplier> 
xDrawPageSupplier(xIA->getByIndex(0),
-                                                                     
UNO_QUERY_THROW);
-        uno::Reference<container::XIndexAccess> 
xDraws(xDrawPageSupplier->getDrawPage(),
-                                                       UNO_QUERY_THROW);
-        CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), 
static_cast<sal_Int32>(2),
-                                     xDraws->getCount());
+    const OString sFailedMessage
+        = OString::Concat("Failed on filter: ") + 
TestFilterNames.at(eFormatType).toUtf8();
 
-        uno::Reference<drawing::XShape> xImage(xDraws->getByIndex(0), 
uno::UNO_QUERY);
-        uno::Reference<beans::XPropertySet> XPropSet(xImage, 
uno::UNO_QUERY_THROW);
+    // Export the document and import again for a check
+    saveAndReload(eFormatType);
 
-        // Check Graphic, Size
-        {
-            uno::Reference<graphic::XGraphic> xGraphic;
-            XPropSet->getPropertyValue(u"Graphic"_ustr) >>= xGraphic;
-            CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), xGraphic.is());
-            CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(),
-                                   xGraphic->getType() != 
graphic::GraphicType::EMPTY);
-            uno::Reference<awt::XBitmap> xBitmap(xGraphic, uno::UNO_QUERY);
-            CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), xBitmap.is());
-            CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), 
static_cast<sal_Int32>(610),
-                                         xBitmap->getSize().Width);
-            CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), 
static_cast<sal_Int32>(381),
-                                         xBitmap->getSize().Height);
-        }
-        // Second Image
-        xImage.set(xDraws->getByIndex(1), uno::UNO_QUERY);
-        XPropSet.set(xImage, uno::UNO_QUERY_THROW);
+    // Check whether graphic was exported well
+    uno::Reference<sheet::XSpreadsheetDocument> xDoc(mxComponent, 
UNO_QUERY_THROW);
+    uno::Reference<container::XIndexAccess> xIA(xDoc->getSheets(), 
UNO_QUERY_THROW);
+    uno::Reference<drawing::XDrawPageSupplier> 
xDrawPageSupplier(xIA->getByIndex(0),
+                                                                 
UNO_QUERY_THROW);
+    uno::Reference<container::XIndexAccess> 
xDraws(xDrawPageSupplier->getDrawPage(),
+                                                   UNO_QUERY_THROW);
+    CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), 
static_cast<sal_Int32>(2),
+                                 xDraws->getCount());
 
-        // Check Graphic, Size
-        {
-            uno::Reference<graphic::XGraphic> xGraphic;
-            XPropSet->getPropertyValue(u"Graphic"_ustr) >>= xGraphic;
-            CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), xGraphic.is());
-            CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(),
-                                   xGraphic->getType() != 
graphic::GraphicType::EMPTY);
-            uno::Reference<awt::XBitmap> xBitmap(xGraphic, uno::UNO_QUERY);
-            CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), xBitmap.is());
-            CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), 
static_cast<sal_Int32>(900),
-                                         xBitmap->getSize().Width);
-            CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), 
static_cast<sal_Int32>(600),
-                                         xBitmap->getSize().Height);
-        }
+    uno::Reference<drawing::XShape> xImage(xDraws->getByIndex(0), 
uno::UNO_QUERY);
+    uno::Reference<beans::XPropertySet> XPropSet(xImage, uno::UNO_QUERY_THROW);
+
+    // Check Graphic, Size
+    {
+        uno::Reference<graphic::XGraphic> xGraphic;
+        XPropSet->getPropertyValue(u"Graphic"_ustr) >>= xGraphic;
+        CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), xGraphic.is());
+        CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(),
+                               xGraphic->getType() != 
graphic::GraphicType::EMPTY);
+        uno::Reference<awt::XBitmap> xBitmap(xGraphic, uno::UNO_QUERY);
+        CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), xBitmap.is());
+        CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), 
static_cast<sal_Int32>(610),
+                                     xBitmap->getSize().Width);
+        CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), 
static_cast<sal_Int32>(381),
+                                     xBitmap->getSize().Height);
+    }
+    // Second Image
+    xImage.set(xDraws->getByIndex(1), uno::UNO_QUERY);
+    XPropSet.set(xImage, uno::UNO_QUERY_THROW);
+
+    // Check Graphic, Size
+    {
+        uno::Reference<graphic::XGraphic> xGraphic;
+        XPropSet->getPropertyValue(u"Graphic"_ustr) >>= xGraphic;
+        CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), xGraphic.is());
+        CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(),
+                               xGraphic->getType() != 
graphic::GraphicType::EMPTY);
+        uno::Reference<awt::XBitmap> xBitmap(xGraphic, uno::UNO_QUERY);
+        CPPUNIT_ASSERT_MESSAGE(sFailedMessage.getStr(), xBitmap.is());
+        CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), 
static_cast<sal_Int32>(900),
+                                     xBitmap->getSize().Width);
+        CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), 
static_cast<sal_Int32>(600),
+                                     xBitmap->getSize().Height);
     }
 }
 
@@ -1782,77 +1816,79 @@ static void 
impl_testLegacyCellAnchoredRotatedShape(ScDocument& rDoc, const tool
 
 CPPUNIT_TEST_FIXTURE(ScExportTest3, testLegacyCellAnchoredRotatedShape)
 {
-    {
-        // This example doc contains cell anchored shape that is rotated, the
-        // rotated shape is in fact clipped by the sheet boundaries (and thus
-        // is a good edge case test to see if we import it still correctly)
-        createScDoc("ods/legacycellanchoredrotatedclippedshape.ods");
+    // This example doc contains cell anchored shape that is rotated, the
+    // rotated shape is in fact clipped by the sheet boundaries (and thus
+    // is a good edge case test to see if we import it still correctly)
+    createScDoc("ods/legacycellanchoredrotatedclippedshape.ods");
 
-        ScDocument* pDoc = getScDoc();
-        // ensure the imported legacy rotated shape is in the expected position
-        tools::Rectangle aRect(6000, -2000, 8000, 4000);
-        // ensure the imported ( and converted ) anchor ( note we internally 
now store the anchor in
-        // terms of the rotated shape ) is more or less contains the correct 
info
-        ScDrawObjData aAnchor;
-        aAnchor.maStart.SetRow(0);
-        aAnchor.maStart.SetCol(5);
-        aAnchor.maEnd.SetRow(3);
-        aAnchor.maEnd.SetCol(7);
-        impl_testLegacyCellAnchoredRotatedShape(*pDoc, aRect, aAnchor);
-        // test save and reload
-        // for some reason having this test in subsequent_export-test.cxx 
causes
-        // a core dump in editeng ( so moved to here )
-        saveAndReload(TestFilter::ODS);
-        pDoc = getScDoc();
-        impl_testLegacyCellAnchoredRotatedShape(*pDoc, aRect, aAnchor);
-    }
-    {
-        // This example doc contains cell anchored shape that is rotated, the
-        // rotated shape is in fact clipped by the sheet boundaries, 
additionally
-        // the shape is completely hidden because the rows the shape occupies
-        // are hidden
-        createScDoc("ods/legacycellanchoredrotatedhiddenshape.ods");
-        ScDocument* pDoc = getScDoc();
-        // ensure the imported legacy rotated shape is in the expected position
-        tools::Rectangle aRect(6000, -2000, 8000, 4000);
-
-        // ensure the imported (and converted) anchor (note we internally now 
store the anchor in
-        // terms of the rotated shape) is more or less contains the correct 
info
-        ScDrawObjData aAnchor;
-        aAnchor.maStart.SetRow(0);
-        aAnchor.maStart.SetCol(5);
-        aAnchor.maEnd.SetRow(3);
-        aAnchor.maEnd.SetCol(7);
-        pDoc->ShowRows(0, 9, 0, true); // show relevant rows
-        pDoc->SetDrawPageSize(0); // trigger recalcpos
-        impl_testLegacyCellAnchoredRotatedShape(*pDoc, aRect, aAnchor);
-        // test save and reload
-        saveAndReload(TestFilter::ODS);
-        pDoc = getScDoc();
-        impl_testLegacyCellAnchoredRotatedShape(*pDoc, aRect, aAnchor);
-    }
-    {
-        // This example doc contains cell anchored shape that is rotated
-        createScDoc("ods/legacycellanchoredrotatedshape.ods");
+    ScDocument* pDoc = getScDoc();
+    // ensure the imported legacy rotated shape is in the expected position
+    tools::Rectangle aRect(6000, -2000, 8000, 4000);
+    // ensure the imported ( and converted ) anchor ( note we internally now 
store the anchor in
+    // terms of the rotated shape ) is more or less contains the correct info
+    ScDrawObjData aAnchor;
+    aAnchor.maStart.SetRow(0);
+    aAnchor.maStart.SetCol(5);
+    aAnchor.maEnd.SetRow(3);
+    aAnchor.maEnd.SetCol(7);
+    impl_testLegacyCellAnchoredRotatedShape(*pDoc, aRect, aAnchor);
+    // test save and reload
+    // for some reason having this test in subsequent_export-test.cxx causes
+    // a core dump in editeng ( so moved to here )
+    saveAndReload(TestFilter::ODS);
+    pDoc = getScDoc();
+    impl_testLegacyCellAnchoredRotatedShape(*pDoc, aRect, aAnchor);
+}
 
-        ScDocument* pDoc = getScDoc();
-        // ensure the imported legacy rotated shape is in the expected position
-        tools::Rectangle aRect(6000, 3000, 8000, 9000);
-        // ensure the imported (and converted) anchor (note we internally now 
store the anchor in
-        // terms of the rotated shape) more or less contains the correct info
-
-        ScDrawObjData aAnchor;
-        aAnchor.maStart.SetRow(3);
-        aAnchor.maStart.SetCol(6);
-        aAnchor.maEnd.SetRow(9);
-        aAnchor.maEnd.SetCol(8);
-        // test import
-        impl_testLegacyCellAnchoredRotatedShape(*pDoc, aRect, aAnchor);
-        // test save and reload
-        saveAndReload(TestFilter::ODS);
-        pDoc = getScDoc();
-        impl_testLegacyCellAnchoredRotatedShape(*pDoc, aRect, aAnchor);
-    }
+CPPUNIT_TEST_FIXTURE(ScExportTest3, testLegacyCellAnchoredRotatedShape2)
+{
+    // This example doc contains cell anchored shape that is rotated, the
+    // rotated shape is in fact clipped by the sheet boundaries, additionally
+    // the shape is completely hidden because the rows the shape occupies
+    // are hidden
+    createScDoc("ods/legacycellanchoredrotatedhiddenshape.ods");
+    ScDocument* pDoc = getScDoc();
+    // ensure the imported legacy rotated shape is in the expected position
+    tools::Rectangle aRect(6000, -2000, 8000, 4000);
+
+    // ensure the imported (and converted) anchor (note we internally now 
store the anchor in
+    // terms of the rotated shape) is more or less contains the correct info
+    ScDrawObjData aAnchor;
+    aAnchor.maStart.SetRow(0);
+    aAnchor.maStart.SetCol(5);
+    aAnchor.maEnd.SetRow(3);
+    aAnchor.maEnd.SetCol(7);
+    pDoc->ShowRows(0, 9, 0, true); // show relevant rows
+    pDoc->SetDrawPageSize(0); // trigger recalcpos
+    impl_testLegacyCellAnchoredRotatedShape(*pDoc, aRect, aAnchor);
+    // test save and reload
+    saveAndReload(TestFilter::ODS);
+    pDoc = getScDoc();
+    impl_testLegacyCellAnchoredRotatedShape(*pDoc, aRect, aAnchor);
+}
+
+CPPUNIT_TEST_FIXTURE(ScExportTest3, testLegacyCellAnchoredRotatedShape3)
+{
+    // This example doc contains cell anchored shape that is rotated
+    createScDoc("ods/legacycellanchoredrotatedshape.ods");
+
+    ScDocument* pDoc = getScDoc();
+    // ensure the imported legacy rotated shape is in the expected position
+    tools::Rectangle aRect(6000, 3000, 8000, 9000);
+    // ensure the imported (and converted) anchor (note we internally now 
store the anchor in
+    // terms of the rotated shape) more or less contains the correct info
+
+    ScDrawObjData aAnchor;
+    aAnchor.maStart.SetRow(3);
+    aAnchor.maStart.SetCol(6);
+    aAnchor.maEnd.SetRow(9);
+    aAnchor.maEnd.SetCol(8);
+    // test import
+    impl_testLegacyCellAnchoredRotatedShape(*pDoc, aRect, aAnchor);
+    // test save and reload
+    saveAndReload(TestFilter::ODS);
+    pDoc = getScDoc();
+    impl_testLegacyCellAnchoredRotatedShape(*pDoc, aRect, aAnchor);
 }
 
 CPPUNIT_TEST_FIXTURE(ScExportTest3, testTdf113646)
diff --git a/sc/qa/unit/subsequent_export_test4.cxx 
b/sc/qa/unit/subsequent_export_test4.cxx
index 14e368e0255c..8e38d23f98ee 100644
--- a/sc/qa/unit/subsequent_export_test4.cxx
+++ b/sc/qa/unit/subsequent_export_test4.cxx
@@ -68,6 +68,8 @@ class ScExportTest4 : public ScModelTestBase
 {
 public:
     ScExportTest4();
+
+    void testTdf151484(TestFilter eFilter);
 };
 
 ScExportTest4::ScExportTest4()
@@ -191,36 +193,39 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf85553)
     CPPUNIT_ASSERT_EQUAL(u"4.5"_ustr, pDoc->GetString(ScAddress(2, 2, 0)));
 }
 
-CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf151484)
+CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf151484_ODS) { 
testTdf151484(TestFilter::ODS); }
+
+CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf151484_XLS)
 {
-    std::vector<TestFilter> aFilterNames{ TestFilter::ODS, TestFilter::XLS, 
TestFilter::XLSX };
+    // Without the fix in place, this test would have failed with
+    // - Expected: 4
+    // - Actual  : 1
+    // - Failed on filter: MS Excel 97
+    testTdf151484(TestFilter::XLS);
+}
 
-    for (size_t i = 0; i < aFilterNames.size(); ++i)
-    {
-        createScDoc("ods/tdf151484.ods");
+CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf151484_XLSX) { 
testTdf151484(TestFilter::XLSX); }
 
-        const OString sFailedMessage
-            = OString::Concat("Failed on filter: ") + 
TestFilterNames.at(aFilterNames[i]).toUtf8();
+void ScExportTest4::testTdf151484(TestFilter eFilter)
+{
+    createScDoc("ods/tdf151484.ods");
 
-        saveAndReload(aFilterNames[i]);
+    const OString sFailedMessage
+        = OString::Concat("Failed on filter: ") + 
TestFilterNames.at(eFilter).toUtf8();
 
-        ScDocument* pDoc = getScDoc();
+    saveAndReload(eFilter);
 
-        const ScValidationData* pData = pDoc->GetValidationEntry(1);
-        CPPUNIT_ASSERT(pData);
+    ScDocument* pDoc = getScDoc();
+
+    const ScValidationData* pData = pDoc->GetValidationEntry(1);
+    CPPUNIT_ASSERT(pData);
 
-        std::vector<ScTypedStrData> aList;
-        pData->FillSelectionList(aList, ScAddress(0, 1, 0));
+    std::vector<ScTypedStrData> aList;
+    pData->FillSelectionList(aList, ScAddress(0, 1, 0));
 
-        // Without the fix in place, this test would have failed with
-        // - Expected: 4
-        // - Actual  : 1
-        // - Failed on filter: MS Excel 97
-        CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), size_t(4), 
aList.size());
-        for (size_t j = 0; j < 4; ++j)
-            CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), double(j + 
1),
-                                         aList[j].GetValue());
-    }
+    CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), size_t(4), 
aList.size());
+    for (size_t j = 0; j < 4; ++j)
+        CPPUNIT_ASSERT_EQUAL_MESSAGE(sFailedMessage.getStr(), double(j + 1), 
aList[j].GetValue());
 }
 
 CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf143979)
@@ -994,7 +999,7 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, 
testtdf169496_hidden_graphic)
         CPPUNIT_FAIL("Names of graphics is incorrect");
 }
 
-CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf144642_RowHeightRounding)
+CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf144642_RowHeightRounding_saveByCalc)
 {
     // MS Excel round down row heights to 0.75pt
     // MS Excel can save a row height of 28.35pt, but will display it as a row 
height of 27.75pt.
@@ -1005,9 +1010,12 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, 
testTdf144642_RowHeightRounding)
     // 10mm == 567 twips == 28.35pt
     CPPUNIT_ASSERT_EQUAL(sal_uInt16(567), pDoc->GetRowHeight(0, 0));
     CPPUNIT_ASSERT_EQUAL(tools::Long(567 * 26), pDoc->GetRowHeight(0, 25, 0, 
true));
+}
 
+CPPUNIT_TEST_FIXTURE(ScExportTest4, 
testTdf144642_RowHeightRounding_saveByExcel)
+{
     createScDoc("xlsx/tdf144642_RowHeight_28.35pt_SavedByExcel.xlsx");
-    pDoc = getScDoc();
+    ScDocument* pDoc = getScDoc();
     // 555twips == 27.75pt == 9.79mm
     CPPUNIT_ASSERT_EQUAL(sal_uInt16(555), pDoc->GetRowHeight(0, 0));
     CPPUNIT_ASSERT_EQUAL(tools::Long(555 * 26), pDoc->GetRowHeight(0, 25, 0, 
true));
diff --git a/sc/qa/unit/subsequent_filters_test.cxx 
b/sc/qa/unit/subsequent_filters_test.cxx
index 458a673edeae..49cade28eb60 100644
--- a/sc/qa/unit/subsequent_filters_test.cxx
+++ b/sc/qa/unit/subsequent_filters_test.cxx
@@ -647,90 +647,100 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest, testFunctionsODS)
     // financial functions
     aCSVPath = createFilePath(u"contentCSV/financial-functions.csv");
     testFile(aCSVPath, *pDoc, 6);
+}
 
+CPPUNIT_TEST_FIXTURE(ScFiltersTest, testFunctionsODS_databaseFunctions)
+{
     createScDoc("ods/database-functions.ods");
-    pDocSh = getScDocShell();
+    ScDocShell* pDocSh = getScDocShell();
     pDocSh->DoHardRecalc();
-    pDoc = getScDoc();
 
-    aCSVPath = createFilePath(u"contentCSV/database-functions.csv");
+    ScDocument* pDoc = getScDoc();
+
+    OUString aCSVPath = createFilePath(u"contentCSV/database-functions.csv");
     testFile(aCSVPath, *pDoc, 0);
+}
 
+CPPUNIT_TEST_FIXTURE(ScFiltersTest, testFunctionsODS_dateTimeFunctions)
+{
     createScDoc("ods/date-time-functions.ods");
-    pDocSh = getScDocShell();
+    ScDocShell* pDocSh = getScDocShell();
     pDocSh->DoHardRecalc();
-    pDoc = getScDoc();
-    aCSVPath = createFilePath(u"contentCSV/date-time-functions.csv");
+
+    ScDocument* pDoc = getScDoc();
+    OUString aCSVPath = createFilePath(u"contentCSV/date-time-functions.csv");
     testFile(aCSVPath, *pDoc, 0, StringType::PureString);
+}
 
+CPPUNIT_TEST_FIXTURE(ScFiltersTest, testFunctionsODS_usedDefinedFunctions)
+{
     createScDoc("ods/user-defined-function.ods");
-    pDocSh = getScDocShell();
+    ScDocShell* pDocSh = getScDocShell();
     pDocSh->DoHardRecalc();
-    pDoc = getScDoc();
-    aCSVPath = createFilePath(u"contentCSV/user-defined-function.csv");
+
+    ScDocument* pDoc = getScDoc();
+    OUString aCSVPath = 
createFilePath(u"contentCSV/user-defined-function.csv");
     testFile(aCSVPath, *pDoc, 0);
 }
 
-CPPUNIT_TEST_FIXTURE(ScFiltersTest, testCachedFormulaResultsODS)
+CPPUNIT_TEST_FIXTURE(ScFiltersTest, testCachedFormulaResultsODS_functions)
 {
-    {
-        createScDoc("ods/functions.ods");
+    createScDoc("ods/functions.ods");
 
-        ScDocument* pDoc = getScDoc();
+    ScDocument* pDoc = getScDoc();
 
-        //test cached formula results of logical functions
-        OUString aCSVPath = 
createFilePath(u"contentCSV/logical-functions.csv");
-        testFile(aCSVPath, *pDoc, 0);
-        //test cached formula results of spreadsheet functions
-        aCSVPath = createFilePath(u"contentCSV/spreadsheet-functions.csv");
-        testFile(aCSVPath, *pDoc, 1);
-        //test cached formula results of mathematical functions
-        aCSVPath = createFilePath(u"contentCSV/mathematical-functions.csv");
-        testFile(aCSVPath, *pDoc, 2, StringType::PureString);
-        //test cached formula results of information functions
-        aCSVPath = createFilePath(u"contentCSV/information-functions.csv");
-        testFile(aCSVPath, *pDoc, 3);
-        // text functions
-        aCSVPath = createFilePath(u"contentCSV/text-functions.csv");
-        testFile(aCSVPath, *pDoc, 4, StringType::PureString);
-    }
+    //test cached formula results of logical functions
+    OUString aCSVPath = createFilePath(u"contentCSV/logical-functions.csv");
+    testFile(aCSVPath, *pDoc, 0);
+    //test cached formula results of spreadsheet functions
+    aCSVPath = createFilePath(u"contentCSV/spreadsheet-functions.csv");
+    testFile(aCSVPath, *pDoc, 1);
+    //test cached formula results of mathematical functions
+    aCSVPath = createFilePath(u"contentCSV/mathematical-functions.csv");
+    testFile(aCSVPath, *pDoc, 2, StringType::PureString);
+    //test cached formula results of information functions
+    aCSVPath = createFilePath(u"contentCSV/information-functions.csv");
+    testFile(aCSVPath, *pDoc, 3);
+    // text functions
+    aCSVPath = createFilePath(u"contentCSV/text-functions.csv");
+    testFile(aCSVPath, *pDoc, 4, StringType::PureString);
+}
 
-    {
-        createScDoc("ods/cachedValue.ods");
+CPPUNIT_TEST_FIXTURE(ScFiltersTest, testCachedFormulaResultsODS_cachedValue)
+{
+    createScDoc("ods/cachedValue.ods");
 
-        ScDocument* pDoc = getScDoc();
-        OUString aCSVPath = createFilePath(u"contentCSV/cachedValue.csv");
-        testFile(aCSVPath, *pDoc, 0);
+    ScDocument* pDoc = getScDoc();
+    OUString aCSVPath = createFilePath(u"contentCSV/cachedValue.csv");
+    testFile(aCSVPath, *pDoc, 0);
 
-        //we want to me sure that volatile functions are always recalculated
-        //regardless of cached results.  if you update the ods file, you must
-        //update the values here.
-        //if NOW() is recalculated, then it should never equal "01/25/13 01:06 
PM"
-        OUString sTodayRecalc(pDoc->GetString(0, 0, 1));
+    //we want to me sure that volatile functions are always recalculated
+    //regardless of cached results.  if you update the ods file, you must
+    //update the values here.
+    //if NOW() is recalculated, then it should never equal "01/25/13 01:06 PM"
+    OUString sTodayRecalc(pDoc->GetString(0, 0, 1));
 
-        CPPUNIT_ASSERT("01/25/13 01:06 PM" != sTodayRecalc);
+    CPPUNIT_ASSERT("01/25/13 01:06 PM" != sTodayRecalc);
 
-        OUString sTodayRecalcRef(pDoc->GetString(1, 0, 1));
-        CPPUNIT_ASSERT_EQUAL(sTodayRecalc, sTodayRecalcRef);
+    OUString sTodayRecalcRef(pDoc->GetString(1, 0, 1));
+    CPPUNIT_ASSERT_EQUAL(sTodayRecalc, sTodayRecalcRef);
 
-        // make sure that error values are not being treated as string values
-        for (SCCOL nCol = 0; nCol < 4; ++nCol)
+    // make sure that error values are not being treated as string values
+    for (SCCOL nCol = 0; nCol < 4; ++nCol)
+    {
+        for (SCROW nRow = 0; nRow < 2; ++nRow)
         {
-            for (SCROW nRow = 0; nRow < 2; ++nRow)
-            {
-                OUString aFormula = "=ISERROR(" + 
OUStringChar(static_cast<char>('A' + nCol))
-                                    + OUString::number(nRow) + ")";
-                pDoc->SetString(nCol, nRow + 2, 2, aFormula);
-                CPPUNIT_ASSERT_EQUAL_MESSAGE(
-                    OUStringToOString(aFormula, 
RTL_TEXTENCODING_UTF8).getStr(), u"TRUE"_ustr,
-                    pDoc->GetString(nCol, nRow + 2, 2));
-
-                OUString aIsTextFormula = "=ISTEXT("
-                                          + 
OUString::number(static_cast<char>('A' + nCol))
-                                          + OUString::number(nRow) + ")";
-                pDoc->SetString(nCol, nRow + 4, 2, aIsTextFormula);
-                CPPUNIT_ASSERT_EQUAL(u"FALSE"_ustr, pDoc->GetString(nCol, nRow 
+ 4, 2));
-            }
+            OUString aFormula = "=ISERROR(" + 
OUStringChar(static_cast<char>('A' + nCol))
+                                + OUString::number(nRow) + ")";
+            pDoc->SetString(nCol, nRow + 2, 2, aFormula);
+            CPPUNIT_ASSERT_EQUAL_MESSAGE(
+                OUStringToOString(aFormula, RTL_TEXTENCODING_UTF8).getStr(), 
u"TRUE"_ustr,
+                pDoc->GetString(nCol, nRow + 2, 2));
+
+            OUString aIsTextFormula = "=ISTEXT(" + 
OUString::number(static_cast<char>('A' + nCol))
+                                      + OUString::number(nRow) + ")";
+            pDoc->SetString(nCol, nRow + 4, 2, aIsTextFormula);
+            CPPUNIT_ASSERT_EQUAL(u"FALSE"_ustr, pDoc->GetString(nCol, nRow + 
4, 2));
         }
     }
 }
diff --git a/sc/qa/unit/subsequent_filters_test2.cxx 
b/sc/qa/unit/subsequent_filters_test2.cxx
index 16533f9517d2..6c81cbad9fb5 100644
--- a/sc/qa/unit/subsequent_filters_test2.cxx
+++ b/sc/qa/unit/subsequent_filters_test2.cxx
@@ -487,85 +487,84 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest2, 
testSharedFormulaXLSB)
     }
 }
 
-CPPUNIT_TEST_FIXTURE(ScFiltersTest2, testSharedFormulaXLS)
+CPPUNIT_TEST_FIXTURE(ScFiltersTest2, testSharedFormulaXLS_fdo80091)
 {
-    {
-        // fdo#80091
-        createScDoc("xls/shared-formula/relative-refs1.xls");
-        ScDocument* pDoc = getScDoc();
-        pDoc->CalcAll();
+    // fdo#80091
+    createScDoc("xls/shared-formula/relative-refs1.xls");
+    ScDocument* pDoc = getScDoc();
+    pDoc->CalcAll();
 
-        // A1:A30 should be all formulas, and they should belong to the same 
group.
-        const ScFormulaCell* pFC = pDoc->GetFormulaCell(ScAddress(0, 1, 0));
-        CPPUNIT_ASSERT(pFC);
-        CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(1), pFC->GetSharedTopRow());
-        CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(29), pFC->GetSharedLength());
+    // A1:A30 should be all formulas, and they should belong to the same group.
+    const ScFormulaCell* pFC = pDoc->GetFormulaCell(ScAddress(0, 1, 0));
+    CPPUNIT_ASSERT(pFC);
+    CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(1), pFC->GetSharedTopRow());
+    CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(29), pFC->GetSharedLength());
 
-        for (SCROW nRow = 0; nRow < 30; ++nRow)
-        {
-            ASSERT_DOUBLES_EQUAL(double(nRow + 1), pDoc->GetValue(0, nRow, 0));
-        }
+    for (SCROW nRow = 0; nRow < 30; ++nRow)
+    {
+        ASSERT_DOUBLES_EQUAL(double(nRow + 1), pDoc->GetValue(0, nRow, 0));
     }
+}
 
-    {
-        // fdo#84556 and some related tests
-        createScDoc("xls/shared-formula/relative-refs2.xls");
-        ScDocument* pDoc = getScDoc();
-        pDoc->CalcAll();
+CPPUNIT_TEST_FIXTURE(ScFiltersTest2, testSharedFormulaXLS_fdo84556)
+{
+    // fdo#84556 and some related tests
+    createScDoc("xls/shared-formula/relative-refs2.xls");
+    ScDocument* pDoc = getScDoc();
+    pDoc->CalcAll();
 
-        {
-            const ScFormulaCell* pFC = pDoc->GetFormulaCell(ScAddress(2, 1, 
0));
-            CPPUNIT_ASSERT(pFC);
-            CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(1), 
pFC->GetSharedTopRow());
-            CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(10), 
pFC->GetSharedLength());
+    {
+        const ScFormulaCell* pFC = pDoc->GetFormulaCell(ScAddress(2, 1, 0));
+        CPPUNIT_ASSERT(pFC);
+        CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(1), pFC->GetSharedTopRow());
+        CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(10), pFC->GetSharedLength());
 
-            pFC = pDoc->GetFormulaCell(ScAddress(2, 10, 0));
-            CPPUNIT_ASSERT(pFC);
-            CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(1), 
pFC->GetSharedTopRow());
-            CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(10), 
pFC->GetSharedLength());
+        pFC = pDoc->GetFormulaCell(ScAddress(2, 10, 0));
+        CPPUNIT_ASSERT(pFC);
+        CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(1), pFC->GetSharedTopRow());
+        CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(10), pFC->GetSharedLength());
 
-            OUString aFormula = pDoc->GetFormula(2, 1, 0);
-            CPPUNIT_ASSERT_EQUAL(u"=SUM(B9:D9)"_ustr, aFormula);
+        OUString aFormula = pDoc->GetFormula(2, 1, 0);
+        CPPUNIT_ASSERT_EQUAL(u"=SUM(B9:D9)"_ustr, aFormula);
 
-            aFormula = pDoc->GetFormula(2, 10, 0);
-            CPPUNIT_ASSERT_EQUAL(u"=SUM(B18:D18)"_ustr, aFormula);
-        }
+        aFormula = pDoc->GetFormula(2, 10, 0);
+        CPPUNIT_ASSERT_EQUAL(u"=SUM(B18:D18)"_ustr, aFormula);
+    }
 
-        {
-            const ScFormulaCell* pFC = pDoc->GetFormulaCell(ScAddress(4, 8, 
0));
-            CPPUNIT_ASSERT(pFC);
-            CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(8), 
pFC->GetSharedTopRow());
-            CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(10), 
pFC->GetSharedLength());
+    {
+        const ScFormulaCell* pFC = pDoc->GetFormulaCell(ScAddress(4, 8, 0));
+        CPPUNIT_ASSERT(pFC);
+        CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(8), pFC->GetSharedTopRow());
+        CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(10), pFC->GetSharedLength());
 
-            pFC = pDoc->GetFormulaCell(ScAddress(4, 17, 0));
-            CPPUNIT_ASSERT(pFC);
-            CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(8), 
pFC->GetSharedTopRow());
-            CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(10), 
pFC->GetSharedLength());
+        pFC = pDoc->GetFormulaCell(ScAddress(4, 17, 0));
+        CPPUNIT_ASSERT(pFC);
+        CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(8), pFC->GetSharedTopRow());
+        CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(10), pFC->GetSharedLength());
 
-            OUString aFormula = pDoc->GetFormula(4, 8, 0);
-            CPPUNIT_ASSERT_EQUAL(u"=SUM(G9:EY9)"_ustr, aFormula);
+        OUString aFormula = pDoc->GetFormula(4, 8, 0);
+        CPPUNIT_ASSERT_EQUAL(u"=SUM(G9:EY9)"_ustr, aFormula);
 
-            aFormula = pDoc->GetFormula(4, 17, 0);
-            CPPUNIT_ASSERT_EQUAL(u"=SUM(G18:EY18)"_ustr, aFormula);
-        }
+        aFormula = pDoc->GetFormula(4, 17, 0);
+        CPPUNIT_ASSERT_EQUAL(u"=SUM(G18:EY18)"_ustr, aFormula);
+    }
 
-        {
-            const ScFormulaCell* pFC = pDoc->GetFormulaCell(ScAddress(6, 15, 
0));
-            CPPUNIT_ASSERT(pFC);
-            CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(15), 
pFC->GetSharedTopRow());
-            CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(10), 
pFC->GetSharedLength());
+    {
+        const ScFormulaCell* pFC = pDoc->GetFormulaCell(ScAddress(6, 15, 0));
+        CPPUNIT_ASSERT(pFC);
+        CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(15), pFC->GetSharedTopRow());
+        CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(10), pFC->GetSharedLength());
 
-            pFC = pDoc->GetFormulaCell(ScAddress(6, 24, 0));
-            CPPUNIT_ASSERT(pFC);
-            CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(15), 
pFC->GetSharedTopRow());
-            CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(10), 
pFC->GetSharedLength());
+        pFC = pDoc->GetFormulaCell(ScAddress(6, 24, 0));
+        CPPUNIT_ASSERT(pFC);
+        CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(15), pFC->GetSharedTopRow());
+        CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(10), pFC->GetSharedLength());
 
-            OUString aFormula = pDoc->GetFormula(6, 15, 0);
-            CPPUNIT_ASSERT_EQUAL(u"=SUM(A16:A40000)"_ustr, aFormula);
+        OUString aFormula = pDoc->GetFormula(6, 15, 0);
+        CPPUNIT_ASSERT_EQUAL(u"=SUM(A16:A40000)"_ustr, aFormula);
 
-            aFormula = pDoc->GetFormula(6, 24, 0);
-            CPPUNIT_ASSERT_EQUAL(u"=SUM(A25:A40009)"_ustr, aFormula);
-        }
+        aFormula = pDoc->GetFormula(6, 24, 0);
+        CPPUNIT_ASSERT_EQUAL(u"=SUM(A25:A40009)"_ustr, aFormula);
     }
 }
 
@@ -1489,59 +1488,58 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest2, testTdf42481)
     CPPUNIT_ASSERT_EQUAL(u"14"_ustr, pDoc->GetString(ScAddress(3, 11, 0)));
 }
 
-CPPUNIT_TEST_FIXTURE(ScFiltersTest2, testNamedExpressionsXLSXML)
+CPPUNIT_TEST_FIXTURE(ScFiltersTest2, testNamedExpressionsXLSXML_Global)
 {
-    {
-        // global named expressions
-
-        createScDoc("xml/named-exp-global.xml");
-        ScDocument* pDoc = getScDoc();
-
-        // A7
-        ScAddress aPos(0, 6, 0);
-        CPPUNIT_ASSERT_EQUAL(15.0, pDoc->GetValue(aPos));
-        CPPUNIT_ASSERT_EQUAL(u"=SUM(MyRange)"_ustr,
-                             pDoc->GetFormula(aPos.Col(), aPos.Row(), 
aPos.Tab()));
-
-        // B7
-        aPos.IncCol();
-        CPPUNIT_ASSERT_EQUAL(55.0, pDoc->GetValue(aPos));
-        CPPUNIT_ASSERT_EQUAL(u"=SUM(MyRange2)"_ustr,
-                             pDoc->GetFormula(aPos.Col(), aPos.Row(), 
aPos.Tab()));
-
-        const ScRangeData* pRD = 
pDoc->GetRangeName()->findByUpperName(u"MYRANGE"_ustr);
-        CPPUNIT_ASSERT(pRD);
-        pRD = pDoc->GetRangeName()->findByUpperName(u"MYRANGE2"_ustr);
-        CPPUNIT_ASSERT(pRD);
-    }
+    // global named expressions
 
-    {
-        // sheet-local named expressions
-
-        createScDoc("xml/named-exp-local.xml");
-        ScDocument* pDoc = getScDoc();
-
-        // A7 on Sheet1
-        ScAddress aPos(0, 6, 0);
-        CPPUNIT_ASSERT_EQUAL(27.0, pDoc->GetValue(aPos));
-        CPPUNIT_ASSERT_EQUAL(u"=SUM(MyRange)"_ustr,
-                             pDoc->GetFormula(aPos.Col(), aPos.Row(), 
aPos.Tab()));
-
-        // A7 on Sheet2
-        aPos.IncTab();
-        CPPUNIT_ASSERT_EQUAL(74.0, pDoc->GetValue(aPos));
-        CPPUNIT_ASSERT_EQUAL(u"=SUM(MyRange)"_ustr,
-                             pDoc->GetFormula(aPos.Col(), aPos.Row(), 
aPos.Tab()));
-
-        const ScRangeName* pRN = pDoc->GetRangeName(0);
-        CPPUNIT_ASSERT(pRN);
-        const ScRangeData* pRD = pRN->findByUpperName(u"MYRANGE"_ustr);
-        CPPUNIT_ASSERT(pRD);
-        pRN = pDoc->GetRangeName(1);
-        CPPUNIT_ASSERT(pRN);
-        pRD = pRN->findByUpperName(u"MYRANGE"_ustr);
-        CPPUNIT_ASSERT(pRD);
-    }
+    createScDoc("xml/named-exp-global.xml");
+    ScDocument* pDoc = getScDoc();
+
+    // A7
+    ScAddress aPos(0, 6, 0);
+    CPPUNIT_ASSERT_EQUAL(15.0, pDoc->GetValue(aPos));
+    CPPUNIT_ASSERT_EQUAL(u"=SUM(MyRange)"_ustr,
+                         pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab()));
+
+    // B7
+    aPos.IncCol();
+    CPPUNIT_ASSERT_EQUAL(55.0, pDoc->GetValue(aPos));
+    CPPUNIT_ASSERT_EQUAL(u"=SUM(MyRange2)"_ustr,
+                         pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab()));
+
+    const ScRangeData* pRD = 
pDoc->GetRangeName()->findByUpperName(u"MYRANGE"_ustr);
+    CPPUNIT_ASSERT(pRD);
+    pRD = pDoc->GetRangeName()->findByUpperName(u"MYRANGE2"_ustr);
+    CPPUNIT_ASSERT(pRD);
+}
+
+CPPUNIT_TEST_FIXTURE(ScFiltersTest2, testNamedExpressionsXLSXML_Local)
+{
+    // sheet-local named expressions
+
+    createScDoc("xml/named-exp-local.xml");
+    ScDocument* pDoc = getScDoc();
+
+    // A7 on Sheet1
+    ScAddress aPos(0, 6, 0);
+    CPPUNIT_ASSERT_EQUAL(27.0, pDoc->GetValue(aPos));
+    CPPUNIT_ASSERT_EQUAL(u"=SUM(MyRange)"_ustr,
+                         pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab()));
+
+    // A7 on Sheet2
+    aPos.IncTab();
+    CPPUNIT_ASSERT_EQUAL(74.0, pDoc->GetValue(aPos));
+    CPPUNIT_ASSERT_EQUAL(u"=SUM(MyRange)"_ustr,
+                         pDoc->GetFormula(aPos.Col(), aPos.Row(), aPos.Tab()));
+
+    const ScRangeName* pRN = pDoc->GetRangeName(0);
+    CPPUNIT_ASSERT(pRN);
+    const ScRangeData* pRD = pRN->findByUpperName(u"MYRANGE"_ustr);
+    CPPUNIT_ASSERT(pRD);
+    pRN = pDoc->GetRangeName(1);
+    CPPUNIT_ASSERT(pRN);
+    pRD = pRN->findByUpperName(u"MYRANGE"_ustr);
+    CPPUNIT_ASSERT(pRD);
 }
 
 CPPUNIT_TEST_FIXTURE(ScFiltersTest2, testEmptyRowsXLSXML)
@@ -1695,15 +1693,18 @@ void testCells(ScDocument* pDoc)
 }
 }
 
-CPPUNIT_TEST_FIXTURE(ScFiltersTest2, testSingleLine)
+CPPUNIT_TEST_FIXTURE(ScFiltersTest2, testSingleLine_xls)
 {
     createScDoc("xls/cell-multi-line.xls");
     ScDocument* pDoc = getScDoc();
     CPPUNIT_ASSERT(pDoc);
     testCells(pDoc);
+}
 
+CPPUNIT_TEST_FIXTURE(ScFiltersTest2, testSingleLine_xlsx)
+{
     createScDoc("xlsx/cell-multi-line.xlsx");
-    pDoc = getScDoc();
+    ScDocument* pDoc = getScDoc();
     CPPUNIT_ASSERT(pDoc);
     testCells(pDoc);
 }
diff --git a/sc/qa/unit/subsequent_filters_test3.cxx 
b/sc/qa/unit/subsequent_filters_test3.cxx
index 937b4b69d0f5..0a170659482f 100644
--- a/sc/qa/unit/subsequent_filters_test3.cxx
+++ b/sc/qa/unit/subsequent_filters_test3.cxx
@@ -1447,7 +1447,7 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest3, testInvalidBareBiff5)
     CPPUNIT_ASSERT_EQUAL(OUString(), pDoc->GetString(aPos));
 }
 
-CPPUNIT_TEST_FIXTURE(ScFiltersTest3, testTooManyColsRows)
+CPPUNIT_TEST_FIXTURE(ScFiltersTest3, testTooManyColsRows_ods)
 {
     // The intentionally doc has cells beyond our MAXROW/MAXCOL, so there
     // should be a warning on load.
@@ -1458,12 +1458,15 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest3, 
testTooManyColsRows)
 
     CPPUNIT_ASSERT(pMedium->GetWarningError() == SCWARN_IMPORT_ROW_OVERFLOW
                    || pMedium->GetWarningError() == 
SCWARN_IMPORT_COLUMN_OVERFLOW);
+}
 
+CPPUNIT_TEST_FIXTURE(ScFiltersTest3, testTooManyColsRows_xlsx)
+{
     createScDoc("xlsx/too-many-cols-rows.xlsx", /*pPassword*/ nullptr,
                 /*bCheckWarningError*/ false);
 
-    pDocSh = getScDocShell();
-    pMedium = pDocSh->GetMedium();
+    ScDocShell* pDocSh = getScDocShell();
+    SfxMedium* pMedium = pDocSh->GetMedium();
 
     CPPUNIT_ASSERT(pMedium->GetWarningError() == SCWARN_IMPORT_ROW_OVERFLOW
                    || pMedium->GetWarningError() == 
SCWARN_IMPORT_COLUMN_OVERFLOW);
@@ -1730,40 +1733,39 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest3, testRhbz1390776)
     CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong range", u"=SUM(A18:A23)"_ustr, 
pDoc->GetFormula(0, 27, 0));
 }
 
-CPPUNIT_TEST_FIXTURE(ScFiltersTest3, testTdf104310)
+CPPUNIT_TEST_FIXTURE(ScFiltersTest3, testTdf104310_x14)
 {
     // 1. Test x14 extension
-    {
-        createScDoc("xlsx/tdf104310.xlsx");
-        ScDocument* pDoc = getScDoc();
+    createScDoc("xlsx/tdf104310.xlsx");
+    ScDocument* pDoc = getScDoc();
 
-        const ScValidationData* pData = pDoc->GetValidationEntry(1);
-        CPPUNIT_ASSERT(pData);
+    const ScValidationData* pData = pDoc->GetValidationEntry(1);
+    CPPUNIT_ASSERT(pData);
 
-        // Make sure the list is correct.
-        std::vector<ScTypedStrData> aList;
-        pData->FillSelectionList(aList, ScAddress(0, 1, 0));
-        CPPUNIT_ASSERT_EQUAL(size_t(5), aList.size());
-        for (size_t i = 0; i < 5; ++i)
-            CPPUNIT_ASSERT_DOUBLES_EQUAL(double(i + 1), aList[i].GetValue(), 
1e-8);
-    }
+    // Make sure the list is correct.
+    std::vector<ScTypedStrData> aList;
+    pData->FillSelectionList(aList, ScAddress(0, 1, 0));
+    CPPUNIT_ASSERT_EQUAL(size_t(5), aList.size());
+    for (size_t i = 0; i < 5; ++i)
+        CPPUNIT_ASSERT_DOUBLES_EQUAL(double(i + 1), aList[i].GetValue(), 1e-8);
+}
 
+CPPUNIT_TEST_FIXTURE(ScFiltersTest3, testTdf104310_x12ac)
+{
     // 2. Test x12ac extension
-    {
-        createScDoc("xlsx/tdf104310-2.xlsx");
-        ScDocument* pDoc = getScDoc();
-
-        const ScValidationData* pData = pDoc->GetValidationEntry(1);
-        CPPUNIT_ASSERT(pData);
+    createScDoc("xlsx/tdf104310-2.xlsx");
+    ScDocument* pDoc = getScDoc();
 
-        // Make sure the list is correct.
-        std::vector<ScTypedStrData> aList;
-        pData->FillSelectionList(aList, ScAddress(0, 1, 0));
-        CPPUNIT_ASSERT_EQUAL(size_t(3), aList.size());
-        CPPUNIT_ASSERT_EQUAL(u"1"_ustr, aList[0].GetString());
-        CPPUNIT_ASSERT_EQUAL(u"2,3"_ustr, aList[1].GetString());
-        CPPUNIT_ASSERT_EQUAL(u"4"_ustr, aList[2].GetString());
-    }
+    const ScValidationData* pData = pDoc->GetValidationEntry(1);
+    CPPUNIT_ASSERT(pData);
+
+    // Make sure the list is correct.
+    std::vector<ScTypedStrData> aList;
+    pData->FillSelectionList(aList, ScAddress(0, 1, 0));
+    CPPUNIT_ASSERT_EQUAL(size_t(3), aList.size());
+    CPPUNIT_ASSERT_EQUAL(u"1"_ustr, aList[0].GetString());
+    CPPUNIT_ASSERT_EQUAL(u"2,3"_ustr, aList[1].GetString());
+    CPPUNIT_ASSERT_EQUAL(u"4"_ustr, aList[2].GetString());
 }
 
 CPPUNIT_TEST_FIXTURE(ScFiltersTest3, testTdf31231)
diff --git a/sc/qa/unit/subsequent_filters_test4.cxx 
b/sc/qa/unit/subsequent_filters_test4.cxx
index 08c4f8c11d36..bc2e0992f164 100644
--- a/sc/qa/unit/subsequent_filters_test4.cxx
+++ b/sc/qa/unit/subsequent_filters_test4.cxx
@@ -1103,25 +1103,39 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest4, testTdf147955)
     CPPUNIT_ASSERT_EQUAL(10.98, pDoc->GetValue(1, 15, 0));
 }
 
-CPPUNIT_TEST_FIXTURE(ScFiltersTest4, testImportCrashes)
+CPPUNIT_TEST_FIXTURE(ScFiltersTest4, testTdf149752) { 
testImportCrash("ods/tdf149752.ods"); }
+
+CPPUNIT_TEST_FIXTURE(ScFiltersTest4, testTdf158483) { 
testImportCrash("xls/tdf158483.xls"); }
+
+CPPUNIT_TEST_FIXTURE(ScFiltersTest4, testTdf122643) { 
testImportCrash("ods/tdf122643.ods"); }
+
+CPPUNIT_TEST_FIXTURE(ScFiltersTest4, testTdf132278) { 
testImportCrash("ods/tdf132278.ods"); }
+
+CPPUNIT_TEST_FIXTURE(ScFiltersTest4, testTdf130959) { 
testImportCrash("xlsx/tdf130959.xlsx"); }
+
+CPPUNIT_TEST_FIXTURE(ScFiltersTest4, testTdf129410) { 
testImportCrash("ods/tdf129410.ods"); }
+
+CPPUNIT_TEST_FIXTURE(ScFiltersTest4, testTdf138507) { 
testImportCrash("ods/tdf138507.ods"); }
+
+CPPUNIT_TEST_FIXTURE(ScFiltersTest4, testTdf131380) { 
testImportCrash("xlsx/tdf131380.xlsx"); }
+
+CPPUNIT_TEST_FIXTURE(ScFiltersTest4, testTdf139782) { 
testImportCrash("ods/tdf139782.ods"); }
+
+CPPUNIT_TEST_FIXTURE(ScFiltersTest4, testTdf136551) { 
testImportCrash("ods/tdf136551.ods"); }
+
+CPPUNIT_TEST_FIXTURE(ScFiltersTest4, testTdf90391) { 
testImportCrash("ods/tdf90391.ods"); }
+
+CPPUNIT_TEST_FIXTURE(ScFiltersTest4, testTdf121887)
 {
-    testImportCrash("ods/tdf149752.ods");
-    testImportCrash("xls/tdf158483.xls");
-    testImportCrash("ods/tdf122643.ods");
-    testImportCrash("ods/tdf132278.ods");
-    testImportCrash("xlsx/tdf130959.xlsx");
-    testImportCrash("ods/tdf129410.ods");
-    testImportCrash("ods/tdf138507.ods");
-    testImportCrash("xlsx/tdf131380.xlsx");
-    testImportCrash("ods/tdf139782.ods");
-    testImportCrash("ods/tdf136551.ods");
-    testImportCrash("ods/tdf90391.ods");
     testImportCrash("xlsx/tdf121887.xlsx"); // 'Maximum number of rows per 
sheet' warning
-    testImportCrash("xlsm/tdf111974.xlsm");
-    testImportCrash("ods/tdf149679.ods");
-    testImportCrash("xlsx/tdf124525.xlsx");
 }
 
+CPPUNIT_TEST_FIXTURE(ScFiltersTest4, testTdf111974) { 
testImportCrash("xlsm/tdf111974.xlsm"); }
+
+CPPUNIT_TEST_FIXTURE(ScFiltersTest4, testTdf149679) { 
testImportCrash("ods/tdf149679.ods"); }
+
+CPPUNIT_TEST_FIXTURE(ScFiltersTest4, testTdf124525) { 
testImportCrash("xlsx/tdf124525.xlsx"); }
+
 CPPUNIT_TEST_FIXTURE(ScFiltersTest4, testTdf129681)
 {
     createScDoc("ods/tdf129681.ods");
@@ -1203,13 +1217,16 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest4, 
testSharedFormulaXLS)
     CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect group geometry.", SCROW(1),
                                  xGroup->mpTopCell->aPos.Row());
     CPPUNIT_ASSERT_EQUAL_MESSAGE("Incorrect group geometry.", SCROW(18), 
xGroup->mnLength);
+}
 
+CPPUNIT_TEST_FIXTURE(ScFiltersTest4, testSharedFormulaXLS2)
+{
     // The following file contains shared formula whose range is inaccurate.
     // Excel can easily mess up shared formula ranges, so we need to be able
     // to handle these wrong ranges that Excel stores.
 
     createScDoc("xls/shared-formula/gap.xls");
-    pDoc = getScDoc();
+    ScDocument* pDoc = getScDoc();
     pDoc->CalcAll();
 
     CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong formula.", u"=A1*20"_ustr, 
pDoc->GetFormula(1, 0, 0));
diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx
index 4497d1de214a..c078f692792e 100644
--- a/sc/qa/unit/uicalc/uicalc.cxx
+++ b/sc/qa/unit/uicalc/uicalc.cxx
@@ -41,6 +41,8 @@ class ScUiCalcTest : public ScModelTestBase
 {
 public:
     ScUiCalcTest();
+
+    void verifyTdf162087();
 };
 
 ScUiCalcTest::ScUiCalcTest()
@@ -48,19 +50,22 @@ ScUiCalcTest::ScUiCalcTest()
 {
 }
 
-CPPUNIT_TEST_FIXTURE(ScUiCalcTest, 
testTdf142854_GridVisibilityImportXlsxInHeadlessMode)
+CPPUNIT_TEST_FIXTURE(ScUiCalcTest, 
testTdf142854_GridVisibilityImportXlsxInHeadlessMode_Globally)
 {
     // Tests are running in Headless mode
     // Import an ods file with 'Hide' global grid visibility setting.
     createScDoc("tdf126541_GridOffGlobally.ods");
     ScDocument* pDoc = getScDoc();
     CPPUNIT_ASSERT(!pDoc->GetViewOptions().GetOption(sc::ViewOption::GRID));
+}
 
+CPPUNIT_TEST_FIXTURE(ScUiCalcTest, 
testTdf142854_GridVisibilityImportXlsxInHeadlessMode)
+{
     // To avoid regression, in headless mode leave the bug tdf126541
     // It means Sheet based grid line visibility setting will overwrite the 
global setting.
     // If there is only 1 sheet in the document, it will not result visible 
problems.
     createScDoc("tdf126541_GridOff.xlsx");
-    pDoc = getScDoc();
+    ScDocument* pDoc = getScDoc();
     CPPUNIT_ASSERT(!pDoc->GetViewOptions().GetOption(sc::ViewOption::GRID));
 }
 
@@ -89,6 +94,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testExternalReferences)
     save(TestFilter::ODS);
 
     // Open a new document
+    dispose();
     createScDoc();
     pDoc = getScDoc();
 
@@ -224,46 +230,52 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf151886)
 }
 #endif
 
-CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf162087)
-{
-    auto verify = [this]() {
-        ScDocument* pDoc = getScDoc();
-        insertArrayToCell(u"E5"_ustr, u"=myData[[#Data]]");
-
-        CPPUNIT_ASSERT_EQUAL(u"Elisabeth"_ustr, pDoc->GetString(4, 4, 0));
-        CPPUNIT_ASSERT_EQUAL(u"Frieda"_ustr, pDoc->GetString(4, 5, 0));
-        CPPUNIT_ASSERT_EQUAL(u"Adele"_ustr, pDoc->GetString(4, 6, 0));
-        CPPUNIT_ASSERT_EQUAL(u"Berta"_ustr, pDoc->GetString(4, 7, 0));
-        CPPUNIT_ASSERT_EQUAL(u"total"_ustr, pDoc->GetString(4, 8, 0));
-        CPPUNIT_ASSERT_EQUAL(u"7"_ustr, pDoc->GetString(5, 4, 0));
-        CPPUNIT_ASSERT_EQUAL(u"6"_ustr, pDoc->GetString(5, 5, 0));
-        CPPUNIT_ASSERT_EQUAL(u"4"_ustr, pDoc->GetString(5, 6, 0));
-        CPPUNIT_ASSERT_EQUAL(u"5"_ustr, pDoc->GetString(5, 7, 0));
-        CPPUNIT_ASSERT_EQUAL(u"22"_ustr, pDoc->GetString(5, 8, 0));
-
-        insertArrayToCell(u"H5"_ustr, u"=myData[[#Headers]]");
-
-        CPPUNIT_ASSERT_EQUAL(u"Name"_ustr, pDoc->GetString(7, 4, 0));
-        CPPUNIT_ASSERT_EQUAL(u"Count"_ustr, pDoc->GetString(8, 4, 0));
-
-        insertArrayToCell(u"K5"_ustr, u"=myData[[#All]]");
-
-        CPPUNIT_ASSERT_EQUAL(u"Name"_ustr, pDoc->GetString(10, 4, 0));
-        CPPUNIT_ASSERT_EQUAL(u"Elisabeth"_ustr, pDoc->GetString(10, 5, 0));
-        CPPUNIT_ASSERT_EQUAL(u"Frieda"_ustr, pDoc->GetString(10, 6, 0));
-        CPPUNIT_ASSERT_EQUAL(u"Adele"_ustr, pDoc->GetString(10, 7, 0));
-        CPPUNIT_ASSERT_EQUAL(u"Berta"_ustr, pDoc->GetString(10, 8, 0));
-        CPPUNIT_ASSERT_EQUAL(u"total"_ustr, pDoc->GetString(10, 9, 0));
-        CPPUNIT_ASSERT_EQUAL(u"Count"_ustr, pDoc->GetString(11, 4, 0));
-        CPPUNIT_ASSERT_EQUAL(u"7"_ustr, pDoc->GetString(11, 5, 0));
-        CPPUNIT_ASSERT_EQUAL(u"6"_ustr, pDoc->GetString(11, 6, 0));
-        CPPUNIT_ASSERT_EQUAL(u"4"_ustr, pDoc->GetString(11, 7, 0));
-        CPPUNIT_ASSERT_EQUAL(u"5"_ustr, pDoc->GetString(11, 8, 0));
-        CPPUNIT_ASSERT_EQUAL(u"22"_ustr, pDoc->GetString(11, 9, 0));
-    };
+void ScUiCalcTest::verifyTdf162087()
+{
+    ScDocument* pDoc = getScDoc();
+    insertArrayToCell(u"E5"_ustr, u"=myData[[#Data]]");
+
+    CPPUNIT_ASSERT_EQUAL(u"Elisabeth"_ustr, pDoc->GetString(4, 4, 0));
+    CPPUNIT_ASSERT_EQUAL(u"Frieda"_ustr, pDoc->GetString(4, 5, 0));
+    CPPUNIT_ASSERT_EQUAL(u"Adele"_ustr, pDoc->GetString(4, 6, 0));
+    CPPUNIT_ASSERT_EQUAL(u"Berta"_ustr, pDoc->GetString(4, 7, 0));
+    CPPUNIT_ASSERT_EQUAL(u"total"_ustr, pDoc->GetString(4, 8, 0));
+    CPPUNIT_ASSERT_EQUAL(u"7"_ustr, pDoc->GetString(5, 4, 0));
+    CPPUNIT_ASSERT_EQUAL(u"6"_ustr, pDoc->GetString(5, 5, 0));
+    CPPUNIT_ASSERT_EQUAL(u"4"_ustr, pDoc->GetString(5, 6, 0));
+    CPPUNIT_ASSERT_EQUAL(u"5"_ustr, pDoc->GetString(5, 7, 0));
+    CPPUNIT_ASSERT_EQUAL(u"22"_ustr, pDoc->GetString(5, 8, 0));
+
+    insertArrayToCell(u"H5"_ustr, u"=myData[[#Headers]]");
 
+    CPPUNIT_ASSERT_EQUAL(u"Name"_ustr, pDoc->GetString(7, 4, 0));
+    CPPUNIT_ASSERT_EQUAL(u"Count"_ustr, pDoc->GetString(8, 4, 0));
+
+    insertArrayToCell(u"K5"_ustr, u"=myData[[#All]]");
+
+    CPPUNIT_ASSERT_EQUAL(u"Name"_ustr, pDoc->GetString(10, 4, 0));
+    CPPUNIT_ASSERT_EQUAL(u"Elisabeth"_ustr, pDoc->GetString(10, 5, 0));
+    CPPUNIT_ASSERT_EQUAL(u"Frieda"_ustr, pDoc->GetString(10, 6, 0));
+    CPPUNIT_ASSERT_EQUAL(u"Adele"_ustr, pDoc->GetString(10, 7, 0));
+    CPPUNIT_ASSERT_EQUAL(u"Berta"_ustr, pDoc->GetString(10, 8, 0));
+    CPPUNIT_ASSERT_EQUAL(u"total"_ustr, pDoc->GetString(10, 9, 0));
+    CPPUNIT_ASSERT_EQUAL(u"Count"_ustr, pDoc->GetString(11, 4, 0));
+    CPPUNIT_ASSERT_EQUAL(u"7"_ustr, pDoc->GetString(11, 5, 0));
+    CPPUNIT_ASSERT_EQUAL(u"6"_ustr, pDoc->GetString(11, 6, 0));
+    CPPUNIT_ASSERT_EQUAL(u"4"_ustr, pDoc->GetString(11, 7, 0));
+    CPPUNIT_ASSERT_EQUAL(u"5"_ustr, pDoc->GetString(11, 8, 0));
+    CPPUNIT_ASSERT_EQUAL(u"22"_ustr, pDoc->GetString(11, 9, 0));
+}
+
+CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf162087_withoutUseEnglishFuncName)
+{
+    createScDoc("tdf162087.ods");
+    verifyTdf162087();
+}
+
+CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf162087_withUseEnglishFuncName)
+{
     createScDoc("tdf162087.ods");
-    verify();
 
     // change UseEnglishFuncName to true
     ScDocShell* pDocSh = getScDocShell();
@@ -272,13 +284,10 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf162087)
     aFormulaOptions.SetUseEnglishFuncName(true);
     pDocSh->SetFormulaOptions(aFormulaOptions);
 
-    createScDoc("tdf162087.ods");
-    pDocSh = getScDocShell();
-
     // Without the fix in place, this test would have failed with
     // - Expected: Elisabeth
     // - Actual  : #NAME?
-    verify();
+    verifyTdf162087();
 
     aFormulaOptions.SetUseEnglishFuncName(bOldStatus);
     pDocSh->SetFormulaOptions(aFormulaOptions);
@@ -296,6 +305,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf103994)
     save(TestFilter::ODS);
 
     // Open a new document
+    dispose();
     createScDoc();
     pDoc = getScDoc();
 
@@ -332,6 +342,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf113541)
     save(TestFilter::ODS);
 
     // Open a new document
+    dispose();
     createScDoc();
     pDoc = getScDoc();
 
@@ -1746,6 +1757,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf117706)
     dispatchCommand(mxComponent, u".uno:Copy"_ustr, {});
 
     // Open a new document
+    dispose();
-e 
... etc. - the rest is truncated

Reply via email to