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

Tamás Zolnai (via logerrit) logerrit at kemper.freedesktop.org
Wed Sep 25 10:34:04 UTC 2019


 sc/qa/unit/tiledrendering/tiledrendering.cxx |   40 ++++++++++++++++++++++-----
 sc/source/ui/view/tabview.cxx                |   38 ++++++++++++-------------
 2 files changed, 52 insertions(+), 26 deletions(-)

New commits:
commit 72b3b651705b6f5a3d1f02572148c5697af9a8a9
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Sat Sep 21 16:13:14 2019 +0200
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Wed Sep 25 12:33:15 2019 +0200

    sc lok: Test invalidation triggered by jumping horizontally on the sheet
    
    Change-Id: Ia3d3b3f3020151939b8fb1cf48635303dc49892e
    Reviewed-on: https://gerrit.libreoffice.org/79495
    Tested-by: Jenkins
    Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>

diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index 35e61c791db6..acd017773b54 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -103,6 +103,7 @@ public:
     void testSheetChangeInvalidation();
     void testInsertDeletePageInvalidation();
     void testGetRowColumnHeadersInvalidation();
+    void testJumpHorizontallyInvalidation();
 
     CPPUNIT_TEST_SUITE(ScTiledRenderingTest);
     CPPUNIT_TEST(testRowColumnSelections);
@@ -141,6 +142,7 @@ public:
     CPPUNIT_TEST(testSheetChangeInvalidation);
     CPPUNIT_TEST(testInsertDeletePageInvalidation);
     CPPUNIT_TEST(testGetRowColumnHeadersInvalidation);
+    CPPUNIT_TEST(testJumpHorizontallyInvalidation);
     CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -1783,6 +1785,33 @@ void ScTiledRenderingTest::testGetRowColumnHeadersInvalidation()
     CPPUNIT_ASSERT_EQUAL(tools::Rectangle(49725, 0, 75225, 19380), aView1.m_aInvalidations[0]);
 }
 
+void ScTiledRenderingTest::testJumpHorizontallyInvalidation()
+{
+    comphelper::LibreOfficeKit::setActive();
+
+    ScModelObj* pModelObj = createDoc("empty.ods");
+    ScViewData* pViewData = ScDocShell::GetViewData();
+    CPPUNIT_ASSERT(pViewData);
+
+    int nView1 = SfxLokHelper::getView();
+    ViewCallback aView1;
+    CPPUNIT_ASSERT(!lcl_hasEditView(*pViewData));
+
+    SfxLokHelper::setView(nView1);
+    aView1.m_bInvalidateTiles = false;
+    aView1.m_aInvalidations.clear();
+    pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::PAGEDOWN | KEY_MOD2);
+    pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::PAGEDOWN | KEY_MOD2);
+    Scheduler::ProcessEventsToIdle();
+    pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::PAGEDOWN | KEY_MOD2);
+    pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::PAGEDOWN | KEY_MOD2);
+    Scheduler::ProcessEventsToIdle();
+    CPPUNIT_ASSERT(aView1.m_bInvalidateTiles);
+    CPPUNIT_ASSERT_EQUAL(size_t(2), aView1.m_aInvalidations.size());
+    CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 0, 1000000000, 1000000000), aView1.m_aInvalidations[0]);
+    CPPUNIT_ASSERT_EQUAL(tools::Rectangle(26775, 0, 39525, 13005), aView1.m_aInvalidations[1]);
+}
+
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(ScTiledRenderingTest);
commit e740aaf876edd58c1f5c5e17af2495cad36cfc27
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Sat Sep 21 15:48:44 2019 +0200
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Wed Sep 25 12:32:53 2019 +0200

    sc lok: Optimize invalidation triggered by getRowColumnHeaders() method
    
    Don't call a full invalidation, rather use invalidation only on the new
    area. Make sure that the invalidation is called first.
    
    Change-Id: I89d1c6342ed8e95fe738a876a76ca6feda031962
    Reviewed-on: https://gerrit.libreoffice.org/79494
    Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>
    Tested-by: Tamás Zolnai <tamas.zolnai at collabora.com>

diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index a22cca344966..35e61c791db6 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -1761,9 +1761,8 @@ void ScTiledRenderingTest::testGetRowColumnHeadersInvalidation()
     pModelObj->getRowColumnHeaders(tools::Rectangle(0, 15, 19650, 5400));
     Scheduler::ProcessEventsToIdle();
     CPPUNIT_ASSERT(aView1.m_bInvalidateTiles);
-    CPPUNIT_ASSERT_EQUAL(size_t(2), aView1.m_aInvalidations.size());
-    CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 0, 1000000000, 1000000000), aView1.m_aInvalidations[0]);
-    CPPUNIT_ASSERT_EQUAL(tools::Rectangle(26775, 0, 49725, 13005), aView1.m_aInvalidations[1]);
+    CPPUNIT_ASSERT_EQUAL(size_t(1), aView1.m_aInvalidations.size());
+    CPPUNIT_ASSERT_EQUAL(tools::Rectangle(26775, 0, 49725, 13005), aView1.m_aInvalidations[0]);
 
     // Extend area top-to-bottom
     aView1.m_bInvalidateTiles = false;
@@ -1771,9 +1770,8 @@ void ScTiledRenderingTest::testGetRowColumnHeadersInvalidation()
     pModelObj->getRowColumnHeaders(tools::Rectangle(0, 5400, 19650, 9800));
     Scheduler::ProcessEventsToIdle();
     CPPUNIT_ASSERT(aView1.m_bInvalidateTiles);
