summaryrefslogtreecommitdiff
path: root/sw/qa
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-09-13 16:49:03 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-09-14 10:11:42 +0200
commit1ac8217f6114943002730502ebafd8617d2fd5c1 (patch)
tree589072e5045a3f93cafbbb38286a61cd0002747b /sw/qa
parent4d9bb7120a2ca27207b30d81d77a810a306fbe04 (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 (cherry picked from commit 2ea385a54b53797ab3960869012f3ce3268eab2c)
Diffstat (limited to 'sw/qa')
-rw-r--r--sw/qa/extras/tiledrendering/tiledrendering.cxx12
1 files changed, 12 insertions, 0 deletions
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index 10cd61ec5f14..56f087a1c84e 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -1195,16 +1195,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();