sc/qa/unit/tiledrendering/data/cursor-away.ods |binary
 sc/qa/unit/tiledrendering/tiledrendering.cxx   |   39 +++++++++++++++++++++++++
 sc/source/ui/view/gridwin4.cxx                 |    6 ---
 3 files changed, 39 insertions(+), 6 deletions(-)

New commits:
commit 44eb05c254c3a45b3590fba7b4ea2194f45930b5
Author: Marco Cecchetti <marco.cecche...@collabora.com>
Date:   Wed May 3 18:15:11 2017 +0200

    sc lok:fix up: scrolling issue: the document size is not updated in client
    
    Change-Id: Ied16f52b0a3a3be074390d60120493c75076c84d

diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 346f833050f2..fa565a4ab8c3 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -1156,16 +1156,10 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice,
     pDoc->GetTiledRenderingArea(nTab, nEndCol, nEndRow);
 
     if (nEndCol < nBottomRightTileCol)
-    {
         nEndCol = nBottomRightTileCol;
-        pViewData->SetMaxTiledCol(nEndCol);
-    }
 
     if (nEndRow < nBottomRightTileRow)
-    {
         nEndRow = nBottomRightTileRow;
-        pViewData->SetMaxTiledRow(nEndRow);
-    }
 
     nTopLeftTileCol = std::max<sal_Int32>(nTopLeftTileCol, 0);
     nTopLeftTileRow = std::max<sal_Int32>(nTopLeftTileRow, 0);
commit 02359793bbb8e2b762d3f9ce0f41905f8422d7d4
Author: Jan Holesovsky <ke...@collabora.com>
Date:   Tue May 2 16:32:28 2017 +0200

    sc lok: Unit test that painting tiles after pgdown returns actual content.
    
    Test based on the online.git test by Ashod Nakashian, thanks for the repro
    steps there!
    
    Change-Id: I225127e953b0dade0b1bd4e12c131dc984b7e3fc

diff --git a/sc/qa/unit/tiledrendering/data/cursor-away.ods 
b/sc/qa/unit/tiledrendering/data/cursor-away.ods
new file mode 100644
index 000000000000..c593fc7db033
Binary files /dev/null and b/sc/qa/unit/tiledrendering/data/cursor-away.ods 
differ
diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx 
b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index 220a1a271e3b..29f8e5179a96 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -82,6 +82,7 @@ public:
     void testUndoLimiting();
     void testUndoRepairDispatch();
     void testInsertGraphicInvalidations();
+    void testDocumentSizeWithTwoViews();
 
     CPPUNIT_TEST_SUITE(ScTiledRenderingTest);
     CPPUNIT_TEST(testRowColumnSelections);
@@ -107,6 +108,7 @@ public:
     CPPUNIT_TEST(testUndoLimiting);
     CPPUNIT_TEST(testUndoRepairDispatch);
     CPPUNIT_TEST(testInsertGraphicInvalidations);
+    CPPUNIT_TEST(testDocumentSizeWithTwoViews);
     CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -1314,6 +1316,43 @@ void 
ScTiledRenderingTest::testInsertGraphicInvalidations()
     comphelper::LibreOfficeKit::setActive(false);
 }
 
+void ScTiledRenderingTest::testDocumentSizeWithTwoViews()
+{
+    comphelper::LibreOfficeKit::setActive();
+
+    // Open a document that has the cursor far away & paint a tile
+    ScModelObj* pModelObj = createDoc("cursor-away.ods");
+
+    // Set the visible area, and press page down
+    pModelObj->setClientVisibleArea(Rectangle(750, 1861, 20583, 6997));
+    pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::PAGEDOWN);
+    pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::PAGEDOWN);
+    Scheduler::ProcessEventsToIdle();
+
+    int nCanvasWidth = 256;
+    int nCanvasHeight = 256;
+    std::vector<unsigned char> aBuffer1(nCanvasWidth * nCanvasHeight * 4);
+    ScopedVclPtrInstance<VirtualDevice> pDevice1(nullptr, Size(1, 1), 
DeviceFormat::DEFAULT);
+    pDevice1->SetOutputSizePixelScaleOffsetAndBuffer(Size(nCanvasWidth, 
nCanvasHeight), Fraction(1.0), Point(), aBuffer1.data());
+    pModelObj->paintTile(*pDevice1.get(), nCanvasWidth, nCanvasHeight, 
/*nTilePosX=*/0, /*nTilePosY=*/291840, /*nTileWidth=*/3840, 
/*nTileHeight=*/3840);
+    Scheduler::ProcessEventsToIdle();
+
+    // Create a new view
+    SfxLokHelper::createView();
+
+    std::vector<unsigned char> aBuffer2(nCanvasWidth * nCanvasHeight * 4);
+    ScopedVclPtrInstance<VirtualDevice> pDevice2(nullptr, Size(1, 1), 
DeviceFormat::DEFAULT);
+    pDevice2->SetOutputSizePixelScaleOffsetAndBuffer(Size(nCanvasWidth, 
nCanvasHeight), Fraction(1.0), Point(), aBuffer2.data());
+    pModelObj->paintTile(*pDevice2.get(), nCanvasWidth, nCanvasHeight, 
/*nTilePosX=*/0, /*nTilePosY=*/291840, /*nTileWidth=*/3840, 
/*nTileHeight=*/3840);
+    Scheduler::ProcessEventsToIdle();
+
+    // Check that the tiles actually have the same content
+    for (size_t i = 0; i < aBuffer1.size(); ++i)
+        CPPUNIT_ASSERT_EQUAL(aBuffer1[i], aBuffer2[i]);
+
+    comphelper::LibreOfficeKit::setActive(false);
+}
+
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(ScTiledRenderingTest);
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to