loolwsd/test/TileCacheTests.cpp | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-)
New commits: commit 3f690113fb149ff0b87e9bcd5beeea51ab9de45a Author: Ashod Nakashian <ashod.nakash...@collabora.co.uk> Date: Fri Oct 7 23:39:24 2016 -0400 loolwsd: unittest invalidatetiles for Writer Writer really has a single part for rendering purposes, 0. This new unittest validates that if we edit a page that isn't the first, part in invalidatetiles will still be 0, and not the page number of something else. Change-Id: Idb5d14c2365cc0f73b76ee47223815ddf611f8ce Reviewed-on: https://gerrit.libreoffice.org/29607 Reviewed-by: Ashod Nakashian <ashnak...@gmail.com> Tested-by: Ashod Nakashian <ashnak...@gmail.com> diff --git a/loolwsd/test/TileCacheTests.cpp b/loolwsd/test/TileCacheTests.cpp index 3590a06..72d5d1a 100644 --- a/loolwsd/test/TileCacheTests.cpp +++ b/loolwsd/test/TileCacheTests.cpp @@ -63,6 +63,7 @@ class TileCacheTests : public CPPUNIT_NS::TestFixture #endif CPPUNIT_TEST(testLoad12ods); CPPUNIT_TEST(testTileInvalidateWriter); + CPPUNIT_TEST(testTileInvalidateWriterPage); CPPUNIT_TEST(testTileInvalidateCalc); CPPUNIT_TEST(testTileInvalidatePartCalc); CPPUNIT_TEST(testTileInvalidatePartImpress); @@ -81,6 +82,7 @@ class TileCacheTests : public CPPUNIT_NS::TestFixture void testSimultaneousTilesRenderedJustOnce(); void testLoad12ods(); void testTileInvalidateWriter(); + void testTileInvalidateWriterPage(); void testWriterAnyKey(); void testTileInvalidateCalc(); void testTileInvalidatePartCalc(); @@ -535,6 +537,28 @@ void TileCacheTests::testTileInvalidateWriter() // TODO: implement a random-sequence "monkey test" } +void TileCacheTests::testTileInvalidateWriterPage() +{ + const auto testname = "tileInvalidateWriterPage"; + + std::string documentPath, documentURL; + getDocumentPathAndURL("empty.odt", documentPath, documentURL); + Poco::Net::HTTPRequest request(Poco::Net::HTTPRequest::HTTP_GET, documentURL); + + auto socket = *loadDocAndGetSocket(_uri, documentURL, testname); + + sendChar(socket, '\n', skCtrl, testname); // Send Ctrl+Enter (page break). + assertResponseLine(socket, "invalidatetiles:", testname); + + sendTextFrame(socket, "uno .uno:InsertTable { \"Columns\": { \"type\": \"long\",\"value\": 3 }, \"Rows\": { \"type\": \"long\",\"value\": 2 }}", testname); + + const auto res = assertResponseLine(socket, "invalidatetiles:", testname); + int part = -1; + CPPUNIT_ASSERT_MESSAGE("No part# in invalidatetiles message.", + LOOLProtocol::getTokenIntegerFromMessage(res, "part", part)); + CPPUNIT_ASSERT_EQUAL(0, part); +} + // This isn't yet used void TileCacheTests::testWriterAnyKey() { @@ -628,7 +652,7 @@ void TileCacheTests::testTileInvalidateCalc() for (char ch : text) { sendChar(socket, ch); // Send ordinary characters -> one tile invalidation for each - auto response = getResponseMessage(socket, "invalidatetiles:"); + assertResponseLine(socket, "invalidatetiles:", testname); } std::cerr << "Sending enters" << std::endl; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits