diff options
author | László Németh <nemeth@numbertext.org> | 2022-02-28 12:35:27 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2022-03-09 09:17:16 +0100 |
commit | 3c74e964d45d6b5d93a701b21e63720ad4ec35c3 (patch) | |
tree | 3f406e7e9dbc7188a46a7e4d5a23a9cbe2a02986 /sw/qa/extras/uiwriter | |
parent | da4ade51efe0b444094ceafce129972432f73405 (diff) |
tdf#146962 sw: hide deleted row at deletion in Hide Changes
In Hide Changes mode, deleting table rows with change tracking
wasn't applied on the table layout immediately, only using Show
Changes and Hide Changes again. Now the deleted row removed from
the table instead leaving an empty table row (except the last
row of a wholly deleted table).
See also commit 95213407dfcbf34056037d60243ff915340d1a2e
"tdf#146622 sw crash fix: don't delete already deleted rows".
Change-Id: I864957cafa38e631a65db0670c7b566cb689f4cd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130701
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
(cherry picked from commit a74c51025fa4519caaf461492e4ed8e68bd34885)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130685
Tested-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sw/qa/extras/uiwriter')
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter3.cxx | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx index d2123c33b20c..a7db089432e0 100644 --- a/sw/qa/extras/uiwriter/uiwriter3.cxx +++ b/sw/qa/extras/uiwriter/uiwriter3.cxx @@ -48,6 +48,7 @@ #include <IDocumentFieldsAccess.hxx> #include <IDocumentLinksAdministration.hxx> #include <IDocumentRedlineAccess.hxx> +#include <rootfrm.hxx> namespace { @@ -1943,6 +1944,51 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf146622) CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTables->getCount()); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf146962) +{ + // load a 2-row table, set Hide Changes mode and delete the first row with change tracking + SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf116789.fodt"); + CPPUNIT_ASSERT(pDoc); + SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + CPPUNIT_ASSERT(pWrtShell); + + // enable redlining + dispatchCommand(mxComponent, ".uno:TrackChanges", {}); + CPPUNIT_ASSERT_MESSAGE("redlining should be on", + pDoc->getIDocumentRedlineAccess().IsRedlineOn()); + // hide changes + dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {}); + CPPUNIT_ASSERT(pWrtShell->GetLayout()->IsHideRedlines()); + + dispatchCommand(mxComponent, ".uno:DeleteRows", {}); + + // Without the fix in place, the deleted row would be visible + + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); + // This was 2 + assertXPath(pXmlDoc, "/root/page[1]/body/tab/row", 1); + + // check it in Show Changes mode + + dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {}); + CPPUNIT_ASSERT(!pWrtShell->GetLayout()->IsHideRedlines()); + + discardDumpedLayout(); + pXmlDoc = parseLayoutDump(); + // 2 rows are visible now + assertXPath(pXmlDoc, "/root/page[1]/body/tab/row", 2); + + // check it in Hide Changes mode again + + dispatchCommand(mxComponent, ".uno:ShowTrackedChanges", {}); + CPPUNIT_ASSERT(pWrtShell->GetLayout()->IsHideRedlines()); + + discardDumpedLayout(); + pXmlDoc = parseLayoutDump(); + // only a single row is visible again + assertXPath(pXmlDoc, "/root/page[1]/body/tab/row", 1); +} + CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf135014) { createSwDoc(); |