[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.1' - sc/qa svx/source

Henry Castro hcastro at collabora.com
Sat Sep 24 12:52:00 UTC 2016


 sc/qa/unit/tiledrendering/data/shape.ods     |binary
 sc/qa/unit/tiledrendering/tiledrendering.cxx |   45 +++++++++++++++++++++++++++
 svx/source/svdraw/sdrpaintwindow.cxx         |    6 +++
 svx/source/svdraw/svdmrkv.cxx                |    2 -
 4 files changed, 51 insertions(+), 2 deletions(-)

New commits:
commit 5d3f237bf1d706adea8fa74e24079810bfc87351
Author: Henry Castro <hcastro at collabora.com>
Date:   Fri Sep 23 17:14:29 2016 -0400

    sc lok: avoid full invalidate tiles
    
    Change-Id: Idd49dc61ba8dbd7af42f641bb019cf83814f9e8d
    Reviewed-on: https://gerrit.libreoffice.org/29240
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Henry Castro <hcastro at collabora.com>

diff --git a/sc/qa/unit/tiledrendering/data/shape.ods b/sc/qa/unit/tiledrendering/data/shape.ods
index eeb89938..d2525f1 100644
Binary files a/sc/qa/unit/tiledrendering/data/shape.ods and b/sc/qa/unit/tiledrendering/data/shape.ods differ
diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index 691496e..be7e78d 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -62,6 +62,7 @@ public:
     void testColRowResize();
     void testUndoShells();
     void testCreateViewGraphicSelection();
+    void testGraphicInvalidate();
 
     CPPUNIT_TEST_SUITE(ScTiledRenderingTest);
     CPPUNIT_TEST(testRowColumnSelections);
@@ -75,6 +76,7 @@ public:
     CPPUNIT_TEST(testColRowResize);
     CPPUNIT_TEST(testUndoShells);
     CPPUNIT_TEST(testCreateViewGraphicSelection);
+    CPPUNIT_TEST(testGraphicInvalidate);
     CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -359,6 +361,7 @@ public:
     bool m_bTextViewSelectionInvalidated;
     bool m_bGraphicSelection;
     bool m_bGraphicViewSelection;
+    bool m_bFullInvalidateTiles;
     bool m_bViewLock;
 
     ViewCallback()
@@ -366,6 +369,7 @@ public:
           m_bViewCursorInvalidated(false),
           m_bTextViewSelectionInvalidated(false),
           m_bGraphicViewSelection(false),
+          m_bFullInvalidateTiles(false),
           m_bViewLock(false)
     {
     }
@@ -412,6 +416,14 @@ public:
             m_bGraphicViewSelection = true;
         }
         break;
+        case LOK_CALLBACK_INVALIDATE_TILES:
+        {
+            std::string text(pPayload);
+            if (text.find("EMPTY") != std::string::npos)
+            {
+                m_bFullInvalidateTiles = true;
+            }
+        }
         }
     }
 };
@@ -641,6 +653,39 @@ void ScTiledRenderingTest::testCreateViewGraphicSelection()
     comphelper::LibreOfficeKit::setActive(false);
 }
 
+void ScTiledRenderingTest::testGraphicInvalidate()
+{
+    // Load a document
+    comphelper::LibreOfficeKit::setActive();
+
+    // Load a document that has a shape and create two views.
+    ScModelObj* pModelObj = createDoc("shape.ods");
+    ViewCallback aView;
+    SfxViewShell::Current()->registerLibreOfficeKitViewCallback(&ViewCallback::callback, &aView);
+
+    // Click to select graphic
+    aView.m_bGraphicSelection = false;
+    pModelObj->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONDOWN, /*x=*/ 1,/*y=*/ 1,/*count=*/ 1, /*buttons=*/ 1, /*modifier=*/0);
+    pModelObj->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONUP, /*x=*/ 1, /*y=*/ 1, /*count=*/ 1, /*buttons=*/ 1, /*modifier=*/0);
+    CPPUNIT_ASSERT(aView.m_bGraphicSelection);
+
+    // Drag Drop graphic
+    aView.m_bGraphicSelection = false;
+    pModelObj->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONDOWN, /*x=*/ 1,/*y=*/ 1,/*count=*/ 1, /*buttons=*/ 1, /*modifier=*/0);
+    pModelObj->postMouseEvent(LOK_MOUSEEVENT_MOUSEMOVE, /*x=*/ 1,/*y=*/ 10,/*count=*/ 1, /*buttons=*/ 1, /*modifier=*/0);
+    pModelObj->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONUP, /*x=*/ 1, /*y=*/ 10, /*count=*/ 1, /*buttons=*/ 1, /*modifier=*/0);
+    Scheduler::ProcessEventsToIdle();
+    CPPUNIT_ASSERT(!aView.m_bFullInvalidateTiles);
+
+    // Check again
+    Scheduler::ProcessEventsToIdle();
+    CPPUNIT_ASSERT(!aView.m_bFullInvalidateTiles);
+
+    mxComponent->dispose();
+    mxComponent.clear();
+    comphelper::LibreOfficeKit::setActive(false);
+}
+
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(ScTiledRenderingTest);
diff --git a/svx/source/svdraw/sdrpaintwindow.cxx b/svx/source/svdraw/sdrpaintwindow.cxx
index c18bfa5..ca40176 100644
--- a/svx/source/svdraw/sdrpaintwindow.cxx
+++ b/svx/source/svdraw/sdrpaintwindow.cxx
@@ -17,6 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <comphelper/lok.hxx>
 #include <comphelper/random.hxx>
 #include <svx/sdrpaintwindow.hxx>
 #include <sdr/overlay/overlaymanagerbuffered.hxx>
@@ -219,7 +220,10 @@ void SdrPaintWindow::impCreateOverlayManager()
             // Request a repaint so that the buffered overlay manager fills
             // its buffer properly.  This is a workaround for missing buffer
             // updates.
-            rWindow.Invalidate();
+            if (!comphelper::LibreOfficeKit::isActive())
+            {
+                rWindow.Invalidate();
+            }
 
             Color aColA(GetPaintView().getOptionsDrawinglayer().GetStripeColorA());
             Color aColB(GetPaintView().getOptionsDrawinglayer().GetStripeColorB());
diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx
index 20ff410..1e779ab 100644
--- a/svx/source/svdraw/svdmrkv.cxx
+++ b/svx/source/svdraw/svdmrkv.cxx
@@ -209,7 +209,7 @@ void SdrMarkView::ModelHasChanged()
         AdjustMarkHdl();
     }
 
-    if (comphelper::LibreOfficeKit::isActive())
+    if (comphelper::LibreOfficeKit::isActive() && GetMarkedObjectCount() > 0)
     {
         //TODO: Is MarkedObjRect valid at this point?
         Rectangle aSelection(GetMarkedObjRect());


More information about the Libreoffice-commits mailing list