summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2023-10-20 14:35:51 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2023-10-20 19:05:55 +0200
commit113c4566933b798e3de4daf9e276ce24cdb8e773 (patch)
tree44bf1d332cc003d61991aef2928b44fadadde857
parentb60b3b5bbcc8db61bb24d3866b48cb4c63eb4f30 (diff)
Avoid double notifications for deletion case
Follow-up to commit 34ac12dca3f5af50fddfb7c77e2943897980b815 When old redline is own Insert, and the new one is Delete, it means that it was already handled in DocumentRedlineManager::DeleteRedline. This also reverts the unit test change done in the mentioned commit. Change-Id: I77e59dceb1c880fc6ec10ad98867be3bf5282f70 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158253 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
-rw-r--r--sw/qa/extras/tiledrendering/tiledrendering.cxx10
-rw-r--r--sw/source/core/doc/DocumentRedlineManager.cxx4
2 files changed, 7 insertions, 7 deletions
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index a280c0473843..4ed5f3af6cdb 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -1652,9 +1652,9 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testRedlineUpdateCallback)
m_nRedlineTableEntryModified = 0;
pWrtShell->DelLeft();
- // Assert that we get exactly two notification about the redline update.
+ // Assert that we get exactly one notification about the redline update.
// This was 0, as LOK_CALLBACK_REDLINE_TABLE_ENTRY_MODIFIED wasn't sent.
- CPPUNIT_ASSERT_EQUAL(2, m_nRedlineTableEntryModified);
+ CPPUNIT_ASSERT_EQUAL(1, m_nRedlineTableEntryModified);
// Turn off the change tracking mode, make some modification to left of the
// redline so that its position changes
@@ -1663,18 +1663,18 @@ CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testRedlineUpdateCallback)
pWrtShell->Insert("This text is left of the redline");
// Position of the redline has changed => Modify callback
- CPPUNIT_ASSERT_EQUAL(3, m_nRedlineTableEntryModified);
+ CPPUNIT_ASSERT_EQUAL(2, m_nRedlineTableEntryModified);
pWrtShell->DelLeft();
// Deletion also emits Modify callback
- CPPUNIT_ASSERT_EQUAL(4, m_nRedlineTableEntryModified);
+ CPPUNIT_ASSERT_EQUAL(3, m_nRedlineTableEntryModified);
// Make changes to the right of the redline => no position change in redline
pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/false, 100/*Go enough right */, /*bBasicCall=*/false);
pWrtShell->Insert("This text is right of the redline");
// No Modify callbacks
- CPPUNIT_ASSERT_EQUAL(4, m_nRedlineTableEntryModified);
+ CPPUNIT_ASSERT_EQUAL(3, m_nRedlineTableEntryModified);
}
CPPUNIT_TEST_FIXTURE(SwTiledRenderingTest, testGetViewRenderState)
diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx
index 7a9af1ee8891..5ac574b54858 100644
--- a/sw/source/core/doc/DocumentRedlineManager.cxx
+++ b/sw/source/core/doc/DocumentRedlineManager.cxx
@@ -1842,8 +1842,8 @@ DocumentRedlineManager::AppendRedline(SwRangeRedline* pNewRedl, bool const bCall
delete pNewRedl;
pNewRedl = nullptr;
- if (!bDec)
- MaybeNotifyRedlineModification(*pRedl, m_rDoc);
+ // No need to call MaybeNotifyRedlineModification, because a notification
+ // was already sent in DocumentRedlineManager::DeleteRedline
break;
case SwComparePosition::Outside: