[Libreoffice-commits] core.git: sc/qa

Kohei Yoshida kohei.yoshida at gmail.com
Tue Feb 20 15:05:38 UTC 2018


 sc/qa/unit/data/xml/border-colors.xml  |  109 +++++++++++++++++++++++++++++++++
 sc/qa/unit/subsequent_filters-test.cxx |   59 +++++++++++++++++
 2 files changed, 168 insertions(+)

New commits:
commit 74ad41f9004746e7a63da218655e951e6a36960a
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Mon Feb 19 20:30:37 2018 -0500

    Add one more test case for importing border colors.
    
    This one is also for the Excel 2003 XML format.
    
    Change-Id: I7c9725f4aa6d11523b647e56af634ca9245c44b6
    Reviewed-on: https://gerrit.libreoffice.org/50022
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Kohei Yoshida <libreoffice at kohei.us>

diff --git a/sc/qa/unit/data/xml/border-colors.xml b/sc/qa/unit/data/xml/border-colors.xml
new file mode 100644
index 000000000000..bab7dec8be20
--- /dev/null
+++ b/sc/qa/unit/data/xml/border-colors.xml
@@ -0,0 +1,109 @@
+<?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>2018-02-07T21:56:45Z</Created>
+  <LastSaved>2018-02-07T22:02:54Z</LastSaved>
+  <Version>16.00</Version>
+ </DocumentProperties>
+ <OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">
+  <AllowPNG/>
+ </OfficeDocumentSettings>
+ <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
+  <WindowHeight>9105</WindowHeight>
+  <WindowWidth>13800</WindowWidth>
+  <WindowTopX>0</WindowTopX>
+  <WindowTopY>0</WindowTopY>
+  <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="s62">
+   <Borders>
+    <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="3"
+     ss:Color="#FF0000"/>
+   </Borders>
+  </Style>
+  <Style ss:ID="s63">
+   <Borders>
+    <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="3"
+     ss:Color="#0070C0"/>
+   </Borders>
+  </Style>
+  <Style ss:ID="s64">
+   <Borders>
+    <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="3"
+     ss:Color="#00B050"/>
+   </Borders>
+  </Style>
+  <Style ss:ID="s65">
+   <Alignment ss:Horizontal="Center" ss:Vertical="Center" ss:WrapText="1"/>
+   <Borders>
+    <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="3"
+     ss:Color="#FFFF00"/>
+    <Border ss:Position="Right" ss:LineStyle="Continuous" ss:Weight="3"
+     ss:Color="#7030A0"/>
+    <Border ss:Position="DiagonalLeft" ss:LineStyle="Continuous" ss:Weight="3"
+     ss:Color="#00B0F0"/>
+    <Border ss:Position="DiagonalRight" ss:LineStyle="Continuous" ss:Weight="3"
+     ss:Color="#00B0F0"/>
+   </Borders>
+  </Style>
+ </Styles>
+ <Worksheet ss:Name="Sheet1">
+  <Table ss:ExpandedColumnCount="2" ss:ExpandedRowCount="7" x:FullColumns="1"
+   x:FullRows="1" ss:DefaultRowHeight="15">
+   <Column ss:Index="2" ss:AutoFitWidth="0" ss:Width="225.75"/>
+   <Row ss:AutoFitHeight="0"/>
+   <Row ss:Index="3" ss:AutoFitHeight="0">
+    <Cell ss:Index="2" ss:StyleID="s62"><Data ss:Type="String">Red -></Data></Cell>
+   </Row>
+   <Row ss:AutoFitHeight="0">
+    <Cell ss:Index="2" ss:StyleID="s63"><Data ss:Type="String">Blue -></Data></Cell>
+   </Row>
+   <Row ss:AutoFitHeight="0">
+    <Cell ss:Index="2" ss:StyleID="s64"><Data ss:Type="String">Green -></Data></Cell>
+   </Row>
+   <Row ss:Index="7" ss:AutoFitHeight="0" ss:Height="66.75">
+    <Cell ss:Index="2" ss:StyleID="s65"><Data ss:Type="String"><- Yellow
Purple ->
Light Blue \</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>
+   <Unsynced/>
+   <Print>
+    <ValidPrinterInfo/>
+    <HorizontalResolution>600</HorizontalResolution>
+    <VerticalResolution>600</VerticalResolution>
+   </Print>
+   <Selected/>
+   <Panes>
+    <Pane>
+     <Number>3</Number>
+     <ActiveRow>8</ActiveRow>
+     <ActiveCol>1</ActiveCol>
+    </Pane>
+   </Panes>
+   <ProtectObjects>False</ProtectObjects>
+   <ProtectScenarios>False</ProtectScenarios>
+  </WorksheetOptions>
+ </Worksheet>
+</Workbook>
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index 003ad24e2c94..38a3950df7fc 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -242,6 +242,7 @@ public:
     void testNamedExpressionsXLSXML();
     void testEmptyRowsXLSXML();
     void testBorderDirectionsXLSXML();
