diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-08-16 12:34:12 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-08-16 11:22:22 +0000 |
commit | 77235ac64be61afd707931675fec100c7c50d01c (patch) | |
tree | 9159b28ad08e13785a5b529d2182e0d38974798b /sw | |
parent | b101ff56e874824fa9f0d37a8468b07dbf3d002c (diff) |
editeng: introduce OutlinerViewShell::NotifyOtherViews()
This allows notifying other views about e.g. cursor position changes
even if SfxLokHelper::notifyOtherViews() is not accessible from editeng.
Change-Id: I921e97344ffe562109a221f241e70b3f68ee9aaf
Reviewed-on: https://gerrit.libreoffice.org/28162
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/tiledrendering/tiledrendering.cxx | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx index c568ddf3c9ca..a87359bd6ad5 100644 --- a/sw/qa/extras/tiledrendering/tiledrendering.cxx +++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx @@ -54,6 +54,7 @@ public: void testPageDownInvalidation(); void testPartHash(); void testViewCursors(); + void testShapeViewCursors(); void testMissingInvalidation(); void testViewCursorVisibility(); void testViewCursorCleanup(); @@ -85,6 +86,7 @@ public: CPPUNIT_TEST(testPageDownInvalidation); CPPUNIT_TEST(testPartHash); CPPUNIT_TEST(testViewCursors); + CPPUNIT_TEST(testShapeViewCursors); CPPUNIT_TEST(testMissingInvalidation); CPPUNIT_TEST(testViewCursorVisibility); CPPUNIT_TEST(testViewCursorCleanup); @@ -735,6 +737,47 @@ void SwTiledRenderingTest::testViewCursors() comphelper::LibreOfficeKit::setActive(false); } +void SwTiledRenderingTest::testShapeViewCursors() +{ + comphelper::LibreOfficeKit::setActive(); + + // Load a document and create a view, so we have 2 ones. + SwXTextDocument* pXTextDocument = createDoc("shape.fodt"); + ViewCallback aView1; + SfxViewShell::Current()->registerLibreOfficeKitViewCallback(&ViewCallback::callback, &aView1); + SfxLokHelper::createView(); + ViewCallback aView2; + pXTextDocument->initializeForTiledRendering(uno::Sequence<beans::PropertyValue>()); + SfxViewShell::Current()->registerLibreOfficeKitViewCallback(&ViewCallback::callback, &aView2); + SwWrtShell* pWrtShell2 = pXTextDocument->GetDocShell()->GetWrtShell(); + + // Start shape text in the second view. + SdrPage* pPage = pWrtShell2->GetDoc()->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0); + SdrObject* pObject = pPage->GetObj(0); + SdrView* pView = pWrtShell2->GetDrawView(); + pWrtShell2->GetView().BeginTextEdit(pObject, pView->GetSdrPageView(), pWrtShell2->GetWin()); + pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 'x', 0); + pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 'x', 0); + + // Press a key in the second view, while the first one observes this. + aView1.m_bOwnCursorInvalidated = false; + aView1.m_bViewCursorInvalidated = false; + aView2.m_bOwnCursorInvalidated = false; + aView2.m_bViewCursorInvalidated = false; + pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 'y', 0); + pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 'y', 0); + // Make sure that aView1 gets a view-only cursor notification, while + // aView2 gets a real cursor notification. + CPPUNIT_ASSERT(!aView1.m_bOwnCursorInvalidated); + CPPUNIT_ASSERT(aView1.m_bViewCursorInvalidated); + CPPUNIT_ASSERT(aView2.m_bOwnCursorInvalidated); + CPPUNIT_ASSERT(!aView2.m_bViewCursorInvalidated); + mxComponent->dispose(); + mxComponent.clear(); + + comphelper::LibreOfficeKit::setActive(false); +} + void SwTiledRenderingTest::testViewCursorVisibility() { comphelper::LibreOfficeKit::setActive(); |