diff options
author | Michael Stahl <michael.stahl@allotropia.de> | 2022-05-17 16:08:39 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2022-05-25 09:27:15 +0200 |
commit | f8d171acf0ed84d011ac4579fa4fb8c1d48af215 (patch) | |
tree | a77a057b0db244dd080863eecb5bfed595118393 /sw/qa/extras/uiwriter | |
parent | fb1c3677fe929c824be42c1c60cf96f355152a89 (diff) |
tdf#147220 sw_redlinehide: update frames in ReplaceRangeImpl()
Change-Id: Ie5d62eaec01a3b06ff1bd6070510384641ea7ad3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134483
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
(cherry picked from commit 1f8795df957c18c5c06bf1d68d0d60b1d30f015d)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134448
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw/qa/extras/uiwriter')
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter.cxx | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index d38c33364803..b7593759971b 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -138,6 +138,7 @@ #include <unotxdoc.hxx> #include <comphelper/processfactory.hxx> #include <rootfrm.hxx> +#include <txtfrm.hxx> namespace { @@ -693,6 +694,43 @@ void SwUiWriterTest::testTdf67238() CPPUNIT_ASSERT(!((rTable.GetTableBox("C3"))->GetFrameFormat()->GetProtect()).IsContentProtected()); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf147220) +{ + SwDoc* pDoc = createSwDoc(); + SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + + pWrtShell->Insert(u"él"); + + // hide and enable + dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {}); + dispatchCommand(mxComponent, ".uno:TrackChanges", {}); + CPPUNIT_ASSERT(pDoc->getIDocumentRedlineAccess().IsRedlineOn()); + CPPUNIT_ASSERT( + IDocumentRedlineAccess::IsShowChanges(pDoc->getIDocumentRedlineAccess().GetRedlineFlags())); + CPPUNIT_ASSERT(pWrtShell->GetLayout()->IsHideRedlines()); + + pWrtShell->GoStartSentence(); + pWrtShell->SetMark(); + pWrtShell->GoEndSentence(); + + // this did not remove the original text from the layout + pWrtShell->Replace(u"Él", false); + + // currently the deleted text is before the replacement text, not sure if + // that is really required + CPPUNIT_ASSERT_EQUAL(OUString(u"élÉl"), + pWrtShell->GetCursor()->GetPoint()->nNode.GetNode().GetTextNode()->GetText()); + CPPUNIT_ASSERT_EQUAL(OUString(u"Él"), + static_cast<SwTextFrame const*>(pWrtShell->GetCursor()->GetPoint()->nNode.GetNode().GetTextNode()->getLayoutFrame(nullptr))->GetText()); + + SwRedlineTable const& rRedlines(pDoc->getIDocumentRedlineAccess().GetRedlineTable()); + CPPUNIT_ASSERT_EQUAL(SwRedlineTable::size_type(2), rRedlines.size()); + CPPUNIT_ASSERT_EQUAL(RedlineType::Delete, rRedlines[0]->GetType()); + CPPUNIT_ASSERT_EQUAL(OUString(u"él"), rRedlines[0]->GetText()); + CPPUNIT_ASSERT_EQUAL(RedlineType::Insert, rRedlines[1]->GetType()); + CPPUNIT_ASSERT_EQUAL(OUString(u"Él"), rRedlines[1]->GetText()); +} + CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf135978) { SwDoc* pDoc = createSwDoc(); |