[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-1-0' - loolwsd/test

Ashod Nakashian ashod.nakashian at collabora.co.uk
Tue May 24 03:18:20 UTC 2016


 loolwsd/test/data/with_comment.odt |binary
 loolwsd/test/httpwstest.cpp        |   65 +++++++++++++++++++++++++++++++++++++
 2 files changed, 65 insertions(+)

New commits:
commit 034bc5e1eda104543bdbd202c5f70d4ee6320153
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Mon May 23 16:29:30 2016 -0400

    loolwsd: test comment editing in Writer
    
    Change-Id: I8449556960dedc2c66547016172acce688098cb3
    Reviewed-on: https://gerrit.libreoffice.org/25388
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/loolwsd/test/data/with_comment.odt b/loolwsd/test/data/with_comment.odt
new file mode 100644
index 0000000..1e91d53
Binary files /dev/null and b/loolwsd/test/data/with_comment.odt differ
diff --git a/loolwsd/test/httpwstest.cpp b/loolwsd/test/httpwstest.cpp
index 4d14c7a..7e11c89 100644
--- a/loolwsd/test/httpwstest.cpp
+++ b/loolwsd/test/httpwstest.cpp
@@ -79,6 +79,7 @@ class HTTPWSTest : public CPPUNIT_NS::TestFixture
     CPPUNIT_TEST(testMaxColumn);
     CPPUNIT_TEST(testMaxRow);
     CPPUNIT_TEST(testInsertAnnotationWriter);
+    CPPUNIT_TEST(testEditAnnotationWriter);
     CPPUNIT_TEST(testInsertAnnotationCalc);
 
     CPPUNIT_TEST_SUITE_END();
@@ -108,6 +109,7 @@ class HTTPWSTest : public CPPUNIT_NS::TestFixture
     void testMaxColumn();
     void testMaxRow();
     void testInsertAnnotationWriter();
+    void testEditAnnotationWriter();
     void testInsertAnnotationCalc();
 
     void loadDoc(const std::string& documentURL);
@@ -1542,6 +1544,69 @@ void HTTPWSTest::testInsertAnnotationWriter()
     CPPUNIT_ASSERT_EQUAL(std::string("textselectioncontent: blah blah xyz"), res);
 }
 
+void HTTPWSTest::testEditAnnotationWriter()
+{
+    std::string documentPath, documentURL;
+    getDocumentPathAndURL("with_comment.odt", documentPath, documentURL);
+    Poco::Net::HTTPRequest request(Poco::Net::HTTPRequest::HTTP_GET, documentURL);
+
+    auto socket = loadDocAndGetSocket(_uri, documentURL);
+
+    // Click in the body.
+    sendTextFrame(socket, "mouse type=buttondown x=1600 y=1600 count=1 buttons=1 modifier=0");
+    sendTextFrame(socket, "mouse type=buttonup x=1600 y=1600 count=1 buttons=1 modifier=0");
+    // Read body text.
+    sendTextFrame(socket, "uno .uno:SelectAll");
+    sendTextFrame(socket, "gettextselection mimetype=text/plain;charset=utf-8");
+    auto res = getResponseLine(socket, "textselectioncontent:", "insertAnnotationWriter ");
+    CPPUNIT_ASSERT_EQUAL(std::string("textselectioncontent: Hello world"), res);
+
+    // Confirm that the comment is intact.
+    sendTextFrame(socket, "mouse type=buttondown x=13855 y=1893 count=1 buttons=1 modifier=0");
+    sendTextFrame(socket, "mouse type=buttonup x=13855 y=1893 count=1 buttons=1 modifier=0");
+    sendTextFrame(socket, "uno .uno:SelectAll");
+    sendTextFrame(socket, "gettextselection mimetype=text/plain;charset=utf-8");
+    res = getResponseLine(socket, "textselectioncontent:", "insertAnnotationWriter ");
+    CPPUNIT_ASSERT_EQUAL(std::string("textselectioncontent: blah blah xyz"), res);
+
+    // Can we still edit the coment?
+    sendTextFrame(socket, "paste mimetype=text/plain;charset=utf-8\nand now for something completely different");
+    sendTextFrame(socket, "uno .uno:SelectAll");
+    sendTextFrame(socket, "gettextselection mimetype=text/plain;charset=utf-8");
+    res = getResponseLine(socket, "textselectioncontent:", "insertAnnotationWriter ");
+    CPPUNIT_ASSERT_EQUAL(std::string("textselectioncontent: and now for something completely different"), res);
+
+    // Close and reopen the same document and test again.
+    socket->shutdown();
+    std::cerr << "Reloading " << std::endl;
+    socket = loadDocAndGetSocket(_uri, documentURL);
+
+    // Confirm that the text is in the comment and not doc body.
+    // Click in the body.
+    sendTextFrame(socket, "mouse type=buttondown x=1600 y=1600 count=1 buttons=1 modifier=0");
+    sendTextFrame(socket, "mouse type=buttonup x=1600 y=1600 count=1 buttons=1 modifier=0");
+    // Read body text.
+    sendTextFrame(socket, "uno .uno:SelectAll");
+    sendTextFrame(socket, "gettextselection mimetype=text/plain;charset=utf-8");
+    res = getResponseLine(socket, "textselectioncontent:", "insertAnnotationWriter ");
+    CPPUNIT_ASSERT_EQUAL(std::string("textselectioncontent: Hello world"), res);
+
+    // Confirm that the comment is still intact.
+    sendTextFrame(socket, "mouse type=buttondown x=13855 y=1893 count=1 buttons=1 modifier=0");
+    sendTextFrame(socket, "mouse type=buttonup x=13855 y=1893 count=1 buttons=1 modifier=0");
+    sendTextFrame(socket, "uno .uno:SelectAll");
+    sendTextFrame(socket, "gettextselection mimetype=text/plain;charset=utf-8");
+    res = getResponseLine(socket, "textselectioncontent:", "insertAnnotationWriter ");
+    CPPUNIT_ASSERT_EQUAL(std::string("textselectioncontent: and now for something completely different"), res);
+
+    // Can we still edit the coment?
+    sendTextFrame(socket, "paste mimetype=text/plain;charset=utf-8\nnew text different");
+    sendTextFrame(socket, "uno .uno:SelectAll");
+    sendTextFrame(socket, "gettextselection mimetype=text/plain;charset=utf-8");
+    res = getResponseLine(socket, "textselectioncontent:", "insertAnnotationWriter ");
+    CPPUNIT_ASSERT_EQUAL(std::string("textselectioncontent: new text different"), res);
+}
+
 void HTTPWSTest::testInsertAnnotationCalc()
 {
     std::string documentPath, documentURL;


More information about the Libreoffice-commits mailing list