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

Kohei Yoshida kohei.yoshida at collabora.com
Thu Feb 20 08:29:39 PST 2014


 sc/qa/unit/subsequent_export-test.cxx  |   89 +++++++++++++++++++++++++++++++++
 sc/qa/unit/subsequent_filters-test.cxx |   69 -------------------------
 sc/source/filter/excel/xestyle.cxx     |    8 +-
 3 files changed, 93 insertions(+), 73 deletions(-)

New commits:
commit 1c1f42fdbad774cae7c45a7f8d60b9af766dee0a
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Thu Feb 20 11:27:32 2014 -0500

    fdo#75130: Export cell borders to xls and xlsx correctly.
    
    Change-Id: Ic629fb4852d2ada9724dfee7618e2436c0fa28a8

diff --git a/sc/source/filter/excel/xestyle.cxx b/sc/source/filter/excel/xestyle.cxx
index f4f8ffc..c753228 100644
--- a/sc/source/filter/excel/xestyle.cxx
+++ b/sc/source/filter/excel/xestyle.cxx
@@ -1570,18 +1570,18 @@ void lclGetBorderLine(
             switch (pLine->GetBorderLineStyle())
             {
                 case table::BorderLineStyle::DASHED:
+                case table::BorderLineStyle::FINE_DASHED:
                     rnXclLine = EXC_LINE_DASHED;
                     break;
                 case table::BorderLineStyle::DOTTED:
                     rnXclLine = EXC_LINE_DOTTED;
                     break;
-                case table::BorderLineStyle::FINE_DASHED:
-                    rnXclLine = EXC_LINE_HAIR;
-                    break;
                 default:
                     break;
             }
         }
+        else if (nOuterWidth >= EXC_BORDER_HAIR)
+            rnXclLine = EXC_LINE_HAIR;
         else
             rnXclLine = EXC_LINE_NONE;
     }
@@ -1726,7 +1726,7 @@ static const char* ToLineStyle( sal_uInt8 nLineStyle )
         case EXC_LINE_HAIR:     return "hair";
         case EXC_LINE_DOTTED:     return "dotted";
         case EXC_LINE_DASHED:     return "dashed";
-        case EXC_LINE_MEDIUMDASHED:     return "mediumdashed";
+        case EXC_LINE_MEDIUMDASHED: return "mediumDashed";
     }
     return "*unknown*";
 }
commit 6d5270dab5c8ea8bae1ac3462aa5f6768f7d2c8f
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Thu Feb 20 11:26:38 2014 -0500

    fdo#75130: Move these tests to the export test and test their export.
    
    Change-Id: Ia6a155f12e3b50c5841211d32e0f8ff2de2bc9c8

diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index 26fc12a..e834ca6 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -42,6 +42,9 @@
 #include "editeng/editobj.hxx"
 #include "editeng/section.hxx"
 #include <editeng/crossedoutitem.hxx>
+#include <editeng/borderline.hxx>
+
+#include <com/sun/star/table/BorderLineStyle.hpp>
 
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
@@ -79,6 +82,9 @@ public:
     void testFormulaReferenceXLS();
     void testSheetProtectionXLSX();
 
+    void testCellBordersXLS();
+    void testCellBordersXLSX();
+
     CPPUNIT_TEST_SUITE(ScExportTest);
     CPPUNIT_TEST(test);
 #if !defined(MACOSX) && !defined(DRAGONFLY)
@@ -100,10 +106,14 @@ public:
     CPPUNIT_TEST(testEmbeddedChartXLS);
     CPPUNIT_TEST(testFormulaReferenceXLS);
     CPPUNIT_TEST(testSheetProtectionXLSX);
+    CPPUNIT_TEST(testCellBordersXLS);
+    CPPUNIT_TEST(testCellBordersXLSX);
 
     CPPUNIT_TEST_SUITE_END();
 
 private:
+    void testExcelCellBorders( sal_uLong nFormatType );
+
     uno::Reference<uno::XInterface> m_xCalcComponent;
 
 };
