diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-09-02 14:21:18 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-09-02 12:54:33 +0000 |
commit | c152008943160fa901ef8a356515a6a074370ff0 (patch) | |
tree | 8fe53e484776cd2dbe2972d56f8b01fc46953751 /sd/qa | |
parent | 9a01af253060123b86b702bb9d8ae8fe623edde4 (diff) |
svx: move GetSfxViewShell() to SdrMarkView
... from SdrObjEditView. This way SdrMarkView can avoid
SfxViewShell::Current() calls, and it can avoid clearing the LOK graphic
selection of the old view when constructing a new view.
With this, an existing graphic selection in an Impress LOK view is no
longer cleared when creating a new view, thanks to the
sd::View::GetSfxViewShell() override.
Change-Id: I70a287aa9c2265bf59a9fb18e0c3839b8f119bbc
Reviewed-on: https://gerrit.libreoffice.org/28618
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'sd/qa')
-rw-r--r-- | sd/qa/unit/tiledrendering/tiledrendering.cxx | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx index 268692e72e07..b5ba3ae13f91 100644 --- a/sd/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx @@ -70,6 +70,7 @@ public: void testCursorViews(); void testViewLock(); void testUndoLimiting(); + void testCreateViewGraphicSelection(); CPPUNIT_TEST_SUITE(SdTiledRenderingTest); CPPUNIT_TEST(testRegisterCallback); @@ -95,6 +96,7 @@ public: CPPUNIT_TEST(testCursorViews); CPPUNIT_TEST(testViewLock); CPPUNIT_TEST(testUndoLimiting); + CPPUNIT_TEST(testCreateViewGraphicSelection); CPPUNIT_TEST_SUITE_END(); private: @@ -1110,6 +1112,37 @@ void SdTiledRenderingTest::testUndoLimiting() comphelper::LibreOfficeKit::setActive(false); } +void SdTiledRenderingTest::testCreateViewGraphicSelection() +{ + comphelper::LibreOfficeKit::setActive(); + + // Load a document and register a callback. + SdXImpressDocument* pXImpressDocument = createDoc("shape.odp"); + pXImpressDocument->initializeForTiledRendering({}); + ViewCallback aView1; + SfxViewShell::Current()->registerLibreOfficeKitViewCallback(&ViewCallback::callback, &aView1); + + // Select the only shape in the document and assert that the graphic selection is changed. + sd::ViewShell* pViewShell = pXImpressDocument->GetDocShell()->GetViewShell(); + SdPage* pActualPage = pViewShell->GetActualPage(); + SdrObject* pObject = pActualPage->GetObj(0); + SdrView* pView = pViewShell->GetView(); + aView1.m_bGraphicSelectionInvalidated = false; + pView->MarkObj(pObject, pView->GetSdrPageView()); + CPPUNIT_ASSERT(aView1.m_bGraphicSelectionInvalidated); + + // Now create a new view. + aView1.m_bGraphicSelectionInvalidated = false; + SfxLokHelper::createView(); + // This failed, creating a new view affected the graphic selection of an + // existing view. + CPPUNIT_ASSERT(!aView1.m_bGraphicSelectionInvalidated); + + mxComponent->dispose(); + mxComponent.clear(); + comphelper::LibreOfficeKit::setActive(false); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdTiledRenderingTest); CPPUNIT_PLUGIN_IMPLEMENT(); |