diff options
author | Marco Cecchetti <marco.cecchetti@collabora.com> | 2019-10-20 12:57:48 +0200 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2019-12-16 15:04:22 +0100 |
commit | af3bb63fc048b4a2e8ccdee89ddd39fcf5a7a6b2 (patch) | |
tree | ad8377cc37696a59d2d082c72166df1e8c4749dd /desktop | |
parent | 9d71f580dc436d400ea3d1e836f118b2d8528157 (diff) |
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@collabora.com>
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/qa/desktop_lib/test_desktop_lib.cxx | 32 |
1 files changed, 32 insertions, 0 deletions
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. |