summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-09-28 17:16:16 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-09-28 17:17:25 +0200
commit7fd1516ed3eeb6523276eabbf9d7f8fcb246e96a (patch)
tree102c404decdd0b7dcb26be67fb39dd122cf65be4 /desktop
parent41ef50797baf7dbd05ebda647ae591e8ed754987 (diff)
sw lok: fix one view inserting a comment, other view jumping there as well
Views are expected to be more or less independent. So when one view inserts a comment, don't emit cursor callbacks in the other views, so that the other views don't jump to the comment position. Change-Id: I5e4eadccef971dce2b7c759f3094f6d348d07645
Diffstat (limited to 'desktop')
-rw-r--r--desktop/qa/desktop_lib/test_desktop_lib.cxx17
1 files changed, 14 insertions, 3 deletions
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index 3456576c63e0..1425c1cf6e84 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -1572,19 +1572,24 @@ void DesktopLOKTest::testPaintPartTile()
void DesktopLOKTest::testWriterCommentInsertCursor()
{
- // Load a document and type a character into the body text.
+ // Load a document and type a character into the body text of the second view.
comphelper::LibreOfficeKit::setActive();
LibLODocument_Impl* pDocument = loadDoc("blank_text.odt");
pDocument->m_pDocumentClass->initializeForRendering(pDocument, "{}");
ViewCallback aView1;
pDocument->m_pDocumentClass->registerCallback(pDocument, &ViewCallback::callback, &aView1);
+ pDocument->m_pDocumentClass->createView(pDocument);
+ pDocument->m_pDocumentClass->initializeForRendering(pDocument, "{}");
+ ViewCallback aView2;
+ pDocument->m_pDocumentClass->registerCallback(pDocument, &ViewCallback::callback, &aView2);
pDocument->m_pDocumentClass->postKeyEvent(pDocument, LOK_KEYEVENT_KEYINPUT, 'x', 0);
pDocument->m_pDocumentClass->postKeyEvent(pDocument, LOK_KEYEVENT_KEYUP, 'x', 0);
Scheduler::ProcessEventsToIdle();
- Rectangle aBodyCursor = aView1.m_aOwnCursor;
+ Rectangle aBodyCursor = aView2.m_aOwnCursor;
// Now insert a comment and make sure that the comment's cursor is shown,
// not the body text's one.
+ aView1.m_aOwnCursor.SetEmpty();
const int nCtrlAltC = KEY_MOD1 + KEY_MOD2 + 512 + 'c' - 'a';
pDocument->m_pDocumentClass->postKeyEvent(pDocument, LOK_KEYEVENT_KEYINPUT, 'c', nCtrlAltC);
pDocument->m_pDocumentClass->postKeyEvent(pDocument, LOK_KEYEVENT_KEYUP, 'c', nCtrlAltC);
@@ -1594,7 +1599,13 @@ void DesktopLOKTest::testWriterCommentInsertCursor()
osl::Thread::wait(std::chrono::seconds(1));
Scheduler::ProcessEventsToIdle();
// This failed: the body cursor was shown right after inserting a comment.
- CPPUNIT_ASSERT(aView1.m_aOwnCursor.getX() > aBodyCursor.getX());
+ CPPUNIT_ASSERT(aView2.m_aOwnCursor.getX() > aBodyCursor.getX());
+ // This failed, the first view's cursor also jumped when the second view
+ // inserted the comment.
+ CPPUNIT_ASSERT(aView1.m_aOwnCursor.IsEmpty());
+
+ mxComponent->dispose();
+ mxComponent.clear();
comphelper::LibreOfficeKit::setActive(false);
}