[Libreoffice-commits] online.git: loolwsd/MessageQueue.hpp loolwsd/test
Jan Holesovsky
kendy at collabora.com
Tue Sep 27 15:13:40 UTC 2016
loolwsd/MessageQueue.hpp | 2 ++
loolwsd/test/WhiteBoxTests.cpp | 14 ++++++++++++++
2 files changed, 16 insertions(+)
New commits:
commit da061317ffe3fc0cb6c322d75c865b986329845b
Author: Jan Holesovsky <kendy at collabora.com>
Date: Tue Sep 27 17:03:39 2016 +0200
Trivial tilecombine unit test for TileQueue.
Fails with any of 137e677eb0d6af1996701b2bd1b27a6eb3822613 or
fb0e041232c9e8c345600eede619a0ca9a947741 reverted.
Change-Id: Ib025e5d943eef1306e89167260ad352b0ecaf65b
diff --git a/loolwsd/MessageQueue.hpp b/loolwsd/MessageQueue.hpp
index 1dee715..1127454 100644
--- a/loolwsd/MessageQueue.hpp
+++ b/loolwsd/MessageQueue.hpp
@@ -21,6 +21,8 @@
*/
class MessageQueue
{
+ friend class WhiteBoxTests;
+
public:
typedef std::vector<char> Payload;
diff --git a/loolwsd/test/WhiteBoxTests.cpp b/loolwsd/test/WhiteBoxTests.cpp
index 15c5b27..a05460e 100644
--- a/loolwsd/test/WhiteBoxTests.cpp
+++ b/loolwsd/test/WhiteBoxTests.cpp
@@ -13,6 +13,7 @@
#include <Common.hpp>
#include <LOOLProtocol.hpp>
+#include <MessageQueue.hpp>
#include <Util.hpp>
/// WhiteBox unit-tests.
@@ -23,12 +24,14 @@ class WhiteBoxTests : public CPPUNIT_NS::TestFixture
CPPUNIT_TEST(testLOOLProtocolFunctions);
CPPUNIT_TEST(testRegexListMatcher);
CPPUNIT_TEST(testRegexListMatcher_Init);
+ CPPUNIT_TEST(testTileQueue);
CPPUNIT_TEST_SUITE_END();
void testLOOLProtocolFunctions();
void testRegexListMatcher();
void testRegexListMatcher_Init();
+ void testTileQueue();
};
void WhiteBoxTests::testLOOLProtocolFunctions()
@@ -144,6 +147,17 @@ void WhiteBoxTests::testRegexListMatcher_Init()
CPPUNIT_ASSERT(matcher.match("192.168.."));
}
+void WhiteBoxTests::testTileQueue()
+{
+ std::unique_ptr<TileQueue> queue(new TileQueue());
+
+ queue->put("tilecombine part=0 width=256 height=256 tileposx=0,3840,7680 tileposy=0,0,0 tilewidth=3840 tileheight=3840");
+ queue->put("tilecombine part=0 width=256 height=256 tileposx=0,3840 tileposy=0,0 tilewidth=3840 tileheight=3840");
+
+ // the tilecombine's get merged, resulting in 3 "tile" messages
+ CPPUNIT_ASSERT_EQUAL(3, static_cast<int>(queue->_queue.size()));
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(WhiteBoxTests);
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list