[Libreoffice-commits] .: sw/qa
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Tue Oct 9 09:51:25 PDT 2012
sw/qa/extras/odfexport/data/first-header-footer.odt |binary
sw/qa/extras/odfexport/odfexport.cxx | 22 +++++++++++++++++++
sw/qa/extras/ww8export/data/first-header-footer.doc |binary
sw/qa/extras/ww8export/ww8export.cxx | 23 ++++++++++++++++++++
4 files changed, 45 insertions(+)
New commits:
commit b5bb36194bc25ccbef027dec257092bbf395386d
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Tue Oct 9 18:33:22 2012 +0200
sw: add odf and ww8 regression tests for first page header/footer
Change-Id: Ic002f3cba79b6758475cf9d3153ae3063eb640a3
diff --git a/sw/qa/extras/odfexport/data/first-header-footer.odt b/sw/qa/extras/odfexport/data/first-header-footer.odt
new file mode 100644
index 0000000..2ed6b74
Binary files /dev/null and b/sw/qa/extras/odfexport/data/first-header-footer.odt differ
diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx
index 1a30dd5..032da03 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
new file mode 100644
index 0000000..023c494
Binary files /dev/null and b/sw/qa/extras/ww8export/data/first-header-footer.doc differ
diff --git a/sw/qa/extras/ww8export/ww8export.cxx b/sw/qa/extras/ww8export/ww8export.cxx
index b38c1f0..470028c 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();
More information about the Libreoffice-commits
mailing list