diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2019-09-25 12:56:43 +0200 |
---|---|---|
committer | Xisco Faulí <xiscofauli@libreoffice.org> | 2019-09-25 17:59:47 +0200 |
commit | 9e257e6b54bb8853f1f5213dfda67a216bcf7403 (patch) | |
tree | cea0788a35698cf7249da6400974a09dee70f77c | |
parent | 7a356cec8b991883a1da03f0fa43ea1590ce2fa7 (diff) |
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@libreoffice.org>
-rw-r--r-- | sw/qa/extras/odfimport/data/BibliographyEntryField.odt | bin | 0 -> 9194 bytes | |||
-rw-r--r-- | sw/qa/extras/odfimport/odfimport.cxx | 17 |
2 files changed, 17 insertions, 0 deletions
diff --git a/sw/qa/extras/odfimport/data/BibliographyEntryField.odt b/sw/qa/extras/odfimport/data/BibliographyEntryField.odt Binary files differnew file mode 100644 index 000000000000..067827bb5163 --- /dev/null +++ b/sw/qa/extras/odfimport/data/BibliographyEntryField.odt 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); |