[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - desktop/qa
Henry Castro (via logerrit)
logerrit at kemper.freedesktop.org
Wed Jan 20 13:55:59 UTC 2021
desktop/qa/desktop_lib/test_desktop_lib.cxx | 39 +++++++++++++++++++++++++++-
1 file changed, 38 insertions(+), 1 deletion(-)
New commits:
commit 08d45119cfb875fa8a5c03d6e946a47f0f680932
Author: Henry Castro <hcastro at collabora.com>
AuthorDate: Fri Jan 15 16:13:29 2021 -0400
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Wed Jan 20 14:55:25 2021 +0100
lok: unit test incorrect cursor position
Test to not send client side cursor position (0,0)
due to:
mpOutlinerView->SetOutputArea( PixelToLogic( tools::Rectangle(0,0,1,1) ) );
Change-Id: Ib5cd7f1c0c45073c5d2039e8b889d3a6fd7ef70c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109417
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Jan Holesovsky <kendy at collabora.com>
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index 6fc8affd77eb..4f708dfe76c5 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -226,6 +226,7 @@ public:
void testControlState();
void testMetricField();
void testMultiDocuments();
+ void testJumpCursor();
void testABI();
CPPUNIT_TEST_SUITE(DesktopLOKTest);
@@ -289,6 +290,7 @@ public:
CPPUNIT_TEST(testControlState);
CPPUNIT_TEST(testMetricField);
CPPUNIT_TEST(testMultiDocuments);
+ CPPUNIT_TEST(testJumpCursor);
CPPUNIT_TEST(testABI);
CPPUNIT_TEST_SUITE_END();
@@ -1947,13 +1949,15 @@ class ViewCallback
public:
OString m_aCellFormula;
bool m_bTilesInvalidated;
+ bool m_bZeroCursor;
tools::Rectangle m_aOwnCursor;
boost::property_tree::ptree m_aCommentCallbackResult;
boost::property_tree::ptree m_aCallbackWindowResult;
ViewCallback(LibLODocument_Impl* pDocument)
: mpDocument(pDocument),
- m_bTilesInvalidated(false)
+ m_bTilesInvalidated(false),
+ m_bZeroCursor(false)
{
mnView = SfxLokHelper::getView();
mpDocument->m_pDocumentClass->registerCallback(pDocument, &ViewCallback::callback, this);
@@ -1990,6 +1994,9 @@ public:
m_aOwnCursor.setY(aSeq[1].toInt32());
m_aOwnCursor.setWidth(aSeq[2].toInt32());
m_aOwnCursor.setHeight(aSeq[3].toInt32());
+
+ if (m_aOwnCursor.getX() == 0 && m_aOwnCursor.getY() == 0)
+ m_bZeroCursor = true;
}
break;
case LOK_CALLBACK_COMMENT:
@@ -3088,6 +3095,36 @@ void DesktopLOKTest::testMultiDocuments()
}
}
+void DesktopLOKTest::testJumpCursor()
+{
+ comphelper::LibreOfficeKit::setTiledAnnotations(false);
+
+ LibLODocument_Impl* pDocument = loadDoc("blank_text.odt");
+ pDocument->m_pDocumentClass->initializeForRendering(pDocument, "{}");
+
+ pDocument->pClass->postKeyEvent(pDocument, LOK_KEYEVENT_KEYINPUT, 'B', 0);
+ pDocument->pClass->postKeyEvent(pDocument, LOK_KEYEVENT_KEYINPUT, 'o', 0);
+ pDocument->pClass->postKeyEvent(pDocument, LOK_KEYEVENT_KEYINPUT, 'l', 0);
+ pDocument->pClass->postKeyEvent(pDocument, LOK_KEYEVENT_KEYINPUT, 'i', 0);
+ pDocument->pClass->postKeyEvent(pDocument, LOK_KEYEVENT_KEYINPUT, 'v', 0);
+ pDocument->pClass->postKeyEvent(pDocument, LOK_KEYEVENT_KEYINPUT, 'i', 0);
+ pDocument->pClass->postKeyEvent(pDocument, LOK_KEYEVENT_KEYINPUT, 'a', 0);
+ pDocument->pClass->postKeyEvent(pDocument, LOK_KEYEVENT_KEYINPUT, 0, com::sun::star::awt::Key::ESCAPE);
+ Scheduler::ProcessEventsToIdle();
+
+ // There is a cursor jump to (0, 0) due to
+ // mpOutlinerView->SetOutputArea( PixelToLogic( tools::Rectangle(0,0,1,1) ) );
+ // when creating a comment
+ ViewCallback aView1(pDocument);
+
+ pDocument->pClass->postUnoCommand(pDocument, ".uno:InsertAnnotation", nullptr, true);
+ Scheduler::ProcessEventsToIdle();
+
+ CPPUNIT_ASSERT(!aView1.m_bZeroCursor);
+
+ comphelper::LibreOfficeKit::setTiledAnnotations(true);
+}
+
namespace {
constexpr size_t classOffset(int i)
More information about the Libreoffice-commits
mailing list