[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - sw/qa
Grzegorz Araminowicz (via logerrit)
logerrit at kemper.freedesktop.org
Tue Nov 5 16:46:58 UTC 2019
sw/qa/extras/tiledrendering/data/hyperlink.odt |binary
sw/qa/extras/tiledrendering/tiledrendering.cxx | 38 +++++++++++++++++++++++++
2 files changed, 38 insertions(+)
New commits:
commit 92c13df41e0b0b40c9a9b92b6b0bdb4730cd7f5d
Author: Grzegorz Araminowicz <grzegorz.araminowicz at collabora.com>
AuthorDate: Tue Nov 5 16:40:05 2019 +0100
Commit: Grzegorz Araminowicz <grzegorz.araminowicz at collabora.com>
CommitDate: Tue Nov 5 17:46:11 2019 +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>
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 3a3fbf4e162e..bbc91370dc2d 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -118,6 +118,7 @@ public:
void testSemiTransparent();
void testAnchorTypes();
void testLanguageStatus();
+ void testHyperlink();
CPPUNIT_TEST_SUITE(SwTiledRenderingTest);
CPPUNIT_TEST(testRegisterCallback);
@@ -178,6 +179,7 @@ public:
CPPUNIT_TEST(testSemiTransparent);
CPPUNIT_TEST(testAnchorTypes);
CPPUNIT_TEST(testLanguageStatus);
+ CPPUNIT_TEST(testHyperlink);
CPPUNIT_TEST_SUITE_END();
private:
@@ -196,6 +198,8 @@ private:
int m_nRedlineTableSizeChanged;
int m_nRedlineTableEntryModified;
int m_nTrackedChangeIndex;
+ OString m_sHyperlinkText;
+ OString m_sHyperlinkLink;
};
SwTiledRenderingTest::SwTiledRenderingTest()
@@ -328,6 +332,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;
}
}
@@ -2542,6 +2559,27 @@ void SwTiledRenderingTest::testLanguageStatus()
CPPUNIT_ASSERT_EQUAL(OUString("English (USA);en-US"), aList[0]);
}
+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