summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorMarco Cecchetti <marco.cecchetti@collabora.com>2019-10-20 12:57:48 +0200
committerMarco Cecchetti <marco.cecchetti@collabora.com>2019-10-21 12:42:57 +0200
commit98ca6029423eaa19cd4f163da49410310cdea8ae (patch)
tree27e5d63dbb31e810dfbc082a5e8090ca8a22bcc2 /desktop
parent021caaa7353ced19e4215c01faf98dd2fe4cb9ad (diff)
lok: unit test dialog text input field
Change-Id: I989086e12ada7c8606f5bfe1534d33360d14031e
Diffstat (limited to 'desktop')
-rw-r--r--desktop/qa/desktop_lib/test_desktop_lib.cxx32
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 760831fabb4d..f36f03c33814 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -144,6 +144,7 @@ public:
void testComplexSelection();
void testDialogPaste();
void testCalcSaveAs();
+ void testDialogInput();
void testABI();
CPPUNIT_TEST_SUITE(DesktopLOKTest);
@@ -198,6 +199,7 @@ public:
CPPUNIT_TEST(testComplexSelection);
CPPUNIT_TEST(testDialogPaste);
CPPUNIT_TEST(testCalcSaveAs);
+ CPPUNIT_TEST(testDialogInput);
CPPUNIT_TEST(testABI);
CPPUNIT_TEST_SUITE_END();
@@ -1702,6 +1704,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.