+    void testBorderColorsXLSXML();
 
     CPPUNIT_TEST_SUITE(ScFiltersTest);
     CPPUNIT_TEST(testBooleanFormatXLSX);
@@ -369,6 +370,7 @@ public:
     CPPUNIT_TEST(testNamedExpressionsXLSXML);
     CPPUNIT_TEST(testEmptyRowsXLSXML);
     CPPUNIT_TEST(testBorderDirectionsXLSXML);
+    CPPUNIT_TEST(testBorderColorsXLSXML);
     CPPUNIT_TEST(testCondFormatFormulaListenerXLSX);
 
     CPPUNIT_TEST_SUITE_END();
@@ -3773,6 +3775,63 @@ void ScFiltersTest::testBorderDirectionsXLSXML()
     xDocSh->DoClose();
 }
 
+void ScFiltersTest::testBorderColorsXLSXML()
+{
+    ScDocShellRef xDocSh = loadDoc("border-colors.", FORMAT_XLS_XML);
+    CPPUNIT_ASSERT_MESSAGE("Failed to load border-colors.xml", xDocSh.is());
+    ScDocument& rDoc = xDocSh->GetDocument();
+
+    // B3 - red
+    const ScPatternAttr* pPat = rDoc.GetPattern(ScAddress(1,2,0));
+    CPPUNIT_ASSERT(pPat);
+    const editeng::SvxBorderLine* pLine = pPat->GetItem(ATTR_BORDER).GetRight();
+    CPPUNIT_ASSERT(pLine);
+    CPPUNIT_ASSERT_EQUAL(SvxBorderLineStyle::SOLID, pLine->GetBorderLineStyle());
+    CPPUNIT_ASSERT_EQUAL(Color(255,0,0), pLine->GetColor());
+
+    // B4 - blue
+    pPat = rDoc.GetPattern(ScAddress(1,3,0));
+    CPPUNIT_ASSERT(pPat);
+    pLine = pPat->GetItem(ATTR_BORDER).GetRight();
+    CPPUNIT_ASSERT(pLine);
+    CPPUNIT_ASSERT_EQUAL(SvxBorderLineStyle::SOLID, pLine->GetBorderLineStyle());
+    CPPUNIT_ASSERT_EQUAL(Color(0,112,192), pLine->GetColor());
+
+    // B5 - green
+    pPat = rDoc.GetPattern(ScAddress(1,4,0));
+    CPPUNIT_ASSERT(pPat);
+    pLine = pPat->GetItem(ATTR_BORDER).GetRight();
+    CPPUNIT_ASSERT(pLine);
+    CPPUNIT_ASSERT_EQUAL(SvxBorderLineStyle::SOLID, pLine->GetBorderLineStyle());
+    CPPUNIT_ASSERT_EQUAL(Color(0,176,80), pLine->GetColor());
+
+    // B7 - yellow (left), purple (right), light blue (cross)
+    pPat = rDoc.GetPattern(ScAddress(1,6,0));
+    CPPUNIT_ASSERT(pPat);
+
+    pLine = pPat->GetItem(ATTR_BORDER).GetLeft();
+    CPPUNIT_ASSERT(pLine);
+    CPPUNIT_ASSERT_EQUAL(SvxBorderLineStyle::SOLID, pLine->GetBorderLineStyle());
+    CPPUNIT_ASSERT_EQUAL(Color(255,255,0), pLine->GetColor()); // yellow
+
+    pLine = pPat->GetItem(ATTR_BORDER).GetRight();
+    CPPUNIT_ASSERT(pLine);
+    CPPUNIT_ASSERT_EQUAL(SvxBorderLineStyle::SOLID, pLine->GetBorderLineStyle());
+    CPPUNIT_ASSERT_EQUAL(Color(112,48,160), pLine->GetColor()); // purple
+
+    pLine = pPat->GetItem(ATTR_BORDER_TLBR).GetLine();
+    CPPUNIT_ASSERT(pLine);
+    CPPUNIT_ASSERT_EQUAL(SvxBorderLineStyle::SOLID, pLine->GetBorderLineStyle());
+    CPPUNIT_ASSERT_EQUAL(Color(0,176,240), pLine->GetColor()); // light blue
+
+    pLine = pPat->GetItem(ATTR_BORDER_BLTR).GetLine();
+    CPPUNIT_ASSERT(pLine);
+    CPPUNIT_ASSERT_EQUAL(SvxBorderLineStyle::SOLID, pLine->GetBorderLineStyle());
+    CPPUNIT_ASSERT_EQUAL(Color(0,176,240), pLine->GetColor()); // light blue
+
+    xDocSh->DoClose();
+}
+
 void ScFiltersTest::testCondFormatXLSB()
 {
     ScDocShellRef xDocSh = loadDoc("cond_format.", FORMAT_XLSB);


More information about the Libreoffice-commits mailing list