sc/qa/unit/helper/qahelper.cxx          |   47 ++++++++-----------
 sc/qa/unit/helper/qahelper.hxx          |   23 +++------
 sc/qa/unit/subsequent_export_test.cxx   |   77 ++++++++++++++++++--------------
 sc/qa/unit/subsequent_filters_test2.cxx |   38 +++++++++------
 4 files changed, 95 insertions(+), 90 deletions(-)

New commits:
commit fba85da0878d4f2aecf8f17cdcde873e7776575d
Author:     Xisco Fauli <[email protected]>
AuthorDate: Fri Feb 6 10:21:31 2026 +0100
Commit:     Xisco Fauli <[email protected]>
CommitDate: Fri Feb 6 15:01:07 2026 +0100

    miscRowHeightsTest: split single test into different ones
    
    so every document is loaded in different tests
    
    Change-Id: I7f4768b693173c518910a25631a4753baba3f942
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198815
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <[email protected]>

diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx
index da1286bb8cb1..d0f381087cac 100644
--- a/sc/qa/unit/helper/qahelper.cxx
+++ b/sc/qa/unit/helper/qahelper.cxx
@@ -652,39 +652,34 @@ ScTabViewShell* ScModelTestBase::getViewShell()
     return pTabViewShell;
 }
 
-void ScModelTestBase::miscRowHeightsTest( TestParam const * aTestValues, 
unsigned int numElems)
+void ScModelTestBase::miscRowHeightsTest(std::u16string_view sFileName, 
TestFilter eExportType, int nRowData, RowData const* pData)
 {
-    for ( unsigned int index=0; index<numElems; ++index )
-    {
-        const std::u16string_view sFileName = aTestValues[ index ].sTestDoc;
-        TestFilter eExportType =  aTestValues[ index ].eExportType;
-        loadFromFile(sFileName);
+    loadFromFile(sFileName);
 
-        if ( eExportType != TestFilter::NONE )
-            saveAndReload(aTestValues[ index ].eExportType);
+    if ( eExportType != TestFilter::NONE )
+        saveAndReload(eExportType);
 
-        ScDocument* pDoc = getScDoc();
+    ScDocument* pDoc = getScDoc();
 
-        for (int i=0; i<aTestValues[ index ].nRowData; ++i)
+    for (int i=0; i< nRowData; ++i)
+    {
+        SCROW nRow = pData[i].nStartRow;
+        SCROW nEndRow = pData[ i ].nEndRow;
+        SCTAB nTab = pData[ i ].nTab;
+        int nExpectedHeight = pData[ i ].nExpectedHeight;
+        if ( nExpectedHeight == -1 )
+            nExpectedHeight = convertTwipToMm100(ScGlobal::nStdRowHeight);
+        bool bCheckOpt = ( ( pData[ i ].nCheck & CHECK_OPTIMAL ) == 
CHECK_OPTIMAL );
+        for ( ; nRow <= nEndRow; ++nRow )
         {
-            SCROW nRow = aTestValues[ index ].pData[ i].nStartRow;
-            SCROW nEndRow = aTestValues[ index ].pData[ i ].nEndRow;
-            SCTAB nTab = aTestValues[ index ].pData[ i ].nTab;
-            int nExpectedHeight = aTestValues[ index ].pData[ i 
].nExpectedHeight;
-            if ( nExpectedHeight == -1 )
-                nExpectedHeight = convertTwipToMm100(ScGlobal::nStdRowHeight);
-            bool bCheckOpt = ( ( aTestValues[ index ].pData[ i ].nCheck & 
CHECK_OPTIMAL ) == CHECK_OPTIMAL );
-            for ( ; nRow <= nEndRow; ++nRow )
+            SAL_INFO( "sc.qa", " checking row " << nRow << " for height " << 
nExpectedHeight );
+            int nHeight = convertTwipToMm100(pDoc->GetRowHeight(nRow, nTab, 
false));
+            if ( bCheckOpt )
             {
-                SAL_INFO( "sc.qa", " checking row " << nRow << " for height " 
<< nExpectedHeight );
-                int nHeight = convertTwipToMm100(pDoc->GetRowHeight(nRow, 
nTab, false));
-                if ( bCheckOpt )
-                {
-                    bool bOpt = !(pDoc->GetRowFlags( nRow, nTab ) & 
CRFlags::ManualSize);
-                    CPPUNIT_ASSERT_EQUAL(aTestValues[ index ].pData[ i 
].bOptimal, bOpt);
-                }
-                CPPUNIT_ASSERT_EQUAL(nExpectedHeight, nHeight);
+                bool bOpt = !(pDoc->GetRowFlags( nRow, nTab ) & 
CRFlags::ManualSize);
+                CPPUNIT_ASSERT_EQUAL(pData[ i ].bOptimal, bOpt);
             }
+            CPPUNIT_ASSERT_EQUAL(nExpectedHeight, nHeight);
         }
     }
 }
diff --git a/sc/qa/unit/helper/qahelper.hxx b/sc/qa/unit/helper/qahelper.hxx
index b45decb32d2c..0763b5a5c18e 100644
--- a/sc/qa/unit/helper/qahelper.hxx
+++ b/sc/qa/unit/helper/qahelper.hxx
@@ -41,21 +41,14 @@ class ScRangeList;
 class ScTokenArray;
 
 // data format for row height tests
-struct TestParam
+struct RowData
 {
-    struct RowData
-    {
-        SCROW nStartRow;
-        SCROW nEndRow;
-        SCTAB nTab;
-        int nExpectedHeight; // -1 for default height
-        int nCheck; // currently only CHECK_OPTIMAL ( we could add 
CHECK_MANUAL etc.)
-        bool bOptimal;
-    };
-    const std::u16string_view sTestDoc;
-    TestFilter  eExportType;
-    int nRowData;
-    RowData const * pData;
+    SCROW nStartRow;
+    SCROW nEndRow;
+    SCTAB nTab;
+    int nExpectedHeight; // -1 for default height
+    int nCheck; // currently only CHECK_OPTIMAL ( we could add CHECK_MANUAL 
etc.)
+    bool bOptimal;
 };
 
 struct RangeNameDef
