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 <xiscofauli@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 0000000..3b6ab7f
--- /dev/null
+++ b/sc/qa/unit/data/ods/tdf121260.ods
Binary files differ
diff --git a/sc/qa/unit/subsequent_export_test2.cxx b/sc/qa/unit/subsequent_export_test2.cxx
index 681b053..0259412 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);