sc/qa/unit/data/ods/tdf121260.ods      |binary
 sc/qa/unit/subsequent_export_test2.cxx |   28 ++++++++++++++++++++++++++++
 2 files changed, 28 insertions(+)

New commits:
commit 7f5348e47d56a16c2691d0dffa45bbaf970092ca
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Fri Nov 5 18:10:24 2021 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Fri Nov 5 21:02:55 2021 +0100

    tdf#121260: sc_subsequent_export_test2: Add unittest
    
    Change-Id: I18d96f41dca5072359fdf325cc37dea84de5838a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124770
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sc/qa/unit/data/ods/tdf121260.ods 
b/sc/qa/unit/data/ods/tdf121260.ods
new file mode 100644
index 000000000000..3b6ab7f10733
Binary files /dev/null and b/sc/qa/unit/data/ods/tdf121260.ods differ
diff --git a/sc/qa/unit/subsequent_export_test2.cxx 
b/sc/qa/unit/subsequent_export_test2.cxx
index 681b05398fa4..025941239507 100644
--- a/sc/qa/unit/subsequent_export_test2.cxx
+++ b/sc/qa/unit/subsequent_export_test2.cxx
@@ -102,6 +102,7 @@ public:
     virtual void tearDown() override;
 
     void testMatrixMultiplicationXLSX();
+    void testTdf121260();
     void testTextDirectionXLSX();
     void testTdf120168();
     void testTdf66668();
@@ -217,6 +218,7 @@ public:
     CPPUNIT_TEST_SUITE(ScExportTest2);
 
     CPPUNIT_TEST(testMatrixMultiplicationXLSX);
+    CPPUNIT_TEST(testTdf121260);
     CPPUNIT_TEST(testTextDirectionXLSX);
     CPPUNIT_TEST(testTdf120168);
     CPPUNIT_TEST(testTdf66668);
@@ -545,6 +547,32 @@ void ScExportTest2::testTextDirectionXLSX()
     xDocSh->DoClose();
 }
 
+void ScExportTest2::testTdf121260()
+{
+    ScDocShellRef xDocSh = loadDoc(u"tdf121260.", FORMAT_ODS);
+    CPPUNIT_ASSERT(xDocSh.is());
+
+    ScDocument& rDoc = xDocSh->GetDocument();
+    // change formula syntax (i.e. not string ref syntax) to ExcelA1
+    rDoc.SetGrammar(formula::FormulaGrammar::GRAM_NATIVE_XL_A1);
+
+    xmlDocUniquePtr pChart1 = XPathHelper::parseExport2(*this, *xDocSh, 
m_xSFactory,
+                                                        
"xl/charts/chart1.xml", FORMAT_XLSX);
+    CPPUNIT_ASSERT(pChart1);
+
+    // Without the fix in place, this test would have failed with
+    // - Expected: Sheet1!$A$1:$A$2
+    // - Actual  : sheet1 $A$1:$A$2
+    assertXPathContent(pChart1,
+                       
"/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser[1]/c:val/c:numRef/c:f",
+                       "Sheet1!$A$1:$A$2");
+    assertXPathContent(pChart1,
+                       
"/c:chartSpace/c:chart/c:plotArea/c:barChart/c:ser[2]/c:val/c:numRef/c:f",
+                       "Sheet1!$B$1:$B$2");
+
+    xDocSh->DoClose();
+}
+
 void ScExportTest2::testTdf120168()
 {
     ScDocShellRef xDocSh = loadDoc(u"tdf120168.", FORMAT_XLSX);

Reply via email to