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

Ashod Nakashian ashod.nakashian at collabora.co.uk
Wed Sep 21 05:10:49 UTC 2016


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

New commits:
commit 836219d269ab95dd4a7335461a1d86b658fc7761
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Thu Sep 15 08:43:30 2016 -0400

    loolwsd: unittests for combined rendering
    
    Change-Id: I164942c1b14727c2f1707341d625c3b4bfc3f672
    Reviewed-on: https://gerrit.libreoffice.org/29116
    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 71469d7..f9ff937 100644
--- a/loolwsd/test/TileCacheTests.cpp
+++ b/loolwsd/test/TileCacheTests.cpp
@@ -63,6 +63,7 @@ class TileCacheTests : public CPPUNIT_NS::TestFixture
     CPPUNIT_TEST(testTileInvalidateWriter);
     //CPPUNIT_TEST(testTileInvalidateCalc);
     CPPUNIT_TEST(testTileQueuePriority);
+    CPPUNIT_TEST(testTileCombinedRendering);
 
     CPPUNIT_TEST_SUITE_END();
 
@@ -79,6 +80,7 @@ class TileCacheTests : public CPPUNIT_NS::TestFixture
     void testWriterAnyKey();
     void testTileInvalidateCalc();
     void testTileQueuePriority();
+    void testTileCombinedRendering();
 
     void checkTiles(Poco::Net::WebSocket& socket,
                     const std::string& type,
@@ -620,9 +622,11 @@ void TileCacheTests::testTileInvalidateCalc()
 void TileCacheTests::testTileQueuePriority()
 {
     const std::string reqHigh = "tile part=0 width=256 height=256 tileposx=0 tileposy=0 tilewidth=3840 tileheight=3840";
-    const TileQueue::Payload payloadHigh(reqHigh.data(), reqHigh.data() + reqHigh.size());
+    const std::string resHigh = "tile part=0 width=256 height=256 tileposx=0 tileposy=0 tilewidth=3840 tileheight=3840 ver=-1";
+    const TileQueue::Payload payloadHigh(resHigh.data(), resHigh.data() + resHigh.size());
     const std::string reqLow = "tile part=0 width=256 height=256 tileposx=0 tileposy=253440 tilewidth=3840 tileheight=3840";
-    const TileQueue::Payload payloadLow(reqLow.data(), reqLow.data() + reqLow.size());
+    const std::string resLow = "tile part=0 width=256 height=256 tileposx=0 tileposy=253440 tilewidth=3840 tileheight=3840 ver=-1";
+    const TileQueue::Payload payloadLow(resLow.data(), resLow.data() + resLow.size());
 
     TileQueue queue;
 
@@ -661,6 +665,39 @@ void TileCacheTests::testTileQueuePriority()
     CPPUNIT_ASSERT_EQUAL(payloadHigh, queue.get());
 }
 
+void TileCacheTests::testTileCombinedRendering()
+{
+    const std::string req1 = "tile part=0 width=256 height=256 tileposx=0 tileposy=0 tilewidth=3840 tileheight=3840";
+    const std::string req2 = "tile part=0 width=256 height=256 tileposx=3840 tileposy=0 tilewidth=3840 tileheight=3840";
+    const std::string req3 = "tile part=0 width=256 height=256 tileposx=0 tileposy=3840 tilewidth=3840 tileheight=3840";
+    const std::string req4 = "tile part=0 width=256 height=256 tileposx=3840 tileposy=3840 tilewidth=3840 tileheight=3840";
+
+    const std::string resHor = "tilecombine part=0 width=256 height=256 tileposx=0,3840 tileposy=0,0 imgsize=0,0 tilewidth=3840 tileheight=3840";
+    const TileQueue::Payload payloadHor(resHor.data(), resHor.data() + resHor.size());
+    const std::string resVer = "tilecombine part=0 width=256 height=256 tileposx=0,0 tileposy=0,3840 imgsize=0,0 tilewidth=3840 tileheight=3840";
+    const TileQueue::Payload payloadVer(resVer.data(), resVer.data() + resVer.size());
+    const std::string resFull = "tilecombine part=0 width=256 height=256 tileposx=0,3840,0 tileposy=0,0,3840 imgsize=0,0,0 tilewidth=3840 tileheight=3840";
+    const TileQueue::Payload payloadFull(resFull.data(), resFull.data() + resFull.size());
+
+    TileQueue queue;
+
+    // Horizontal.
+    queue.put(req1);
+    queue.put(req2);
+    CPPUNIT_ASSERT_EQUAL(payloadHor, queue.get());
+
+    // Vertical.
+    queue.put(req1);
+    queue.put(req3);
+    CPPUNIT_ASSERT_EQUAL(payloadVer, queue.get());
+
+    // Vertical.
+    queue.put(req1);
+    queue.put(req2);
+    queue.put(req3);
+    CPPUNIT_ASSERT_EQUAL(payloadFull, queue.get());
+}
+
 void TileCacheTests::checkTiles(Poco::Net::WebSocket& socket, const std::string& docType, const std::string& name)
 {
     const std::string current = "current=";


More information about the Libreoffice-commits mailing list