[Libreoffice-commits] online.git: loolwsd/test
Henry Castro
hcastro at collabora.com
Sun May 22 22:51:55 UTC 2016
loolwsd/test/helpers.hpp | 20 ++++++++++++++++++++
loolwsd/test/httpwstest.cpp | 26 --------------------------
2 files changed, 20 insertions(+), 26 deletions(-)
New commits:
commit 166edb66ebd704142daa0b7480f8c65027ecba93
Author: Henry Castro <hcastro at collabora.com>
Date: Sun May 22 18:52:36 2016 -0400
loolwsd: test: move getDocSize to helpers
diff --git a/loolwsd/test/helpers.hpp b/loolwsd/test/helpers.hpp
index 67c0e96..55859c6 100644
--- a/loolwsd/test/helpers.hpp
+++ b/loolwsd/test/helpers.hpp
@@ -386,6 +386,26 @@ void SocketProcessor(const std::string& name,
while (n > 0 && (flags & Poco::Net::WebSocket::FRAME_OP_BITMASK) != Poco::Net::WebSocket::FRAME_OP_CLOSE);
}
+inline
+void getDocSize(const std::string& message, const std::string& type,
+ int& part, int& parts, int& width, int& height)
+{
+ Poco::StringTokenizer tokens(message, " ", Poco::StringTokenizer::TOK_IGNORE_EMPTY | Poco::StringTokenizer::TOK_TRIM);
+ CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(5), tokens.count());
+
+ // Expected format is something like 'type= parts= current= width= height='.
+ const std::string text = tokens[0].substr(std::string("type=").size());
+ parts = std::stoi(tokens[1].substr(std::string("parts=").size()));
+ part = std::stoi(tokens[2].substr(std::string("current=").size()));
+ width = std::stoi(tokens[3].substr(std::string("width=").size()));
+ height = std::stoi(tokens[4].substr(std::string("height=").size()));
+ CPPUNIT_ASSERT_EQUAL(type, text);
+ CPPUNIT_ASSERT(parts > 0);
+ CPPUNIT_ASSERT(part >= 0);
+ CPPUNIT_ASSERT(width > 0);
+ CPPUNIT_ASSERT(height > 0);
+}
+
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/loolwsd/test/httpwstest.cpp b/loolwsd/test/httpwstest.cpp
index 94e04b4..02608a2 100644
--- a/loolwsd/test/httpwstest.cpp
+++ b/loolwsd/test/httpwstest.cpp
@@ -111,13 +111,6 @@ class HTTPWSTest : public CPPUNIT_NS::TestFixture
void getPartHashCodes(const std::string response,
std::vector<std::string>& parts);
- void getDocSize(const std::string& message,
- const std::string& type,
- int& part,
- int& parts,
- int& width,
- int& height);
-
void getCursor(const std::string& message,
int& cursorX,
int& cursorY,
@@ -1278,25 +1271,6 @@ void HTTPWSTest::getPartHashCodes(const std::string status,
CPPUNIT_ASSERT_EQUAL(totalParts, (int)parts.size());
}
-void HTTPWSTest::getDocSize(const std::string& message, const std::string& type,
- int& part, int& parts, int& width, int& height)
-{
- Poco::StringTokenizer tokens(message, " ", Poco::StringTokenizer::TOK_IGNORE_EMPTY | Poco::StringTokenizer::TOK_TRIM);
- CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(5), tokens.count());
-
- // Expected format is something like 'type= parts= current= width= height='.
- const std::string text = tokens[0].substr(std::string("type=").size());
- parts = std::stoi(tokens[1].substr(std::string("parts=").size()));
- part = std::stoi(tokens[2].substr(std::string("current=").size()));
- width = std::stoi(tokens[3].substr(std::string("width=").size()));
- height = std::stoi(tokens[4].substr(std::string("height=").size()));
- CPPUNIT_ASSERT_EQUAL(type, text);
- CPPUNIT_ASSERT(parts > 0);
- CPPUNIT_ASSERT(part >= 0);
- CPPUNIT_ASSERT(width > 0);
- CPPUNIT_ASSERT(height > 0);
-}
-
void HTTPWSTest::getCursor(const std::string& message,
int& cursorX, int& cursorY, int& cursorWidth, int& cursorHeight)
{
More information about the Libreoffice-commits
mailing list