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

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Fri Aug 27 10:19:09 UTC 2021


 sw/qa/extras/uiwriter/uiwriter3.cxx |   37 ++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

New commits:
commit 1864e6353179678a2ca1a175c203fd9e0cc5a580
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Fri Aug 27 10:30:02 2021 +0200
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Fri Aug 27 12:18:33 2021 +0200

    tdf#116315: sw_uiwriter3: Add unittest
    
    Change-Id: I29aa953d8541d45b003703ba91c143fc9760ceac
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121135
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx
index c88abacb9536..72b715051cce 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -1686,6 +1686,43 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf130629)
     CPPUNIT_ASSERT_EQUAL(1, getShapes());
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf116315)
+{
+    SwDoc* const pDoc = createSwDoc();
+    SwWrtShell* const pWrtSh = pDoc->GetDocShell()->GetWrtShell();
+    CPPUNIT_ASSERT(pWrtSh);
+
+    pWrtSh->Insert("This is a test");
+    pWrtSh->Left(CRSR_SKIP_CHARS, /*bSelect=*/true, 4, /*bBasicCall=*/false);
+
+    SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+    for (sal_Int32 i = 0; i < 5; ++i)
+    {
+        pTextDoc->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_SHIFT | KEY_F3);
+        Scheduler::ProcessEventsToIdle();
+
+        CPPUNIT_ASSERT_EQUAL(OUString("This is a Test"), getParagraph(1)->getString());
+
+        pTextDoc->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_SHIFT | KEY_F3);
+        Scheduler::ProcessEventsToIdle();
+
+        // Without the fix in place, this test would have failed with
+        // - Expected: This is a test
+        // - Actual  : This is a TEST
+        CPPUNIT_ASSERT_EQUAL(OUString("This is a test"), getParagraph(1)->getString());
+
+        pTextDoc->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_SHIFT | KEY_F3);
+        Scheduler::ProcessEventsToIdle();
+
+        CPPUNIT_ASSERT_EQUAL(OUString("This is a TEST"), getParagraph(1)->getString());
+
+        pTextDoc->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_SHIFT | KEY_F3);
+        Scheduler::ProcessEventsToIdle();
+
+        CPPUNIT_ASSERT_EQUAL(OUString("This is a test"), getParagraph(1)->getString());
+    }
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf141613)
 {
     SwDoc* const pDoc = createSwDoc();


More information about the Libreoffice-commits mailing list