[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - sc/qa sc/source

Marco Cecchetti (via logerrit) logerrit at kemper.freedesktop.org
Wed Jun 24 11:03:07 UTC 2020


 sc/qa/unit/tiledrendering/data/multiline.ods |binary
 sc/qa/unit/tiledrendering/tiledrendering.cxx |   42 +++++++++++++++++++++++++++
 sc/source/ui/docshell/docfunc.cxx            |   17 ++++++++++
 3 files changed, 59 insertions(+)

New commits:
commit dc13c656dc25ed35c31bec7b6c8ae7d0c6b258e3
Author:     Marco Cecchetti <marco.cecchetti at collabora.com>
AuthorDate: Mon Jun 22 14:55:06 2020 +0200
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Wed Jun 24 13:02:36 2020 +0200

    lok: calc: messed up view when deleting from multiline content
    
    To see the problem was enough to click on the cell with the multiline
    content (because of wrap text enabled), and press delete.
    
    Change-Id: I8288e7739c8513f5fa0bdee5f7eb414b4abac456
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96905
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Andras Timar <andras.timar at collabora.com>

diff --git a/sc/qa/unit/tiledrendering/data/multiline.ods b/sc/qa/unit/tiledrendering/data/multiline.ods
new file mode 100644
index 000000000000..847835690a5f
Binary files /dev/null and b/sc/qa/unit/tiledrendering/data/multiline.ods differ
diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index b3b73fc03b0a..e35233cbc3f0 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -109,6 +109,7 @@ public:
     void testGetRowColumnHeadersInvalidation();
     void testJumpHorizontallyInvalidation();
     void testJumpToLastRowInvalidation();
+    void testDeleteCellMultilineContent();
 
     CPPUNIT_TEST_SUITE(ScTiledRenderingTest);
     CPPUNIT_TEST(testRowColumnHeaders);
@@ -149,6 +150,7 @@ public:
     CPPUNIT_TEST(testGetRowColumnHeadersInvalidation);
     CPPUNIT_TEST(testJumpHorizontallyInvalidation);
     CPPUNIT_TEST(testJumpToLastRowInvalidation);
+    CPPUNIT_TEST(testDeleteCellMultilineContent);
     CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -459,6 +461,7 @@ public:
     bool m_bViewLock;
     OString m_sCellFormula;
     boost::property_tree::ptree m_aCommentCallbackResult;
+    OString m_sInvalidateHeader;
 
     ViewCallback()
         : m_bOwnCursorInvalidated(false),
@@ -550,6 +553,10 @@ public:
             m_aCommentCallbackResult = m_aCommentCallbackResult.get_child("comment");
         }
         break;
+        case LOK_CALLBACK_INVALIDATE_HEADER:
+        {
+            m_sInvalidateHeader = pPayload;
+        }
         }
     }
 };
@@ -1944,6 +1951,41 @@ void ScTiledRenderingTest::testRowColumnHeaders()
     SfxViewShell::Current()->registerLibreOfficeKitViewCallback(nullptr, nullptr);
 }
 
+void ScTiledRenderingTest::testDeleteCellMultilineContent()
+{
+    comphelper::LibreOfficeKit::setActive();
+
+    ScModelObj* pModelObj = createDoc("multiline.ods");
+    CPPUNIT_ASSERT(pModelObj);
+    ScViewData* pViewData = ScDocShell::GetViewData();
+    CPPUNIT_ASSERT(pViewData);
+    ScDocShell* pDocSh = dynamic_cast< ScDocShell* >( pModelObj->GetEmbeddedObject() );
+    CPPUNIT_ASSERT(pDocSh);
+
+    // view #1
+    ViewCallback aView1;
+    SfxViewShell::Current()->registerLibreOfficeKitViewCallback(&ViewCallback::callback, &aView1);
+    CPPUNIT_ASSERT(!lcl_hasEditView(*pViewData));
+
+    aView1.m_sInvalidateHeader = "";
+    ScDocument& rDoc = pDocSh->GetDocument();
+    sal_uInt16 nRow1Height = rDoc.GetRowHeight(static_cast<SCROW>(0), static_cast<SCTAB>(0), false);
+
+    // delete multiline cell content in view #1
+    pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::DOWN);
+    pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::DOWN);
+    pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::DELETE);
+    pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::DELETE);
+    Scheduler::ProcessEventsToIdle();
+
+    // check if the row header has been invalidated and if the involved row is of the expected height
+    CPPUNIT_ASSERT_EQUAL(aView1.m_sInvalidateHeader, OString("row"));
+    sal_uInt16 nRow2Height = rDoc.GetRowHeight(static_cast<SCROW>(0), static_cast<SCTAB>(0), false);
+    CPPUNIT_ASSERT_EQUAL(nRow1Height, nRow2Height);
+
+    SfxViewShell::Current()->registerLibreOfficeKitViewCallback(nullptr, nullptr);
+}
+
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(ScTiledRenderingTest);
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index 01670613a776..38af064a918c 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -153,6 +153,20 @@ bool ScDocFunc::AdjustRowHeight( const ScRange& rRange, bool bPaint )
     SCROW nStartRow = rRange.aStart.Row();
     SCROW nEndRow   = rRange.aEnd.Row();
 
+    if (comphelper::LibreOfficeKit::isActive())
+    {
+        SfxViewShell* pViewShell = SfxViewShell::GetFirst();
+        while (pViewShell)
+        {
+            ScTabViewShell* pTabViewShell = dynamic_cast<ScTabViewShell*>(pViewShell);
+            if (pTabViewShell)
+            {
+                pTabViewShell->GetViewData().GetLOKHeightHelper(nTab)->invalidateByIndex(nStartRow);
+            }
+            pViewShell = SfxViewShell::GetNext(*pViewShell);
+        }
+    }
+
     ScSizeDeviceProvider aProv( &rDocShell );
     Fraction aOne(1,1);
 
@@ -166,6 +180,9 @@ bool ScDocFunc::AdjustRowHeight( const ScRange& rRange, bool bPaint )
         rDocShell.PostPaint(ScRange(0, nStartRow, nTab, MAXCOL, MAXROW, nTab),
                             PaintPartFlags::Grid | PaintPartFlags::Left);
 
+    if (comphelper::LibreOfficeKit::isActive())
+        ScTabViewShell::notifyAllViewsHeaderInvalidation(ROW_HEADER, nTab);
+
     return bChanged;
 }
 


More information about the Libreoffice-commits mailing list