[Libreoffice-commits] core.git: sw/qa
Justin Luth
justin_luth at sil.org
Thu Mar 16 08:44:24 UTC 2017
dev/null |binary
sw/qa/extras/ooxmlexport/data/bnc519228_odd-breaksB.docx |binary
sw/qa/extras/ooxmlexport/ooxmlexport9.cxx | 33 +++++++++++++++
sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 33 ---------------
4 files changed, 33 insertions(+), 33 deletions(-)
New commits:
commit 78b195c484f8b10eb356a6f9079942e709fd8cda
Author: Justin Luth <justin_luth at sil.org>
Date: Sat Mar 11 09:24:38 2017 +0300
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 at libreoffice.org>
Reviewed-by: Justin Luth <justin_luth at sil.org>
Tested-by: Justin Luth <justin_luth at sil.org>
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
diff --git a/sw/qa/extras/ooxmlexport/data/bnc519228_odd-breaksB.docx b/sw/qa/extras/ooxmlexport/data/bnc519228_odd-breaksB.docx
new file mode 100755
index 0000000..674d714
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/bnc519228_odd-breaksB.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index 176c918..678e092 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
deleted file mode 100644
index 8711d62..0000000
Binary files a/sw/qa/extras/ooxmlimport/data/bnc519228_odd-breaks.docx and /dev/null differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 367b894..77880b9 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 )));
More information about the Libreoffice-commits
mailing list