@@ -991,6 +1001,85 @@ void ScExportTest::testSheetProtectionXLSX()
     xDocSh->DoClose();
 }
 
+namespace {
+
+const char* toBorderName( sal_Int16 eStyle )
+{
+    switch (eStyle)
+    {
+        case table::BorderLineStyle::SOLID: return "SOLID";
+        case table::BorderLineStyle::DOTTED: return "DOTTED";
+        case table::BorderLineStyle::DASHED: return "DASHED";
+        case table::BorderLineStyle::DOUBLE: return "DOUBLE";
+        case table::BorderLineStyle::FINE_DASHED: return "FINE_DASHED";
+        default:
+            ;
+    }
+
+    return "";
+}
+
+}
+
+void ScExportTest::testExcelCellBorders( sal_uLong nFormatType )
+{
+    ScDocShellRef xDocSh = loadDoc("cell-borders.", nFormatType);
+
+    CPPUNIT_ASSERT_MESSAGE("Failed to load file", xDocSh.Is());
+    ScDocument* pDoc = xDocSh->GetDocument();
+
+    struct
+    {
+        SCROW mnRow;
+        sal_Int16 mnStyle;
+        long mnWidth;
+    } aChecks[] = {
+        {  1, table::BorderLineStyle::SOLID,        1L }, // hair
+        {  3, table::BorderLineStyle::DOTTED,      15L }, // thin
+        {  9, table::BorderLineStyle::FINE_DASHED, 15L }, // dashed
+        { 11, table::BorderLineStyle::SOLID,       15L }, // thin
+        { 19, table::BorderLineStyle::DASHED,      35L }, // medium dashed
+        { 21, table::BorderLineStyle::SOLID,       35L }, // medium
+        { 23, table::BorderLineStyle::SOLID,       50L }, // thick
+        { 25, table::BorderLineStyle::DOUBLE,      -1L }, // double (don't check width)
+    };
+
+    for (size_t i = 0; i < SAL_N_ELEMENTS(aChecks); ++i)
+    {
+        const editeng::SvxBorderLine* pLine = NULL;
+        pDoc->GetBorderLines(2, aChecks[i].mnRow, 0, NULL, &pLine, NULL, NULL);
+        CPPUNIT_ASSERT(pLine);
+        CPPUNIT_ASSERT_EQUAL(toBorderName(aChecks[i].mnStyle), toBorderName(pLine->GetBorderLineStyle()));
+        if (aChecks[i].mnWidth >= 0)
+            CPPUNIT_ASSERT_EQUAL(aChecks[i].mnWidth, pLine->GetWidth());
+    }
+
+    ScDocShellRef xNewDocSh = saveAndReload(xDocSh, nFormatType);
+    xDocSh->DoClose();
+    pDoc = xNewDocSh->GetDocument();
+    for (size_t i = 0; i < SAL_N_ELEMENTS(aChecks); ++i)
+    {
+        const editeng::SvxBorderLine* pLine = NULL;
+        pDoc->GetBorderLines(2, aChecks[i].mnRow, 0, NULL, &pLine, NULL, NULL);
+        CPPUNIT_ASSERT(pLine);
+        CPPUNIT_ASSERT_EQUAL(toBorderName(aChecks[i].mnStyle), toBorderName(pLine->GetBorderLineStyle()));
+        if (aChecks[i].mnWidth >= 0)
+            CPPUNIT_ASSERT_EQUAL(aChecks[i].mnWidth, pLine->GetWidth());
+    }
+
+    xNewDocSh->DoClose();
+}
+
+void ScExportTest::testCellBordersXLS()
+{
+    testExcelCellBorders(XLS);
+}
+
+void ScExportTest::testCellBordersXLSX()
+{
+    testExcelCellBorders(XLSX);
+}
+
 ScExportTest::ScExportTest()
       : ScBootstrapFixture("/sc/qa/unit/data")
 {
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index fe76538..f4acfa9 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -106,8 +106,6 @@ public:
     void testMatrixODS();
     void testMatrixXLS();
     void testBorderODS();
-    void testCellBordersXLS();
-    void testCellBordersXLSX();
     void testBordersOoo33();
     void testBugFixesODS();
     void testBugFixesXLS();
@@ -183,8 +181,6 @@ public:
     CPPUNIT_TEST(testMatrixODS);
     CPPUNIT_TEST(testMatrixXLS);
     CPPUNIT_TEST(testBorderODS);
-    CPPUNIT_TEST(testCellBordersXLS);
-    CPPUNIT_TEST(testCellBordersXLSX);
     CPPUNIT_TEST(testBordersOoo33);
     CPPUNIT_TEST(testBugFixesODS);
     CPPUNIT_TEST(testBugFixesXLS);
@@ -242,7 +238,6 @@ public:
 
 private:
     void testPassword_Impl(const OUString& rFileNameBase);
-    void testExcelCellBorders( sal_uLong nFormatType );
     uno::Reference<uno::XInterface> m_xCalcComponent;
 };
 
