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

Thorsten Behrens (via logerrit) logerrit at kemper.freedesktop.org
Sun Feb 16 23:41:43 UTC 2020


 sc/qa/unit/data/ods/autoheight2rows.ods |binary
 sc/qa/unit/subsequent_filters-test.cxx  |    9 +++++++--
 sc/source/core/data/segmenttree.cxx     |    4 +++-
 3 files changed, 10 insertions(+), 3 deletions(-)

New commits:
commit f55140c7376c330bcdac071592aada75e8781e19
Author:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
AuthorDate: Sun Feb 16 12:14:01 2020 +0100
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Mon Feb 17 00:41:07 2020 +0100

    tdf#123971 don't clobber entire RowHeight range on updates
    
    Use start index from current loop variable, not full range; otherwise
    we're always clobbering values from (possibly higher) upper rows.
    
    Change-Id: I3add7c2358710f4ae3927e7b0a1c1ff544965a03
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88785
    Tested-by: Jenkins
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/sc/qa/unit/data/ods/autoheight2rows.ods b/sc/qa/unit/data/ods/autoheight2rows.ods
index b687701240c1..099df137ff64 100644
Binary files a/sc/qa/unit/data/ods/autoheight2rows.ods and b/sc/qa/unit/data/ods/autoheight2rows.ods differ
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index d57404bc3ed9..4038430dceee 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -4323,11 +4323,16 @@ void ScFiltersTest::testAutoheight2Rows()
 
     SCTAB nTab = 0;
     int nHeight1 = rDoc.GetRowHeight(0, nTab, false);
-    int nHeight3 = rDoc.GetRowHeight(2, nTab, false);
+    int nHeight2 = rDoc.GetRowHeight(1, nTab, false);
+    int nHeight4 = rDoc.GetRowHeight(3, nTab, false);
+    int nHeight5 = rDoc.GetRowHeight(4, nTab, false);
 
     // We will do relative comparison, because calculated autoheight
     // can be different on different platforms
-    CPPUNIT_ASSERT_MESSAGE("Row #3 should be thinner than #1", nHeight3 < nHeight1);
+    CPPUNIT_ASSERT_MESSAGE("Row #1 and row #4 must have same height after load & auto-adjust",
+                           abs( nHeight1 - nHeight4 ) < 10 );
+    CPPUNIT_ASSERT_MESSAGE("Row #2 and row #5 must have same height after load & auto-adjust",
+                           abs( nHeight2 - nHeight5 ) < 10 );
 
     xDocSh->DoClose();
 }
diff --git a/sc/source/core/data/segmenttree.cxx b/sc/source/core/data/segmenttree.cxx
index b4116168002f..254f0f875571 100644
--- a/sc/source/core/data/segmenttree.cxx
+++ b/sc/source/core/data/segmenttree.cxx
@@ -110,7 +110,9 @@ void ScFlatSegmentsImpl<ValueType_, ExtValueType_>::setValueIf(SCCOLROW nPos1, S
         getRangeData(nCurrentStartRow, aRangeData);
         if (rPredicate(aRangeData.mnValue))
         {
-            setValue(nPos1, std::min<SCCOLROW>(nPos2, aRangeData.mnPos2), nValue);
+            // set value from current iteration point on, til end of range.
+            // Note that aRangeData may well contain much lower values for nPos1
+            setValue(nCurrentStartRow, std::min<SCCOLROW>(nPos2, aRangeData.mnPos2), nValue);
         }
 
         // even if nPos2 is bigger than nPos2 this should terminate the loop


More information about the Libreoffice-commits mailing list