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@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
This commit is contained in:
@@ -58,6 +58,7 @@ public:
|
|||||||
void testViewCursorCleanup();
|
void testViewCursorCleanup();
|
||||||
void testViewLock();
|
void testViewLock();
|
||||||
void testTextEditViewInvalidations();
|
void testTextEditViewInvalidations();
|
||||||
|
void testUndoInvalidations();
|
||||||
|
|
||||||
CPPUNIT_TEST_SUITE(SwTiledRenderingTest);
|
CPPUNIT_TEST_SUITE(SwTiledRenderingTest);
|
||||||
CPPUNIT_TEST(testRegisterCallback);
|
CPPUNIT_TEST(testRegisterCallback);
|
||||||
@@ -82,6 +83,7 @@ public:
|
|||||||
CPPUNIT_TEST(testViewCursorCleanup);
|
CPPUNIT_TEST(testViewCursorCleanup);
|
||||||
CPPUNIT_TEST(testViewLock);
|
CPPUNIT_TEST(testViewLock);
|
||||||
CPPUNIT_TEST(testTextEditViewInvalidations);
|
CPPUNIT_TEST(testTextEditViewInvalidations);
|
||||||
|
CPPUNIT_TEST(testUndoInvalidations);
|
||||||
CPPUNIT_TEST_SUITE_END();
|
CPPUNIT_TEST_SUITE_END();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -854,6 +856,40 @@ void SwTiledRenderingTest::testTextEditViewInvalidations()
|
|||||||
comphelper::LibreOfficeKit::setActive(false);
|
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_TEST_SUITE_REGISTRATION(SwTiledRenderingTest);
|
||||||
|
|
||||||
CPPUNIT_PLUGIN_IMPLEMENT();
|
CPPUNIT_PLUGIN_IMPLEMENT();
|
||||||
|
@@ -489,15 +489,19 @@ void SwBaseShell::ExecUndo(SfxRequest &rReq)
|
|||||||
switch( nId )
|
switch( nId )
|
||||||
{
|
{
|
||||||
case SID_UNDO:
|
case SID_UNDO:
|
||||||
rWrtShell.LockPaint();
|
for (SwViewShell& rShell : rWrtShell.GetRingContainer())
|
||||||
|
rShell.LockPaint();
|
||||||
rWrtShell.Do( SwWrtShell::UNDO, nCnt );
|
rWrtShell.Do( SwWrtShell::UNDO, nCnt );
|
||||||
rWrtShell.UnlockPaint();
|
for (SwViewShell& rShell : rWrtShell.GetRingContainer())
|
||||||
|
rShell.UnlockPaint();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SID_REDO:
|
case SID_REDO:
|
||||||
rWrtShell.LockPaint();
|
for (SwViewShell& rShell : rWrtShell.GetRingContainer())
|
||||||
|
rShell.LockPaint();
|
||||||
rWrtShell.Do( SwWrtShell::REDO, nCnt );
|
rWrtShell.Do( SwWrtShell::REDO, nCnt );
|
||||||
rWrtShell.UnlockPaint();
|
for (SwViewShell& rShell : rWrtShell.GetRingContainer())
|
||||||
|
rShell.UnlockPaint();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SID_REPEAT:
|
case SID_REPEAT:
|
||||||
|
Reference in New Issue
Block a user