loolwsd/test/data/with_comment.odt |binary loolwsd/test/httpwstest.cpp | 65 +++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+)
New commits: commit dd4d2b026bf1e768160f7a6e1660f349cf84702f Author: Ashod Nakashian <ashod.nakash...@collabora.co.uk> Date: Mon May 23 16:29:30 2016 -0400 loolwsd: test comment editing in Writer Change-Id: I8449556960dedc2c66547016172acce688098cb3 (cherry picked from commit e96140b745283c0ae5e466001e0cf89cf945a398) Reviewed-on: https://gerrit.libreoffice.org/25391 Reviewed-by: Ashod Nakashian <ashnak...@gmail.com> Tested-by: Ashod Nakashian <ashnak...@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 1847e59..43bd94a 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); @@ -1437,6 +1439,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; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits