[Libreoffice-commits] core.git: sw/qa sw/source
Miklos Vajna (via logerrit)
logerrit at kemper.freedesktop.org
Fri Jan 29 16:06:36 UTC 2021
sw/qa/extras/tiledrendering/tiledrendering.cxx | 34 +++++++++++++++++++++++++
sw/source/core/txtnode/ndtxt.cxx | 4 ++
2 files changed, 37 insertions(+), 1 deletion(-)
New commits:
commit ccabb67d77e2bcece42434f51cf6d84d393d567c
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Fri Jan 29 09:44:04 2021 +0100
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Fri Jan 29 17:05:53 2021 +0100
sw: don't repaint all text frames on turning off a bullet for bullet numberings
This is similar to the text node deletion case, but here no text is
deleted, just a text node with bullet numbering is turned into one
without a numbering.
Again, it is not necessary to repaint all text frames of the numbering,
since the bullet char is the same for all nodes (unlike e.g. Arabic
numbering).
Change-Id: Ieb071031ca5ce0421c4120c4c89089af6c811848
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110125
Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
Tested-by: Jenkins
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index eb453e9bbec8..c82c4fe10dde 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -150,6 +150,7 @@ public:
void testSpellOnlineRenderParameter();
void testExtTextInputReadOnly();
void testBulletDeleteInvalidation();
+ void testBulletNoNumInvalidation();
CPPUNIT_TEST_SUITE(SwTiledRenderingTest);
CPPUNIT_TEST(testRegisterCallback);
@@ -225,6 +226,7 @@ public:
CPPUNIT_TEST(testSpellOnlineRenderParameter);
CPPUNIT_TEST(testExtTextInputReadOnly);
CPPUNIT_TEST(testBulletDeleteInvalidation);
+ CPPUNIT_TEST(testBulletNoNumInvalidation);
CPPUNIT_TEST_SUITE_END();
private:
@@ -2970,6 +2972,38 @@ void SwTiledRenderingTest::testBulletDeleteInvalidation()
CPPUNIT_ASSERT(!aFirstTextRect.IsOver(m_aInvalidations));
}
+void SwTiledRenderingTest::testBulletNoNumInvalidation()
+{
+ // Given a document with 3 paragraphs: all are bulleted.
+ SwXTextDocument* pXTextDocument = createDoc();
+ SwWrtShell* pWrtShell = pXTextDocument->GetDocShell()->GetWrtShell();
+ pWrtShell->StartAllAction();
+ pWrtShell->BulletOn();
+ pWrtShell->EndAllAction();
+ pWrtShell->Insert2("a");
+ pWrtShell->SplitNode();
+ pWrtShell->Insert2("b");
+ pWrtShell->SplitNode();
+ pWrtShell->GetLayout()->PaintSwFrame(*pWrtShell->GetOut(),
+ pWrtShell->GetLayout()->getFrameArea());
+ Scheduler::ProcessEventsToIdle();
+ pWrtShell->GetSfxViewShell()->registerLibreOfficeKitViewCallback(&SwTiledRenderingTest::callback, this);
+ m_aInvalidations = tools::Rectangle();
+
+ // When pressing backspace in the last paragraph to turn bullets off.
+ pWrtShell->StartAllAction();
+ pWrtShell->NumOrNoNum(/*bDelete=*/false);
+ pWrtShell->EndAllAction();
+
+ // Then the first paragraph should not be invalidated.
+ SwRootFrame* pRoot = pWrtShell->GetLayout();
+ SwFrame* pPage = pRoot->GetLower();
+ SwFrame* pBody = pPage->GetLower();
+ SwFrame* pFirstText = pBody->GetLower();
+ tools::Rectangle aFirstTextRect = pFirstText->getFrameArea().SVRect();
+ CPPUNIT_ASSERT(!aFirstTextRect.IsOver(m_aInvalidations));
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SwTiledRenderingTest);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 5516136db040..5ff9923e6bad 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -4875,8 +4875,10 @@ namespace {
});
}
- if ( mbUpdateListCount && mrTextNode.IsInList() )
+ if (mbUpdateListCount && mrTextNode.IsInList() && NeedsRenumbering(mrTextNode))
{
+ // Repaint all text frames that belong to this numbering to avoid outdated generated
+ // numbers.
mrTextNode.DoNum(
[](SwNodeNum & rNum) { rNum.InvalidateAndNotifyTree(); });
}
More information about the Libreoffice-commits
mailing list