diff options
author | Miklos Vajna <vmiklos@suse.cz> | 2012-10-09 18:33:22 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@suse.cz> | 2012-10-09 18:49:38 +0200 |
commit | b5bb36194bc25ccbef027dec257092bbf395386d (patch) | |
tree | 401d10b0d020973cf95cd56370d11decdb50a882 /sw/qa | |
parent | 59ab112fe93cbf4e2b052f4e8bafbdb4e6738bef (diff) |
sw: add odf and ww8 regression tests for first page header/footer
Change-Id: Ic002f3cba79b6758475cf9d3153ae3063eb640a3
Diffstat (limited to 'sw/qa')
-rw-r--r-- | sw/qa/extras/odfexport/data/first-header-footer.odt | bin | 0 -> 9644 bytes | |||
-rw-r--r-- | sw/qa/extras/odfexport/odfexport.cxx | 22 | ||||
-rw-r--r-- | sw/qa/extras/ww8export/data/first-header-footer.doc | bin | 0 -> 23552 bytes | |||
-rw-r--r-- | sw/qa/extras/ww8export/ww8export.cxx | 23 |
4 files changed, 45 insertions, 0 deletions
diff --git a/sw/qa/extras/odfexport/data/first-header-footer.odt b/sw/qa/extras/odfexport/data/first-header-footer.odt Binary files differnew file mode 100644 index 000000000000..2ed6b740a102 --- /dev/null +++ b/sw/qa/extras/odfexport/data/first-header-footer.odt diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx index 1a30dd5fddba..032da03cd640 100644 --- a/sw/qa/extras/odfexport/odfexport.cxx +++ b/sw/qa/extras/odfexport/odfexport.cxx @@ -33,10 +33,12 @@ class Test : public SwModelTestBase { public: void testFdo38244(); + void testFirstHeaderFooter(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) CPPUNIT_TEST(testFdo38244); + CPPUNIT_TEST(testFirstHeaderFooter); #endif CPPUNIT_TEST_SUITE_END(); @@ -86,6 +88,26 @@ void Test::testFdo38244() CPPUNIT_ASSERT_EQUAL(OUString("M"), getProperty<OUString>(xPropertySet, "Initials")); } +void Test::testFirstHeaderFooter() +{ + // Test import and export of the header-first token. + roundtrip("first-header-footer.odt"); + + // The document has 6 pages, two page styles for the first and second half of pages. + CPPUNIT_ASSERT_EQUAL(OUString("First header"), parseDump("/root/page[1]/header/txt/text()")); + CPPUNIT_ASSERT_EQUAL(OUString("First footer"), parseDump("/root/page[1]/footer/txt/text()")); + CPPUNIT_ASSERT_EQUAL(OUString("Left header"), parseDump("/root/page[2]/header/txt/text()")); + CPPUNIT_ASSERT_EQUAL(OUString("Left footer"), parseDump("/root/page[2]/footer/txt/text()")); + CPPUNIT_ASSERT_EQUAL(OUString("Right header"), parseDump("/root/page[3]/header/txt/text()")); + CPPUNIT_ASSERT_EQUAL(OUString("Right footer"), parseDump("/root/page[3]/footer/txt/text()")); + CPPUNIT_ASSERT_EQUAL(OUString("First header2"), parseDump("/root/page[4]/header/txt/text()")); + CPPUNIT_ASSERT_EQUAL(OUString("First footer2"), parseDump("/root/page[4]/footer/txt/text()")); + CPPUNIT_ASSERT_EQUAL(OUString("Right header2"), parseDump("/root/page[5]/header/txt/text()")); + CPPUNIT_ASSERT_EQUAL(OUString("Right footer2"), parseDump("/root/page[5]/footer/txt/text()")); + CPPUNIT_ASSERT_EQUAL(OUString("Left header2"), parseDump("/root/page[6]/header/txt/text()")); + CPPUNIT_ASSERT_EQUAL(OUString("Left footer2"), parseDump("/root/page[6]/footer/txt/text()")); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/qa/extras/ww8export/data/first-header-footer.doc b/sw/qa/extras/ww8export/data/first-header-footer.doc Binary files differnew file mode 100644 index 000000000000..023c494862a5 --- /dev/null +++ b/sw/qa/extras/ww8export/data/first-header-footer.doc diff --git a/sw/qa/extras/ww8export/ww8export.cxx b/sw/qa/extras/ww8export/ww8export.cxx index b38c1f0c771c..470028cd9635 100644 --- a/sw/qa/extras/ww8export/ww8export.cxx +++ b/sw/qa/extras/ww8export/ww8export.cxx @@ -41,12 +41,14 @@ public: void testN325936(); void testFdo45724(); void testFdo46020(); + void testFirstHeaderFooter(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) CPPUNIT_TEST(testN325936); CPPUNIT_TEST(testFdo45724); CPPUNIT_TEST(testFdo46020); + CPPUNIT_TEST(testFirstHeaderFooter); #endif CPPUNIT_TEST_SUITE_END(); @@ -104,6 +106,27 @@ void Test::testFdo46020() CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xFootnotes->getCount()); } +void Test::testFirstHeaderFooter() +{ + // Test import and export of a section's headerf/footerf properties. + roundtrip("first-header-footer.doc"); + + // The document has 6 pages. Note that we don't test if 4 or just 2 page + // styles are created, the point is that layout should be correct. + CPPUNIT_ASSERT_EQUAL(OUString("First page header"), parseDump("/root/page[1]/header/txt/text()")); + CPPUNIT_ASSERT_EQUAL(OUString("First page footer"), parseDump("/root/page[1]/footer/txt/text()")); + CPPUNIT_ASSERT_EQUAL(OUString("Even page header"), parseDump("/root/page[2]/header/txt/text()")); + CPPUNIT_ASSERT_EQUAL(OUString("Even page footer"), parseDump("/root/page[2]/footer/txt/text()")); + CPPUNIT_ASSERT_EQUAL(OUString("Odd page header"), parseDump("/root/page[3]/header/txt/text()")); + CPPUNIT_ASSERT_EQUAL(OUString("Odd page footer"), parseDump("/root/page[3]/footer/txt/text()")); + CPPUNIT_ASSERT_EQUAL(OUString("First page header2"), parseDump("/root/page[4]/header/txt/text()")); + CPPUNIT_ASSERT_EQUAL(OUString("First page footer 2"), parseDump("/root/page[4]/footer/txt/text()")); + CPPUNIT_ASSERT_EQUAL(OUString("Odd page header 2"), parseDump("/root/page[5]/header/txt/text()")); + CPPUNIT_ASSERT_EQUAL(OUString("Odd page footer 2"), parseDump("/root/page[5]/footer/txt/text()")); + CPPUNIT_ASSERT_EQUAL(OUString("Even page header 2"), parseDump("/root/page[6]/header/txt/text()")); + CPPUNIT_ASSERT_EQUAL(OUString("Even page footer 2"), parseDump("/root/page[6]/footer/txt/text()")); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); |