From af3bb63fc048b4a2e8ccdee89ddd39fcf5a7a6b2 Mon Sep 17 00:00:00 2001 From: Marco Cecchetti Date: Sun, 20 Oct 2019 12:57:48 +0200 Subject: lok: unit test dialog text input field Change-Id: I989086e12ada7c8606f5bfe1534d33360d14031e Reviewed-on: https://gerrit.libreoffice.org/82017 Tested-by: Jenkins Reviewed-by: Michael Meeks --- desktop/qa/desktop_lib/test_desktop_lib.cxx | 32 +++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'desktop') 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 pWindow(Application::GetActiveTopWindow()); + CPPUNIT_ASSERT(pWindow); + + Control* pCtrlFocused = GetFocusControl(pWindow.get()); + CPPUNIT_ASSERT(pCtrlFocused); + ComboBox* pCtrlURL = dynamic_cast(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(pWindow.get())->Close(); + Scheduler::ProcessEventsToIdle(); +} + void DesktopLOKTest::testInput() { // Load a Writer document, enable change recording and press a key. -- cgit