diff options
author | Henry Castro <hcastro@collabora.com> | 2017-06-27 14:35:58 -0400 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2017-07-26 18:24:17 +0200 |
commit | ea31fa38bfef778428203d1473cafc31659be1b9 (patch) | |
tree | bc746ba1434c63e7fed065f2e0f6f01048488028 /sd/qa/unit/tiledrendering | |
parent | Defer also loading of the English CalendarWrapper, tdf#109045 follow-up (diff) | |
download | core-ea31fa38bfef778428203d1473cafc31659be1b9.tar.gz core-ea31fa38bfef778428203d1473cafc31659be1b9.zip |
sd lok: fix Undo/Redo Document Repair
REPAIRPACKAGE is sent to enable Undo/Redo actions when two views
have conflicts.
Change-Id: I58133f5b9006c41a297711c52ed0acfce3c19f92
Reviewed-on: https://gerrit.libreoffice.org/39325
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Henry Castro <hcastro@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/39398
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
Diffstat (limited to 'sd/qa/unit/tiledrendering')
-rw-r--r-- | sd/qa/unit/tiledrendering/tiledrendering.cxx | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx index a6f13cbcead9..6a75280b7f4f 100644 --- a/sd/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx @@ -1170,31 +1170,37 @@ void SdTiledRenderingTest::testUndoLimiting() // Create the first view. SdXImpressDocument* pXImpressDocument = createDoc("title-shape.odp"); - SfxViewShell& rViewShell1 = pXImpressDocument->GetDocShell()->GetViewShell()->GetViewShellBase(); + sd::ViewShell* pViewShell1 = pXImpressDocument->GetDocShell()->GetViewShell(); + int nView1 = SfxLokHelper::getView(); SfxLokHelper::createView(); - pXImpressDocument->initializeForTiledRendering(uno::Sequence<beans::PropertyValue>()); - SfxViewShell& rViewShell2 = pXImpressDocument->GetDocShell()->GetViewShell()->GetViewShellBase(); + sd::ViewShell* pViewShell2 = pXImpressDocument->GetDocShell()->GetViewShell(); + CPPUNIT_ASSERT(pViewShell1 != pViewShell2); // Begin text edit on the only object on the slide. - sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell(); - SdrView* pView = pViewShell->GetView(); + SfxLokHelper::setView(nView1); pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::TAB); pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::TAB); pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 'x', 0); pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 'x', 0); Scheduler::ProcessEventsToIdle(); - CPPUNIT_ASSERT(pView->IsTextEdit()); + CPPUNIT_ASSERT(pViewShell1->GetView()->IsTextEdit()); - // Now check what views see the undo action. - SdDrawDocument* pDocument = pXImpressDocument->GetDoc(); - sd::UndoManager* pUndoManager = pDocument->GetUndoManager(); - pUndoManager->SetViewShell(&rViewShell1); - // This was 1, undo action was visible to the first view, even if the - // action belongs to the second view. - CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(0), pUndoManager->GetUndoActionCount()); - pUndoManager->SetViewShell(&rViewShell2); - CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pUndoManager->GetUndoActionCount()); - pUndoManager->SetViewShell(nullptr); + // Now check view2 cannot undo actions. + { + SfxRequest aReq2(SID_UNDO, SfxCallMode::SLOT, pXImpressDocument->GetDocShell()->GetDoc()->GetPool()); + aReq2.AppendItem(SfxUInt16Item(SID_UNDO, 1)); + pViewShell2->ExecuteSlot(aReq2); + CPPUNIT_ASSERT(dynamic_cast< const SfxUInt32Item* >(aReq2.GetReturnValue())); + CPPUNIT_ASSERT_EQUAL(static_cast< sal_uInt32 >(SID_REPAIRPACKAGE), dynamic_cast< const SfxUInt32Item * >(aReq2.GetReturnValue())->GetValue()); + } + + // Now check view1 can undo action + { + SfxRequest aReq1(SID_UNDO, SfxCallMode::SLOT, pXImpressDocument->GetDocShell()->GetDoc()->GetPool()); + aReq1.AppendItem(SfxUInt16Item(SID_UNDO, 1)); + pViewShell1->ExecuteSlot(aReq1); + CPPUNIT_ASSERT(aReq1.IsDone()); + } mxComponent->dispose(); mxComponent.clear(); |