[Libreoffice-commits] online.git: loolwsd/test

Ashod Nakashian ashod.nakashian at collabora.co.uk
Wed May 4 10:38:46 UTC 2016


 loolwsd/test/TileCacheTests.cpp |   39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

New commits:
commit bc58536113ed578661e9a54892bba805853b3142
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Tue May 3 23:36:08 2016 -0400

    loolwsd: new tiles unittest
    
    Change-Id: Id63f1ae03c1d33dec666c43d64042838df10c29d
    Reviewed-on: https://gerrit.libreoffice.org/24646
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/loolwsd/test/TileCacheTests.cpp b/loolwsd/test/TileCacheTests.cpp
index a20c82f..71887f5 100644
--- a/loolwsd/test/TileCacheTests.cpp
+++ b/loolwsd/test/TileCacheTests.cpp
@@ -31,6 +31,7 @@ class TileCacheTests : public CPPUNIT_NS::TestFixture
     CPPUNIT_TEST_SUITE(TileCacheTests);
 
     CPPUNIT_TEST(testSimple);
+    CPPUNIT_TEST(testSimpleCombine);
     CPPUNIT_TEST(testClientPartImpress);
     CPPUNIT_TEST(testClientPartCalc);
 #if ENABLE_DEBUG
@@ -40,6 +41,7 @@ class TileCacheTests : public CPPUNIT_NS::TestFixture
     CPPUNIT_TEST_SUITE_END();
 
     void testSimple();
+    void testSimpleCombine();
     void testClientPartImpress();
     void testClientPartCalc();
     void testSimultaneousTilesRenderedJustOnce();
@@ -152,6 +154,43 @@ void TileCacheTests::testSimple()
     CPPUNIT_ASSERT_MESSAGE("found tile when none was expected", !file);
 }
 
+void TileCacheTests::testSimpleCombine()
+{
+    std::string documentPath, documentURL;
+    getDocumentPathAndURL("hello.odt", documentPath, documentURL);
+    Poco::Net::HTTPRequest request(Poco::Net::HTTPRequest::HTTP_GET, documentURL);
+
+    auto socket1 = *loadDocAndGetSocket(_uri, documentURL);
+
+    getResponseMessage(socket1, "invalidatetiles");
+
+    sendTextFrame(socket1, "tilecombine part=0 width=256 height=256 tileposx=0,3840 tileposy=0,0 tilewidth=3840 tileheight=3840");
+
+    auto tile1a = getResponseMessage(socket1, "tile:");
+    CPPUNIT_ASSERT_MESSAGE("did not receive a tile: message as expected", !tile1a.empty());
+    auto tile1b = getResponseMessage(socket1, "tile:");
+    CPPUNIT_ASSERT_MESSAGE("did not receive a tile: message as expected", !tile1b.empty());
+    sendTextFrame(socket1, "tilecombine part=0 width=256 height=256 tileposx=0,3840 tileposy=0,0 tilewidth=3840 tileheight=3840");
+
+    tile1a = getResponseMessage(socket1, "tile:");
+    CPPUNIT_ASSERT_MESSAGE("did not receive a tile: message as expected", !tile1a.empty());
+    tile1b = getResponseMessage(socket1, "tile:");
+    CPPUNIT_ASSERT_MESSAGE("did not receive a tile: message as expected", !tile1b.empty());
+
+    sleep(4);
+    std::cerr << "Connecting second client." << std::endl;
+    auto socket2 = *loadDocAndGetSocket(_uri, documentURL);
+    sendTextFrame(socket2, "tilecombine part=0 width=256 height=256 tileposx=0,3840 tileposy=0,0 tilewidth=3840 tileheight=3840");
+
+    auto tile2a = getResponseMessage(socket2, "tile:");
+    CPPUNIT_ASSERT_MESSAGE("did not receive a tile: message as expected", !tile2a.empty());
+    auto tile2b = getResponseMessage(socket2, "tile:");
+    CPPUNIT_ASSERT_MESSAGE("did not receive a tile: message as expected", !tile2b.empty());
+
+    socket1.shutdown();
+    socket2.shutdown();
+}
+
 void TileCacheTests::testClientPartImpress()
 {
     try


More information about the Libreoffice-commits mailing list