[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - 2 commits - sc/qa sc/source sd/qa
Tamás Zolnai (via logerrit)
logerrit at kemper.freedesktop.org
Thu Sep 26 18:01:21 UTC 2019
sc/qa/unit/tiledrendering/tiledrendering.cxx | 11 +++++-
sc/source/ui/view/tabview5.cxx | 8 ++++-
sd/qa/unit/tiledrendering/tiledrendering.cxx | 43 +++++++++++++++++++++++++++
3 files changed, 59 insertions(+), 3 deletions(-)
New commits:
commit 61a3956d71e0c120b0d918d5181e75263e06ee28
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Thu Sep 26 11:37:11 2019 +0200
Commit: Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Thu Sep 26 20:00:37 2019 +0200
sc lok: Optimize invalidation triggered by ScTabView::TabChanged() method
We don't need to invalidate all parts of the document. It's enough to
invalidate only that sheet which we changed to.
Reviewed-on: https://gerrit.libreoffice.org/79500
Tested-by: Jenkins
Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>
(cherry picked from commit 96bd7504165f89ec5485d00a487e54634af347ce)
Change-Id: I2c3aeb226c83bef473b0b33444b625e93d111b01
Reviewed-on: https://gerrit.libreoffice.org/79626
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 5b37123f301a..1ae084e5eb49 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -453,6 +453,7 @@ public:
bool m_bFullInvalidateTiles;
bool m_bInvalidateTiles;
std::vector<tools::Rectangle> m_aInvalidations;
+ std::vector<int> m_aInvalidationsParts;
bool m_bViewLock;
OString m_sCellFormula;
boost::property_tree::ptree m_aCommentCallbackResult;
@@ -528,6 +529,8 @@ public:
aInvalidationRect.setWidth(aSeq[2].toInt32());
aInvalidationRect.setHeight(aSeq[3].toInt32());
m_aInvalidations.push_back(aInvalidationRect);
+ if (aSeq.getLength() == 5)
+ m_aInvalidationsParts.push_back(aSeq[4].toInt32());
m_bInvalidateTiles = true;
}
}
@@ -1743,12 +1746,16 @@ void ScTiledRenderingTest::testSheetChangeInvalidation()
SfxLokHelper::setView(nView1);
aView1.m_bInvalidateTiles = false;
aView1.m_aInvalidations.clear();
+ aView1.m_aInvalidationsParts.clear();
pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::PAGEDOWN | KEY_MOD1);
pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::PAGEDOWN | KEY_MOD1);
Scheduler::ProcessEventsToIdle();
CPPUNIT_ASSERT(aView1.m_bInvalidateTiles);
- CPPUNIT_ASSERT_EQUAL(size_t(3), aView1.m_aInvalidations.size());
+ CPPUNIT_ASSERT_EQUAL(size_t(2), aView1.m_aInvalidations.size());
CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 0, 1310720, 268435456), aView1.m_aInvalidations[0]);
+ CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 0, 1000000000, 1000000000), aView1.m_aInvalidations[1]);
+ CPPUNIT_ASSERT_EQUAL(size_t(1), aView1.m_aInvalidationsParts.size());
+ CPPUNIT_ASSERT_EQUAL(pModelObj->getPart(), aView1.m_aInvalidationsParts[0]);
}
void ScTiledRenderingTest::testInsertDeletePageInvalidation()
@@ -1777,7 +1784,7 @@ void ScTiledRenderingTest::testInsertDeletePageInvalidation()
comphelper::dispatchCommand(".uno:Insert", aArgs);
Scheduler::ProcessEventsToIdle();
CPPUNIT_ASSERT(aView1.m_bInvalidateTiles);
- CPPUNIT_ASSERT_EQUAL(size_t(8), aView1.m_aInvalidations.size());
+ CPPUNIT_ASSERT_EQUAL(size_t(6), aView1.m_aInvalidations.size());
CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 0, 1000000000, 1000000000), aView1.m_aInvalidations[0]);
CPPUNIT_ASSERT_EQUAL(2, pModelObj->getParts());
diff --git a/sc/source/ui/view/tabview5.cxx b/sc/source/ui/view/tabview5.cxx
index d98716d57aad..b8736dd6d6e5 100644
--- a/sc/source/ui/view/tabview5.cxx
+++ b/sc/source/ui/view/tabview5.cxx
@@ -332,8 +332,14 @@ void ScTabView::TabChanged( bool bSameTabButMoved )
ss << aDocSize.Width() << ", " << aDocSize.Height();
OString sRect = ss.str().c_str();
ScTabViewShell* pViewShell = aViewData.GetViewShell();
+
+ // Invalidate first
+ tools::Rectangle aRectangle(0, 0, 1000000000, 1000000000);
+ OString sPayload = aRectangle.toString() + OString(", ") + OString::number(aViewData.GetTabNo());
+ pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_TILES, sPayload.getStr());
+
ScModelObj* pModel = ScModelObj::getImplementation(pViewShell->GetCurrentDocument());
- SfxLokHelper::notifyDocumentSizeChanged(pViewShell, sRect, pModel);
+ SfxLokHelper::notifyDocumentSizeChanged(pViewShell, sRect, pModel, false);
}
}
}
commit 3a8124d5ce9c45a14edb88c5614d994e4dbfc225
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Sun Sep 22 13:21:46 2019 +0200
Commit: Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Thu Sep 26 20:00:27 2019 +0200
sd lok: Test invalidation after adding\removing slide
Reviewed-on: https://gerrit.libreoffice.org/79499
Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>
Tested-by: Tamás Zolnai <tamas.zolnai at collabora.com>
(cherry picked from commit 2984856798d8ad98b96e6a57bfcc701bc52876e8)
Change-Id: I4677d78b1bfad36a7b3bde4651b9900e617b6422
Reviewed-on: https://gerrit.libreoffice.org/79625
Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>
Tested-by: Tamás Zolnai <tamas.zolnai at collabora.com>
diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index d9797587ae21..6a3837897bbb 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -117,6 +117,7 @@ public:
void testTdf115873Group();
void testCutSelectionChange();
void testLanguageAllText();
+ void testInsertDeletePageInvalidation();
CPPUNIT_TEST_SUITE(SdTiledRenderingTest);
CPPUNIT_TEST(testRegisterCallback);
@@ -164,6 +165,7 @@ public:
CPPUNIT_TEST(testTdf115873Group);
CPPUNIT_TEST(testCutSelectionChange);
CPPUNIT_TEST(testLanguageAllText);
+ CPPUNIT_TEST(testInsertDeletePageInvalidation);
CPPUNIT_TEST_SUITE_END();
@@ -931,6 +933,7 @@ public:
bool m_bCursorVisibleChanged;
bool m_bViewLock;
bool m_bTilesInvalidated;
+ std::vector<tools::Rectangle> m_aInvalidations;
std::map<int, bool> m_aViewCursorInvalidations;
std::map<int, bool> m_aViewCursorVisibilities;
bool m_bViewSelectionSet;
@@ -959,6 +962,18 @@ public:
case LOK_CALLBACK_INVALIDATE_TILES:
{
m_bTilesInvalidated = true;
+ OString text(pPayload);
+ if (!text.startsWith("EMPTY"))
+ {
+ uno::Sequence<OUString> aSeq = comphelper::string::convertCommaSeparated(OUString::createFromAscii(pPayload));
+ CPPUNIT_ASSERT(aSeq.getLength() == 4 || aSeq.getLength() == 5);
+ tools::Rectangle aInvalidationRect;
+ aInvalidationRect.setX(aSeq[0].toInt32());
+ aInvalidationRect.setY(aSeq[1].toInt32());
+ aInvalidationRect.setWidth(aSeq[2].toInt32());
+ aInvalidationRect.setHeight(aSeq[3].toInt32());
+ m_aInvalidations.push_back(aInvalidationRect);
+ }
}
break;
case LOK_CALLBACK_GRAPHIC_SELECTION:
@@ -2168,6 +2183,34 @@ void SdTiledRenderingTest::testCutSelectionChange()
CPPUNIT_ASSERT_EQUAL(static_cast<std::size_t>(0), m_aSelection.size());
}
+void SdTiledRenderingTest::testInsertDeletePageInvalidation()
+{
+ // Load the document.
+ comphelper::LibreOfficeKit::setActive();
+ SdXImpressDocument* pXImpressDocument = createDoc("dummy.odp");
+ ViewCallback aView1;
+ SfxViewShell::Current()->registerLibreOfficeKitViewCallback(&ViewCallback::callback, &aView1);
+ CPPUNIT_ASSERT_EQUAL(8, pXImpressDocument->getParts());
+
+ // Insert slide
+ aView1.m_bTilesInvalidated = false;
+ aView1.m_aInvalidations.clear();
+ comphelper::dispatchCommand(".uno:InsertPage", uno::Sequence<beans::PropertyValue>());
+ Scheduler::ProcessEventsToIdle();
+ CPPUNIT_ASSERT(aView1.m_bTilesInvalidated);
+ CPPUNIT_ASSERT_EQUAL(9, pXImpressDocument->getParts());
+ CPPUNIT_ASSERT_EQUAL(size_t(9), aView1.m_aInvalidations.size());
+
+ // Delete slide
+ aView1.m_bTilesInvalidated = false;
+ aView1.m_aInvalidations.clear();
+ comphelper::dispatchCommand(".uno:DeletePage", uno::Sequence<beans::PropertyValue>());
+ Scheduler::ProcessEventsToIdle();
+ CPPUNIT_ASSERT(aView1.m_bTilesInvalidated);
+ CPPUNIT_ASSERT_EQUAL(8, pXImpressDocument->getParts());
+ CPPUNIT_ASSERT_EQUAL(size_t(8), aView1.m_aInvalidations.size());
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SdTiledRenderingTest);
CPPUNIT_PLUGIN_IMPLEMENT();
More information about the Libreoffice-commits
mailing list