[Libreoffice-commits] core.git: sw/qa sw/source
Miklos Vajna
vmiklos at collabora.co.uk
Thu Jul 28 12:23:16 UTC 2016
sw/qa/extras/tiledrendering/tiledrendering.cxx | 36 +++++++++++++++++++++++++
sw/source/uibase/shells/basesh.cxx | 12 +++++---
2 files changed, 44 insertions(+), 4 deletions(-)
New commits:
commit 1e21c32a2f81b4ae5302fc8d537e4f200a1a3e76
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Thu Jul 28 12:47:29 2016 +0200
tdf#101168 sw: fix missing repaint on undo with multiple windows
Need to lock / unlock all view shells, not just the current one.
Change-Id: I754214a202c6bbb74daac6f933481cb3fe7b9dbb
Reviewed-on: https://gerrit.libreoffice.org/27620
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
Tested-by: Jenkins <ci at libreoffice.org>
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index 82d87f4..79d3e18 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -58,6 +58,7 @@ public:
void testViewCursorCleanup();
void testViewLock();
void testTextEditViewInvalidations();
+ void testUndoInvalidations();
CPPUNIT_TEST_SUITE(SwTiledRenderingTest);
CPPUNIT_TEST(testRegisterCallback);
@@ -82,6 +83,7 @@ public:
CPPUNIT_TEST(testViewCursorCleanup);
CPPUNIT_TEST(testViewLock);
CPPUNIT_TEST(testTextEditViewInvalidations);
+ CPPUNIT_TEST(testUndoInvalidations);
CPPUNIT_TEST_SUITE_END();
private:
@@ -854,6 +856,40 @@ void SwTiledRenderingTest::testTextEditViewInvalidations()
comphelper::LibreOfficeKit::setActive(false);
}
+void SwTiledRenderingTest::testUndoInvalidations()
+{
+ // Load a document and create two views.
+ comphelper::LibreOfficeKit::setActive();
+ SwXTextDocument* pXTextDocument = createDoc("dummy.fodt");
+ ViewCallback aView1;
+ SfxViewShell::Current()->registerLibreOfficeKitViewCallback(&ViewCallback::callback, &aView1);
+ SfxLokHelper::createView();
+ pXTextDocument->initializeForTiledRendering(uno::Sequence<beans::PropertyValue>());
+ ViewCallback aView2;
+ SfxViewShell::Current()->registerLibreOfficeKitViewCallback(&ViewCallback::callback, &aView2);
+
+ // Insert a character the end of the document.
+ SwWrtShell* pWrtShell = pXTextDocument->GetDocShell()->GetWrtShell();
+ pWrtShell->EndDoc();
+ pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 'c', 0);
+ pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 'c', 0);
+ SwShellCursor* pShellCursor = pWrtShell->getShellCursor(false);
+ CPPUNIT_ASSERT_EQUAL(OUString("Aaa bbb.c"), pShellCursor->GetPoint()->nNode.GetNode().GetTextNode()->GetText());
+
+ // Undo and assert that both views are invalidated.
+ aView1.m_bTilesInvalidated = false;
+ aView2.m_bTilesInvalidated = false;
+ comphelper::dispatchCommand(".uno:Undo", {});
+ Scheduler::ProcessEventsToIdle();
+ CPPUNIT_ASSERT(aView1.m_bTilesInvalidated);
+ // Undo was dispatched on the first view, this second view was not invalidated.
+ CPPUNIT_ASSERT(aView2.m_bTilesInvalidated);
+
+ mxComponent->dispose();
+ mxComponent.clear();
+ comphelper::LibreOfficeKit::setActive(false);
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SwTiledRenderingTest);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx
index 4d29c40..fc2bfb1 100644
--- a/sw/source/uibase/shells/basesh.cxx
+++ b/sw/source/uibase/shells/basesh.cxx
@@ -489,15 +489,19 @@ void SwBaseShell::ExecUndo(SfxRequest &rReq)
switch( nId )
{
case SID_UNDO:
- rWrtShell.LockPaint();
+ for (SwViewShell& rShell : rWrtShell.GetRingContainer())
+ rShell.LockPaint();
rWrtShell.Do( SwWrtShell::UNDO, nCnt );
- rWrtShell.UnlockPaint();
+ for (SwViewShell& rShell : rWrtShell.GetRingContainer())
+ rShell.UnlockPaint();
break;
case SID_REDO:
- rWrtShell.LockPaint();
+ for (SwViewShell& rShell : rWrtShell.GetRingContainer())
+ rShell.LockPaint();
rWrtShell.Do( SwWrtShell::REDO, nCnt );
- rWrtShell.UnlockPaint();
+ for (SwViewShell& rShell : rWrtShell.GetRingContainer())
+ rShell.UnlockPaint();
break;
case SID_REPEAT:
More information about the Libreoffice-commits
mailing list