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

Michael Meeks (via logerrit) logerrit at kemper.freedesktop.org
Wed Oct 2 15:04:13 UTC 2019


 desktop/qa/desktop_lib/test_desktop_lib.cxx |   39 ++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

New commits:
commit 62b337a3d6650b8b3045dd98f59a8c0188f0a6fa
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Tue Jul 16 15:23:54 2019 +0100
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Wed Oct 2 17:02:39 2019 +0200

    Unit test for removeTextContext.
    
    Change-Id: Ib75259f1680fac41a84caeef57718203ec9c4b86
    Reviewed-on: https://gerrit.libreoffice.org/79880
    Tested-by: Jenkins
    Reviewed-by: Michael Meeks <michael.meeks at collabora.com>

diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index e16bc91aecb7..5945a3bd378a 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -121,6 +121,7 @@ public:
     void testNotificationCompression();
     void testTileInvalidationCompression();
     void testPartInInvalidation();
+    void testInput();
     void testRedlineWriter();
     void testTrackChanges();
     void testRedlineCalc();
@@ -174,6 +175,7 @@ public:
     CPPUNIT_TEST(testNotificationCompression);
     CPPUNIT_TEST(testTileInvalidationCompression);
     CPPUNIT_TEST(testPartInInvalidation);
+    CPPUNIT_TEST(testInput);
     CPPUNIT_TEST(testRedlineWriter);
     CPPUNIT_TEST(testTrackChanges);
     CPPUNIT_TEST(testRedlineCalc);
@@ -1699,6 +1701,43 @@ void DesktopLOKTest::testPartInInvalidation()
     }
 }
 
+void DesktopLOKTest::testInput()
+{
+    // Load a Writer document, enable change recording and press a key.
+    LibLODocument_Impl* pDocument = loadDoc("blank_text.odt");
+    uno::Reference<beans::XPropertySet> xPropertySet(mxComponent, uno::UNO_QUERY);
+
+    Scheduler::ProcessEventsToIdle(); // Get focus & other bits setup.
+
+    pDocument->pClass->postWindowExtTextInputEvent(pDocument, 0, LOK_EXT_TEXTINPUT, "far");
+    pDocument->pClass->postWindowExtTextInputEvent(pDocument, 0, LOK_EXT_TEXTINPUT_END, "far");
+    pDocument->pClass->postWindowExtTextInputEvent(pDocument, 0, LOK_EXT_TEXTINPUT, " ");
+    pDocument->pClass->postWindowExtTextInputEvent(pDocument, 0, LOK_EXT_TEXTINPUT_END, " ");
+    pDocument->pClass->postWindowExtTextInputEvent(pDocument, 0, LOK_EXT_TEXTINPUT, "beyond");
+    pDocument->pClass->postWindowExtTextInputEvent(pDocument, 0, LOK_EXT_TEXTINPUT_END, "beyond");
+    pDocument->pClass->postWindowExtTextInputEvent(pDocument, 0, LOK_EXT_TEXTINPUT, " ");
+    pDocument->pClass->postWindowExtTextInputEvent(pDocument, 0, LOK_EXT_TEXTINPUT_END, " ");
+    // Mis-spelled ...
+    pDocument->pClass->postWindowExtTextInputEvent(pDocument, 0, LOK_EXT_TEXTINPUT, "kovely");
+    pDocument->pClass->postWindowExtTextInputEvent(pDocument, 0, LOK_EXT_TEXTINPUT_END, "kovely");
+    // Remove it again
+    pDocument->pClass->removeTextContext(pDocument, 0, 6, 0);
+    // Replace it with lovely
+    pDocument->pClass->postWindowExtTextInputEvent(pDocument, 0, LOK_EXT_TEXTINPUT, "lovely");
+    pDocument->pClass->postWindowExtTextInputEvent(pDocument, 0, LOK_EXT_TEXTINPUT_END, "lovely");
+    pDocument->pClass->postWindowExtTextInputEvent(pDocument, 0, LOK_EXT_TEXTINPUT, " ");
+    pDocument->pClass->postWindowExtTextInputEvent(pDocument, 0, LOK_EXT_TEXTINPUT_END, " ");
+
+    // get the text ...
+    pDocument->pClass->postUnoCommand(pDocument, ".uno:SelectAll", nullptr, false);
+    Scheduler::ProcessEventsToIdle();
+    char* pText = pDocument->pClass->getTextSelection(pDocument, "text/plain;charset=utf-8", nullptr);
+    CPPUNIT_ASSERT(pText != nullptr);
+    OString aLovely("far beyond lovely ");
+    CPPUNIT_ASSERT_EQUAL(aLovely, OString(pText));
+    free(pText);
+}
+
 void DesktopLOKTest::testRedlineWriter()
 {
     // Load a Writer document, enable change recording and press a key.


More information about the Libreoffice-commits mailing list