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

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Tue Apr 7 10:25:18 UTC 2020


 sw/qa/extras/uiwriter/data3/tdf130685.odt |binary
 sw/qa/extras/uiwriter/uiwriter3.cxx       |   32 +++++++++++++++++++++++++++++-
 2 files changed, 31 insertions(+), 1 deletion(-)

New commits:
commit 9977fbeed1461a8f5cfa8029c02e914c099f3230
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Mon Apr 6 14:15:53 2020 +0200
Commit:     Xisco Faulí <xiscofauli at libreoffice.org>
CommitDate: Tue Apr 7 12:24:41 2020 +0200

    tdf#130685: Add unittest
    
    Change-Id: I9f0b9a7129056ff3447e1cf91d4eaf188180a04c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91747
    Tested-by: Jenkins
    Reviewed-by: Xisco Faulí <xiscofauli at libreoffice.org>

diff --git a/sw/qa/extras/uiwriter/data3/tdf130685.odt b/sw/qa/extras/uiwriter/data3/tdf130685.odt
new file mode 100644
index 000000000000..f83827ebb7e4
Binary files /dev/null and b/sw/qa/extras/uiwriter/data3/tdf130685.odt differ
diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx
index 7b35f1a85c83..2bafcd233e8f 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -318,6 +318,36 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf130746)
     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount());
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf130685)
+{
+    load(DATA_DIRECTORY, "tdf130685.odt");
+
+    SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+    CPPUNIT_ASSERT(pTextDoc);
+
+    CPPUNIT_ASSERT_EQUAL(2, getPages());
+    dispatchCommand(mxComponent, ".uno:SelectAll", {});
+    dispatchCommand(mxComponent, ".uno:Cut", {});
+    Scheduler::ProcessEventsToIdle();
+    CPPUNIT_ASSERT_EQUAL(1, getPages());
+
+    dispatchCommand(mxComponent, ".uno:Paste", {});
+    dispatchCommand(mxComponent, ".uno:Paste", {});
+
+    // Without fix in place, this test would have failed with:
+    //- Expected: 2
+    //- Actual  : 4
+    CPPUNIT_ASSERT_EQUAL(2, getPages());
+
+    dispatchCommand(mxComponent, ".uno:Undo", {});
+    dispatchCommand(mxComponent, ".uno:Undo", {});
+    CPPUNIT_ASSERT_EQUAL(1, getPages());
+
+    //FIXME: See tdf#131147
+    //dispatchCommand(mxComponent, ".uno:Undo", {});
+    //CPPUNIT_ASSERT_EQUAL(2, getPages());
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf130680)
 {
     load(DATA_DIRECTORY, "tdf130680.odt");
@@ -337,7 +367,7 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf130680)
     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xIndexAccess->getCount());
     dispatchCommand(mxComponent, ".uno:Paste", {});
     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount());
-    //FIXME: See https://bugs.documentfoundation.org/show_bug.cgi?id=130680#c5
+    //FIXME: See tdf#131147
     //dispatchCommand(mxComponent, ".uno:Undo", {});
     //CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xIndexAccess->getCount());
     //dispatchCommand(mxComponent, ".uno:Undo", {});


More information about the Libreoffice-commits mailing list