summaryrefslogtreecommitdiff
path: root/sw/qa/extras/tiledrendering/tiledrendering.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/qa/extras/tiledrendering/tiledrendering.cxx')
-rw-r--r--sw/qa/extras/tiledrendering/tiledrendering.cxx43
1 files changed, 41 insertions, 2 deletions
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index e43d0717ed58..6ab106ddfb72 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -54,6 +54,7 @@ public:
void testPartHash();
void testViewCursors();
void testMissingInvalidation();
+ void testViewCursorVisibility();
CPPUNIT_TEST_SUITE(SwTiledRenderingTest);
CPPUNIT_TEST(testRegisterCallback);
@@ -74,6 +75,7 @@ public:
CPPUNIT_TEST(testPartHash);
CPPUNIT_TEST(testViewCursors);
CPPUNIT_TEST(testMissingInvalidation);
+ CPPUNIT_TEST(testViewCursorVisibility);
CPPUNIT_TEST_SUITE_END();
private:
@@ -554,13 +556,15 @@ public:
bool m_bOwnSelectionSet;
bool m_bViewSelectionSet;
bool m_bTilesInvalidated;
+ bool m_bViewCursorVisible;
ViewCallback()
: m_bOwnCursorInvalidated(false),
m_bViewCursorInvalidated(false),
m_bOwnSelectionSet(false),
m_bViewSelectionSet(false),
- m_bTilesInvalidated(false)
+ m_bTilesInvalidated(false),
+ m_bViewCursorVisible(false)
{
}
@@ -569,7 +573,7 @@ public:
static_cast<ViewCallback*>(pData)->callbackImpl(nType, pPayload);
}
- void callbackImpl(int nType, const char* /*pPayload*/)
+ void callbackImpl(int nType, const char* pPayload)
{
switch (nType)
{
@@ -598,6 +602,11 @@ public:
m_bViewSelectionSet = true;
}
break;
+ case LOK_CALLBACK_VIEW_CURSOR_VISIBLE:
+ {
+ m_bViewCursorVisible = OString("true") == pPayload;
+ }
+ break;
}
}
};
@@ -681,6 +690,36 @@ void SwTiledRenderingTest::testViewCursors()
comphelper::LibreOfficeKit::setActive(false);
}
+void SwTiledRenderingTest::testViewCursorVisibility()
+{
+ comphelper::LibreOfficeKit::setActive();
+
+ // Load a document that has a shape and create two views.
+ SwXTextDocument* pXTextDocument = createDoc("shape.fodt");
+ ViewCallback aView1;
+ SfxViewShell::Current()->registerLibreOfficeKitViewCallback(&ViewCallback::callback, &aView1);
+ SfxLokHelper::createView();
+ pXTextDocument->initializeForTiledRendering(uno::Sequence<beans::PropertyValue>());
+ ViewCallback aView2;
+ SfxViewShell::Current()->registerLibreOfficeKitViewCallback(&ViewCallback::callback, &aView2);
+
+ // Click on the shape in the second view.
+ aView1.m_bViewCursorVisible = true;
+ SwWrtShell* pWrtShell = pXTextDocument->GetDocShell()->GetWrtShell();
+ SdrPage* pPage = pWrtShell->GetDoc()->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0);
+ SdrObject* pObject = pPage->GetObj(0);
+ Point aCenter = pObject->GetSnapRect().Center();
+ pXTextDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONDOWN, aCenter.getX(), aCenter.getY(), 1);
+ pXTextDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONUP, aCenter.getX(), aCenter.getY(), 1);
+ Scheduler::ProcessEventsToIdle();
+ // Make sure the "view/text" cursor of the first view gets a notification.
+ CPPUNIT_ASSERT(!aView1.m_bViewCursorVisible);
+ mxComponent->dispose();
+ mxComponent.clear();
+
+ comphelper::LibreOfficeKit::setActive(false);
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SwTiledRenderingTest);
CPPUNIT_PLUGIN_IMPLEMENT();