[Libreoffice-commits] core.git: sc/qa

Markus Mohrhard markus.mohrhard at googlemail.com
Sun Oct 2 22:41:16 UTC 2016


 sc/qa/unit/data/ods/hyperlink_frame.ods |binary
 sc/qa/unit/subsequent_export-test.cxx   |   26 ++++++++++++++++++++++++++
 2 files changed, 26 insertions(+)

New commits:
commit d0349556c3d045d325d511d8ca4e6ddcac666cf2
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sun Oct 2 19:51:47 2016 +0200

    add test for tdf#77873
    
    Change-Id: Ifd16c51029d2aa4deda0370f4d2867ed9c9e53d9
    Reviewed-on: https://gerrit.libreoffice.org/29461
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/sc/qa/unit/data/ods/hyperlink_frame.ods b/sc/qa/unit/data/ods/hyperlink_frame.ods
new file mode 100644
index 0000000..cc05949
Binary files /dev/null and b/sc/qa/unit/data/ods/hyperlink_frame.ods differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index 0b78c56..0f19e59 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();


More information about the Libreoffice-commits mailing list