diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2020-09-22 11:14:03 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2020-09-22 13:14:09 +0200 |
commit | 4bc8c14c34232bb31edf0cb67c971f2d40dd7fdd (patch) | |
tree | 72b36c2dfefc6b211afebfdb678ee2479d707d02 /sw | |
parent | de74d98c58db604aafc0ee623c252f3aa25ac4b7 (diff) |
tdf#134227: sw_uiwriter: Add unittest
Change-Id: I473ab1ea5ccc603c6086189075db49c224d33743
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103149
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/uiwriter/data3/tdf134227.docx | bin | 0 -> 19455 bytes | |||
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter3.cxx | 31 |
2 files changed, 31 insertions, 0 deletions
diff --git a/sw/qa/extras/uiwriter/data3/tdf134227.docx b/sw/qa/extras/uiwriter/data3/tdf134227.docx Binary files differnew file mode 100644 index 000000000000..e5228e6ca52f --- /dev/null +++ b/sw/qa/extras/uiwriter/data3/tdf134227.docx diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx index dca99f9e3c4c..b3eda5512555 100644 --- a/sw/qa/extras/uiwriter/uiwriter3.cxx +++ b/sw/qa/extras/uiwriter/uiwriter3.cxx @@ -73,6 +73,37 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf129382) CPPUNIT_ASSERT_EQUAL(8, getShapes()); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf134227) +{ + load(DATA_DIRECTORY, "tdf134227.docx"); + + SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); + CPPUNIT_ASSERT(pTextDoc); + + CPPUNIT_ASSERT_EQUAL(4, getShapes()); + + dispatchCommand(mxComponent, ".uno:SelectAll", {}); + dispatchCommand(mxComponent, ".uno:SelectAll", {}); + + // Without the fix in place, it would have crashed here + SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); + rtl::Reference<SwTransferable> xTransfer = new SwTransferable(*pWrtShell); + xTransfer->Cut(); + + CPPUNIT_ASSERT_EQUAL(0, getShapes()); + + TransferableDataHelper aHelper(xTransfer.get()); + SwTransferable::Paste(*pWrtShell, aHelper); + + CPPUNIT_ASSERT_EQUAL(4, getShapes()); + + dispatchCommand(mxComponent, ".uno:Undo", {}); + CPPUNIT_ASSERT_EQUAL(0, getShapes()); + + dispatchCommand(mxComponent, ".uno:Undo", {}); + CPPUNIT_ASSERT_EQUAL(4, getShapes()); +} + CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf135412) { load(DATA_DIRECTORY, "tdf135412.docx"); |