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

Marco Cecchetti (via logerrit) logerrit at kemper.freedesktop.org
Mon Dec 16 14:05:12 UTC 2019


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

New commits:
commit af3bb63fc048b4a2e8ccdee89ddd39fcf5a7a6b2
Author:     Marco Cecchetti <marco.cecchetti at collabora.com>
AuthorDate: Sun Oct 20 12:57:48 2019 +0200
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Mon Dec 16 15:04:22 2019 +0100

    lok: unit test dialog text input field
    
    Change-Id: I989086e12ada7c8606f5bfe1534d33360d14031e
    Reviewed-on: https://gerrit.libreoffice.org/82017
    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 232d8cb3073a..178d42f335c0 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -146,6 +146,7 @@ public:
     void testComplexSelection();
     void testDialogPaste();
     void testShowHideDialog();
+    void testDialogInput();
     void testABI();
 
     CPPUNIT_TEST_SUITE(DesktopLOKTest);
@@ -202,6 +203,7 @@ public:
     CPPUNIT_TEST(testComplexSelection);
     CPPUNIT_TEST(testDialogPaste);
     CPPUNIT_TEST(testShowHideDialog);
+    CPPUNIT_TEST(testDialogInput);
     CPPUNIT_TEST(testABI);
     CPPUNIT_TEST_SUITE_END();
 
@@ -1703,6 +1705,36 @@ void DesktopLOKTest::testPartInInvalidation()
     }
 }
 
+void DesktopLOKTest::testDialogInput()
+{
+    comphelper::LibreOfficeKit::setActive();
+    LibLODocument_Impl* pDocument = loadDoc("blank_text.odt");
+    pDocument->pClass->postUnoCommand(pDocument, ".uno:HyperlinkDialog", nullptr, false);
+    Scheduler::ProcessEventsToIdle();
+
+    SfxViewShell* pViewShell = SfxViewShell::Current();
+    pViewShell->GetViewFrame()->GetBindings().Update();
+
+    VclPtr<vcl::Window> pWindow(Application::GetActiveTopWindow());
+    CPPUNIT_ASSERT(pWindow);
+
+    Control* pCtrlFocused = GetFocusControl(pWindow.get());
+    CPPUNIT_ASSERT(pCtrlFocused);
+    ComboBox* pCtrlURL = dynamic_cast<ComboBox*>(pCtrlFocused);
+    CPPUNIT_ASSERT(pCtrlURL);
+    CPPUNIT_ASSERT_EQUAL(OUString(""), pCtrlURL->GetText());
+
+    vcl::LOKWindowId nDialogId = pWindow->GetLOKWindowId();
+    pDocument->pClass->postWindowExtTextInputEvent(pDocument, nDialogId, LOK_EXT_TEXTINPUT, "wiki.");
+    pDocument->pClass->postWindowExtTextInputEvent(pDocument, nDialogId, LOK_EXT_TEXTINPUT_END, "wiki.");
+    pDocument->pClass->removeTextContext(pDocument, nDialogId, 1, 0);
+    Scheduler::ProcessEventsToIdle();
+    CPPUNIT_ASSERT_EQUAL(OUString("wiki"), pCtrlURL->GetText());
+
+    static_cast<SystemWindow*>(pWindow.get())->Close();
+    Scheduler::ProcessEventsToIdle();
+}
+
 void DesktopLOKTest::testInput()
 {
     // Load a Writer document, enable change recording and press a key.


More information about the Libreoffice-commits mailing list