sc/qa/unit/data/xlsx/totalsRowFunction.xlsx |binary
 sc/qa/unit/subsequent_export_test2.cxx      |   25 +++++++++++++++++++++++++
 2 files changed, 25 insertions(+)

New commits:
commit 8b9e182f90c681d55848f08605470d2bff39078c
Author:     offtkp <[email protected]>
AuthorDate: Wed Nov 23 11:34:52 2022 +0200
Commit:     Tomaž Vajngerl <[email protected]>
CommitDate: Wed Nov 30 14:24:27 2022 +0100

    xlsx: Add test for totalsRowFunction roundtrip
    
    Change-Id: I3b7539a88abbe2f9bab3331d8550c1050c52059a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143137
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <[email protected]>

diff --git a/sc/qa/unit/data/xlsx/totalsRowFunction.xlsx 
b/sc/qa/unit/data/xlsx/totalsRowFunction.xlsx
new file mode 100644
index 000000000000..3731caf86491
Binary files /dev/null and b/sc/qa/unit/data/xlsx/totalsRowFunction.xlsx differ
diff --git a/sc/qa/unit/subsequent_export_test2.cxx 
b/sc/qa/unit/subsequent_export_test2.cxx
index b3d46d1cdd58..628401167d5a 100644
--- a/sc/qa/unit/subsequent_export_test2.cxx
+++ b/sc/qa/unit/subsequent_export_test2.cxx
@@ -188,6 +188,7 @@ public:
     void testTdf91286();
     void testTdf148820();
     void testEmbeddedTextInDecimal();
+    void testTotalsRowFunction();
 
     CPPUNIT_TEST_SUITE(ScExportTest2);
 
@@ -313,6 +314,7 @@ public:
     CPPUNIT_TEST(testTdf91286);
     CPPUNIT_TEST(testTdf148820);
     CPPUNIT_TEST(testEmbeddedTextInDecimal);
+    CPPUNIT_TEST(testTotalsRowFunction);
 
     CPPUNIT_TEST_SUITE_END();
 };
@@ -2824,6 +2826,29 @@ void ScExportTest2::testEmbeddedTextInDecimal()
     lcl_TestEmbeddedTextInDecimal(*getScDoc());
 }
 
+void ScExportTest2::testTotalsRowFunction()
+{
+    createScDoc("xlsx/totalsRowFunction.xlsx");
+    saveAndReload("Calc Office Open XML");
+    {
+        xmlDocUniquePtr pDocXml = parseExport("xl/tables/table1.xml");
+        CPPUNIT_ASSERT(pDocXml);
+        assertXPath(pDocXml, "/x:table/x:tableColumns/x:tableColumn[5]", 
"totalsRowFunction",
+                    "sum");
+    }
+    ScDocument* pDoc = getScDoc();
+    pDoc->InsertCol(ScRange(3, 0, 0, 3, pDoc->MaxRow(), 0)); // Insert col 4
+    saveAndReload("Calc Office Open XML");
+    {
+        xmlDocUniquePtr pDocXml = parseExport("xl/tables/table1.xml");
+        CPPUNIT_ASSERT(pDocXml);
+        assertXPathNoAttribute(pDocXml, 
"/x:table/x:tableColumns/x:tableColumn[5]",
+                               "totalsRowFunction");
+        assertXPath(pDocXml, "/x:table/x:tableColumns/x:tableColumn[6]", 
"totalsRowFunction",
+                    "sum");
+    }
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest2);
 
 CPPUNIT_PLUGIN_IMPLEMENT();

Reply via email to