diff options
author | Adam Co <rattles2013@gmail.com> | 2013-06-12 15:06:42 +0300 |
---|---|---|
committer | Miklos Vajna <vmiklos@suse.cz> | 2013-06-19 14:31:38 +0200 |
commit | 782adba4d436c65cdf85d48f28486321873b15ed (patch) | |
tree | d290af4203b229a4e8fb6db83e1a0a46b96d9cf7 /sw | |
parent | 8c1d1b66904cdd95e8eec746a81cf1c57ad0e85a (diff) |
fdo#64238: fix for missing footer bug
Signed-off-by: Miklos Vajna <vmiklos@suse.cz>
Conflicts:
sw/qa/extras/ooxmlexport/ooxmlexport.cxx
Change-Id: I328547c41bfc1a23f7e6233db57fbfa415e22cb3
Signed-off-by: Miklos Vajna <vmiklos@suse.cz>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/Module_sw.mk | 1 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/fdo64238_a.docx | bin | 0 -> 16401 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/fdo64238_b.docx | bin | 0 -> 14359 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 44 |
4 files changed, 45 insertions, 0 deletions
diff --git a/sw/Module_sw.mk b/sw/Module_sw.mk index d8ca65ecc151..202c67c4fc35 100644 --- a/sw/Module_sw.mk +++ b/sw/Module_sw.mk @@ -48,6 +48,7 @@ $(eval $(call gb_Module_add_check_targets,sw,\ $(eval $(call gb_Module_add_slowcheck_targets,sw,\ CppunitTest_sw_htmlexport \ CppunitTest_sw_macros_test \ + CppunitTest_sw_ooxmlexport \ CppunitTest_sw_ooxmlimport \ CppunitTest_sw_ww8export \ CppunitTest_sw_ww8import \ diff --git a/sw/qa/extras/ooxmlexport/data/fdo64238_a.docx b/sw/qa/extras/ooxmlexport/data/fdo64238_a.docx Binary files differnew file mode 100644 index 000000000000..7c43feaf75a7 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/fdo64238_a.docx diff --git a/sw/qa/extras/ooxmlexport/data/fdo64238_b.docx b/sw/qa/extras/ooxmlexport/data/fdo64238_b.docx Binary files differnew file mode 100644 index 000000000000..bfaf92cca2fc --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/fdo64238_b.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index 1cfc0aec25f9..3dbb0a45febf 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -81,6 +81,8 @@ public: void testFDO63053(); void testWatermark(); void testFdo43093(); + void testFdo64238_a(); + void testFdo64238_b(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -136,6 +138,8 @@ void Test::run() {"fdo63053.docx" , &Test::testFDO63053}, {"watermark.docx", &Test::testWatermark}, {"fdo43093.docx", &Test::testFdo43093}, + {"fdo64238_a.docx", &Test::testFdo64238_a}, + {"fdo64238_b.docx", &Test::testFdo64238_b}, }; // Don't test the first import of these, for some reason those tests fail const char* aBlacklist[] = { @@ -808,6 +812,46 @@ void Test::testFdo43093() CPPUNIT_ASSERT_EQUAL(text::WritingMode2::LR_TB, nLRDir); } +void Test::testFdo64238_a() +{ + // The problem was that when 'Show Only Odd Footer' was marked in Word and the Even footer *was filled* + // then LO would still import the Even footer and concatenate it to to the odd footer. + // This case specifically is for : + // 'Blank Odd Footer' with 'Non-Blank Even Footer' when 'Show Only Odd Footer' is marked in Word + // In this case the imported footer in LO was supposed to be blank, but instead was the 'even' footer + uno::Reference<text::XText> xFooterText = getProperty< uno::Reference<text::XText> >(getStyles("PageStyles")->getByName(DEFAULT_STYLE), "FooterText"); + uno::Reference< text::XTextRange > xFooterParagraph = getParagraphOfText( 1, xFooterText ); + uno::Reference<container::XEnumerationAccess> xRunEnumAccess(xFooterParagraph, uno::UNO_QUERY); + uno::Reference<container::XEnumeration> xRunEnum = xRunEnumAccess->createEnumeration(); + int numOfRuns = 0; + while (xRunEnum->hasMoreElements()) + { + uno::Reference<text::XTextRange> xRun(xRunEnum->nextElement(), uno::UNO_QUERY); + numOfRuns++; + } + CPPUNIT_ASSERT_EQUAL(sal_Int32(2), numOfRuns); +} + +void Test::testFdo64238_b() +{ + // The problem was that when 'Show Only Odd Footer' was marked in Word and the Even footer *was filled* + // then LO would still import the Even footer and concatenate it to to the odd footer. + // This case specifically is for : + // 'Non-Blank Odd Footer' with 'Non-Blank Even Footer' when 'Show Only Odd Footer' is marked in Word + // In this case the imported footer in LO was supposed to be just the odd footer, but instead was the 'odd' and 'even' footers concatenated + uno::Reference<text::XText> xFooterText = getProperty< uno::Reference<text::XText> >(getStyles("PageStyles")->getByName(DEFAULT_STYLE), "FooterText"); + uno::Reference< text::XTextRange > xFooterParagraph = getParagraphOfText( 1, xFooterText ); + uno::Reference<container::XEnumerationAccess> xRunEnumAccess(xFooterParagraph, uno::UNO_QUERY); + uno::Reference<container::XEnumeration> xRunEnum = xRunEnumAccess->createEnumeration(); + int numOfRuns = 0; + while (xRunEnum->hasMoreElements()) + { + uno::Reference<text::XTextRange> xRun(xRunEnum->nextElement(), uno::UNO_QUERY); + numOfRuns++; + } + CPPUNIT_ASSERT_EQUAL(sal_Int32(5), numOfRuns); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); |