@@ -856,70 +851,6 @@ void ScFiltersTest::testBorderODS()
     xDocSh->DoClose();
 }
 
-namespace {
-
-const char* toBorderName( sal_Int16 eStyle )
-{
-    switch (eStyle)
-    {
-        case table::BorderLineStyle::SOLID: return "SOLID";
-        case table::BorderLineStyle::DOTTED: return "DOTTED";
-        case table::BorderLineStyle::DASHED: return "DASHED";
-        case table::BorderLineStyle::DOUBLE: return "DOUBLE";
-        case table::BorderLineStyle::FINE_DASHED: return "FINE_DASHED";
-        default:
-            ;
-    }
-
-    return "";
-}
-
-}
-
-void ScFiltersTest::testExcelCellBorders( sal_uLong nFormatType )
-{
-    ScDocShellRef xDocSh = loadDoc("cell-borders.", nFormatType);
-
-    CPPUNIT_ASSERT_MESSAGE("Failed to load file", xDocSh.Is());
-    ScDocument* pDoc = xDocSh->GetDocument();
-
-    struct
-    {
-        SCROW mnRow;
-        sal_Int16 mnStyle;
-        long mnWidth;
-    } aChecks[] = {
-        {  1, table::BorderLineStyle::SOLID,        1L }, // hair
-        {  3, table::BorderLineStyle::DOTTED,      15L }, // thin
-        {  9, table::BorderLineStyle::FINE_DASHED, 15L }, // dashed
-        { 11, table::BorderLineStyle::SOLID,       15L }, // thin
-        { 19, table::BorderLineStyle::DASHED,      35L }, // medium dashed
-        { 21, table::BorderLineStyle::SOLID,       35L }, // medium
-        { 23, table::BorderLineStyle::SOLID,       50L }, // thick
-        { 25, table::BorderLineStyle::DOUBLE,      -1L }, // double (don't check width)
-    };
-
-    for (size_t i = 0; i < SAL_N_ELEMENTS(aChecks); ++i)
-    {
-        const editeng::SvxBorderLine* pLine = NULL;
-        pDoc->GetBorderLines(2, aChecks[i].mnRow, 0, NULL, &pLine, NULL, NULL);
-        CPPUNIT_ASSERT(pLine);
-        CPPUNIT_ASSERT_EQUAL(toBorderName(aChecks[i].mnStyle), toBorderName(pLine->GetBorderLineStyle()));
-        if (aChecks[i].mnWidth >= 0)
-            CPPUNIT_ASSERT_EQUAL(aChecks[i].mnWidth, pLine->GetWidth());
-    }
-}
-
-void ScFiltersTest::testCellBordersXLS()
-{
-    testExcelCellBorders(XLS);
-}
-
-void ScFiltersTest::testCellBordersXLSX()
-{
-    testExcelCellBorders(XLSX);
-}
-
 struct Border
 {
     sal_Int16 column;


More information about the Libreoffice-commits mailing list