summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAron Budea <aron.budea@collabora.com>2017-11-28 07:23:12 +0100
committerAron Budea <aron.budea@collabora.com>2017-12-04 06:01:08 +0100
commit1416a420d0045267b37711ce02db043960e4d771 (patch)
tree62a1bd7fe6e69608afce0a032fd88e02d3b014a8
parentdaa60794e6030d48b08717b93b231fea1396801a (diff)
tdf#109240, tdf#112571: add unit test
Follow-up to bba57a7eb9dd118df5772068b3a70aedb3602003 (cherry picked from commit f8b9d0fb0767d8bbe8477f92abaf6b8e0ff65546) Change-Id: Ib61fa81e34440681f0e3eb88a10de45062bc981f Reviewed-on: https://gerrit.libreoffice.org/45770 Reviewed-by: Aron Budea <aron.budea@collabora.com> Tested-by: Aron Budea <aron.budea@collabora.com>
-rw-r--r--sc/qa/unit/data/xlsx/built-in_ranges.xlsxbin0 -> 10164 bytes
-rw-r--r--sc/qa/unit/subsequent_export-test.cxx28
2 files changed, 28 insertions, 0 deletions
diff --git a/sc/qa/unit/data/xlsx/built-in_ranges.xlsx b/sc/qa/unit/data/xlsx/built-in_ranges.xlsx
new file mode 100644
index 000000000000..b18a4862fdd6
--- /dev/null
+++ b/sc/qa/unit/data/xlsx/built-in_ranges.xlsx
Binary files differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index 4b6370ba64c8..b72346c284e8 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -103,6 +103,7 @@ public:
void testConditionalFormatRangeListXLSX();
void testMiscRowHeightExport();
void testNamedRangeBugfdo62729();
+ void testBuiltinRangesXLSX();
void testRichTextExportODS();
void testRichTextCellFormat();
void testFormulaRefSheetNameODS();
@@ -231,6 +232,7 @@ public:
CPPUNIT_TEST(testConditionalFormatRangeListXLSX);
CPPUNIT_TEST(testMiscRowHeightExport);
CPPUNIT_TEST(testNamedRangeBugfdo62729);
+ CPPUNIT_TEST(testBuiltinRangesXLSX);
CPPUNIT_TEST(testRichTextExportODS);
CPPUNIT_TEST(testRichTextCellFormat);
CPPUNIT_TEST(testFormulaRefSheetNameODS);
@@ -1307,6 +1309,32 @@ void ScExportTest::testNamedRangeBugfdo62729()
xDocSh->DoClose();
}
+void ScExportTest::testBuiltinRangesXLSX()
+{
+ ScDocShellRef xShell = loadDoc("built-in_ranges.", FORMAT_XLSX);
+ CPPUNIT_ASSERT(xShell.is());
+ ScDocShellRef xDocSh = saveAndReload(xShell.get(), FORMAT_XLSX);
+ CPPUNIT_ASSERT(xDocSh.is());
+ xShell->DoClose();
+
+ xmlDocPtr pDoc = XPathHelper::parseExport(*xDocSh, m_xSFactory, "xl/workbook.xml", FORMAT_XLSX);
+ CPPUNIT_ASSERT(pDoc);
+
+ //assert the existing OOXML built-in names are still there
+ assertXPathContent(pDoc, "/x:workbook/x:definedNames/x:definedName[@name='_xlnm._FilterDatabase'][@localSheetId='0']", "'Sheet1 Test'!$A$1:$A$5");
+ assertXPathContent(pDoc, "/x:workbook/x:definedNames/x:definedName[@name='_xlnm._FilterDatabase'][@localSheetId='1']", "'Sheet2 Test'!$K$10:$K$14");
+ assertXPathContent(pDoc, "/x:workbook/x:definedNames/x:definedName[@name='_xlnm.Print_Area'][@localSheetId='0']", "'Sheet1 Test'!$A$1:$A$5");
+ assertXPathContent(pDoc, "/x:workbook/x:definedNames/x:definedName[@name='_xlnm.Print_Area'][@localSheetId='1']", "'Sheet2 Test'!$K$10:$M$18");
+
+ //...and that no extra ones are added (see tdf#112571)
+ assertXPath(pDoc, "/x:workbook/x:definedNames/x:definedName[@name='_xlnm._FilterDatabase_0'][@localSheetId='0']", 0);
+ assertXPath(pDoc, "/x:workbook/x:definedNames/x:definedName[@name='_xlnm._FilterDatabase_0'][@localSheetId='1']", 0);
+ assertXPath(pDoc, "/x:workbook/x:definedNames/x:definedName[@name='_xlnm.Print_Area_0'][@localSheetId='0']", 0);
+ assertXPath(pDoc, "/x:workbook/x:definedNames/x:definedName[@name='_xlnm.Print_Area_0'][@localSheetId='1']", 0);
+
+ xDocSh->DoClose();
+}
+
void ScExportTest::testRichTextExportODS()
{
struct