[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-1-0' - loolwsd/test
Tor Lillqvist
tml at collabora.com
Tue Oct 11 13:16:57 UTC 2016
loolwsd/test/httpwstest.cpp | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
New commits:
commit 45c70da298892b54bb8bf754ee8eff475869cb0c
Author: Tor Lillqvist <tml at collabora.com>
Date: Tue Oct 11 16:14:53 2016 +0300
More adaption for viewid parameters
Do what the comment said, be more flexible. This is how this kind of
testing should be done IMHO. Use the LOOLProtocol helpers.
diff --git a/loolwsd/test/httpwstest.cpp b/loolwsd/test/httpwstest.cpp
index fcaa88f..c7c3c09 100644
--- a/loolwsd/test/httpwstest.cpp
+++ b/loolwsd/test/httpwstest.cpp
@@ -351,8 +351,22 @@ void HTTPWSTest::loadDoc(const std::string& documentURL)
if (msg.find(prefix) == 0)
{
const auto status = msg.substr(prefix.length());
- // Might be too strict, consider something flexible instread.
- CPPUNIT_ASSERT_EQUAL(std::string("type=text parts=1 current=0 width=12808 height=16408"), status);
+ Poco::StringTokenizer tokens(status, " ", Poco::StringTokenizer::TOK_IGNORE_EMPTY | Poco::StringTokenizer::TOK_TRIM);
+ std::string type;
+ int parts;
+ int current;
+ int width;
+ int height;
+ CPPUNIT_ASSERT(LOOLProtocol::getTokenString(tokens, "type", type));
+ CPPUNIT_ASSERT_EQUAL(std::string("text"), type);
+ CPPUNIT_ASSERT(LOOLProtocol::getTokenInteger(tokens, "parts", parts));
+ CPPUNIT_ASSERT_EQUAL(1, parts);
+ CPPUNIT_ASSERT(LOOLProtocol::getTokenInteger(tokens, "current", current));
+ CPPUNIT_ASSERT_EQUAL(0, current);
+ CPPUNIT_ASSERT(LOOLProtocol::getTokenInteger(tokens, "width", width));
+ CPPUNIT_ASSERT_EQUAL(12808, width);
+ CPPUNIT_ASSERT(LOOLProtocol::getTokenInteger(tokens, "height", height));
+ CPPUNIT_ASSERT_EQUAL(16408, height);
}
else if (msg.find("editlock") == 0)
{
More information about the Libreoffice-commits
mailing list