[Libreoffice-commits] core.git: sw/qa

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Mon Jul 6 21:05:56 UTC 2020


 sw/qa/extras/uiwriter/data3/tdf134253.odt |binary
 sw/qa/extras/uiwriter/uiwriter3.cxx       |   29 +++++++++++++++++++++++++++++
 2 files changed, 29 insertions(+)

New commits:
commit 656fd1ec9123de5dbeecb8db4de5254b05c21e76
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Mon Jul 6 12:02:56 2020 +0200
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Mon Jul 6 23:05:07 2020 +0200

    tdf#134253: sw: Add unittest
    
    Change-Id: Icd930f9c632a5c44d4391ca065afbc4db166ae37
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98200
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/sw/qa/extras/uiwriter/data3/tdf134253.odt b/sw/qa/extras/uiwriter/data3/tdf134253.odt
new file mode 100644
index 000000000000..234b0bdca7ff
Binary files /dev/null and b/sw/qa/extras/uiwriter/data3/tdf134253.odt differ
diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx
index d7f20d6bd21a..d191f6e4d453 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -310,6 +310,35 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf133982)
     CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount());
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf134253)
+{
+    load(DATA_DIRECTORY, "tdf134253.odt");
+
+    SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+    CPPUNIT_ASSERT(pTextDoc);
+
+    uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
+    uno::Reference<container::XIndexAccess> xIndexAccess(xTextTablesSupplier->getTextTables(),
+                                                         uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount());
+    CPPUNIT_ASSERT_EQUAL(6, getPages());
+
+    //Use selectAll 3 times in a row
+    dispatchCommand(mxComponent, ".uno:SelectAll", {});
+    dispatchCommand(mxComponent, ".uno:SelectAll", {});
+    dispatchCommand(mxComponent, ".uno:SelectAll", {});
+
+    dispatchCommand(mxComponent, ".uno:Copy", {});
+    dispatchCommand(mxComponent, ".uno:Paste", {});
+
+    //Without the fix in place, it would have crashed here
+    dispatchCommand(mxComponent, ".uno:Undo", {});
+    Scheduler::ProcessEventsToIdle();
+
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount());
+    CPPUNIT_ASSERT_EQUAL(6, getPages());
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf76636)
 {
     load(DATA_DIRECTORY, "tdf76636.doc");


More information about the Libreoffice-commits mailing list