[Libreoffice-commits] core.git: oox/source sd/qa
Tibor Nagy (via logerrit)
logerrit at kemper.freedesktop.org
Thu Apr 29 09:03:58 UTC 2021
oox/source/drawingml/hyperlinkcontext.cxx | 2 +-
sd/qa/unit/data/pptx/tdf65724.pptx |binary
sd/qa/unit/import-tests.cxx | 28 ++++++++++++++++++++++++++++
3 files changed, 29 insertions(+), 1 deletion(-)
New commits:
commit d0550d1c5d0e27b8fe9d93e2c7a6dc7ffc4f8c21
Author: Tibor Nagy <nagy.tibor2 at nisz.hu>
AuthorDate: Thu Apr 15 12:12:47 2021 +0200
Commit: László Németh <nemeth at numbertext.org>
CommitDate: Thu Apr 29 11:03:09 2021 +0200
tdf#65724 PPTX import: fix internal hyperlink to slide
Internal hyperlinks were lost, if they refer slides
using their names.
Change-Id: Ic464300adb1e6e50bd4d61d957306592b7b22b14
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114139
Tested-by: László Németh <nemeth at numbertext.org>
Reviewed-by: László Németh <nemeth at numbertext.org>
diff --git a/oox/source/drawingml/hyperlinkcontext.cxx b/oox/source/drawingml/hyperlinkcontext.cxx
index 7ea5d5d10b53..0221e3875d31 100644
--- a/oox/source/drawingml/hyperlinkcontext.cxx
+++ b/oox/source/drawingml/hyperlinkcontext.cxx
@@ -96,7 +96,7 @@ HyperLinkContext::HyperLinkContext( ContextHandler2Helper const & rParent,
}
else if ( aPPAction.match( "hlinksldjump" ) )
{
- sURL.clear();
+ sHref = sURL;
sal_Int32 nIndex2 = 0;
while ( nIndex2 < sHref.getLength() )
diff --git a/sd/qa/unit/data/pptx/tdf65724.pptx b/sd/qa/unit/data/pptx/tdf65724.pptx
new file mode 100644
index 000000000000..fef2d9f2dde7
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf65724.pptx differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index cbe6c061d90e..bbdc8b5a19cd 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -119,6 +119,7 @@ public:
virtual void setUp() override;
void testDocumentLayout();
+ void testInternalHyperlink();
void testHyperlinkColor();
void testSmoketest();
void testTdf131269();
@@ -236,6 +237,7 @@ public:
CPPUNIT_TEST_SUITE(SdImportTest);
CPPUNIT_TEST(testDocumentLayout);
+ CPPUNIT_TEST(testInternalHyperlink);
CPPUNIT_TEST(testHyperlinkColor);
CPPUNIT_TEST(testSmoketest);
CPPUNIT_TEST(testTdf131269);
@@ -429,6 +431,32 @@ void SdImportTest::testDocumentLayout()
}
}
+void SdImportTest::testInternalHyperlink()
+{
+ ::sd::DrawDocShellRef xDocShRef
+ = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf65724.pptx"), PPTX);
+
+ uno::Reference< beans::XPropertySet > xShape( getShapeFromPage( 1, 0, xDocShRef ) );
+
+ // Get first paragraph
+ uno::Reference<text::XTextRange> const xParagraph( getParagraphFromShape( 0, xShape ) );
+
+ // first chunk of text
+ uno::Reference<text::XTextRange> xRun( getRunFromParagraph( 0, xParagraph ) );
+ uno::Reference< beans::XPropertySet > xPropSet( xRun, uno::UNO_QUERY_THROW );
+
+ uno::Reference<text::XTextField> xField;
+ xPropSet->getPropertyValue("TextField") >>= xField;
+ CPPUNIT_ASSERT_MESSAGE("The text field is missing!", xField.is() );
+
+ xPropSet.set(xField, uno::UNO_QUERY);
+ OUString aURL;
+ xPropSet->getPropertyValue("URL") >>= aURL;
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("URLs don't match", OUString("#Slide2"), aURL);
+
+ xDocShRef->DoClose();
+}
+
void SdImportTest::testHyperlinkColor()
{
::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf137367.pptx"), PPTX);
More information about the Libreoffice-commits
mailing list