diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-09-13 16:49:03 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-09-13 20:27:51 +0200 |
commit | 2ea385a54b53797ab3960869012f3ce3268eab2c (patch) | |
tree | 093e38182845f63f362d10165591029eded820c7 /sw/qa/extras | |
parent | e12c9b41012e44275761b35795b83ec4bc838d42 (diff) |
sw draw text: emit LOK_CALLBACK_TEXT_VIEW_SELECTION from registerCallback()
With this, in case the first view has an active text edit selection and
a new view is created, then the text selection is instantly visible in
the second view, even if the first view's text selection does not change
later.
Change-Id: I3255febd5d65d6576ddbc57cf96836bdf0b06a72
Diffstat (limited to 'sw/qa/extras')
-rw-r--r-- | sw/qa/extras/tiledrendering/tiledrendering.cxx | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx index 0424fea85921..eeef56d816c0 100644 --- a/sw/qa/extras/tiledrendering/tiledrendering.cxx +++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx @@ -1194,16 +1194,28 @@ void SwTiledRenderingTest::testShapeTextUndoGroupShells() // This was -1: the view shell id for the (top) undo list action wasn't known. CPPUNIT_ASSERT_EQUAL(nView1, rUndoManager.GetUndoAction()->GetViewShellId()); + // Create an editeng text selection in the first view. + EditView& rEditView = pView->GetTextEditOutlinerView()->GetEditView(); + pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 'x', 0); + pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 'x', 0); + // 0th para, 0th char -> 0th para, 1st char. + ESelection aWordSelection(0, 0, 0, 1); + rEditView.SetSelection(aWordSelection); + // Create a second view, and make sure that the new view sees the same // cursor position as the old one. SfxLokHelper::createView(); pXTextDocument->initializeForTiledRendering({}); ViewCallback aView2; aView2.m_aViewCursor = Rectangle(); + aView2.m_bViewSelectionSet = false; SfxViewShell::Current()->registerLibreOfficeKitViewCallback(&ViewCallback::callback, &aView2); // Difference was 935 twips, the new view didn't see the editeng cursor of // the old one. The new difference should be <1px, but here we deal with twips. CPPUNIT_ASSERT(std::abs(aView1.m_aOwnCursor.Top() - aView2.m_aViewCursor.Top()) < 10); + // This was false, editeng text selection of the first view wasn't noticed + // by the second view. + CPPUNIT_ASSERT(aView2.m_bViewSelectionSet); mxComponent->dispose(); mxComponent.clear(); |