sw/qa/core/header_footer/HeaderFooterTest.cxx | 24 ++++++++++ sw/qa/core/header_footer/data/tdf166205_first_page_header_footer_visible.docx |binary 2 files changed, 24 insertions(+)
New commits: commit 9f424bb469e550ea8f7a8b8aa2aacbf6e272f987 Author: Bayram Çiçek <[email protected]> AuthorDate: Sat May 24 10:37:27 2025 +0300 Commit: Bayram Çiçek <[email protected]> CommitDate: Fri May 30 10:16:14 2025 +0200 tdf#166205: add unittest for first-page-header&footer make sure header&footer visible on the screen by checking their height. Signed-off-by: Bayram Çiçek <[email protected]> Change-Id: I5c6f32e7ea8f58d195dea9a8423702f502caf44a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185730 Tested-by: Jenkins Reviewed-by: Caolán McNamara <[email protected]> Tested-by: Caolán McNamara <[email protected]> (cherry picked from commit 98164d19c21fe753554190172c35523c8c82f375) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186002 Tested-by: Jenkins CollaboraOffice <[email protected]> diff --git a/sw/qa/core/header_footer/HeaderFooterTest.cxx b/sw/qa/core/header_footer/HeaderFooterTest.cxx index f277a0ed77aa..a28d90f96591 100644 --- a/sw/qa/core/header_footer/HeaderFooterTest.cxx +++ b/sw/qa/core/header_footer/HeaderFooterTest.cxx @@ -493,6 +493,30 @@ CPPUNIT_TEST_FIXTURE(HeaderFooterTest, testTdf145998_firstHeader) assertXPathContent(pXmlDoc, "/root/page[2]/header/txt", u"Normal Header"); } +CPPUNIT_TEST_FIXTURE(HeaderFooterTest, tdf166205_first_page_header_footer_visible) +{ + createSwDoc("tdf166205_first_page_header_footer_visible.docx"); + + // Sanity check - always good to test when dealing with page styles and breaks. + CPPUNIT_ASSERT_EQUAL(2, getPages()); + + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); + assertXPathContent(pXmlDoc, "/root/page[1]/header/txt[1]", u"HEADER TOP #1"); + assertXPathContent(pXmlDoc, "/root/page[1]/header/txt[5]", u"HEADER BOTTOM #1"); + assertXPathContent(pXmlDoc, "/root/page[1]/footer/txt", u"THIS IS FOOTER #1"); + + // make sure the first-page-header is visible + OUString headerHeight1 = getXPath(pXmlDoc, "/root/page[1]/header/infos/bounds", "height"); + CPPUNIT_ASSERT((headerHeight1.toInt32()) >= 14162); + OUString headerHeight2 + = getXPath(pXmlDoc, "/root/page[1]/header/txt[5]/infos/prtBounds", "height"); + CPPUNIT_ASSERT((headerHeight2.toInt32()) >= 280); + + // make sure the first-page-footer is visible + OUString footerHeight = getXPath(pXmlDoc, "/root/page[1]/footer/txt/infos/bounds", "height"); + CPPUNIT_ASSERT((footerHeight.toInt32()) >= 517); +} + CPPUNIT_TEST_FIXTURE(HeaderFooterTest, testEvenPageOddPageFooter_Import) { // Related tdf#135216 diff --git a/sw/qa/core/header_footer/data/tdf166205_first_page_header_footer_visible.docx b/sw/qa/core/header_footer/data/tdf166205_first_page_header_footer_visible.docx new file mode 100644 index 000000000000..f24304e65c98 Binary files /dev/null and b/sw/qa/core/header_footer/data/tdf166205_first_page_header_footer_visible.docx differ
