loolwsd/test/httpwstest.cpp |   23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

New commits:
commit 21f8b072f33d5dbd9939bc5d91432ae2a663488c
Author: Miklos Vajna <vmik...@collabora.co.uk>
Date:   Mon Sep 19 16:32:13 2016 +0200

    Add EMPTY cell cursor testcase
    
    Change-Id: I8d1e86a72eb3383d8d012d884a24233f8ee3079c

diff --git a/loolwsd/test/httpwstest.cpp b/loolwsd/test/httpwstest.cpp
index 2877797..bf4eee1 100644
--- a/loolwsd/test/httpwstest.cpp
+++ b/loolwsd/test/httpwstest.cpp
@@ -80,6 +80,7 @@ class HTTPWSTest : public CPPUNIT_NS::TestFixture
     CPPUNIT_TEST(testInactiveClient);
     CPPUNIT_TEST(testMaxColumn);
     CPPUNIT_TEST(testMaxRow);
+    CPPUNIT_TEST(testEmptyCellCursor);
     CPPUNIT_TEST(testInsertAnnotationWriter);
     CPPUNIT_TEST(testEditAnnotationWriter);  // Broken with multiview.
     CPPUNIT_TEST(testInsertAnnotationCalc);
@@ -120,6 +121,7 @@ class HTTPWSTest : public CPPUNIT_NS::TestFixture
     void testInactiveClient();
     void testMaxColumn();
     void testMaxRow();
+    void testEmptyCellCursor();
     void testInsertAnnotationWriter();
     void testEditAnnotationWriter();
     void testInsertAnnotationCalc();
@@ -1125,6 +1127,27 @@ void HTTPWSTest::testMaxRow()
     }
 }
 
+void HTTPWSTest::testEmptyCellCursor()
+{
+    // Load a document, and make sure a cell cursor shows up.
+    std::string docPath;
+    std::string docURL;
+    getDocumentPathAndURL("setclientpart.ods", docPath, docURL);
+    Poco::Net::HTTPRequest request(Poco::Net::HTTPRequest::HTTP_GET, docURL);
+    std::shared_ptr<Poco::Net::WebSocket> socket = loadDocAndGetSocket(_uri, 
docURL);
+    std::string response;
+    getResponseMessage(socket, "cellcursor:", response, false);
+
+    // Begin text edit of a cell.
+    sendTextFrame(socket, "key type=input char=115 key=97");
+
+    // Make sure the cell cursor is now hidden.
+    getResponseMessage(socket, "cellcursor: ", response, false);
+    // This failed as response was "", not "EMPTY", because code in
+    // Document::ViewCallback() crashed.
+    CPPUNIT_ASSERT_EQUAL(std::string("EMPTY"), response);
+}
+
 void HTTPWSTest::testNoExtraLoolKitsLeft()
 {
     const auto countNow = countLoolKitProcesses(InitialLoolKitCount);
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to