summaryrefslogtreecommitdiff
path: root/sw/qa
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2021-02-01 10:09:19 +0100
committerMiklos Vajna <vmiklos@collabora.com>2021-02-01 13:56:28 +0100
commitca9a84f82d2b2790a0ffc49d1e0157ff93852817 (patch)
treee1d502b87fa9b819fad1fd1ffd7b10e6cc9b5622 /sw/qa
parent46db5807b88547a7219db78f38932114ec483167 (diff)
sw: don't repaint all text frames on selecting and deleting several bullets
This is similar to disabling bullets for a paragraph, but in this case the text nodes are deleted as well. It seems to me that both invalidations are only useful in the numberging (e.g. Arabic) case, and not in the bullet case. (cherry picked from commit e267fe1a3dffc39bf5076dd6413ed3b0e698378c) Change-Id: Ie03e2847e5e50d9464399f4ea0840910e43a663a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110247 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw/qa')
-rw-r--r--sw/qa/extras/tiledrendering/tiledrendering.cxx38
1 files changed, 38 insertions, 0 deletions
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index 732ebc7bcf09..4b9e133c3a52 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -137,6 +137,7 @@ public:
void testExtTextInputReadOnly();
void testBulletDeleteInvalidation();
void testBulletNoNumInvalidation();
+ void testBulletMultiDeleteInvalidation();
CPPUNIT_TEST_SUITE(SwTiledRenderingTest);
CPPUNIT_TEST(testRegisterCallback);
@@ -210,6 +211,7 @@ public:
CPPUNIT_TEST(testExtTextInputReadOnly);
CPPUNIT_TEST(testBulletDeleteInvalidation);
CPPUNIT_TEST(testBulletNoNumInvalidation);
+ CPPUNIT_TEST(testBulletMultiDeleteInvalidation);
CPPUNIT_TEST_SUITE_END();
private:
@@ -2901,6 +2903,42 @@ void SwTiledRenderingTest::testBulletNoNumInvalidation()
CPPUNIT_ASSERT(!aFirstTextRect.IsOver(m_aInvalidations));
}
+void SwTiledRenderingTest::testBulletMultiDeleteInvalidation()
+{
+ // Given a document with 5 paragraphs: all are bulleted.
+ SwXTextDocument* pXTextDocument = createDoc();
+ SwWrtShell* pWrtShell = pXTextDocument->GetDocShell()->GetWrtShell();
+ pWrtShell->StartAllAction();
+ pWrtShell->BulletOn();
+ pWrtShell->EndAllAction();
+ // There is alredy an initial text node, so type 5 times, but split 4 times.
+ for (int i = 0; i < 4; ++i)
+ {
+ pWrtShell->Insert2("a");
+ pWrtShell->SplitNode();
+ }
+ pWrtShell->Insert2("a");
+ // Go to the end of the 4th para.
+ pWrtShell->Up(/*bSelect=*/false);
+ pWrtShell->GetLayout()->PaintSwFrame(*pWrtShell->GetOut(),
+ pWrtShell->GetLayout()->getFrameArea());
+ Scheduler::ProcessEventsToIdle();
+ pWrtShell->GetSfxViewShell()->registerLibreOfficeKitViewCallback(&SwTiledRenderingTest::callback, this);
+ m_aInvalidations = tools::Rectangle();
+
+ // When selecting and deleting several bullets: select till the end of the 2nd para and delete.
+ pWrtShell->Up(/*bSelect=*/true, /*nCount=*/2);
+ pWrtShell->DelRight();
+
+ // 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();