diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-10-02 19:51:47 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-10-02 22:33:46 +0000 |
commit | d0349556c3d045d325d511d8ca4e6ddcac666cf2 (patch) | |
tree | b34efc600f495e81db2ccd55dfe5813ff491c7db | |
parent | b11ad787372c4b833cc58a3738e375af26309b8d (diff) |
add test for tdf#77873
Change-Id: Ifd16c51029d2aa4deda0370f4d2867ed9c9e53d9
Reviewed-on: https://gerrit.libreoffice.org/29461
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
-rw-r--r-- | sc/qa/unit/data/ods/hyperlink_frame.ods | bin | 0 -> 7703 bytes | |||
-rw-r--r-- | sc/qa/unit/subsequent_export-test.cxx | 26 |
2 files changed, 26 insertions, 0 deletions
diff --git a/sc/qa/unit/data/ods/hyperlink_frame.ods b/sc/qa/unit/data/ods/hyperlink_frame.ods Binary files differnew file mode 100644 index 000000000000..cc05949d384e --- /dev/null +++ b/sc/qa/unit/data/ods/hyperlink_frame.ods diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 0b78c565ad61..0f19e5904883 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -57,6 +57,7 @@ #include <editeng/escapementitem.hxx> #include <editeng/fontitem.hxx> #include <editeng/udlnitem.hxx> +#include <editeng/flditem.hxx> #include <formula/grammar.hxx> #include <unotools/useroptions.hxx> #include <tools/datetime.hxx> @@ -175,6 +176,7 @@ public: void testNatNumInNumberFormatXLSX(); void testHiddenRepeatedRowsODS(); + void testHyperlinkTargetFrameODS(); CPPUNIT_TEST_SUITE(ScExportTest); CPPUNIT_TEST(test); @@ -258,6 +260,7 @@ public: CPPUNIT_TEST(testNatNumInNumberFormatXLSX); CPPUNIT_TEST(testHiddenRepeatedRowsODS); + CPPUNIT_TEST(testHyperlinkTargetFrameODS); CPPUNIT_TEST_SUITE_END(); @@ -3679,6 +3682,29 @@ void ScExportTest::testHiddenRepeatedRowsODS() CPPUNIT_ASSERT_EQUAL((SCROW)20, nLastRow); } +void ScExportTest::testHyperlinkTargetFrameODS() +{ + ScDocShellRef xDocSh = loadDoc("hyperlink_frame.", FORMAT_ODS); + CPPUNIT_ASSERT(xDocSh.Is()); + + ScDocument& rDoc = xDocSh->GetDocument(); + const EditTextObject* pEditText = rDoc.GetEditText(ScAddress(2, 5, 0)); + CPPUNIT_ASSERT(pEditText); + + const SvxFieldData* pData = pEditText->GetFieldData(0, 0, text::textfield::Type::URL); + CPPUNIT_ASSERT_MESSAGE("Failed to get the URL data.", pData && pData->GetClassId() == text::textfield::Type::URL); + + const SvxURLField* pURLData = static_cast<const SvxURLField*>(pData); + OUString aTargetFrame = pURLData->GetTargetFrame(); + CPPUNIT_ASSERT_EQUAL(OUString("_blank"), aTargetFrame); + + xmlDocPtr pDoc = XPathHelper::parseExport(*xDocSh, m_xSFactory, "content.xml", FORMAT_ODS); + CPPUNIT_ASSERT(pDoc); + OUString aTargetFrameExport = getXPath(pDoc, + "/office:document-content/office:body/office:spreadsheet/table:table/table:table-row[2]/table:table-cell[2]/text:p/text:a", "target-frame-name"); + CPPUNIT_ASSERT_EQUAL(OUString("_blank"), aTargetFrameExport); +} + CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); |