[Libreoffice-commits] core.git: desktop/qa
Henry Castro (via logerrit)
logerrit at kemper.freedesktop.org
Thu Jan 21 11:51:00 UTC 2021
desktop/qa/desktop_lib/test_desktop_lib.cxx | 39 +++++++++++++++++++++++++++-
1 file changed, 38 insertions(+), 1 deletion(-)
New commits:
commit 033d732cf636aa4e81570864d40c541d7a1c6492
Author: Henry Castro <hcastro at collabora.com>
AuthorDate: Fri Jan 15 16:13:29 2021 -0400
Commit: Henry Castro <hcastro at collabora.com>
CommitDate: Thu Jan 21 12:50:13 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>
(cherry picked from commit 08d45119cfb875fa8a5c03d6e946a47f0f680932)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109733
Tested-by: Jenkins
Reviewed-by: Henry Castro <hcastro at collabora.com>
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index 99fba50f14bb..8660906e5659 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -199,6 +199,7 @@ public:
void testControlState();
void testMetricField();
void testMultiDocuments();
+ void testJumpCursor();
void testABI();
CPPUNIT_TEST_SUITE(DesktopLOKTest);
@@ -262,6 +263,7 @@ public:
CPPUNIT_TEST(testControlState);
CPPUNIT_TEST(testMetricField);
CPPUNIT_TEST(testMultiDocuments);
+ CPPUNIT_TEST(testJumpCursor);
CPPUNIT_TEST(testABI);
CPPUNIT_TEST_SUITE_END();
@@ -1926,6 +1928,7 @@ 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;
@@ -1933,7 +1936,8 @@ public:
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);
@@ -1970,6 +1974,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:
@@ -3080,6 +3087,36 @@ void DesktopLOKTest::testMetricField()
CPPUNIT_ASSERT_EQUAL(aMap["VALUE"], aRet["Value"]);
}
+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