[Libreoffice-commits] core.git: sw/qa
Grzegorz Araminowicz (via logerrit)
logerrit at kemper.freedesktop.org
Fri Feb 28 18:10:07 UTC 2020
sw/qa/extras/tiledrendering/data/hyperlink.odt |binary
sw/qa/extras/tiledrendering/tiledrendering.cxx | 38 +++++++++++++++++++++++++
2 files changed, 38 insertions(+)
New commits:
commit f752602f08bb975058a50feb47b0856735ad23a2
Author: Grzegorz Araminowicz <grzegorz.araminowicz at collabora.com>
AuthorDate: Tue Nov 5 16:40:05 2019 +0100
Commit: Muhammet Kara <muhammet.kara at collabora.com>
CommitDate: Fri Feb 28 19:09:29 2020 +0100
add hyperlink info unit test
Change-Id: I72c07837ac7ef0bb1ebe10c8dde2adcc9970464a
Reviewed-on: https://gerrit.libreoffice.org/82077
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Grzegorz Araminowicz <grzegorz.araminowicz at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89703
Tested-by: Jenkins
Reviewed-by: Muhammet Kara <muhammet.kara at collabora.com>
diff --git a/sw/qa/extras/tiledrendering/data/hyperlink.odt b/sw/qa/extras/tiledrendering/data/hyperlink.odt
new file mode 100644
index 000000000000..4a97bf76b665
Binary files /dev/null and b/sw/qa/extras/tiledrendering/data/hyperlink.odt differ
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index 16196e1327ba..214b6352f9f6 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -123,6 +123,7 @@ public:
void testAnchorTypes();
void testLanguageStatus();
void testRedlineNotificationDuringSave();
+ void testHyperlink();
CPPUNIT_TEST_SUITE(SwTiledRenderingTest);
CPPUNIT_TEST(testRegisterCallback);
@@ -185,6 +186,7 @@ public:
CPPUNIT_TEST(testAnchorTypes);
CPPUNIT_TEST(testLanguageStatus);
CPPUNIT_TEST(testRedlineNotificationDuringSave);
+ CPPUNIT_TEST(testHyperlink);
CPPUNIT_TEST_SUITE_END();
private:
@@ -203,6 +205,8 @@ private:
int m_nRedlineTableSizeChanged;
int m_nRedlineTableEntryModified;
int m_nTrackedChangeIndex;
+ OString m_sHyperlinkText;
+ OString m_sHyperlinkLink;
};
SwTiledRenderingTest::SwTiledRenderingTest()
@@ -334,6 +338,19 @@ void SwTiledRenderingTest::callbackImpl(int nType, const char* pPayload)
}
}
break;
+ case LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR:
+ {
+ if (comphelper::LibreOfficeKit::isViewIdForVisCursorInvalidation())
+ {
+ boost::property_tree::ptree aTree;
+ std::stringstream aStream(pPayload);
+ boost::property_tree::read_json(aStream, aTree);
+ boost::property_tree::ptree &aChild = aTree.get_child("hyperlink");
+ m_sHyperlinkText = aChild.get("text", "").c_str();
+ m_sHyperlinkLink = aChild.get("link", "").c_str();
+ }
+ }
+ break;
}
}
@@ -2478,6 +2495,27 @@ void SwTiledRenderingTest::testRedlineNotificationDuringSave()
xStorable->storeToURL(maTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList());
}
+void SwTiledRenderingTest::testHyperlink()
+{
+ comphelper::LibreOfficeKit::setActive();
+ comphelper::LibreOfficeKit::setViewIdForVisCursorInvalidation(true);
+ SwXTextDocument* pXTextDocument = createDoc("hyperlink.odt");
+ SwWrtShell* pWrtShell = pXTextDocument->GetDocShell()->GetWrtShell();
+ pWrtShell->GetSfxViewShell()->registerLibreOfficeKitViewCallback(&SwTiledRenderingTest::callback, this);
+ SwShellCursor* pShellCursor = pWrtShell->getShellCursor(false);
+
+ Point aStart = pShellCursor->GetSttPos();
+ aStart.setX(aStart.getX() + 1800);
+ pXTextDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONDOWN, aStart.getX(), aStart.getY(), 1,
+ MOUSE_LEFT, 0);
+ pXTextDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONUP, aStart.getX(), aStart.getY(), 1,
+ MOUSE_LEFT, 0);
+ Scheduler::ProcessEventsToIdle();
+
+ CPPUNIT_ASSERT_EQUAL(OString("hyperlink"), m_sHyperlinkText);
+ CPPUNIT_ASSERT_EQUAL(OString("http://example.com/"), m_sHyperlinkLink);
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SwTiledRenderingTest);
CPPUNIT_PLUGIN_IMPLEMENT();
More information about the Libreoffice-commits
mailing list