summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2019-07-16 15:23:54 +0100
committerMichael Meeks <michael.meeks@collabora.com>2019-10-02 21:49:43 +0200
commita3c689705894c5993e23d91dfe1faca3535243a8 (patch)
tree3a073153771ead11a8dab6182e29acc104e6b4cc /desktop
parent0c157b0d40019abe43531b512cb27bff28ae778b (diff)
Unit test for removeTextContext.
Change-Id: Ib75259f1680fac41a84caeef57718203ec9c4b86 Reviewed-on: https://gerrit.libreoffice.org/79880 Tested-by: Jenkins Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/80061 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Diffstat (limited to 'desktop')
-rw-r--r--desktop/qa/desktop_lib/test_desktop_lib.cxx39
1 files changed, 39 insertions, 0 deletions
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.