loolwsd/test/httpwstest.cpp | 52 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+)
New commits: commit f751d36c8f3f84948acd77e5c14b18597578f0fe Author: Henry Castro <hcas...@collabora.com> Date: Thu Sep 8 10:26:25 2016 -0400 loolwsd: test: view cursor visible diff --git a/loolwsd/test/httpwstest.cpp b/loolwsd/test/httpwstest.cpp index 4af1fea..79bb226 100644 --- a/loolwsd/test/httpwstest.cpp +++ b/loolwsd/test/httpwstest.cpp @@ -90,6 +90,7 @@ class HTTPWSTest : public CPPUNIT_NS::TestFixture CPPUNIT_TEST(testColumnRowResize); CPPUNIT_TEST(testOptimalResize); CPPUNIT_TEST(testInvalidateViewCursor); + CPPUNIT_TEST(testViewCursorVisible); CPPUNIT_TEST_SUITE_END(); @@ -128,6 +129,7 @@ class HTTPWSTest : public CPPUNIT_NS::TestFixture void testColumnRowResize(); void testOptimalResize(); void testInvalidateViewCursor(); + void testViewCursorVisible(); void loadDoc(const std::string& documentURL); @@ -2172,6 +2174,56 @@ void HTTPWSTest::testInvalidateViewCursor() } } +void HTTPWSTest::testViewCursorVisible() +{ + try + { + int docSlide = -1; + int docSlides = 0; + int docHeight = 0; + int docWidth = 0; + int docViewId = -1; + + // Load a document + std::string documentPath, documentURL, response, text; + getDocumentPathAndURL("viewcursor.odp", documentPath, documentURL); + + Poco::Net::HTTPRequest request(Poco::Net::HTTPRequest::HTTP_GET, documentURL); + Poco::Net::WebSocket socket1 = *connectLOKit(_uri, request, _response); + + sendTextFrame(socket1, "load url=" + documentURL); + CPPUNIT_ASSERT_MESSAGE("cannot load the document " + documentURL, isDocumentLoaded(socket1)); + + // Check document size + sendTextFrame(socket1, "status"); + getResponseMessage(socket1, "status:", response, false); + CPPUNIT_ASSERT_MESSAGE("did not receive a status: message as expected", !response.empty()); + parseDocSize(response, "presentation", docSlide, docSlides, docWidth, docHeight, docViewId); + + // Click to show a cursor + Poco::format(text, "mouse type=%s x=%d y=%d count=1 buttons=1 modifier=0", std::string("buttondown"), docWidth/2, docHeight/6); + sendTextFrame(socket1, text); text.clear(); + Poco::format(text, "mouse type=%s x=%d y=%d count=1 buttons=1 modifier=0", std::string("buttonup"), docWidth/2, docHeight/6); + sendTextFrame(socket1, text); + getResponseMessage(socket1, "cursorvisible:", response, false); + CPPUNIT_ASSERT_MESSAGE("did not receive a cursorvisible: message as expected", !response.empty()); + + // Connect and load second view. + Poco::Net::WebSocket socket2 = *connectLOKit(_uri, request, _response); + sendTextFrame(socket2, "load url=" + documentURL); + CPPUNIT_ASSERT_MESSAGE("cannot load the document " + documentURL, isDocumentLoaded(socket2, "", true)); + + // Expected to receive viewcursorvisible second view + getResponseMessage(socket2, "viewcursorvisible:", response, false); + CPPUNIT_ASSERT_MESSAGE("did not receive a viewcursorvisible: message as expected", !response.empty()); + } + catch (const Poco::Exception& exc) + { + CPPUNIT_FAIL(exc.displayText()); + } +} + + CPPUNIT_TEST_SUITE_REGISTRATION(HTTPWSTest); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits