sc/qa/unit/data/ods/tdf131471.ods       |binary
 sc/qa/unit/subsequent_filters_test3.cxx |   25 +++++++++++++++++++++++--
 sc/source/ui/unoobj/docuno.cxx          |    2 +-
 3 files changed, 24 insertions(+), 3 deletions(-)

New commits:
commit f142b3e84f97ae678bd0a94614e867d369680458
Author:     Tibor Nagy <nagy.tib...@nisz.hu>
AuthorDate: Mon Jul 10 17:53:49 2023 +0200
Commit:     László Németh <nem...@numbertext.org>
CommitDate: Mon Jul 24 15:03:58 2023 +0200

    tdf#131471 sc: fix background color of conditional formatting style
    
    The issue appears for merged cells when you trigger a change that
    causes the condition to be evaluated again.
    
    Manual test: open unit test document, put "1" in A1, and press Undo:
    the green background color of the condition was removed only
    partially.
    
    Change-Id: I8bb17c77ac49a1ee897c3e2b4902723d237765d8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154277
    Reviewed-by: László Németh <nem...@numbertext.org>
    Tested-by: László Németh <nem...@numbertext.org>

diff --git a/sc/qa/unit/data/ods/tdf131471.ods 
b/sc/qa/unit/data/ods/tdf131471.ods
new file mode 100644
index 000000000000..31f079274256
Binary files /dev/null and b/sc/qa/unit/data/ods/tdf131471.ods differ
diff --git a/sc/qa/unit/subsequent_filters_test3.cxx 
b/sc/qa/unit/subsequent_filters_test3.cxx
index 44cd7024506c..54d5061d2cd9 100644
--- a/sc/qa/unit/subsequent_filters_test3.cxx
+++ b/sc/qa/unit/subsequent_filters_test3.cxx
@@ -391,8 +391,9 @@ struct PaintListener : public SfxListener
         const ScPaintHint* pPaintHint = dynamic_cast<const 
ScPaintHint*>(&rHint);
         if (pPaintHint)
         {
-            if (pPaintHint->GetStartCol() <= 0 && pPaintHint->GetEndCol() >= 0
-                && pPaintHint->GetStartRow() <= 9 && pPaintHint->GetEndRow() 
>= 9)
+            if ((pPaintHint->GetStartCol() <= 0 && pPaintHint->GetEndCol() >= 
0)
+                && ((pPaintHint->GetStartRow() <= 9 && pPaintHint->GetEndRow() 
>= 9)
+                    || (pPaintHint->GetStartRow() == 2 && 
pPaintHint->GetEndRow() == 3)))
             {
                 mbCalled = true;
             }
@@ -420,6 +421,26 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest3, 
testCondFormatFormulaListenerXLSX)
     CPPUNIT_ASSERT(aListener.mbCalled);
 }
 
+CPPUNIT_TEST_FIXTURE(ScFiltersTest3, testTdf131471)
+{
+    // Repaint range of conditional format in merged cell.
+    createScDoc("ods/tdf131471.ods");
+    ScDocShell* pDocSh = getScDocShell();
+    PaintListener aListener;
+    aListener.StartListening(*pDocSh);
+    ScDocument* pDoc = getScDoc();
+    ScConditionalFormatList* pList = pDoc->GetCondFormList(0);
+    CPPUNIT_ASSERT(pList);
+
+    CPPUNIT_ASSERT_EQUAL(size_t(1), pList->size());
+    ScConditionalFormat* pFormat = pList->begin()->get();
+    CPPUNIT_ASSERT(pFormat);
+    pDoc->SetDocVisible(true);
+    pDoc->SetValue(0, 0, 0, 1.0);
+
+    CPPUNIT_ASSERT(aListener.mbCalled);
+}
+
 CPPUNIT_TEST_FIXTURE(ScFiltersTest3, testTdf137091)
 {
     // Set the system locale to Turkish
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 33ffbd393f12..66c2667a1a1f 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -488,7 +488,7 @@ void ScModelObj::RepaintRange( const ScRange& rRange )
 void ScModelObj::RepaintRange( const ScRangeList& rRange )
 {
     if (pDocShell)
-        pDocShell->PostPaint( rRange, PaintPartFlags::Grid );
+        pDocShell->PostPaint(rRange, PaintPartFlags::Grid, SC_PF_TESTMERGE);
 }
 
 static ScViewData* lcl_getViewMatchingDocZoomTab(const Fraction& rZoomX,

Reply via email to