desktop/qa/desktop_lib/test_desktop_lib.cxx | 39 ++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+)
New commits: commit a3c689705894c5993e23d91dfe1faca3535243a8 Author: Michael Meeks <michael.me...@collabora.com> AuthorDate: Tue Jul 16 15:23:54 2019 +0100 Commit: Michael Meeks <michael.me...@collabora.com> CommitDate: Wed Oct 2 21:49:43 2019 +0200 Unit test for removeTextContext. Change-Id: Ib75259f1680fac41a84caeef57718203ec9c4b86 Reviewed-on: https://gerrit.libreoffice.org/79880 Tested-by: Jenkins Reviewed-by: Michael Meeks <michael.me...@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/80061 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 27b987b8bc51..92f275784fc9 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -119,6 +119,7 @@ public: void testNotificationCompression(); void testTileInvalidationCompression(); void testPartInInvalidation(); + void testInput(); void testRedlineWriter(); void testTrackChanges(); void testRedlineCalc(); @@ -172,6 +173,7 @@ public: CPPUNIT_TEST(testNotificationCompression); CPPUNIT_TEST(testTileInvalidationCompression); CPPUNIT_TEST(testPartInInvalidation); + CPPUNIT_TEST(testInput); CPPUNIT_TEST(testRedlineWriter); CPPUNIT_TEST(testTrackChanges); CPPUNIT_TEST(testRedlineCalc); @@ -1700,6 +1702,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. _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits