diff options
author | László Németh <nemeth@numbertext.org> | 2022-01-24 17:37:09 +0100 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2022-01-25 12:18:23 +0100 |
commit | 5e8aa259e48d5602b932353bb146ebb523982cf2 (patch) | |
tree | 0549d07d7fa9785487272cf7a29e21b1b87ea187 /sw/qa | |
parent | 9446b3ccd1240dbd44cbe1f1ccdfca04b61c85af (diff) |
tdf#146967 sw table: fix freezing in Hide Changes mode
During change tracking, drag & drop or Cut & Paste a
table row resulted freezing in Hide Changes mode.
Test: In Hide Changes mode, select a table row by
clicking on their left border, and drag & drop or
Cut & Paste it in a different table row.
Regression from commit 5a1c19624eda0c8b847af0dcee70b82502578ceb.
Follow-up to commit 5a1c19624eda0c8b847af0dcee70b82502578ceb
tdf#146965 sw track changes: fix tracked table row moving
Change-Id: Iab606ce036fedcc70e42638e3ccf804c9dbca064
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128875
Tested-by: László Németh <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sw/qa')
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter2.cxx | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx index 157891b1b363..a1fc810fafec 100644 --- a/sw/qa/extras/uiwriter/uiwriter2.cxx +++ b/sw/qa/extras/uiwriter/uiwriter2.cxx @@ -5110,6 +5110,52 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testPasteTrackedTableRow) CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTable->getRows()->getCount()); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testPasteTrackedTableRowInHideChangesMode) +{ + // load a 1-row table + SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf118311.fodt"); + + // turn on red-lining and show changes + pDoc->getIDocumentRedlineAccess().SetRedlineFlags(RedlineFlags::On); + CPPUNIT_ASSERT_MESSAGE("redlining should be on", + pDoc->getIDocumentRedlineAccess().IsRedlineOn()); + CPPUNIT_ASSERT_MESSAGE("redlines should be invisible", + !IDocumentRedlineAccess::IsShowChanges( + pDoc->getIDocumentRedlineAccess().GetRedlineFlags())); + + // check table count + uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), + uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTables->getCount()); + + // check table row count + uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTable->getRows()->getCount()); + + // copy table row and paste it by Paste Special->Rows Above + dispatchCommand(mxComponent, ".uno:SelectTable", {}); + dispatchCommand(mxComponent, ".uno:Copy", {}); + dispatchCommand(mxComponent, ".uno:Escape", {}); + + // This resulted freezing + dispatchCommand(mxComponent, ".uno:PasteRowsBefore", {}); + + // 2-row table + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTable->getRows()->getCount()); + + // This was 2 (inserted as a nested table in the first cell of the new row) + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTables->getCount()); + + dispatchCommand(mxComponent, ".uno:Undo", {}); + dispatchCommand(mxComponent, ".uno:Undo", {}); + dispatchCommand(mxComponent, ".uno:Undo", {}); // FIXME Why 3 Undos? + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTable->getRows()->getCount()); + + dispatchCommand(mxComponent, ".uno:Redo", {}); + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTable->getRows()->getCount()); +} + CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf145091) { // load a deleted table, reject them, and delete only its text and export to DOCX |