[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - sc/qa svtools/source

Justin Luth justin_luth at sil.org
Tue Nov 15 05:42:49 UTC 2016


 sc/qa/unit/data/ods/tdf88827_borderDoubleThin.ods |binary
 sc/qa/unit/subsequent_export-test.cxx             |   12 ++++++------
 sc/qa/unit/subsequent_filters-test.cxx            |   21 +++++++++++++++++++++
 svtools/source/control/ctrlbox.cxx                |    2 +-
 4 files changed, 28 insertions(+), 7 deletions(-)

New commits:
commit 8fc6be8d2c0fd455b9c461143594457a08a3e250
Author: Justin Luth <justin_luth at sil.org>
Date:   Mon Nov 14 09:38:25 2016 +0300

    tdf#88827 - double-thin border: MINGAPWIDTH is a valid width
    
    double-thin borders are available in the UI starting from 0.5pt.
    The actual minumum (as seen in a round-trip), is 1.10pt.
    (Each thin line is ~ .50pt, the gap is ~ .05pt, and then some
    approximations and rounding show it as 1.10 - at least that is how I
    understood it). 1.15pt is the first point at which the gap is larger
    than the minimum - and double_thins with a minimum gap were considered
    invalid, and thus were not imported.
    
    With this fix, double-thin borders created with a size less than 1.15pt
    are valid and visible on import.
    
    cherry-picked from master, commit 9259fcd40b1749cd421c433bcc436cb335cbbe43
    
    Conflicts:
    
    	sc/qa/unit/subsequent_export-test.cxx
    
    Change-Id: Ia8cff677516eca371b7e8a9ef7ba33a1b8f176bf
    Reviewed-on: https://gerrit.libreoffice.org/30856
    Reviewed-by: Justin Luth <justin_luth at sil.org>
    Tested-by: Justin Luth <justin_luth at sil.org>

diff --git a/sc/qa/unit/data/ods/tdf88827_borderDoubleThin.ods b/sc/qa/unit/data/ods/tdf88827_borderDoubleThin.ods
new file mode 100644
index 0000000..b20e0aa
Binary files /dev/null and b/sc/qa/unit/data/ods/tdf88827_borderDoubleThin.ods differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index 294ede0..163c2b9 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -1596,8 +1596,8 @@ void ScExportTest::testBordersExchangeXLSX()
 /* 0,05 */   {{Solid   , Solid   ,  1,  1}, {Dotted  , Dotted  , 15, 15}, {Dotted  , Dotted  , 15, 15}, {FineDash, FineDash, 15, 15}, {FineDash, FineDash, 15, 15}, {FineDash, FineDash, 15, 15}, {None    , None    ,  0,  0}},
 /* 0,25 */   {{Solid   , Solid   ,  1,  1}, {Dotted  , Dotted  , 15, 15}, {Dotted  , Dotted  , 15, 15}, {FineDash, FineDash, 15, 15}, {FineDash, FineDash, 15, 15}, {FineDash, FineDash, 15, 15}, {None    , None    ,  0,  0}},
 /* 0,50 */   {{Solid   , Solid   ,  1,  1}, {Dotted  , Dotted  , 15, 15}, {Dotted  , Dotted  , 15, 15}, {FineDash, FineDash, 15, 15}, {FineDash, FineDash, 15, 15}, {FineDash, FineDash, 15, 15}, {None    , None    ,  0,  0}},
-/* 0,75 */   {{Solid   , Solid   , 15, 15}, {Dotted  , Dotted  , 15, 15}, {FineDash, FineDash, 15, 15}, {FineDash, FineDash, 15, 15}, {DashDot , DashDot , 15, 15}, {DashDoDo, DashDoDo, 15, 15}, {None    , None    ,  0,  0}},
-/* 1,00 */   {{Solid   , Solid   , 15, 15}, {Dotted  , Dotted  , 15, 15}, {FineDash, FineDash, 15, 15}, {FineDash, FineDash, 15, 15}, {DashDot , DashDot , 15, 15}, {DashDoDo, DashDoDo, 15, 15}, {None    , None    ,  0,  0}},
+/* 0,75 */   {{Solid   , Solid   , 15, 15}, {Dotted  , Dotted  , 15, 15}, {FineDash, FineDash, 15, 15}, {FineDash, FineDash, 15, 15}, {DashDot , DashDot , 15, 15}, {DashDoDo, DashDoDo, 15, 15}, {DoubThin, DoubThin, 35, 35}},
+/* 1,00 */   {{Solid   , Solid   , 15, 15}, {Dotted  , Dotted  , 15, 15}, {FineDash, FineDash, 15, 15}, {FineDash, FineDash, 15, 15}, {DashDot , DashDot , 15, 15}, {DashDoDo, DashDoDo, 15, 15}, {DoubThin, DoubThin, 35, 35}},
 /* 1,25 */   {{Solid   , Solid   , 15, 15}, {Dotted  , Dotted  , 15, 15}, {FineDash, FineDash, 15, 15}, {FineDash, FineDash, 15, 15}, {DashDot , DashDot , 15, 15}, {DashDoDo, DashDoDo, 15, 15}, {DoubThin, DoubThin, 35, 35}},
 /* 1,50 */   {{Solid   , Solid   , 15, 15}, {Dotted  , Dotted  , 15, 15}, {FineDash, FineDash, 15, 15}, {FineDash, FineDash, 15, 15}, {DashDot , DashDot , 15, 15}, {DashDoDo, DashDoDo, 15, 15}, {DoubThin, DoubThin, 35, 35}},
 
@@ -1629,10 +1629,10 @@ void ScExportTest::testBordersExchangeXLSX()
             const editeng::SvxBorderLine* pLineTop    = nullptr;
             const editeng::SvxBorderLine* pLineBottom = nullptr;
             rDoc.GetBorderLines(nCol + 2, (nRow * 2) + 8, 0, nullptr, &pLineTop, nullptr, &pLineBottom);
-            if((nCol < 5) && (nRow == 6))
-            {   // in this range no lines
-                CPPUNIT_ASSERT(pLineTop == nullptr);
-                CPPUNIT_ASSERT(pLineBottom == nullptr);
+            if((nCol < 3) && (nRow == 6))
+            {   // in this range no lines since minimum size to create a double is 0.5
+                CPPUNIT_ASSERT(!pLineTop);
+                CPPUNIT_ASSERT(!pLineBottom);
                 continue;
             }
             else
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index 16545b9..3ff7c44 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -123,6 +123,7 @@ public:
     // void testFormatsXLSX();
     void testMatrixODS();
     void testMatrixXLS();
+    void testDoubleThinBorder();
     void testBorderODS();
     void testBordersOoo33();
     void testBugFixesODS();
@@ -242,6 +243,7 @@ public:
 //  CPPUNIT_TEST(testFormatsXLSX); TODO: Fix this
     CPPUNIT_TEST(testMatrixODS);
     CPPUNIT_TEST(testMatrixXLS);
+    CPPUNIT_TEST(testDoubleThinBorder);
     CPPUNIT_TEST(testBorderODS);
     CPPUNIT_TEST(testBordersOoo33);
     CPPUNIT_TEST(testBugFixesODS);
@@ -889,6 +891,25 @@ void ScFiltersTest::testMatrixXLS()
     xDocSh->DoClose();
 }
 
+void ScFiltersTest::testDoubleThinBorder()
+{
+// double-thin borders created with size less than 1.15 where invisible (and subsequently lost) on round-trips.
+    ScDocShellRef xDocSh = loadDoc("tdf88827_borderDoubleThin.", FORMAT_ODS);
+
+    CPPUNIT_ASSERT_MESSAGE("Failed to load tdf88827_borderDoubleThin.*", xDocSh.Is());
+    ScDocument& rDoc = xDocSh->GetDocument();
+
+    const editeng::SvxBorderLine* pLeft = nullptr;
+    const editeng::SvxBorderLine* pTop = nullptr;
+    const editeng::SvxBorderLine* pRight = nullptr;
+    const editeng::SvxBorderLine* pBottom = nullptr;
+
+    rDoc.GetBorderLines( 2, 2, 0, &pLeft, &pTop, &pRight, &pBottom );
+    CPPUNIT_ASSERT(pTop);
+    CPPUNIT_ASSERT(pRight);
+    CPPUNIT_ASSERT_EQUAL( table::BorderLineStyle::DOUBLE_THIN, pRight->GetBorderLineStyle() );
+}
+
 void ScFiltersTest::testBorderODS()
 {
     ScDocShellRef xDocSh = loadDoc("border.", FORMAT_ODS);
diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx
index 20fdb89..3b17faa 100644
--- a/svtools/source/control/ctrlbox.cxx
+++ b/svtools/source/control/ctrlbox.cxx
@@ -401,7 +401,7 @@ long BorderWidthImpl::GuessWidth( long nLine1, long nLine2, long nGap )
 
     bool bGapChange = bool( m_nFlags & BorderWidthImplFlags::CHANGE_DIST );
     double nWidthGap = lcl_getGuessedWidth( nGap, m_nRateGap, bGapChange );
-    if ( bGapChange && nGap > MINGAPWIDTH )
+    if ( bGapChange && nGap >= MINGAPWIDTH )
         aToCompare.push_back( nWidthGap );
     else if ( !bGapChange && nWidthGap < 0 )
         bInvalid = true;


More information about the Libreoffice-commits mailing list