[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.0' - desktop/inc desktop/qa
Ashod Nakashian
ashod.nakashian at collabora.co.uk
Sat Apr 23 18:11:26 UTC 2016
desktop/inc/lib/init.hxx | 9 +++++++++
desktop/qa/desktop_lib/test_desktop_lib.cxx | 28 +++++++++++++++++++++++++++-
2 files changed, 36 insertions(+), 1 deletion(-)
New commits:
commit 45037438d84485356a5ceb820ecc3e0bae4b112e
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date: Sat Apr 23 14:06:22 2016 -0400
Desktop compresses text selection start/end notifications
Change-Id: Ia85ded04d0eaf9d9b846fab6d86a44a758fccb69
Reviewed-on: https://gerrit.libreoffice.org/24320
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at gmail.com>
diff --git a/desktop/inc/lib/init.hxx b/desktop/inc/lib/init.hxx
index fdcb54f..c9e0ff5 100644
--- a/desktop/inc/lib/init.hxx
+++ b/desktop/inc/lib/init.hxx
@@ -39,6 +39,8 @@ 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_INVALIDATE_VISIBLE_CURSOR, "NIL");
m_states.emplace(LOK_CALLBACK_STATE_CHANGED, "NIL");
@@ -94,6 +96,13 @@ namespace desktop {
return;
}
+ if (type == LOK_CALLBACK_TEXT_SELECTION && payload.empty())
+ {
+ // Removing text selection invalidates the start and end as well.
+ m_states[LOK_CALLBACK_TEXT_SELECTION_START] = "";
+ m_states[LOK_CALLBACK_TEXT_SELECTION_END] = "";
+ }
+
m_queue.emplace_back(type, payload);
lock.unlock();
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index b9d5969..1199fe7 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -701,10 +701,18 @@ void DesktopLOKTest::testNotificationCompression()
handler->queue(LOK_CALLBACK_INVALIDATE_TILES, "15 25 15 10"); // 8
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_TEXT_SELECTION_START, "15 25 15 10"); // 9
+ handler->queue(LOK_CALLBACK_TEXT_SELECTION_END, "15 25 15 10"); // 10
+ handler->queue(LOK_CALLBACK_TEXT_SELECTION, "15 25 15 10"); // 11
+ 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, ""); // 12
+ handler->queue(LOK_CALLBACK_TEXT_SELECTION_START, "15 25 15 10"); // 13
+ handler->queue(LOK_CALLBACK_TEXT_SELECTION_END, "15 25 15 10"); // 14
flushTimers();
- CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(9), notifs.size());
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(15), notifs.size());
CPPUNIT_ASSERT_EQUAL((int)LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR, (int)std::get<0>(notifs[0]));
CPPUNIT_ASSERT_EQUAL(std::string(""), std::get<1>(notifs[0]));
@@ -732,6 +740,24 @@ void DesktopLOKTest::testNotificationCompression()
CPPUNIT_ASSERT_EQUAL((int)LOK_CALLBACK_INVALIDATE_TILES, (int)std::get<0>(notifs[8]));
CPPUNIT_ASSERT_EQUAL(std::string("15 25 15 10"), std::get<1>(notifs[8]));
+
+ CPPUNIT_ASSERT_EQUAL((int)LOK_CALLBACK_TEXT_SELECTION_START, (int)std::get<0>(notifs[9]));
+ CPPUNIT_ASSERT_EQUAL(std::string("15 25 15 10"), std::get<1>(notifs[9]));
+
+ CPPUNIT_ASSERT_EQUAL((int)LOK_CALLBACK_TEXT_SELECTION_END, (int)std::get<0>(notifs[10]));
+ CPPUNIT_ASSERT_EQUAL(std::string("15 25 15 10"), std::get<1>(notifs[10]));
+
+ CPPUNIT_ASSERT_EQUAL((int)LOK_CALLBACK_TEXT_SELECTION, (int)std::get<0>(notifs[11]));
+ CPPUNIT_ASSERT_EQUAL(std::string("15 25 15 10"), std::get<1>(notifs[11]));
+
+ CPPUNIT_ASSERT_EQUAL((int)LOK_CALLBACK_TEXT_SELECTION, (int)std::get<0>(notifs[12]));
+ CPPUNIT_ASSERT_EQUAL(std::string(""), std::get<1>(notifs[12]));
+
+ CPPUNIT_ASSERT_EQUAL((int)LOK_CALLBACK_TEXT_SELECTION_START, (int)std::get<0>(notifs[13]));
+ CPPUNIT_ASSERT_EQUAL(std::string("15 25 15 10"), std::get<1>(notifs[13]));
+
+ CPPUNIT_ASSERT_EQUAL((int)LOK_CALLBACK_TEXT_SELECTION_END, (int)std::get<0>(notifs[14]));
+ CPPUNIT_ASSERT_EQUAL(std::string("15 25 15 10"), std::get<1>(notifs[14]));
}
CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest);
More information about the Libreoffice-commits
mailing list