summaryrefslogtreecommitdiff
path: root/desktop/qa
diff options
context:
space:
mode:
authorHenry Castro <hcastro@collabora.com>2019-04-18 18:10:13 -0400
committerHenry Castro <hcastro@collabora.com>2019-04-26 15:28:11 +0200
commit2ead533d2383083925537832b473e3264811d454 (patch)
tree60792f8db8b1990adcc87000a0e415c36146d260 /desktop/qa
parent75d6bc7abdaad42a20899079cd9e8ff5139fedf1 (diff)
lok: allow paste content to popup dialog
Change-Id: I1893d52df505bc43428c37a624ca05c569ba1bc0 Reviewed-on: https://gerrit.libreoffice.org/70958 Tested-by: Jenkins Reviewed-by: Henry Castro <hcastro@collabora.com>
Diffstat (limited to 'desktop/qa')
-rw-r--r--desktop/qa/desktop_lib/test_desktop_lib.cxx51
1 files changed, 51 insertions, 0 deletions
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index a08d476a8bac..e18cda94bb7d 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -22,7 +22,11 @@
#include <com/sun/star/frame/XStorable.hpp>
+#include <vcl/combobox.hxx>
#include <vcl/scheduler.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/syswin.hxx>
+#include <vcl/window.hxx>
#include <comphelper/processfactory.hxx>
#include <rtl/uri.hxx>
#include <sfx2/app.hxx>
@@ -130,6 +134,7 @@ public:
void testInsertCertificate_PEM_DOCX();
void testSignDocument_PEM_PDF();
void testTextSelectionHandles();
+ void testDialogPaste();
void testABI();
CPPUNIT_TEST_SUITE(DesktopLOKTest);
@@ -180,6 +185,7 @@ public:
CPPUNIT_TEST(testInsertCertificate_PEM_DOCX);
CPPUNIT_TEST(testSignDocument_PEM_PDF);
CPPUNIT_TEST(testTextSelectionHandles);
+ CPPUNIT_TEST(testDialogPaste);
CPPUNIT_TEST(testABI);
CPPUNIT_TEST_SUITE_END();
@@ -207,6 +213,23 @@ public:
};
+static Control* GetFocusControl(vcl::Window const * pParent)
+{
+ sal_uInt16 nChildren = pParent->GetChildCount();
+ for (sal_uInt16 nChild = 0; nChild < nChildren; ++nChild)
+ {
+ vcl::Window* pChild = pParent->GetChild( nChild );
+ Control* pCtrl = dynamic_cast<Control*>(pChild);
+ if (pCtrl && pCtrl->HasControlFocus())
+ return pCtrl;
+
+ Control* pSubCtrl = GetFocusControl( pChild );
+ if (pSubCtrl)
+ return pSubCtrl;
+ }
+ return nullptr;
+}
+
LibLODocument_Impl* DesktopLOKTest::loadDoc(const char* pName, LibreOfficeKitDocumentType eType)
{
OUString aFileURL;
@@ -2616,6 +2639,34 @@ void DesktopLOKTest::testTextSelectionHandles()
comphelper::LibreOfficeKit::setActive(false);
}
+void DesktopLOKTest::testDialogPaste()
+{
+ 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);
+
+ pDocument->pClass->postWindow(pDocument, pWindow->GetLOKWindowId(), LOK_WINDOW_PASTE,
+ "{ \"MimeType\" : { \"type\" : \"string\", \"value\" : \"text/plain;charset=utf-8\" }, \"Data\" : { \"type\" : \"[]byte\", \"value\" : \"www.softwarelibre.org.bo\" } }");
+ Scheduler::ProcessEventsToIdle();
+
+ Control* pCtrlFocused = GetFocusControl(pWindow.get());
+ CPPUNIT_ASSERT(pCtrlFocused);
+ ComboBox* pCtrlURL = dynamic_cast<ComboBox*>(pCtrlFocused);
+ CPPUNIT_ASSERT(pCtrlURL);
+ CPPUNIT_ASSERT_EQUAL(OUString("www.softwarelibre.org.bo"), pCtrlURL->GetText());
+
+ static_cast<SystemWindow*>(pWindow.get())->Close();
+ Scheduler::ProcessEventsToIdle();
+ comphelper::LibreOfficeKit::setActive(false);
+}
+
namespace {
constexpr size_t classOffset(int i)