summaryrefslogtreecommitdiff
path: root/test/helpers.hpp
diff options
context:
space:
mode:
authorAshod Nakashian <ashod.nakashian@collabora.co.uk>2017-04-30 21:54:38 -0400
committerAshod Nakashian <ashnakash@gmail.com>2017-05-02 06:12:27 +0200
commit647e5f8936b683b6ca511b967fcb35f2cd1cf463 (patch)
tree6249e34b268acbaaf17def7efd60d5fc594d448e /test/helpers.hpp
parentf8ae6243dde0c2fdd9bc048020d386de07145bfd (diff)
wsd: unittest to reproduce rendering issue in Calc
The following scenario causes rendering failure where blank tiles are returned. 1. Load doc where the cursor is saved to a top cell. 2. Page down (typically several 100th row). 3. Load a new view to the same doc (do nothing else). 4. In the first view up-arrow to move cursor and invalidate. 5. New tile is rendered incorrectly. Change-Id: I06c7627d1b74d9e3be3e83d9d9a09cb5479ba660 Reviewed-on: https://gerrit.libreoffice.org/37129 Reviewed-by: Ashod Nakashian <ashnakash@gmail.com> Tested-by: Ashod Nakashian <ashnakash@gmail.com>
Diffstat (limited to 'test/helpers.hpp')
-rw-r--r--test/helpers.hpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/helpers.hpp b/test/helpers.hpp
index 70bf6e4c8..1b00b2e32 100644
--- a/test/helpers.hpp
+++ b/test/helpers.hpp
@@ -540,6 +540,33 @@ inline void sendText(std::shared_ptr<LOOLWebSocket>& socket, const std::string&
}
}
+inline std::vector<char> getTileAndSave(std::shared_ptr<LOOLWebSocket>& socket,
+ const std::string& req,
+ const std::string& filename,
+ const std::string& testname)
+{
+ std::cerr << testname << "Requesting: " << req << std::endl;
+ sendTextFrame(socket, req, testname);
+
+ const auto tile = getResponseMessage(socket, "tile:", testname);
+ std::cerr << testname << " Tile PNG size: " << tile.size() << std::endl;
+
+ const std::string firstLine = LOOLProtocol::getFirstLine(tile);
+ std::vector<char> res(tile.begin() + firstLine.size() + 1, tile.end());
+ std::stringstream streamRes;
+ std::copy(res.begin(), res.end(), std::ostream_iterator<char>(streamRes));
+
+ if (!filename.empty())
+ {
+ std::fstream outStream(filename, std::ios::out);
+ outStream.write(res.data(), res.size());
+ outStream.close();
+ std::cerr << testname << "Saved [" << firstLine << "] to [" << filename << "]" << std::endl;
+ }
+
+ return res;
+}
+
}
#endif