@@ -165,7 +158,7 @@ public:
     ScDocument* getScDoc2();
     ScDocShell* getScDocShell();
     ScTabViewShell* getViewShell();
-    void miscRowHeightsTest( TestParam const * aTestValues, unsigned int 
numElems);
+    void miscRowHeightsTest(std::u16string_view sFileName, TestFilter 
eExportTyle, int nRowData, RowData const* pData);
 
     void enableOpenCL();
     void disableOpenCL();
diff --git a/sc/qa/unit/subsequent_export_test.cxx 
b/sc/qa/unit/subsequent_export_test.cxx
index 231cd0dfa712..1bcf70cff0eb 100644
--- a/sc/qa/unit/subsequent_export_test.cxx
+++ b/sc/qa/unit/subsequent_export_test.cxx
@@ -1091,43 +1091,54 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, 
testTdf162177_EastersundayODF14)
     assertXPath(pXmlDoc, sPath, "formula", u"of:=EASTERSUNDAY(2024)");
 }
 
+const RowData DfltRowData[] = {
+    { 0, 4, 0, 529, 0, false },
+    { 5, 10, 0, 1058, 0, false },
+    { 17, 20, 0, 1746, 0, false },
+    // check last couple of row in document to ensure
+    // they are 5.29mm ( effective default row xlsx height )
+    { 1048573, 1048575, 0, 529, 0, false },
+};
+
+const RowData EmptyRepeatRowData[] = {
+    // rows 0-4, 5-10, 17-20 are all set at various
+    // heights, there is no content in the rows, there
+    // was a bug where only the first row ( of repeated rows )
+    // was set after export
+    { 0, 4, 0, 529, 0, false },
+    { 5, 10, 0, 1058, 0, false },
+    { 17, 20, 0, 1767, 0, false },
+};
+
 CPPUNIT_TEST_FIXTURE(ScExportTest, testMiscRowHeightExport)
 {
-    static const TestParam::RowData DfltRowData[] = {
-        { 0, 4, 0, 529, 0, false },
-        { 5, 10, 0, 1058, 0, false },
-        { 17, 20, 0, 1746, 0, false },
-        // check last couple of row in document to ensure
-        // they are 5.29mm ( effective default row xlsx height )
-        { 1048573, 1048575, 0, 529, 0, false },
-    };
+    // Checks that some distributed ( non-empty ) heights remain set after 
export (roundtrip)
+    // additionally there is effectively a default row height ( 5.29 mm ). So 
we test the
+    // unset rows at the end of the document to ensure the effective xlsx 
default height
+    // is set there too.
+    miscRowHeightsTest(u"xlsx/miscrowheights.xlsx", TestFilter::XLSX, 
SAL_N_ELEMENTS(DfltRowData),
+                       DfltRowData);
+}
 
-    static const TestParam::RowData EmptyRepeatRowData[] = {
-        // rows 0-4, 5-10, 17-20 are all set at various
-        // heights, there is no content in the rows, there
-        // was a bug where only the first row ( of repeated rows )
-        // was set after export
-        { 0, 4, 0, 529, 0, false },
-        { 5, 10, 0, 1058, 0, false },
-        { 17, 20, 0, 1767, 0, false },
-    };
+CPPUNIT_TEST_FIXTURE(ScExportTest, testMiscRowHeightExport2)
+{
+    // Checks that some distributed ( non-empty ) heights remain set after 
export (to xls)
+    miscRowHeightsTest(u"xlsx/miscrowheights.xlsx", TestFilter::XLS, 
SAL_N_ELEMENTS(DfltRowData),
+                       DfltRowData);
+}
 
