Kaydet (Commit) cbec4cb7 authored tarafından Kohei Yoshida's avatar Kohei Yoshida Kaydeden (comit) Kohei Yoshida

Add a test case for importing merged cells from Excel 2003 XML file.

Since the filter type has changed, we need to also update the filter
flags used in the unit tests.  And because the new filter no longer
relies on XSLT, we can drop the dependency on xslt.

Change-Id: I9dd040b3c8c0e95300c4dda1b87bf448a800097d
Reviewed-on: https://gerrit.libreoffice.org/49832Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarKohei Yoshida <libreoffice@kohei.us>
üst 2448e6cf
......@@ -119,8 +119,4 @@ endif
$(eval $(call gb_CppunitTest_use_configuration,sc_bugfix_test))
$(eval $(call gb_CppunitTest_use_packages,sc_bugfix_test,\
filter_xslt \
))
# vim: set noet sw=4 ts=4:
......@@ -113,8 +113,4 @@ $(eval $(call gb_CppunitTest_use_components,sc_filters_test,\
$(eval $(call gb_CppunitTest_use_configuration,sc_filters_test))
$(eval $(call gb_CppunitTest_use_packages,sc_filters_test,\
filter_xslt \
))
# vim: set noet sw=4 ts=4:
......@@ -1196,7 +1196,7 @@ public:
SCCOL& rEndCol, SCROW& rEndRow, SCTAB nTab,
bool bRefresh = false );
bool ExtendMerge( ScRange& rRange, bool bRefresh = false );
void ExtendTotalMerge( ScRange& rRange ) const;
SC_DLLPUBLIC void ExtendTotalMerge( ScRange& rRange ) const;
SC_DLLPUBLIC void ExtendOverlapped( SCCOL& rStartCol, SCROW& rStartRow,
SCCOL nEndCol, SCROW nEndRow, SCTAB nTab ) const;
SC_DLLPUBLIC void ExtendOverlapped( ScRange& rRange ) const;
......
<?xml version="1.0"?>
<?mso-application progid="Excel.Sheet"?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:html="http://www.w3.org/TR/REC-html40">
<DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
<Author>Kohei Yoshida</Author>
<LastAuthor>Kohei Yoshida</LastAuthor>
<Created>2016-12-15T03:48:24Z</Created>
<LastSaved>2016-12-15T03:54:21Z</LastSaved>
<Version>15.00</Version>
</DocumentProperties>
<OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">
<AllowPNG/>
</OfficeDocumentSettings>
<ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
<WindowHeight>14385</WindowHeight>
<WindowWidth>24000</WindowWidth>
<WindowTopX>0</WindowTopX>
<WindowTopY>0</WindowTopY>
<RefModeR1C1/>
<ProtectStructure>False</ProtectStructure>
<ProtectWindows>False</ProtectWindows>
</ExcelWorkbook>
<Styles>
<Style ss:ID="Default" ss:Name="Normal">
<Alignment ss:Vertical="Bottom"/>
<Borders/>
<Font ss:FontName="Calibri" x:Family="Swiss" ss:Size="11" ss:Color="#000000"/>
<Interior/>
<NumberFormat/>
<Protection/>
</Style>
<Style ss:ID="s17">
<Interior ss:Color="#FCE4D6" ss:Pattern="Solid"/>
</Style>
<Style ss:ID="s22">
<Alignment ss:Horizontal="Center" ss:Vertical="Bottom"/>
<Interior ss:Color="#EDEDED" ss:Pattern="Solid"/>
</Style>
<Style ss:ID="s23">
<Alignment ss:Horizontal="Center" ss:Vertical="Bottom"/>
<Interior ss:Color="#FFF2CC" ss:Pattern="Solid"/>
</Style>
<Style ss:ID="s24">
<Alignment ss:Horizontal="Center" ss:Vertical="Bottom"/>
<Interior ss:Color="#F8CBAD" ss:Pattern="Solid"/>
</Style>
<Style ss:ID="s25">
<Alignment ss:Horizontal="Center" ss:Vertical="Bottom"/>
<Interior ss:Color="#F4B084" ss:Pattern="Solid"/>
</Style>
<Style ss:ID="s26">
<Alignment ss:Horizontal="Center" ss:Vertical="Bottom"/>
<Interior ss:Color="#FFFF00" ss:Pattern="Solid"/>
</Style>
</Styles>
<Worksheet ss:Name="Sheet1">
<Table ss:ExpandedColumnCount="6" ss:ExpandedRowCount="6" x:FullColumns="1"
x:FullRows="1" ss:DefaultRowHeight="15">
<Row>
<Cell ss:StyleID="s17"><Data ss:Type="Number">1</Data></Cell>
<Cell ss:MergeAcross="1" ss:StyleID="s22"><Data ss:Type="Number">2</Data></Cell>
<Cell ss:MergeAcross="2" ss:StyleID="s23"><Data ss:Type="Number">3</Data></Cell>
</Row>
<Row>
<Cell ss:MergeDown="1" ss:StyleID="s24"><Data ss:Type="Number">2</Data></Cell>
</Row>
<Row>
<Cell ss:Index="3" ss:MergeAcross="3" ss:MergeDown="3" ss:StyleID="s26"><Data
ss:Type="String">merged cell</Data></Cell>
</Row>
<Row>
<Cell ss:MergeDown="2" ss:StyleID="s25"><Data ss:Type="Number">3</Data></Cell>
</Row>
</Table>
<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
<PageSetup>
<Header x:Margin="0.3"/>
<Footer x:Margin="0.3"/>
<PageMargins x:Bottom="0.75" x:Left="0.7" x:Right="0.7" x:Top="0.75"/>
</PageSetup>
<Print>
<ValidPrinterInfo/>
<VerticalResolution>0</VerticalResolution>
</Print>
<Selected/>
<Panes>
<Pane>
<Number>3</Number>
<ActiveRow>8</ActiveRow>
<ActiveCol>5</ActiveCol>
</Pane>
</Panes>
<ProtectObjects>False</ProtectObjects>
<ProtectScenarios>False</ProtectScenarios>
</WorksheetOptions>
</Worksheet>
</Workbook>
......@@ -78,7 +78,7 @@ const FileFormat ScBootstrapFixture::aFileFormats[] = {
{ "html" , "calc_HTML_WebQuery", "generic_HTML", HTML_FORMAT_TYPE },
{ "123" , "Lotus", "calc_Lotus", LOTUS123_FORMAT_TYPE },
{ "dif", "DIF", "calc_DIF", DIF_FORMAT_TYPE },
{ "xml", "MS Excel 2003 XML", "calc_MS_Excel_2003_XML", XLS_XML_FORMAT_TYPE },
{ "xml", "MS Excel 2003 XML Orcus", "calc_MS_Excel_2003_XML", XLS_XML_FORMAT_TYPE },
{ "xlsb", "Calc MS Excel 2007 Binary", "MS Excel 2007 Binary", XLSB_XML_FORMAT_TYPE },
{ "fods", "OpenDocument Spreadsheet Flat XML", "calc_ODS_FlatXML", FODS_FORMAT_TYPE },
{ "gnumeric", "Gnumeric Spreadsheet", "Gnumeric XML", GNUMERIC_FORMAT_TYPE }
......
......@@ -50,7 +50,7 @@
#define CSV_FORMAT_TYPE (SfxFilterFlags::IMPORT | SfxFilterFlags::EXPORT | SfxFilterFlags::ALIEN )
#define HTML_FORMAT_TYPE (SfxFilterFlags::IMPORT | SfxFilterFlags::EXPORT | SfxFilterFlags::ALIEN )
#define DIF_FORMAT_TYPE (SfxFilterFlags::IMPORT | SfxFilterFlags::EXPORT | SfxFilterFlags::ALIEN )
#define XLS_XML_FORMAT_TYPE (SfxFilterFlags::IMPORT | SfxFilterFlags::EXPORT | SfxFilterFlags::ALIEN | SfxFilterFlags::STARONEFILTER)
#define XLS_XML_FORMAT_TYPE (SfxFilterFlags::IMPORT | SfxFilterFlags::ALIEN | SfxFilterFlags::PREFERED)
#define XLSB_XML_FORMAT_TYPE (SfxFilterFlags::IMPORT | SfxFilterFlags::ALIEN | SfxFilterFlags::STARONEFILTER | SfxFilterFlags::PREFERED)
#define FODS_FORMAT_TYPE (SfxFilterFlags::IMPORT | SfxFilterFlags::EXPORT | SfxFilterFlags::OWN | SfxFilterFlags::STARONEFILTER )
#define GNUMERIC_FORMAT_TYPE (SfxFilterFlags::IMPORT | SfxFilterFlags::ALIEN | SfxFilterFlags::PREFERED )
......
......@@ -235,6 +235,8 @@ public:
void testUnicodeFileNameGnumeric();
#endif
void testMergedCellsXLSXML();
CPPUNIT_TEST_SUITE(ScFiltersTest);
CPPUNIT_TEST(testBooleanFormatXLSX);
CPPUNIT_TEST(testBasicCellContentODS);
......@@ -356,6 +358,7 @@ public:
#ifdef UNX
CPPUNIT_TEST(testUnicodeFileNameGnumeric);
#endif
CPPUNIT_TEST(testMergedCellsXLSXML);
CPPUNIT_TEST_SUITE_END();
......@@ -3498,6 +3501,40 @@ void ScFiltersTest::testUnicodeFileNameGnumeric()
}
#endif
void ScFiltersTest::testMergedCellsXLSXML()
{
ScDocShellRef xDocSh = loadDoc("merged-cells.", FORMAT_XLS_XML);
CPPUNIT_ASSERT_MESSAGE("Failed to load merged-cells.xml", xDocSh.is());
ScDocument& rDoc = xDocSh->GetDocument();
// B1:C1 is merged.
ScRange aMergedRange(1,0,0); // B1
rDoc.ExtendTotalMerge(aMergedRange);
CPPUNIT_ASSERT_EQUAL(ScRange(1,0,0,2,0,0), aMergedRange);
// D1:F1 is merged.
aMergedRange = ScRange(3,0,0); // D1
rDoc.ExtendTotalMerge(aMergedRange);
CPPUNIT_ASSERT_EQUAL(ScRange(3,0,0,5,0,0), aMergedRange);
// A2:A3 is merged.
aMergedRange = ScRange(0,1,0); // A2
rDoc.ExtendTotalMerge(aMergedRange);
CPPUNIT_ASSERT_EQUAL(ScRange(0,1,0,0,2,0), aMergedRange);
// A4:A6 is merged.
aMergedRange = ScRange(0,3,0); // A4
rDoc.ExtendTotalMerge(aMergedRange);
CPPUNIT_ASSERT_EQUAL(ScRange(0,3,0,0,5,0), aMergedRange);
// C3:F6 is merged.
aMergedRange = ScRange(2,2,0); // C3
rDoc.ExtendTotalMerge(aMergedRange);
CPPUNIT_ASSERT_EQUAL(ScRange(2,2,0,5,5,0), aMergedRange);
xDocSh->DoClose();
}
void ScFiltersTest::testCondFormatXLSB()
{
ScDocShellRef xDocSh = loadDoc("cond_format.", FORMAT_XLSB);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment