[Libreoffice-commits] online.git: 2 commits - common/MessageQueue.cpp kit/Kit.cpp test/TileQueueTests.cpp

Jan Holesovsky kendy at collabora.com
Fri Apr 7 12:10:22 UTC 2017


 common/MessageQueue.cpp |    1 +
 kit/Kit.cpp             |    7 ++++---
 test/TileQueueTests.cpp |   28 ++++++++++++++++++++++++++++
 3 files changed, 33 insertions(+), 3 deletions(-)

New commits:
commit 8ea0bd03b2892a93975e23eb7d1f3c22ae7b4fac
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Fri Apr 7 12:29:01 2017 +0200

    Unit tests for the indicator value and page size callback merging.
    
    Change-Id: Id97fcf9bad37669eb649f73b38b4dba0b2e9a00e

diff --git a/test/TileQueueTests.cpp b/test/TileQueueTests.cpp
index 4128df3e..2bf8e7a7 100644
--- a/test/TileQueueTests.cpp
+++ b/test/TileQueueTests.cpp
@@ -50,6 +50,8 @@ class TileQueueTests : public CPPUNIT_NS::TestFixture
     CPPUNIT_TEST(testSenderQueueTileDeduplication);
     CPPUNIT_TEST(testInvalidateViewCursorDeduplication);
     CPPUNIT_TEST(testCallbackInvalidation);
+    CPPUNIT_TEST(testCallbackIndicatorValue);
+    CPPUNIT_TEST(testCallbackPageSize);
 
     CPPUNIT_TEST_SUITE_END();
 
@@ -62,6 +64,8 @@ class TileQueueTests : public CPPUNIT_NS::TestFixture
     void testSenderQueueTileDeduplication();
     void testInvalidateViewCursorDeduplication();
     void testCallbackInvalidation();
+    void testCallbackIndicatorValue();
+    void testCallbackPageSize();
 };
 
 void TileQueueTests::testTileQueuePriority()
@@ -444,6 +448,30 @@ void TileQueueTests::testCallbackInvalidation()
     CPPUNIT_ASSERT_EQUAL(std::string("callback all 0 EMPTY, 0"), payloadAsString(queue.get()));
 }
 
+void TileQueueTests::testCallbackIndicatorValue()
+{
+    TileQueue queue;
+
+    // join tiles
+    queue.put("callback all 10 25");
+    queue.put("callback all 10 50");
+
+    CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(queue._queue.size()));
+    CPPUNIT_ASSERT_EQUAL(std::string("callback all 10 50"), payloadAsString(queue.get()));
+}
+
+void TileQueueTests::testCallbackPageSize()
+{
+    TileQueue queue;
+
+    // join tiles
+    queue.put("callback all 13 12474, 188626");
+    queue.put("callback all 13 12474, 205748");
+
+    CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(queue._queue.size()));
+    CPPUNIT_ASSERT_EQUAL(std::string("callback all 13 12474, 205748"), payloadAsString(queue.get()));
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(TileQueueTests);
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 1585cbdb6b467ab910e4d549b9139a3066318cbe
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Fri Apr 7 12:13:45 2017 +0200

    Merge document size changes callbacks in the message queue.
    
    Change-Id: I1a540b17f2a72c374568db834a30b814878e9032

diff --git a/common/MessageQueue.cpp b/common/MessageQueue.cpp
index acff9b88..a53ae988 100644
--- a/common/MessageQueue.cpp
+++ b/common/MessageQueue.cpp
@@ -341,6 +341,7 @@ std::string TileQueue::removeCallbackDuplicate(const std::string& callbackMsg)
     else if (callbackType == "1" || // the cursor has moved
             callbackType == "5" ||  // the cursor visibility has changed
             callbackType == "10" || // setting the indicator value
+            callbackType == "13" || // setting the document size
             callbackType == "17" || // the cell cursor has moved
             callbackType == "24" || // the view cursor has moved
             callbackType == "26" || // the view cell cursor has moved
diff --git a/kit/Kit.cpp b/kit/Kit.cpp
index 242dc575..6717c677 100644
--- a/kit/Kit.cpp
+++ b/kit/Kit.cpp
@@ -889,10 +889,11 @@ public:
         }
 
         // merge various callback types together if possible
-        if (type == LOK_CALLBACK_INVALIDATE_TILES)
+        if (type == LOK_CALLBACK_INVALIDATE_TILES ||
+            type == LOK_CALLBACK_DOCUMENT_SIZE_CHANGED)
         {
-            // no point in handling invalidations per-view, all views have to
-            // be in sync
+            // no point in handling invalidations or page resizes per-view,
+            // all views have to be in sync
             tileQueue->put("callback all " + std::to_string(type) + ' ' + payload);
         }
         else if (type == LOK_CALLBACK_INVALIDATE_VIEW_CURSOR ||


More information about the Libreoffice-commits mailing list