-    CPPUNIT_ASSERT_EQUAL(size_t(2), aView1.m_aInvalidations.size());
-    CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 0, 1000000000, 1000000000), aView1.m_aInvalidations[0]);
-    CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 13005, 49725, 19380), aView1.m_aInvalidations[1]);
+    CPPUNIT_ASSERT_EQUAL(size_t(1), aView1.m_aInvalidations.size());
+    CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 13005, 49725, 19380), aView1.m_aInvalidations[0]);
 
     // Extend area left-to-right
     aView1.m_bInvalidateTiles = false;
@@ -1781,9 +1779,8 @@ void ScTiledRenderingTest::testGetRowColumnHeadersInvalidation()
     pModelObj->getRowColumnHeaders(tools::Rectangle(5400, 5400, 25050, 9800));
     Scheduler::ProcessEventsToIdle();
     CPPUNIT_ASSERT(aView1.m_bInvalidateTiles);
-    CPPUNIT_ASSERT_EQUAL(size_t(2), aView1.m_aInvalidations.size());
-    CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 0, 1000000000, 1000000000), aView1.m_aInvalidations[0]);
-    CPPUNIT_ASSERT_EQUAL(tools::Rectangle(49725, 0, 75225, 19380), aView1.m_aInvalidations[1]);
+    CPPUNIT_ASSERT_EQUAL(size_t(1), aView1.m_aInvalidations.size());
+    CPPUNIT_ASSERT_EQUAL(tools::Rectangle(49725, 0, 75225, 19380), aView1.m_aInvalidations[0]);
 }
 
 }
diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index 5116fd17e6fc..8e83b17ed267 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -2555,14 +2555,6 @@ OUString ScTabView::getRowColumnHeaders(const tools::Rectangle& rRectangle)
         SAL_INFO("sc.lok.header", "Row Header: a new height: " << aNewSize.Height());
         if (pDocSh)
         {
-            // Provide size in the payload, so clients don't have to
-            // call lok::Document::getDocumentSize().
-            std::stringstream ss;
-            ss << aNewSize.Width() << ", " << aNewSize.Height();
-            OString sSize = ss.str().c_str();
-            ScModelObj* pModel = comphelper::getUnoTunnelImplementation<ScModelObj>(aViewData.GetViewShell()->GetCurrentDocument());
-            SfxLokHelper::notifyDocumentSizeChanged(aViewData.GetViewShell(), sSize, pModel);
-
             // New area extended to the bottom of the sheet after last row
             // excluding overlapping area with aNewColArea
             tools::Rectangle aNewRowArea(0, aOldSize.getHeight(), aOldSize.getWidth(), aNewSize.getHeight());
@@ -2573,6 +2565,14 @@ OUString ScTabView::getRowColumnHeaders(const tools::Rectangle& rRectangle)
                 UpdateSelectionOverlay();
                 SfxLokHelper::notifyInvalidation(aViewData.GetViewShell(), aNewRowArea.toString());
             }
+
+            // Provide size in the payload, so clients don't have to
+            // call lok::Document::getDocumentSize().
+            std::stringstream ss;
+            ss << aNewSize.Width() << ", " << aNewSize.Height();
+            OString sSize = ss.str().c_str();
+            ScModelObj* pModel = comphelper::getUnoTunnelImplementation<ScModelObj>(aViewData.GetViewShell()->GetCurrentDocument());
+            SfxLokHelper::notifyDocumentSizeChanged(aViewData.GetViewShell(), sSize, pModel, false);
         }
     }
 
@@ -2697,17 +2697,6 @@ OUString ScTabView::getRowColumnHeaders(const tools::Rectangle& rRectangle)
 
         if (pDocSh)
         {
-            if (aOldSize != aNewSize)
-            {
-                // Provide size in the payload, so clients don't have to
-                // call lok::Document::getDocumentSize().
-                std::stringstream ss;
-                ss << aNewSize.Width() << ", " << aNewSize.Height();
-                OString sSize = ss.str().c_str();
-                ScModelObj* pModel = comphelper::getUnoTunnelImplementation<ScModelObj>(aViewData.GetViewShell()->GetCurrentDocument());
-                SfxLokHelper::notifyDocumentSizeChanged(aViewData.GetViewShell(), sSize, pModel);
-            }
-
             // New area extended to the right of the sheet after last column
             // including overlapping area with aNewRowArea
             tools::Rectangle aNewColArea(aOldSize.getWidth(), 0, aNewSize.getWidth(), aNewSize.getHeight());
@@ -2718,6 +2707,17 @@ OUString ScTabView::getRowColumnHeaders(const tools::Rectangle& rRectangle)
                 UpdateSelectionOverlay();
                 SfxLokHelper::notifyInvalidation(aViewData.GetViewShell(), aNewColArea.toString());
             }
+
+            if (aOldSize != aNewSize)
+            {
+                // Provide size in the payload, so clients don't have to
+                // call lok::Document::getDocumentSize().
+                std::stringstream ss;
+                ss << aNewSize.Width() << ", " << aNewSize.Height();
+                OString sSize = ss.str().c_str();
+                ScModelObj* pModel = comphelper::getUnoTunnelImplementation<ScModelObj>(aViewData.GetViewShell()->GetCurrentDocument());
+                SfxLokHelper::notifyDocumentSizeChanged(aViewData.GetViewShell(), sSize, pModel, false);
+            }
         }
     }
 


More information about the Libreoffice-commits mailing list