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

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Wed Sep 25 16:00:40 UTC 2019


 sw/qa/extras/odfimport/data/BibliographyEntryField.odt |binary
 sw/qa/extras/odfimport/odfimport.cxx                   |   17 +++++++++++++++++
 2 files changed, 17 insertions(+)

New commits:
commit 9e257e6b54bb8853f1f5213dfda67a216bcf7403
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Wed Sep 25 12:56:43 2019 +0200
Commit:     Xisco FaulĂ­ <xiscofauli at libreoffice.org>
CommitDate: Wed Sep 25 17:59:47 2019 +0200

    ODF Import: Add unittest for bibliography entries
    
    This is the reason why 417d993b8b8a86c019758ee0850e4b42967e2afa
    was reverted
    
    In ODF format, the bibliography entries are displayed in fields
    as ['identifier']
    
    Change-Id: Id2b51c37ba0141a88fa1298a9c9f271f23d22992
    Reviewed-on: https://gerrit.libreoffice.org/79532
    Tested-by: Jenkins
    Reviewed-by: Xisco FaulĂ­ <xiscofauli at libreoffice.org>

diff --git a/sw/qa/extras/odfimport/data/BibliographyEntryField.odt b/sw/qa/extras/odfimport/data/BibliographyEntryField.odt
new file mode 100644
index 000000000000..067827bb5163
Binary files /dev/null and b/sw/qa/extras/odfimport/data/BibliographyEntryField.odt differ
diff --git a/sw/qa/extras/odfimport/odfimport.cxx b/sw/qa/extras/odfimport/odfimport.cxx
index 616580f31274..13d72cd9aed5 100644
--- a/sw/qa/extras/odfimport/odfimport.cxx
+++ b/sw/qa/extras/odfimport/odfimport.cxx
@@ -16,6 +16,7 @@
 #include <com/sun/star/style/PageStyleLayout.hpp>
 #include <com/sun/star/style/FootnoteLineStyle.hpp>
 #include <com/sun/star/table/BorderLine.hpp>
+#include <com/sun/star/text/XTextField.hpp>
 #include <com/sun/star/text/XTextSection.hpp>
 #include <com/sun/star/text/XTextTable.hpp>
 #include <com/sun/star/text/PageNumberType.hpp>
@@ -434,6 +435,22 @@ DECLARE_ODFIMPORT_TEST(testPageBackground, "PageBackground.odt")
     CPPUNIT_ASSERT_EQUAL(drawing::BitmapMode_REPEAT, getProperty<drawing::BitmapMode>(xPropertySetOld, "FillBitmapMode"));
 }
 
+DECLARE_ODFIMPORT_TEST(testBibliographyEntryField, "BibliographyEntryField.odt")
+{
+    uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY);
+    uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields());
+    uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration());
+
+    if( !xFields->hasMoreElements() ) {
+        CPPUNIT_ASSERT(false);
+        return;
+    }
+
+    uno::Reference<text::XTextField> xEnumerationAccess(xFields->nextElement(), uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL(OUString("Bibliography entry"), xEnumerationAccess->getPresentation(true).trim());
+    CPPUNIT_ASSERT_EQUAL(OUString("[ABC]"), xEnumerationAccess->getPresentation(false).trim());
+}
+
 DECLARE_ODFIMPORT_TEST(testFdo56272, "fdo56272.odt")
 {
     uno::Reference<drawing::XShape> xShape = getShape(1);


More information about the Libreoffice-commits mailing list