diff options
Diffstat (limited to 'writerfilter/qa')
-rw-r--r-- | writerfilter/qa/cppunittests/dmapper/PropertyMap.cxx | 24 | ||||
-rw-r--r-- | writerfilter/qa/cppunittests/dmapper/data/follow-page-top-margin.docx | bin | 0 -> 23144 bytes |
2 files changed, 24 insertions, 0 deletions
diff --git a/writerfilter/qa/cppunittests/dmapper/PropertyMap.cxx b/writerfilter/qa/cppunittests/dmapper/PropertyMap.cxx index 71b3ab80e50b..2c7586649c01 100644 --- a/writerfilter/qa/cppunittests/dmapper/PropertyMap.cxx +++ b/writerfilter/qa/cppunittests/dmapper/PropertyMap.cxx @@ -13,6 +13,8 @@ #include <com/sun/star/frame/Desktop.hpp> #include <com/sun/star/text/XPageCursor.hpp> #include <com/sun/star/text/XTextViewCursorSupplier.hpp> +#include <com/sun/star/style/XStyleFamiliesSupplier.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> using namespace ::com::sun::star; @@ -63,6 +65,28 @@ CPPUNIT_TEST_FIXTURE(Test, testFloatingTableHeader) // i.e. a document which is 1 page in Word was imported as a 3 page one. CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(1), xCursor->getPage()); } + +CPPUNIT_TEST_FIXTURE(Test, testFollowPageTopMargin) +{ + // Load a document with 2 pages: first page has larger top margin, second page has smaller top + // margin. + OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "follow-page-top-margin.docx"; + getComponent() = loadFromDesktop(aURL); + uno::Reference<style::XStyleFamiliesSupplier> xStyleFamiliesSupplier(getComponent(), + uno::UNO_QUERY); + uno::Reference<container::XNameAccess> xStyleFamilies + = xStyleFamiliesSupplier->getStyleFamilies(); + uno::Reference<container::XNameAccess> xStyleFamily(xStyleFamilies->getByName("PageStyles"), + uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xStyle(xStyleFamily->getByName("Standard"), uno::UNO_QUERY); + auto nTopMargin = xStyle->getPropertyValue("TopMargin").get<sal_Int32>(); + + // Without the accompanying fix in place, this test would have failed with: + // - Expected: 250 + // - Actual : 1249 + // i.e. the top margin on page 2 was too large. + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(250), nTopMargin); +} } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/qa/cppunittests/dmapper/data/follow-page-top-margin.docx b/writerfilter/qa/cppunittests/dmapper/data/follow-page-top-margin.docx Binary files differnew file mode 100644 index 000000000000..ceae0b784e18 --- /dev/null +++ b/writerfilter/qa/cppunittests/dmapper/data/follow-page-top-margin.docx |