sc/qa/unit/tiledrendering/tiledrendering.cxx | 55 +++++++++++++++++++++++++++ sc/source/ui/view/tabview3.cxx | 16 +++---- 2 files changed, 63 insertions(+), 8 deletions(-)
New commits: commit b3e6b97dfc11378a39e78d7335b64a9179e4fb72 Author: Tamás Zolnai <tamas.zol...@collabora.com> AuthorDate: Fri Sep 27 19:35:47 2019 +0200 Commit: Tamás Zolnai <tamas.zol...@collabora.com> CommitDate: Sat Sep 28 03:32:45 2019 +0200 sc lok: Optimize invalidation triggered by ScTabView::SetCursor() method Don't call a full invalidation, rather use invalidation only on the new area. Make sure that the invalidation is called first. Reviewed-on: https://gerrit.libreoffice.org/79497 Tested-by: Jenkins Reviewed-by: Tamás Zolnai <tamas.zol...@collabora.com> (cherry picked from commit db0e7e3715bdef7ad6c1f536e9cf1ea84773fbe8) Change-Id: Ibdcc71a81f852acbd40a710204540ebd8df77907 Reviewed-on: https://gerrit.libreoffice.org/79623 Reviewed-by: Tamás Zolnai <tamas.zol...@collabora.com> Tested-by: Tamás Zolnai <tamas.zol...@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/79766 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index ff6078ab5092..685b36659845 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -1848,9 +1848,8 @@ void ScTiledRenderingTest::testJumpHorizontallyInvalidation() 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_ASSERT_EQUAL(size_t(1), aView1.m_aInvalidations.size()); + CPPUNIT_ASSERT_EQUAL(tools::Rectangle(26775, 0, 39525, 13005), aView1.m_aInvalidations[0]); } void ScTiledRenderingTest::testJumpToLastRowInvalidation() @@ -1873,9 +1872,8 @@ void ScTiledRenderingTest::testJumpToLastRowInvalidation() pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::DOWN | KEY_MOD1); 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, 26775, 127500255), aView1.m_aInvalidations[1]); + CPPUNIT_ASSERT_EQUAL(size_t(1), aView1.m_aInvalidations.size()); + CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 13005, 26775, 127500255), aView1.m_aInvalidations[0]); } } diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx index f64b8d35ecfe..ab357ccf9463 100644 --- a/sc/source/ui/view/tabview3.cxx +++ b/sc/source/ui/view/tabview3.cxx @@ -382,14 +382,6 @@ void ScTabView::SetCursor( SCCOL nPosX, SCROW nPosY, bool bNew ) 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 = ScModelObj::getImplementation(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()); @@ -408,6 +400,14 @@ void ScTabView::SetCursor( SCCOL nPosX, SCROW nPosY, bool bNew ) { 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 = ScModelObj::getImplementation(aViewData.GetViewShell()->GetCurrentDocument()); + SfxLokHelper::notifyDocumentSizeChanged(aViewData.GetViewShell(), sSize, pModel, false); } } } commit 5f815b40febe224b9f0a96bb9b8b5478b9f9d952 Author: Tamás Zolnai <tamas.zol...@collabora.com> AuthorDate: Sat Sep 21 16:39:46 2019 +0200 Commit: Tamás Zolnai <tamas.zol...@collabora.com> CommitDate: Sat Sep 28 03:32:38 2019 +0200 sc lok: Test invalidation triggered by jumping to the last row on the sheet Reviewed-on: https://gerrit.libreoffice.org/79496 Reviewed-by: Tamás Zolnai <tamas.zol...@collabora.com> Tested-by: Tamás Zolnai <tamas.zol...@collabora.com> (cherry picked from commit b929d645ad1b0959c1491629dc88d3124794f922) Change-Id: I27e9a1cea465fab2c129754b2ebba978919c2bca Reviewed-on: https://gerrit.libreoffice.org/79622 Reviewed-by: Tamás Zolnai <tamas.zol...@collabora.com> Tested-by: Tamás Zolnai <tamas.zol...@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/79765 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index 256364e5940f..ff6078ab5092 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -104,6 +104,7 @@ public: void testInsertDeletePageInvalidation(); void testGetRowColumnHeadersInvalidation(); void testJumpHorizontallyInvalidation(); + void testJumpToLastRowInvalidation(); CPPUNIT_TEST_SUITE(ScTiledRenderingTest); CPPUNIT_TEST(testRowColumnSelections); @@ -142,6 +143,7 @@ public: CPPUNIT_TEST(testInsertDeletePageInvalidation); CPPUNIT_TEST(testGetRowColumnHeadersInvalidation); CPPUNIT_TEST(testJumpHorizontallyInvalidation); + CPPUNIT_TEST(testJumpToLastRowInvalidation); CPPUNIT_TEST_SUITE_END(); private: @@ -1851,6 +1853,31 @@ void ScTiledRenderingTest::testJumpHorizontallyInvalidation() CPPUNIT_ASSERT_EQUAL(tools::Rectangle(26775, 0, 39525, 13005), aView1.m_aInvalidations[1]); } +void ScTiledRenderingTest::testJumpToLastRowInvalidation() +{ + comphelper::LibreOfficeKit::setActive(); + + ScModelObj* pModelObj = createDoc("empty.ods"); + ScViewData* pViewData = ScDocShell::GetViewData(); + CPPUNIT_ASSERT(pViewData); + + int nView1 = SfxLokHelper::getView(); + ViewCallback aView1; + SfxViewShell::Current()->registerLibreOfficeKitViewCallback(&ViewCallback::callback, &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::DOWN | KEY_MOD1); + pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::DOWN | KEY_MOD1); + 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, 26775, 127500255), aView1.m_aInvalidations[1]); +} + } CPPUNIT_TEST_SUITE_REGISTRATION(ScTiledRenderingTest); commit 413258b7251781f9035da3991ac40a66d1667163 Author: Tamás Zolnai <tamas.zol...@collabora.com> AuthorDate: Sat Sep 21 16:13:14 2019 +0200 Commit: Tamás Zolnai <tamas.zol...@collabora.com> CommitDate: Sat Sep 28 03:32:31 2019 +0200 sc lok: Test invalidation triggered by jumping horizontally on the sheet Reviewed-on: https://gerrit.libreoffice.org/79495 Tested-by: Jenkins Reviewed-by: Tamás Zolnai <tamas.zol...@collabora.com> (cherry picked from commit 72b3b651705b6f5a3d1f02572148c5697af9a8a9) Change-Id: Ia3d3b3f3020151939b8fb1cf48635303dc49892e Reviewed-on: https://gerrit.libreoffice.org/79621 Reviewed-by: Tamás Zolnai <tamas.zol...@collabora.com> Tested-by: Tamás Zolnai <tamas.zol...@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/79764 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index f88070b065b0..256364e5940f 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); @@ -140,6 +141,7 @@ public: CPPUNIT_TEST(testSheetChangeInvalidation); CPPUNIT_TEST(testInsertDeletePageInvalidation); CPPUNIT_TEST(testGetRowColumnHeadersInvalidation); + CPPUNIT_TEST(testJumpHorizontallyInvalidation); CPPUNIT_TEST_SUITE_END(); private: @@ -1821,6 +1823,34 @@ 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; + SfxViewShell::Current()->registerLibreOfficeKitViewCallback(&ViewCallback::callback, &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); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits