summaryrefslogtreecommitdiff
path: root/sw/qa/extras/rtfimport
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2023-11-28 13:46:21 +0900
committerTomaž Vajngerl <quikee@gmail.com>2023-12-01 08:26:38 +0100
commit4b0fa253a4540f5461397815d290586f9ddabe61 (patch)
treec58c59871244dc75e538caeea40658303da00b8b /sw/qa/extras/rtfimport
parent93357349ff1998b41ea1ebedf09dc1cc5da316f7 (diff)
tdf#136472 adjust ooxml import to handle first header/footer
Previously the ooxml import added a new page style when the first header or footer was detected. Since then we gained support to add first page header/footer in an existing page style so we don't need to import it like that anymore. This changes the import code so that the old complication to add "First Page" page style is removed and it always just uses the "Standard" page style for all 3 cases: first, left and right headers and footers. This also adjusts the existing tests to align with this change. Change-Id: Ibf69597e6990499ac520ea9e323a5f73f429800b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157860 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'sw/qa/extras/rtfimport')
-rw-r--r--sw/qa/extras/rtfimport/rtfimport.cxx18
1 files changed, 10 insertions, 8 deletions
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index a0a75c1559d1..3d516a004218 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -1030,11 +1030,13 @@ CPPUNIT_TEST_FIXTURE(Test, testBehindDoc)
CPPUNIT_TEST_FIXTURE(Test, testFdo82114)
{
createSwDoc("fdo82114.rtf");
- uno::Reference<text::XText> xHeaderText = getProperty<uno::Reference<text::XText>>(
- getStyles("PageStyles")->getByName("Converted1"), "HeaderText");
- OUString aActual = xHeaderText->getString();
- // This was 'Right page header, section 1'.
- CPPUNIT_ASSERT_EQUAL(OUString("First page header, section 2"), aActual);
+ uno::Reference<text::XText> xHeaderTextPage1 = getProperty<uno::Reference<text::XText>>(
+ getStyles("PageStyles")->getByName("Standard"), "HeaderTextFirst");
+ CPPUNIT_ASSERT_EQUAL(OUString("First page header, section 1"), xHeaderTextPage1->getString());
+
+ uno::Reference<text::XText> xHeaderTextPage2 = getProperty<uno::Reference<text::XText>>(
+ getStyles("PageStyles")->getByName("Converted1"), "HeaderTextFirst");
+ CPPUNIT_ASSERT_EQUAL(OUString("First page header, section 2"), xHeaderTextPage2->getString());
}
CPPUNIT_TEST_FIXTURE(Test, testFdo44984)
@@ -1522,7 +1524,7 @@ CPPUNIT_TEST_FIXTURE(Test, testImportHeaderFooter)
//Check if Headers/Footers only contain what they should in this document
uno::Reference<text::XText> xHeaderText = getProperty<uno::Reference<text::XText>>(
- getStyles("PageStyles")->getByName("First Page"), "HeaderText");
+ getStyles("PageStyles")->getByName("Default Page Style"), "HeaderTextFirst");
OUString aActual = xHeaderText->getString();
CPPUNIT_ASSERT_EQUAL(OUString("First Page Header"), aActual);
@@ -1537,7 +1539,7 @@ CPPUNIT_TEST_FIXTURE(Test, testImportHeaderFooter)
CPPUNIT_ASSERT_EQUAL(OUString("Header uneven"), aActual);
uno::Reference<text::XText> xFooterText = getProperty<uno::Reference<text::XText>>(
- getStyles("PageStyles")->getByName("First Page"), "FooterText");
+ getStyles("PageStyles")->getByName("Default Page Style"), "FooterTextFirst");
aActual = xFooterText->getString();
CPPUNIT_ASSERT_EQUAL(OUString("First Page Footer"), aActual);
@@ -1566,7 +1568,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf108947)
uno::Reference<text::XText> xHeaderTextLeft = getProperty<uno::Reference<text::XText>>(
getStyles("PageStyles")->getByName("Default Page Style"), "HeaderTextLeft");
aActual = xHeaderTextLeft->getString();
- CPPUNIT_ASSERT_EQUAL(OUString(SAL_NEWLINE_STRING "Header Page 2 ?"), aActual);
+ CPPUNIT_ASSERT_EQUAL(OUString("Header Page 2 ?"), aActual);
#endif
}