diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-09-29 16:53:59 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-09-30 09:36:00 +0200 |
commit | 59cff0dbbdcbe1382f09fb23c71eadbe7d471fa8 (patch) | |
tree | a4e9647c41c9ecbb6a18290dc8a709c59045602e /sw/qa | |
parent | dadbb11c16197ad80b96e11af5ddcb3c5e888f66 (diff) |
sw lok: disable pixel alignment of cursor logic values
It just makes harder for a client to find out if the cursor of one view
is at the same position as the cursor of an other view.
Change-Id: Ifaebd1c93c45918c87f3c2c3d12bbb3af949184e
Reviewed-on: https://gerrit.libreoffice.org/29393
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
(cherry picked from commit b32b6c09d190effbe29389a87a80df36007d2e99)
Diffstat (limited to 'sw/qa')
-rw-r--r-- | sw/qa/extras/tiledrendering/tiledrendering.cxx | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx index 9da36aade9d1..e7b78b7ade82 100644 --- a/sw/qa/extras/tiledrendering/tiledrendering.cxx +++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx @@ -77,6 +77,7 @@ public: void testCreateViewTextSelection(); void testRedlineColors(); void testCommentEndTextEdit(); + void testCursorPosition(); CPPUNIT_TEST_SUITE(SwTiledRenderingTest); CPPUNIT_TEST(testRegisterCallback); @@ -117,6 +118,7 @@ public: CPPUNIT_TEST(testCreateViewTextSelection); CPPUNIT_TEST(testRedlineColors); CPPUNIT_TEST(testCommentEndTextEdit); + CPPUNIT_TEST(testCursorPosition); CPPUNIT_TEST_SUITE_END(); private: @@ -1504,6 +1506,30 @@ void SwTiledRenderingTest::testCommentEndTextEdit() comphelper::LibreOfficeKit::setActive(false); } +void SwTiledRenderingTest::testCursorPosition() +{ + // Load a document and register a callback, should get an own cursor. + comphelper::LibreOfficeKit::setActive(); + SwXTextDocument* pXTextDocument = createDoc(); + ViewCallback aView1; + SfxViewShell::Current()->registerLibreOfficeKitViewCallback(&ViewCallback::callback, &aView1); + + // Crete a second view, so the first view gets a collaborative cursor. + SfxLokHelper::createView(); + pXTextDocument->initializeForTiledRendering({}); + ViewCallback aView2; + SfxViewShell::Current()->registerLibreOfficeKitViewCallback(&ViewCallback::callback, &aView2); + + // Make sure the two are exactly the same. + // This failed, own cursor was at '1418, 1418', collaborative cursor was at + // '1425, 1425', due to pixel alignment. + CPPUNIT_ASSERT_EQUAL(aView1.m_aOwnCursor.toString(), aView1.m_aViewCursor.toString()); + + mxComponent->dispose(); + mxComponent.clear(); + comphelper::LibreOfficeKit::setActive(false); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SwTiledRenderingTest); CPPUNIT_PLUGIN_IMPLEMENT(); |