diff options
author | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2020-02-16 12:14:01 +0100 |
---|---|---|
committer | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2020-02-18 10:14:47 +0100 |
commit | a915d7b7b9855a487902784dcdd8e295b6222519 (patch) | |
tree | f2e8d1c6c17b43e5a5c6fafcb67026a9afef39ac /sc | |
parent | 1260b71c6796f12053cddd4c7a8f3f727fdf1890 (diff) |
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@CIB.de>
(cherry picked from commit f55140c7376c330bcdac071592aada75e8781e19)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88787
Reviewed-by: Vasily Melenchuk <vasily.melenchuk@cib.de>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/qa/unit/data/ods/autoheight2rows.ods | bin | 19351 -> 11327 bytes | |||
-rw-r--r-- | sc/qa/unit/subsequent_filters-test.cxx | 9 | ||||
-rw-r--r-- | sc/source/core/data/segmenttree.cxx | 4 |
3 files changed, 10 insertions, 3 deletions
diff --git a/sc/qa/unit/data/ods/autoheight2rows.ods b/sc/qa/unit/data/ods/autoheight2rows.ods Binary files differindex b687701240c1..099df137ff64 100644 --- a/sc/qa/unit/data/ods/autoheight2rows.ods +++ b/sc/qa/unit/data/ods/autoheight2rows.ods diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index 9110505667fc..e005b258d979 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -4300,11 +4300,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 b47f1e7b9f3c..01f1f9d82416 100644 --- a/sc/source/core/data/segmenttree.cxx +++ b/sc/source/core/data/segmenttree.cxx @@ -106,7 +106,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 |