summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorJustin Luth <justin_luth@sil.org>2017-03-10 11:09:21 +0300
committerJustin Luth <justin_luth@sil.org>2017-03-11 04:14:28 +0000
commitb4fdb46a75731b22eb85671af4773e5bc9208f85 (patch)
tree85fff5165d167f95654b9cc458d64999c0e49ab3 /sw
parent423cc764291bc07acb9d4d2414151b08de232a0f (diff)
ooxmlimport: unit test for tdf#93640 is round-trippable
Since this test round-trips well, move it to ooxmlexport Change-Id: I95038e27a5779687152cca2bd31fe5719cac65b6 Reviewed-on: https://gerrit.libreoffice.org/35034 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Justin Luth <justin_luth@sil.org>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/ooxmlexport/data/headerfooter-link-to-prev.docx (renamed from sw/qa/extras/ooxmlimport/data/headerfooter-link-to-prev.docx)bin18770 -> 18770 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport9.cxx99
-rw-r--r--sw/qa/extras/ooxmlimport/ooxmlimport.cxx99
3 files changed, 99 insertions, 99 deletions
diff --git a/sw/qa/extras/ooxmlimport/data/headerfooter-link-to-prev.docx b/sw/qa/extras/ooxmlexport/data/headerfooter-link-to-prev.docx
index cc4ddc89bb9b..cc4ddc89bb9b 100644
--- a/sw/qa/extras/ooxmlimport/data/headerfooter-link-to-prev.docx
+++ b/sw/qa/extras/ooxmlexport/data/headerfooter-link-to-prev.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index a54d0239e6b6..99b274412e79 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -88,6 +88,105 @@ DECLARE_OOXMLEXPORT_TEST(testTdf46940_dontEquallyDistributeColumns, "tdf46940_do
CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xTextSections->getByIndex(3), "DontBalanceTextColumns"));
}
+// base class to supply a helper method for testHFLinkToPrev
+class testHFBase : public Test
+{
+protected:
+ OUString
+ getHFText(const uno::Reference<style::XStyle>& xPageStyle,
+ const OUString &sPropName)
+ {
+ auto xTextRange = getProperty< uno::Reference<text::XTextRange> >(
+ xPageStyle, sPropName);
+ return xTextRange->getString();
+ }
+};
+
+DECLARE_SW_EXPORT_TEST(testHFLinkToPrev, "headerfooter-link-to-prev.docx", nullptr, testHFBase)
+{
+ uno::Reference<container::XNameAccess> xPageStyles = getStyles("PageStyles");
+
+ // get a page cursor
+ uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
+ uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier(
+ xModel->getCurrentController(), uno::UNO_QUERY);
+ uno::Reference<text::XPageCursor> xCursor(
+ xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY);
+
+ // get LO page style for page 1, corresponding to docx section 1 first page
+ xCursor->jumpToFirstPage();
+ OUString pageStyleName = getProperty<OUString>(xCursor, "PageStyleName");
+ uno::Reference<style::XStyle> xPageStyle(
+ xPageStyles->getByName(pageStyleName), uno::UNO_QUERY);
+ // check page 1 header & footer text
+ CPPUNIT_ASSERT_EQUAL(getHFText(xPageStyle, "HeaderText"),
+ OUString("First page header for all sections"));
+ CPPUNIT_ASSERT_EQUAL(getHFText(xPageStyle, "FooterText"),
+ OUString("First page footer for section 1 only"));
+
+ // get LO page style for page 2, corresponding to docx section 1
+ xCursor->jumpToPage(2);
+ pageStyleName = getProperty<OUString>(xCursor, "PageStyleName");
+ xPageStyle.set( xPageStyles->getByName(pageStyleName), uno::UNO_QUERY );
+ // check header & footer text
+ CPPUNIT_ASSERT_EQUAL(getHFText(xPageStyle, "HeaderTextLeft"),
+ OUString("Even page header for section 1 only"));
+ CPPUNIT_ASSERT_EQUAL(getHFText(xPageStyle, "FooterTextLeft"),
+ OUString("Even page footer for all sections"));
+ CPPUNIT_ASSERT_EQUAL(getHFText(xPageStyle, "HeaderText"),
+ OUString("Odd page header for all sections"));
+ CPPUNIT_ASSERT_EQUAL(getHFText(xPageStyle, "FooterText"),
+ OUString("Odd page footer for section 1 only"));
+
+ // get LO page style for page 4, corresponding to docx section 2 first page
+ xCursor->jumpToPage(4);
+ pageStyleName = getProperty<OUString>(xCursor, "PageStyleName");
+ xPageStyle.set( xPageStyles->getByName(pageStyleName), uno::UNO_QUERY );
+ // check header & footer text
+ CPPUNIT_ASSERT_EQUAL(getHFText(xPageStyle, "HeaderText"),
+ OUString("First page header for all sections"));
+ CPPUNIT_ASSERT_EQUAL(getHFText(xPageStyle, "FooterText"),
+ OUString("First page footer for sections 2 and 3 only"));
+
+ // get LO page style for page 5, corresponding to docx section 2
+ xCursor->jumpToPage(5);
+ pageStyleName = getProperty<OUString>(xCursor, "PageStyleName");
+ xPageStyle.set( xPageStyles->getByName(pageStyleName), uno::UNO_QUERY );
+ // check header & footer text
+ CPPUNIT_ASSERT_EQUAL(getHFText(xPageStyle, "HeaderTextLeft"),
+ OUString("Even page header for sections 2 and 3 only"));
+ CPPUNIT_ASSERT_EQUAL(getHFText(xPageStyle, "FooterTextLeft"),
+ OUString("Even page footer for all sections"));
+ CPPUNIT_ASSERT_EQUAL(getHFText(xPageStyle, "HeaderText"),
+ OUString("Odd page header for all sections"));
+ CPPUNIT_ASSERT_EQUAL(getHFText(xPageStyle, "FooterText"),
+ OUString("Odd page footer for sections 2 and 3 only"));
+
+ // get LO page style for page 7, corresponding to docx section 3 first page
+ xCursor->jumpToPage(7);
+ pageStyleName = getProperty<OUString>(xCursor, "PageStyleName");
+ xPageStyle.set( xPageStyles->getByName(pageStyleName), uno::UNO_QUERY );
+ // check header & footer text
+ CPPUNIT_ASSERT_EQUAL(getHFText(xPageStyle, "HeaderText"),
+ OUString("First page header for all sections"));
+ CPPUNIT_ASSERT_EQUAL(getHFText(xPageStyle, "FooterText"),
+ OUString("First page footer for sections 2 and 3 only"));
+
+ // get LO page style for page 8, corresponding to docx section 3
+ xCursor->jumpToPage(8);
+ pageStyleName = getProperty<OUString>(xCursor, "PageStyleName");
+ xPageStyle.set( xPageStyles->getByName(pageStyleName), uno::UNO_QUERY );
+ // check header & footer text
+ CPPUNIT_ASSERT_EQUAL(getHFText(xPageStyle, "HeaderTextLeft"),
+ OUString("Even page header for sections 2 and 3 only"));
+ CPPUNIT_ASSERT_EQUAL(getHFText(xPageStyle, "FooterTextLeft"),
+ OUString("Even page footer for all sections"));
+ CPPUNIT_ASSERT_EQUAL(getHFText(xPageStyle, "HeaderText"),
+ OUString("Odd page header for all sections"));
+ CPPUNIT_ASSERT_EQUAL(getHFText(xPageStyle, "FooterText"),
+ OUString("Odd page footer for sections 2 and 3 only"));
+}
+
DECLARE_OOXMLEXPORT_TEST(testRhbz988516, "rhbz988516.docx")
{
// The problem was that the list properties of the footer leaked into body
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index bb012fc87776..a37f16efdeea 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -1229,105 +1229,6 @@ DECLARE_OOXMLIMPORT_TEST(testTdf96674, "tdf96674.docx")
CPPUNIT_ASSERT(aActualSize.Height > 0);
}
-// base class to supply a helper method for testHFLinkToPrev
-class testHFBase : public Test
-{
-protected:
- OUString
- getHFText(const uno::Reference<style::XStyle>& xPageStyle,
- const OUString &sPropName)
- {
- auto xTextRange = getProperty< uno::Reference<text::XTextRange> >(
- xPageStyle, sPropName);
- return xTextRange->getString();
- }
-};
-
-DECLARE_SW_IMPORT_TEST(testHFLinkToPrev, "headerfooter-link-to-prev.docx", nullptr, testHFBase)
-{
- uno::Reference<container::XNameAccess> xPageStyles = getStyles("PageStyles");
-
- // get a page cursor
- uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
- uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier(
- xModel->getCurrentController(), uno::UNO_QUERY);
- uno::Reference<text::XPageCursor> xCursor(
- xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY);
-
- // get LO page style for page 1, corresponding to docx section 1 first page
- xCursor->jumpToFirstPage();
- OUString pageStyleName = getProperty<OUString>(xCursor, "PageStyleName");
- uno::Reference<style::XStyle> xPageStyle(
- xPageStyles->getByName(pageStyleName), uno::UNO_QUERY);
- // check page 1 header & footer text
- CPPUNIT_ASSERT_EQUAL(getHFText(xPageStyle, "HeaderText"),
- OUString("First page header for all sections"));
- CPPUNIT_ASSERT_EQUAL(getHFText(xPageStyle, "FooterText"),
- OUString("First page footer for section 1 only"));
-
- // get LO page style for page 2, corresponding to docx section 1
- xCursor->jumpToPage(2);
- pageStyleName = getProperty<OUString>(xCursor, "PageStyleName");
- xPageStyle.set( xPageStyles->getByName(pageStyleName), uno::UNO_QUERY );
- // check header & footer text
- CPPUNIT_ASSERT_EQUAL(getHFText(xPageStyle, "HeaderTextLeft"),
- OUString("Even page header for section 1 only"));
- CPPUNIT_ASSERT_EQUAL(getHFText(xPageStyle, "FooterTextLeft"),
- OUString("Even page footer for all sections"));
- CPPUNIT_ASSERT_EQUAL(getHFText(xPageStyle, "HeaderText"),
- OUString("Odd page header for all sections"));
- CPPUNIT_ASSERT_EQUAL(getHFText(xPageStyle, "FooterText"),
- OUString("Odd page footer for section 1 only"));
-
- // get LO page style for page 4, corresponding to docx section 2 first page
- xCursor->jumpToPage(4);
- pageStyleName = getProperty<OUString>(xCursor, "PageStyleName");
- xPageStyle.set( xPageStyles->getByName(pageStyleName), uno::UNO_QUERY );
- // check header & footer text
- CPPUNIT_ASSERT_EQUAL(getHFText(xPageStyle, "HeaderText"),
- OUString("First page header for all sections"));
- CPPUNIT_ASSERT_EQUAL(getHFText(xPageStyle, "FooterText"),
- OUString("First page footer for sections 2 and 3 only"));
-
- // get LO page style for page 5, corresponding to docx section 2
- xCursor->jumpToPage(5);
- pageStyleName = getProperty<OUString>(xCursor, "PageStyleName");
- xPageStyle.set( xPageStyles->getByName(pageStyleName), uno::UNO_QUERY );
- // check header & footer text
- CPPUNIT_ASSERT_EQUAL(getHFText(xPageStyle, "HeaderTextLeft"),
- OUString("Even page header for sections 2 and 3 only"));
- CPPUNIT_ASSERT_EQUAL(getHFText(xPageStyle, "FooterTextLeft"),
- OUString("Even page footer for all sections"));
- CPPUNIT_ASSERT_EQUAL(getHFText(xPageStyle, "HeaderText"),
- OUString("Odd page header for all sections"));
- CPPUNIT_ASSERT_EQUAL(getHFText(xPageStyle, "FooterText"),
- OUString("Odd page footer for sections 2 and 3 only"));
-
- // get LO page style for page 7, corresponding to docx section 3 first page
- xCursor->jumpToPage(7);
- pageStyleName = getProperty<OUString>(xCursor, "PageStyleName");
- xPageStyle.set( xPageStyles->getByName(pageStyleName), uno::UNO_QUERY );
- // check header & footer text
- CPPUNIT_ASSERT_EQUAL(getHFText(xPageStyle, "HeaderText"),
- OUString("First page header for all sections"));
- CPPUNIT_ASSERT_EQUAL(getHFText(xPageStyle, "FooterText"),
- OUString("First page footer for sections 2 and 3 only"));
-
- // get LO page style for page 8, corresponding to docx section 3
- xCursor->jumpToPage(8);
- pageStyleName = getProperty<OUString>(xCursor, "PageStyleName");
- xPageStyle.set( xPageStyles->getByName(pageStyleName), uno::UNO_QUERY );
- // check header & footer text
- CPPUNIT_ASSERT_EQUAL(getHFText(xPageStyle, "HeaderTextLeft"),
- OUString("Even page header for sections 2 and 3 only"));
- CPPUNIT_ASSERT_EQUAL(getHFText(xPageStyle, "FooterTextLeft"),
- OUString("Even page footer for all sections"));
- CPPUNIT_ASSERT_EQUAL(getHFText(xPageStyle, "HeaderText"),
- OUString("Odd page header for all sections"));
- CPPUNIT_ASSERT_EQUAL(getHFText(xPageStyle, "FooterText"),
- OUString("Odd page footer for sections 2 and 3 only"));
-}
-
DECLARE_OOXMLIMPORT_TEST(testTdf98882, "tdf98882.docx")
{
sal_Int32 nFlyHeight = parseDump("//fly/infos/bounds", "height").toInt32();