summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAshod Nakashian <ashod.nakashian@collabora.co.uk>2016-05-09 23:21:56 -0400
committerAshod Nakashian <ashnakash@gmail.com>2016-05-10 03:47:44 +0000
commitcd4fd1b556da7b76928ff0577220333941fda25d (patch)
tree0ca0a77c44d503f6bc1ef0d8749634b55dc8f466
parent7cdfe080432f69c2247cc7ff28316b653bd654ff (diff)
LOK: simplify notification compression to minimize error
Change-Id: I4de2d652e08586b38294ebf903fedc9935711a13 Reviewed-on: https://gerrit.libreoffice.org/24816 Reviewed-by: Ashod Nakashian <ashnakash@gmail.com> Tested-by: Ashod Nakashian <ashnakash@gmail.com>
-rw-r--r--desktop/inc/lib/init.hxx11
-rw-r--r--desktop/qa/desktop_lib/test_desktop_lib.cxx43
2 files changed, 23 insertions, 31 deletions
diff --git a/desktop/inc/lib/init.hxx b/desktop/inc/lib/init.hxx
index 82a01b27b297..415143dcc253 100644
--- a/desktop/inc/lib/init.hxx
+++ b/desktop/inc/lib/init.hxx
@@ -40,17 +40,7 @@ namespace desktop {
// Add the states that are safe to skip duplicates on,
// even when not consequent.
- m_states.emplace(LOK_CALLBACK_TEXT_SELECTION_START, "NIL");
- m_states.emplace(LOK_CALLBACK_TEXT_SELECTION_END, "NIL");
- m_states.emplace(LOK_CALLBACK_TEXT_SELECTION, "NIL");
- m_states.emplace(LOK_CALLBACK_GRAPHIC_SELECTION, "NIL");
- m_states.emplace(LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR, "NIL");
m_states.emplace(LOK_CALLBACK_STATE_CHANGED, "NIL");
- m_states.emplace(LOK_CALLBACK_MOUSE_POINTER, "NIL");
- m_states.emplace(LOK_CALLBACK_CELL_CURSOR, "NIL");
- m_states.emplace(LOK_CALLBACK_CELL_FORMULA, "NIL");
- m_states.emplace(LOK_CALLBACK_CURSOR_VISIBLE, "NIL");
- m_states.emplace(LOK_CALLBACK_SET_PART, "NIL");
Start();
}
@@ -129,7 +119,6 @@ namespace desktop {
case LOK_CALLBACK_CELL_CURSOR:
case LOK_CALLBACK_CELL_FORMULA:
case LOK_CALLBACK_CURSOR_VISIBLE:
- case LOK_CALLBACK_SET_PART:
case LOK_CALLBACK_STATUS_INDICATOR_SET_VALUE:
removeAllButLast(type, false);
break;
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index 13382acb4d56..fbd88960ebed 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -815,33 +815,33 @@ void DesktopLOKTest::testNotificationCompression()
handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "15 25 15 10"); // Superseeded.
handler->queue(LOK_CALLBACK_TEXT_SELECTION, "15 25 15 10"); // Should be dropped.
handler->queue(LOK_CALLBACK_TEXT_SELECTION, ""); // Superseeded.
- handler->queue(LOK_CALLBACK_STATE_CHANGED, ""); // 2
- handler->queue(LOK_CALLBACK_STATE_CHANGED, ".uno:Bold"); // 3
- handler->queue(LOK_CALLBACK_STATE_CHANGED, ""); // 4
- handler->queue(LOK_CALLBACK_MOUSE_POINTER, "text"); // 5
- handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "15 25 15 10"); // 6
+ handler->queue(LOK_CALLBACK_STATE_CHANGED, ""); // 1
+ handler->queue(LOK_CALLBACK_STATE_CHANGED, ".uno:Bold"); // 2
+ handler->queue(LOK_CALLBACK_STATE_CHANGED, ""); // 3
+ handler->queue(LOK_CALLBACK_MOUSE_POINTER, "text"); // Superseeded.
+ handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "15 25 15 10"); // 4
handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "15 25 15 10"); // Should be dropped.
- handler->queue(LOK_CALLBACK_MOUSE_POINTER, "text"); // Should be dropped.
+ handler->queue(LOK_CALLBACK_MOUSE_POINTER, "text"); // 5
handler->queue(LOK_CALLBACK_TEXT_SELECTION_START, "15 25 15 10"); // Superseeded.
handler->queue(LOK_CALLBACK_TEXT_SELECTION_END, "15 25 15 10"); // Superseeded.
handler->queue(LOK_CALLBACK_TEXT_SELECTION, "15 25 15 10"); // Superseedd.
handler->queue(LOK_CALLBACK_TEXT_SELECTION_START, "15 25 15 10"); // Should be dropped.
handler->queue(LOK_CALLBACK_TEXT_SELECTION_END, "15 25 15 10"); // Should be dropped.
- handler->queue(LOK_CALLBACK_TEXT_SELECTION, ""); // 7
- handler->queue(LOK_CALLBACK_TEXT_SELECTION_START, "15 25 15 10"); // 8
- handler->queue(LOK_CALLBACK_TEXT_SELECTION_END, "15 25 15 10"); // 9
- handler->queue(LOK_CALLBACK_CELL_CURSOR, "15 25 15 10"); // 10
- handler->queue(LOK_CALLBACK_CURSOR_VISIBLE, ""); // 11
+ handler->queue(LOK_CALLBACK_TEXT_SELECTION, ""); // 6
+ handler->queue(LOK_CALLBACK_TEXT_SELECTION_START, "15 25 15 10"); // 7
+ handler->queue(LOK_CALLBACK_TEXT_SELECTION_END, "15 25 15 10"); // 8
+ handler->queue(LOK_CALLBACK_CELL_CURSOR, "15 25 15 10"); // 9
+ handler->queue(LOK_CALLBACK_CURSOR_VISIBLE, ""); // Superseeded.
handler->queue(LOK_CALLBACK_CELL_CURSOR, "15 25 15 10"); // Should be dropped.
- handler->queue(LOK_CALLBACK_CELL_FORMULA, "blah"); // 12
- handler->queue(LOK_CALLBACK_SET_PART, "1"); // 13
- handler->queue(LOK_CALLBACK_CURSOR_VISIBLE, ""); // Should be dropped.
- handler->queue(LOK_CALLBACK_CELL_FORMULA, "blah"); // Should be dropped.
- handler->queue(LOK_CALLBACK_SET_PART, "1"); // Should be dropped.
+ handler->queue(LOK_CALLBACK_CELL_FORMULA, "blah"); // Superseeded.
+ handler->queue(LOK_CALLBACK_SET_PART, "1"); // 11
+ handler->queue(LOK_CALLBACK_CURSOR_VISIBLE, ""); // 12
+ handler->queue(LOK_CALLBACK_CELL_FORMULA, "blah"); // 13
+ handler->queue(LOK_CALLBACK_SET_PART, "1"); // 14
Scheduler::ProcessEventsToIdle();
- CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(13), notifs.size());
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(14), notifs.size());
size_t i = 0;
CPPUNIT_ASSERT_EQUAL((int)LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR, (int)std::get<0>(notifs[i]));
@@ -856,12 +856,12 @@ void DesktopLOKTest::testNotificationCompression()
CPPUNIT_ASSERT_EQUAL((int)LOK_CALLBACK_STATE_CHANGED, (int)std::get<0>(notifs[i]));
CPPUNIT_ASSERT_EQUAL(std::string(""), std::get<1>(notifs[i++]));
- CPPUNIT_ASSERT_EQUAL((int)LOK_CALLBACK_MOUSE_POINTER, (int)std::get<0>(notifs[i]));
- CPPUNIT_ASSERT_EQUAL(std::string("text"), std::get<1>(notifs[i++]));
-
CPPUNIT_ASSERT_EQUAL((int)LOK_CALLBACK_INVALIDATE_TILES, (int)std::get<0>(notifs[i]));
CPPUNIT_ASSERT_EQUAL(std::string("15 25 15 10"), std::get<1>(notifs[i++]));
+ CPPUNIT_ASSERT_EQUAL((int)LOK_CALLBACK_MOUSE_POINTER, (int)std::get<0>(notifs[i]));
+ CPPUNIT_ASSERT_EQUAL(std::string("text"), std::get<1>(notifs[i++]));
+
CPPUNIT_ASSERT_EQUAL((int)LOK_CALLBACK_TEXT_SELECTION, (int)std::get<0>(notifs[i]));
CPPUNIT_ASSERT_EQUAL(std::string(""), std::get<1>(notifs[i++]));
@@ -874,6 +874,9 @@ void DesktopLOKTest::testNotificationCompression()
CPPUNIT_ASSERT_EQUAL((int)LOK_CALLBACK_CELL_CURSOR, (int)std::get<0>(notifs[i]));
CPPUNIT_ASSERT_EQUAL(std::string("15 25 15 10"), std::get<1>(notifs[i++]));
+ CPPUNIT_ASSERT_EQUAL((int)LOK_CALLBACK_SET_PART, (int)std::get<0>(notifs[i]));
+ CPPUNIT_ASSERT_EQUAL(std::string("1"), std::get<1>(notifs[i++]));
+
CPPUNIT_ASSERT_EQUAL((int)LOK_CALLBACK_CURSOR_VISIBLE, (int)std::get<0>(notifs[i]));
CPPUNIT_ASSERT_EQUAL(std::string(""), std::get<1>(notifs[i++]));