diff options
author | Justin Luth <justin_luth@sil.org> | 2017-03-11 09:24:38 +0300 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2017-03-16 08:43:54 +0000 |
commit | 78b195c484f8b10eb356a6f9079942e709fd8cda (patch) | |
tree | e33dcc8df0ccb7375eece1a789dc69d08cdfb796 /sw | |
parent | 2b3f043ad79a5b592a1034aaeee1dcb1134daaa8 (diff) |
ooxmlimport: move bnc#519228 unit test to ooxmlexport9
The unit test wasn't round-tripping due to the paragraph count changing.
Writer always add a CR to a blank paragraph, and so these are
ignored on import (bRemove). The unit test's second paragraph
was one of these.
Simplifying the unit test by removing that CR, allowing it
to become a round-trippable test.
Change-Id: I8786915fb5df8fc4325a6a427ab84bb879632a7a
Reviewed-on: https://gerrit.libreoffice.org/35072
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Justin Luth <justin_luth@sil.org>
Tested-by: Justin Luth <justin_luth@sil.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'sw')
-rwxr-xr-x | sw/qa/extras/ooxmlexport/data/bnc519228_odd-breaksB.docx | bin | 0 -> 13674 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport9.cxx | 33 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlimport/data/bnc519228_odd-breaks.docx | bin | 14777 -> 0 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 33 |
4 files changed, 33 insertions, 33 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/bnc519228_odd-breaksB.docx b/sw/qa/extras/ooxmlexport/data/bnc519228_odd-breaksB.docx Binary files differnew file mode 100755 index 000000000000..674d71401110 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/bnc519228_odd-breaksB.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx index 176c9180a29a..678e0923637d 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx @@ -19,6 +19,7 @@ #include <com/sun/star/text/XTextEmbeddedObjectsSupplier.hpp> #include <com/sun/star/text/XTextViewCursorSupplier.hpp> #include <com/sun/star/graphic/XGraphic.hpp> +#include <com/sun/star/style/PageStyleLayout.hpp> #include <com/sun/star/text/HoriOrientation.hpp> #include <com/sun/star/text/RelOrientation.hpp> @@ -260,6 +261,38 @@ DECLARE_OOXMLEXPORT_TEST(testTdf103573, "tdf103573.docx") CPPUNIT_ASSERT_EQUAL_MESSAGE("Not centered horizontally relatively to right page border", text::RelOrientation::PAGE_RIGHT, nValue); } +DECLARE_OOXMLEXPORT_TEST(testBnc519228OddBreaks, "bnc519228_odd-breaksB.docx") +{ + // Check that all the normal styles are not set as right-only, those should be only those used after odd page breaks. + uno::Reference<beans::XPropertySet> defaultStyle(getStyles("PageStyles")->getByName("Standard"), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(uno::makeAny(style::PageStyleLayout_ALL), defaultStyle->getPropertyValue("PageStyleLayout")); + uno::Reference<beans::XPropertySet> firstPage( getStyles("PageStyles")->getByName("First Page"), uno::UNO_QUERY ); + CPPUNIT_ASSERT_EQUAL(uno::makeAny(style::PageStyleLayout_ALL), firstPage->getPropertyValue("PageStyleLayout")); + + OUString page1StyleName = getProperty<OUString>( getParagraph( 1, "This is the first page." ), "PageDescName"); + uno::Reference<beans::XPropertySet> page1Style(getStyles("PageStyles")->getByName(page1StyleName), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(uno::makeAny(style::PageStyleLayout_RIGHT), page1Style->getPropertyValue("PageStyleLayout")); + getParagraphOfText( 1, getProperty< uno::Reference<text::XText> >(page1Style, "HeaderText"), "This is the header for odd pages"); + + // Page2 comes from follow of style for page 1 and should be a normal page. Also check the two page style have the same properties, + // since page style for page1 was created from page style for page 2. + uno::Any page2StyleAny = uno::Reference<beans::XPropertySet>( + getParagraph(2, "This is page 2, which is obviously an even page."), + uno::UNO_QUERY_THROW)->getPropertyValue("PageDescName"); + CPPUNIT_ASSERT_EQUAL(uno::Any(), page2StyleAny); + OUString page2StyleName = getProperty<OUString>( page1Style, "FollowStyle" ); + uno::Reference<beans::XPropertySet> page2Style(getStyles("PageStyles")->getByName(page2StyleName), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(uno::makeAny(style::PageStyleLayout_ALL), page2Style->getPropertyValue("PageStyleLayout")); + getParagraphOfText( 1, getProperty< uno::Reference<text::XText> >(page2Style, "HeaderTextLeft"), "This is the even header"); + getParagraphOfText( 1, getProperty< uno::Reference<text::XText> >(page2Style, "HeaderTextRight"), "This is the header for odd pages"); + CPPUNIT_ASSERT_EQUAL(getProperty<sal_Int32>(page1Style, "TopMargin"), getProperty<sal_Int32>(page2Style, "TopMargin")); + + OUString page5StyleName = getProperty<OUString>( getParagraph( 4, "Then an odd break after an odd page, should lead us to page #5." ), "PageDescName"); + uno::Reference<beans::XPropertySet> page5Style(getStyles("PageStyles")->getByName(page5StyleName), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(uno::makeAny(style::PageStyleLayout_RIGHT), page5Style->getPropertyValue("PageStyleLayout")); + getParagraphOfText( 1, getProperty< uno::Reference<text::XText> >(page5Style, "HeaderText"), "This is the header for odd pages"); +} + DECLARE_OOXMLEXPORT_TEST(testTdf79329, "tdf79329.docx") { uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY); diff --git a/sw/qa/extras/ooxmlimport/data/bnc519228_odd-breaks.docx b/sw/qa/extras/ooxmlimport/data/bnc519228_odd-breaks.docx Binary files differdeleted file mode 100644 index 8711d62df045..000000000000 --- a/sw/qa/extras/ooxmlimport/data/bnc519228_odd-breaks.docx +++ /dev/null diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 367b894a08d7..77880b935b96 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -44,7 +44,6 @@ #include <com/sun/star/text/RubyAdjust.hpp> #include <com/sun/star/style/ParagraphAdjust.hpp> #include <com/sun/star/text/SizeType.hpp> -#include <com/sun/star/style/PageStyleLayout.hpp> #include <com/sun/star/util/DateTime.hpp> #include <com/sun/star/view/XViewSettingsSupplier.hpp> #include <com/sun/star/document/XFilter.hpp> @@ -917,38 +916,6 @@ DECLARE_OOXMLIMPORT_TEST(testFloatingTableSectionColumns, "floating-table-sectio CPPUNIT_ASSERT( tableWidth.toInt32() > 10000 ); } -DECLARE_OOXMLIMPORT_TEST(testBnc519228OddBreaks, "bnc519228_odd-breaks.docx") -{ - // Check that all the normal styles are not set as right-only, those should be only those used after odd page breaks. - uno::Reference<beans::XPropertySet> defaultStyle(getStyles("PageStyles")->getByName("Standard"), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(uno::makeAny(style::PageStyleLayout_ALL), defaultStyle->getPropertyValue("PageStyleLayout")); - uno::Reference<beans::XPropertySet> firstPage( getStyles("PageStyles")->getByName("First Page"), uno::UNO_QUERY ); - CPPUNIT_ASSERT_EQUAL(uno::makeAny(style::PageStyleLayout_ALL), firstPage->getPropertyValue("PageStyleLayout")); - - OUString page1StyleName = getProperty<OUString>( getParagraph( 1, "This is the first page." ), "PageDescName"); - uno::Reference<beans::XPropertySet> page1Style(getStyles("PageStyles")->getByName(page1StyleName), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(uno::makeAny(style::PageStyleLayout_RIGHT), page1Style->getPropertyValue("PageStyleLayout")); - getParagraphOfText( 1, getProperty< uno::Reference<text::XText> >(page1Style, "HeaderText"), "This is the header for odd pages"); - - // Page2 comes from follow of style for page 1 and should be a normal page. Also check the two page style have the same properties, - // since page style for page1 was created from page style for page 2. - uno::Any page2StyleAny = uno::Reference<beans::XPropertySet>( - getParagraph(3, "This is page 2, which is obviously an even page."), - uno::UNO_QUERY_THROW)->getPropertyValue("PageDescName"); - CPPUNIT_ASSERT_EQUAL(uno::Any(), page2StyleAny); - OUString page2StyleName = getProperty<OUString>( page1Style, "FollowStyle" ); - uno::Reference<beans::XPropertySet> page2Style(getStyles("PageStyles")->getByName(page2StyleName), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(uno::makeAny(style::PageStyleLayout_ALL), page2Style->getPropertyValue("PageStyleLayout")); - getParagraphOfText( 1, getProperty< uno::Reference<text::XText> >(page2Style, "HeaderTextLeft"), "This is the even header"); - getParagraphOfText( 1, getProperty< uno::Reference<text::XText> >(page2Style, "HeaderTextRight"), "This is the header for odd pages"); - CPPUNIT_ASSERT_EQUAL(getProperty<sal_Int32>(page1Style, "TopMargin"), getProperty<sal_Int32>(page2Style, "TopMargin")); - - OUString page5StyleName = getProperty<OUString>( getParagraph( 5, "Then an odd break after an odd page, should lead us to page #5." ), "PageDescName"); - uno::Reference<beans::XPropertySet> page5Style(getStyles("PageStyles")->getByName(page5StyleName), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(uno::makeAny(style::PageStyleLayout_RIGHT), page5Style->getPropertyValue("PageStyleLayout")); - getParagraphOfText( 1, getProperty< uno::Reference<text::XText> >(page5Style, "HeaderText"), "This is the header for odd pages"); -} - static OString dateTimeToString( const util::DateTime& dt ) { return DateTimeToOString( DateTime( Date( dt.Day, dt.Month, dt.Year ), tools::Time( dt.Hours, dt.Minutes, dt.Seconds ))); |