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

Szymon Kłos (via logerrit) logerrit at kemper.freedesktop.org
Tue May 14 15:55:37 UTC 2019


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

New commits:
commit 135eb77464a7a4682547e28ac5e291abff145f3c
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Mon May 13 14:48:47 2019 +0200
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Tue May 14 17:54:24 2019 +0200

    lok: test show/hide status of a window
    
    Change-Id: I610fa6c5b7f19a7c995e02c4aa50e55090271642
    Reviewed-on: https://gerrit.libreoffice.org/72230
    Tested-by: Jenkins
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>

diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index 1d7ae45a3b2e..d57ae546c7de 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -139,6 +139,7 @@ public:
     void testSignDocument_PEM_PDF();
     void testTextSelectionHandles();
     void testDialogPaste();
+    void testShowHideDialog();
     void testABI();
 
     CPPUNIT_TEST_SUITE(DesktopLOKTest);
@@ -190,6 +191,7 @@ public:
     CPPUNIT_TEST(testSignDocument_PEM_PDF);
     CPPUNIT_TEST(testTextSelectionHandles);
     CPPUNIT_TEST(testDialogPaste);
+    CPPUNIT_TEST(testShowHideDialog);
     CPPUNIT_TEST(testABI);
     CPPUNIT_TEST_SUITE_END();
 
@@ -1784,6 +1786,7 @@ public:
     bool m_bTilesInvalidated;
     tools::Rectangle m_aOwnCursor;
     boost::property_tree::ptree m_aCommentCallbackResult;
+    boost::property_tree::ptree m_aCallbackWindowResult;
 
     ViewCallback()
         : m_bTilesInvalidated(false)
@@ -1825,6 +1828,13 @@ public:
             m_aCommentCallbackResult = m_aCommentCallbackResult.get_child("comment");
         }
         break;
+        case LOK_CALLBACK_WINDOW:
+        {
+            m_aCallbackWindowResult.clear();
+            std::stringstream aStream(pPayload);
+            boost::property_tree::read_json(aStream, m_aCallbackWindowResult);
+        }
+        break;
         }
     }
 };
@@ -2573,6 +2583,33 @@ void DesktopLOKTest::testDialogPaste()
     Scheduler::ProcessEventsToIdle();
 }
 
+void DesktopLOKTest::testShowHideDialog()
+{
+    ViewCallback aView;
+
+    comphelper::LibreOfficeKit::setActive();
+    LibLODocument_Impl* pDocument = loadDoc("blank_text.odt");
+
+    pDocument->m_pDocumentClass->initializeForRendering(pDocument, "{}");
+    pDocument->m_pDocumentClass->registerCallback(pDocument, &ViewCallback::callback, &aView);
+
+    pDocument->pClass->postUnoCommand(pDocument, ".uno:HyperlinkDialog", nullptr, false);
+    Scheduler::ProcessEventsToIdle();
+
+    VclPtr<vcl::Window> pWindow(Application::GetActiveTopWindow());
+    CPPUNIT_ASSERT(pWindow);
+
+    pWindow->Hide();
+    Scheduler::ProcessEventsToIdle();
+
+    CPPUNIT_ASSERT_EQUAL(std::string("hide"), aView.m_aCallbackWindowResult.get<std::string>("action"));
+
+    pWindow->Show();
+    Scheduler::ProcessEventsToIdle();
+
+    CPPUNIT_ASSERT_EQUAL(std::string("invalidate"), aView.m_aCallbackWindowResult.get<std::string>("action"));
+}
+
 namespace {
 
 constexpr size_t classOffset(int i)


More information about the Libreoffice-commits mailing list