Kaydet (Commit) 3b042335 authored tarafından Korrawit Pruegsanusak's avatar Korrawit Pruegsanusak Kaydeden (comit) Muthu Subramanian

Fix fdo#47669: also check if we started the tag before ending it

The problem is we created imbalance end tag </w:hyperlink> which shouldn't
be there. So, place a check before inserting end tag should help.

Inspired by (read: copied from) c1c26889 ;)

Change-Id: Ic933f6da44c788cba48bb2fe6fa29658985310b6
üst e55414df
......@@ -63,6 +63,7 @@ public:
void testMathSubscripts();
void testMathVerticalStacks();
void testTablePosition();
void testFdo47669();
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
......@@ -86,6 +87,7 @@ public:
CPPUNIT_TEST(testMathSubscripts);
CPPUNIT_TEST(testMathVerticalStacks);
CPPUNIT_TEST(testTablePosition);
CPPUNIT_TEST(testFdo47669);
#endif
CPPUNIT_TEST_SUITE_END();
......@@ -397,6 +399,20 @@ void Test::testTablePosition()
}
}
void Test::testFdo47669()
{
roundtrip("fdo47669.docx");
/*
* Problem: we created imbalance </w:hyperlink> which shouldn't be there,
* resulting in loading error: missing last character of hyperlink text
* and content after it wasn't loaded.
*/
getParagraph(1, "This is a hyperlink with anchor. Also, this sentence should be seen.");
getRun(getParagraph(1), 2, "hyperlink with anchor");
CPPUNIT_ASSERT_EQUAL(OUString("http://www.google.com/#a"), getProperty<OUString>(getRun(getParagraph(1), 2), "HyperLinkURL"));
}
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
CPPUNIT_PLUGIN_IMPLEMENT();
......
......@@ -534,8 +534,12 @@ void DocxAttributeOutput::EndRun()
m_pSerializer->mark(); // let's call it "actual run start"
if ( m_closeHyperlinkInPreviousRun )
{
if ( m_startedHyperlink )
{
m_pSerializer->endElementNS( XML_w, XML_hyperlink );
m_startedHyperlink = false;
}
m_closeHyperlinkInPreviousRun = false;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment