[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - sw/qa sw/source
László Németh (via logerrit)
logerrit at kemper.freedesktop.org
Wed Mar 3 09:49:51 UTC 2021
sw/qa/extras/uiwriter/uiwriter.cxx | 14 ++++++++++----
sw/source/core/edit/acorrect.cxx | 17 ++++++-----------
2 files changed, 16 insertions(+), 15 deletions(-)
New commits:
commit 84c7773c0f95ff356e669dd171f66598b78e346d
Author: László Németh <nemeth at numbertext.org>
AuthorDate: Mon Jan 4 14:05:46 2021 +0100
Commit: Gabor Kelemen <kelemen.gabor2 at nisz.hu>
CommitDate: Wed Mar 3 10:49:18 2021 +0100
tdf#106380 sw AutoCorrect: track deletion at capitalization
Deletion of the original lowercase character wasn't
tracked during sentence capitalization, resulting broken
change tracking data.
Note: for similar potential problems, see FIXME at the
end of DocumentContentOperationsManager::Overwrite().
Change-Id: If6ddbb77675d87eb126f7d3bf554b529892b88d7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108670
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth at numbertext.org>
(cherry picked from commit aecb7364713871ce068effdb59a5da68ab4b2e53)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108857
Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
(cherry picked from commit 2c25f59fae2201ef57237bf67625dcdcf238d5ed)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111875
Tested-by: Gabor Kelemen <kelemen.gabor2 at nisz.hu>
Reviewed-by: Gabor Kelemen <kelemen.gabor2 at nisz.hu>
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index d3f3461a3637..7517dc825a10 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -7492,12 +7492,15 @@ void SwUiWriterTest::testRedlineAutoCorrect()
SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
- // show tracked deletion
+ // show tracked deletion with enabled change tracking
RedlineFlags const nMode(pWrtShell->GetRedlineFlags() | RedlineFlags::On);
CPPUNIT_ASSERT(nMode & (RedlineFlags::ShowDelete | RedlineFlags::ShowInsert));
pWrtShell->SetRedlineFlags(nMode);
CPPUNIT_ASSERT(nMode & RedlineFlags::ShowDelete);
+ CPPUNIT_ASSERT_MESSAGE("redlining should be on",
+ pDoc->getIDocumentRedlineAccess().IsRedlineOn());
+
SwAutoCorrect corr(*SvxAutoCorrCfg::Get().GetAutoCorrect());
pWrtShell->AutoCorrect(corr, ' ');
sal_uLong nIndex = pWrtShell->GetCursor()->GetNode().GetIndex();
@@ -7524,7 +7527,8 @@ void SwUiWriterTest::testRedlineAutoCorrect()
nIndex = pWrtShell->GetCursor()->GetNode().GetIndex();
// This still keep the tracked deletion, capitalize only the visible text "s"
- sReplaced = "tS ";
+ // with tracked deletion of the original character
+ sReplaced = "tsS ";
CPPUNIT_ASSERT_EQUAL(sReplaced, static_cast<SwTextNode*>(pDoc->GetNodes()[nIndex])->GetText());
// repeat it with visible redlining and word auto replacement of "tset"
@@ -7534,7 +7538,8 @@ void SwUiWriterTest::testRedlineAutoCorrect()
pWrtShell->Insert("et");
pWrtShell->AutoCorrect(corr, ' ');
// This was "Ttest" removing the tracked deletion silently.
- sReplaced = "ttest ";
+ // FIXME The second patch from bug #83419 is missing from backport
+ sReplaced = "tstest ";
nIndex = pWrtShell->GetCursor()->GetNode().GetIndex();
CPPUNIT_ASSERT_EQUAL(sReplaced, static_cast<SwTextNode*>(pDoc->GetNodes()[nIndex])->GetText());
@@ -7542,7 +7547,8 @@ void SwUiWriterTest::testRedlineAutoCorrect()
dispatchCommand(mxComponent, ".uno:GoToStartOfDoc", {});
pWrtShell->Insert("a");
pWrtShell->AutoCorrect(corr, ' ');
- sReplaced = "A ttest ";
+ // FIXME The second patch from bug #83419 is missing from backport
+ sReplaced = "A tstest ";
nIndex = pWrtShell->GetCursor()->GetNode().GetIndex();
CPPUNIT_ASSERT_EQUAL(sReplaced, static_cast<SwTextNode*>(pDoc->GetNodes()[nIndex])->GetText());
}
diff --git a/sw/source/core/edit/acorrect.cxx b/sw/source/core/edit/acorrect.cxx
index fdbad84c6db3..d48adc51557f 100644
--- a/sw/source/core/edit/acorrect.cxx
+++ b/sw/source/core/edit/acorrect.cxx
@@ -281,17 +281,12 @@ bool SwAutoCorrDoc::ReplaceRange( sal_Int32 nPos, sal_Int32 nSourceLength, const
}
else
{
- if( nSourceLength != rText.getLength() )
- {
- pPam->SetMark();
- pPam->GetPoint()->nContent = std::min<sal_Int32>(
- pos.first->GetText().getLength(), pos.second + nSourceLength);
- pDoc->getIDocumentContentOperations().ReplaceRange( *pPam, rText, false );
- pPam->Exchange();
- pPam->DeleteMark();
- }
- else
- pDoc->getIDocumentContentOperations().Overwrite( *pPam, rText );
+ pPam->SetMark();
+ pPam->GetPoint()->nContent = std::min<sal_Int32>(
+ pos.first->GetText().getLength(), pos.second + nSourceLength);
+ pDoc->getIDocumentContentOperations().ReplaceRange( *pPam, rText, false );
+ pPam->Exchange();
+ pPam->DeleteMark();
}
if( m_bUndoIdInitialized )
More information about the Libreoffice-commits
mailing list