-    TestParam aTestValues[] = {
-        // Checks that some distributed ( non-empty ) heights remain set after 
export (roundtrip)
-        // additionally there is effectively a default row height ( 5.29 mm ). 
So we test the
-        // unset rows at the end of the document to ensure the effective xlsx 
default height
-        // is set there too.
-        { u"xlsx/miscrowheights.xlsx", TestFilter::XLSX, 
SAL_N_ELEMENTS(DfltRowData), DfltRowData },
-        // Checks that some distributed ( non-empty ) heights remain set after 
export (to xls)
-        { u"xlsx/miscrowheights.xlsx", TestFilter::XLS, 
SAL_N_ELEMENTS(DfltRowData), DfltRowData },
-        // Checks that repeated rows ( of various heights ) remain set after 
export ( to xlsx )
-        { u"ods/miscemptyrepeatedrowheights.ods", TestFilter::XLSX,
-          SAL_N_ELEMENTS(EmptyRepeatRowData), EmptyRepeatRowData },
-        // Checks that repeated rows ( of various heights ) remain set after 
export ( to xls )
-        { u"ods/miscemptyrepeatedrowheights.ods", TestFilter::XLS,
-          SAL_N_ELEMENTS(EmptyRepeatRowData), EmptyRepeatRowData },
-    };
-    miscRowHeightsTest(aTestValues, SAL_N_ELEMENTS(aTestValues));
+CPPUNIT_TEST_FIXTURE(ScExportTest, testMiscRowHeightExport3)
+{
+    // Checks that repeated rows ( of various heights ) remain set after 
export ( to xlsx )
+    miscRowHeightsTest(u"ods/miscemptyrepeatedrowheights.ods", 
TestFilter::XLSX,
+                       SAL_N_ELEMENTS(EmptyRepeatRowData), EmptyRepeatRowData);
+}
+
+CPPUNIT_TEST_FIXTURE(ScExportTest, testMiscRowHeightExport4)
+{
+    // Checks that repeated rows ( of various heights ) remain set after 
export ( to xls )
+    miscRowHeightsTest(u"ods/miscemptyrepeatedrowheights.ods", TestFilter::XLS,
+                       SAL_N_ELEMENTS(EmptyRepeatRowData), EmptyRepeatRowData);
 }
 
 namespace
diff --git a/sc/qa/unit/subsequent_filters_test2.cxx 
b/sc/qa/unit/subsequent_filters_test2.cxx
index ee91dfa9526d..16533f9517d2 100644
--- a/sc/qa/unit/subsequent_filters_test2.cxx
+++ b/sc/qa/unit/subsequent_filters_test2.cxx
@@ -69,7 +69,7 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest2, testMiscRowHeights)
     if (!IsDefaultDPI())
         return;
 
-    static const TestParam::RowData DfltRowData[] = {
+    static const RowData DfltRowData[] = {
         // check rows at the beginning and end of document
         // and make sure they are reported as the default row
         // height ( indicated by -1 )
@@ -77,27 +77,33 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest2, testMiscRowHeights)
         { 1048573, 1048575, 0, -1, 0, false },
     };
 
-    static const TestParam::RowData MultiLineOptData[] = {
+    /* Checks that a document saved to ods with default rows does indeed
+       have default row heights ( there was a problem where the optimal
+       height was being calculated after import if no hard height )
+    */
+    miscRowHeightsTest(u"ods/alldefaultheights.ods", TestFilter::NONE, 
SAL_N_ELEMENTS(DfltRowData),
+                       DfltRowData);
+}
+
+CPPUNIT_TEST_FIXTURE(ScFiltersTest2, testMiscRowHeights2)
+{
+    // FIXME: the DPI check should be removed when either (1) the test is 
fixed to work with
+    // non-default DPI; or (2) unit tests on Windows are made to use svp VCL 
plugin.
+    if (!IsDefaultDPI())
+        return;
+
+    static const RowData MultiLineOptData[] = {
         // Row 0 is 12.63 mm and optimal flag is set => 12.36 mm
         { 0, 0, 0, 1236, CHECK_OPTIMAL, true },
         // Row 1 is 11.99 mm and optimal flag is NOT set
         { 1, 1, 0, 1199, CHECK_OPTIMAL, false },
     };
 
-    TestParam aTestValues[] = {
-        /* Checks that a document saved to ods with default rows does indeed
-           have default row heights ( there was a problem where the optimal
-           height was being calculated after import if no hard height )
-        */
-        { u"ods/alldefaultheights.ods", TestFilter::NONE, 
SAL_N_ELEMENTS(DfltRowData),
-          DfltRowData },
-        /* Checks the imported height of some multiline input, additionally 
checks
-           that the optimal height flag is set ( or not )
-        */
-        { u"ods/multilineoptimal.ods", TestFilter::NONE, 
SAL_N_ELEMENTS(MultiLineOptData),
-          MultiLineOptData },
-    };
-    miscRowHeightsTest(aTestValues, SAL_N_ELEMENTS(aTestValues));
+    /* Checks the imported height of some multiline input, additionally checks
+       that the optimal height flag is set ( or not )
+    */
+    miscRowHeightsTest(u"ods/multilineoptimal.ods", TestFilter::NONE,
+                       SAL_N_ELEMENTS(MultiLineOptData), MultiLineOptData);
 }
 
 // regression test at least fdo#59193

Reply via email to