[Libreoffice-commits] online.git: test/TileCacheTests.cpp

Ashod Nakashian ashod.nakashian at collabora.co.uk
Mon Jan 9 06:20:06 UTC 2017


 test/TileCacheTests.cpp |   56 ++++++++++++++++++++++++++++++++++++------------
 1 file changed, 42 insertions(+), 14 deletions(-)

New commits:
commit 93c66eeb9bad244e57555d5fe01a4d573922677e
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Thu Jan 5 11:09:44 2017 -0500

    wsd: fixup tileInvalidatePartImpress
    
    Since the Impress slides use large fonts, we end up
    overflowing the part bounds with this test.
    
    Luckily the top row of text has smaller font, and
    more vertical space within the slide, so now
    we edit the top-left textbox and this test
    doesn't fail anymore (tested 50 times) when
    it failed ~1 in 4 previously.
    
    Change-Id: I13d8cc4462d48b128578a9d3fdde90a79c607c4b
    Reviewed-on: https://gerrit.libreoffice.org/32862
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/test/TileCacheTests.cpp b/test/TileCacheTests.cpp
index 2c235dc..78e54c5 100644
--- a/test/TileCacheTests.cpp
+++ b/test/TileCacheTests.cpp
@@ -94,8 +94,6 @@ class TileCacheTests : public CPPUNIT_NS::TestFixture
     void testTileInvalidatePartCalc();
     void testTileInvalidatePartImpress();
 
-    void tileInvalidatePart(const std::string& filename, const std::string& testname);
-
     void checkTiles(std::shared_ptr<LOOLWebSocket>& socket,
                     const std::string& type,
                     const std::string& name = "checkTiles ");
@@ -860,8 +858,10 @@ void TileCacheTests::testTileInvalidateCalc()
     }
 }
 
-void TileCacheTests::tileInvalidatePart(const std::string& filename, const std::string& testname)
+void TileCacheTests::testTileInvalidatePartCalc()
 {
+    const std::string filename = "setclientpart.ods";
+    const std::string testname = "tileInvalidatePartCalc";
     const std::string testname1 = testname + "-1 ";
     const std::string testname2 = testname + "-2 ";
 
@@ -871,14 +871,14 @@ void TileCacheTests::tileInvalidatePart(const std::string& filename, const std::
 
     sendTextFrame(socket1, "setclientpart part=2", testname1);
     assertResponseString(socket1, "setpart:", testname1);
-    sendTextFrame(socket1, "mouse type=buttondown x=7886 y=8929 count=1 buttons=1 modifier=0", testname1);
+    sendTextFrame(socket1, "mouse type=buttondown x=1500 y=1500 count=1 buttons=1 modifier=0", testname1);
 
-    auto socket2 = loadDocAndGetSocket(_uri, documentURL);
+    auto socket2 = loadDocAndGetSocket(_uri, documentURL, testname2);
     sendTextFrame(socket2, "setclientpart part=5", testname2);
     assertResponseString(socket2, "setpart:", testname2);
-    sendTextFrame(socket2, "mouse type=buttondown x=7886 y=8929 count=1 buttons=1 modifier=0", testname2);
+    sendTextFrame(socket2, "mouse type=buttondown x=1500 y=1500 count=1 buttons=1 modifier=0", testname2);
 
-    std::string text = "Some test";
+    static const std::string text = "Some test";
     for (char ch : text)
     {
         sendChar(socket1, ch);
@@ -896,15 +896,43 @@ void TileCacheTests::tileInvalidatePart(const std::string& filename, const std::
     }
 }
 
-
-void TileCacheTests::testTileInvalidatePartCalc()
-{
-    tileInvalidatePart("setclientpart.ods", "tileInvalidatePartCalc");
-}
-
 void TileCacheTests::testTileInvalidatePartImpress()
 {
-    tileInvalidatePart("setclientpart.odp", "tileInvalidatePartImpress");
+    const std::string filename = "setclientpart.odp";
+    const std::string testname = "tileInvalidatePartImpress";
+    const std::string testname1 = testname + "-1 ";
+    const std::string testname2 = testname + "-2 ";
+
+    std::string documentPath, documentURL;
+    getDocumentPathAndURL(filename, documentPath, documentURL, testname);
+    auto socket1 = loadDocAndGetSocket(_uri, documentURL, testname1);
+
+    sendTextFrame(socket1, "setclientpart part=2", testname1);
+    assertResponseString(socket1, "setpart:", testname1);
+    sendTextFrame(socket1, "mouse type=buttondown x=1500 y=1500 count=1 buttons=1 modifier=0", testname1);
+
+    auto socket2 = loadDocAndGetSocket(_uri, documentURL, testname2);
+    sendTextFrame(socket2, "setclientpart part=5", testname2);
+    assertResponseString(socket2, "setpart:", testname2);
+    sendTextFrame(socket2, "mouse type=buttondown x=1500 y=1500 count=1 buttons=1 modifier=0", testname2);
+
+    // This should be short, as in odp the font is large and we leave the page otherwise.
+    static const std::string text = "Some test";
+    for (char ch : text)
+    {
+        sendChar(socket1, ch);
+        sendChar(socket2, ch);
+
+        const auto response1 = assertResponseString(socket1, "invalidatetiles:", testname1);
+        int value1;
+        LOOLProtocol::getTokenIntegerFromMessage(response1, "part", value1);
+        CPPUNIT_ASSERT_EQUAL(2, value1);
+
+        const auto response2 = assertResponseString(socket2, "invalidatetiles:", testname2);
+        int value2;
+        LOOLProtocol::getTokenIntegerFromMessage(response2, "part", value2);
+        CPPUNIT_ASSERT_EQUAL(5, value2);
+    }
 }
 
 void TileCacheTests::checkTiles(std::shared_ptr<LOOLWebSocket>& socket, const std::string& docType, const std::string& name)


More information about the Libreoffice-commits mailing list