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

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Wed Mar 18 13:12:33 UTC 2020


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

New commits:
commit b705be7c8c28c4e1c1263e476b7b9cb0d6cee089
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Wed Mar 18 11:37:34 2020 +0100
Commit:     Xisco Faulí <xiscofauli at libreoffice.org>
CommitDate: Wed Mar 18 14:12:10 2020 +0100

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

diff --git a/sw/qa/extras/uiwriter/data3/tdf130746.odt b/sw/qa/extras/uiwriter/data3/tdf130746.odt
new file mode 100644
index 000000000000..7fcbec95b0a8
Binary files /dev/null and b/sw/qa/extras/uiwriter/data3/tdf130746.odt differ
diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx
index 2a62ac2e9928..0a7d61695821 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -280,6 +280,43 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf107975)
     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount());
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf130746)
+{
+    load(DATA_DIRECTORY, "tdf130746.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(1), xIndexAccess->getCount());
+
+    dispatchCommand(mxComponent, ".uno:JumpToNextTable", {});
+
+    uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
+    uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier(
+        xModel->getCurrentController(), uno::UNO_QUERY);
+    uno::Reference<text::XPageCursor> xCursor(xTextViewCursorSupplier->getViewCursor(),
+                                              uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL(sal_Int16(1), xCursor->getPage());
+
+    pTextDoc->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_RETURN);
+    Scheduler::ProcessEventsToIdle();
+
+    CPPUNIT_ASSERT_EQUAL(sal_Int16(2), xCursor->getPage());
+
+    pTextDoc->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_UP | KEY_MOD2);
+    Scheduler::ProcessEventsToIdle();
+
+    CPPUNIT_ASSERT_EQUAL(sal_Int16(2), xCursor->getPage());
+
+    dispatchCommand(mxComponent, ".uno:Undo", {});
+
+    CPPUNIT_ASSERT_EQUAL(sal_Int16(1), xCursor->getPage());
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount());
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf130680)
 {
     load(DATA_DIRECTORY, "tdf130680.odt");


More information about the Libreoffice-commits mailing list