tdf#113271: sc_subsequent_export: Add unittest
Change-Id: I92b9184cc36dcfedec40a74b6dbcee1c2583ebf6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112540
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
diff --git a/sc/qa/unit/data/xlsx/tdf113271.xlsx b/sc/qa/unit/data/xlsx/tdf113271.xlsx
new file mode 100644
index 0000000..49a1614
--- /dev/null
+++ b/sc/qa/unit/data/xlsx/tdf113271.xlsx
Binary files differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index b0f3902..2048898 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -90,6 +90,7 @@ public:
void test();
void testTdf139167();
void testTdf113271();
void testTdf139394();
void testExtCondFormatXLSX();
void testTdf90104();
@@ -289,6 +290,7 @@ public:
CPPUNIT_TEST_SUITE(ScExportTest);
CPPUNIT_TEST(test);
CPPUNIT_TEST(testTdf139167);
CPPUNIT_TEST(testTdf113271);
CPPUNIT_TEST(testTdf139394);
CPPUNIT_TEST(testExtCondFormatXLSX);
CPPUNIT_TEST(testTdf90104);
@@ -553,6 +555,29 @@ void ScExportTest::testTdf139167()
xDocSh->DoClose();
}
void ScExportTest::testTdf113271()
{
ScDocShellRef xShell = loadDoc(u"tdf113271.", FORMAT_XLSX);
CPPUNIT_ASSERT(xShell.is());
ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX);
CPPUNIT_ASSERT(xDocSh.is());
std::shared_ptr<utl::TempFile> pXPathFile = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX);
xmlDocUniquePtr pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/styles.xml");
CPPUNIT_ASSERT(pDoc);
assertXPath(pDoc, "/x:styleSheet/x:fonts", "count", "6");
// Without the fix in place, this test would have failed with
// - Expected: FF000000
// - Actual : FFFFFFFF
assertXPath(pDoc, "/x:styleSheet/x:fonts/x:font[1]/x:color", "rgb", "FF000000");
assertXPath(pDoc, "/x:styleSheet/x:fonts/x:font[1]/x:name", "val", "Calibri");
xDocSh->DoClose();
}
void ScExportTest::testTdf139394()
{
ScDocShellRef xShell = loadDoc(u"tdf139394.", FORMAT_XLSX);