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 98164d19c21fe753554190172c35523c8c82f375
Author:     Bayram Çiçek <bayram.ci...@collabora.com>
AuthorDate: Sat May 24 10:37:27 2025 +0300
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Sat May 24 20:35:26 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 <bayram.ci...@collabora.com>
    Change-Id: I5c6f32e7ea8f58d195dea9a8423702f502caf44a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185730
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    Tested-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/sw/qa/core/header_footer/HeaderFooterTest.cxx 
b/sw/qa/core/header_footer/HeaderFooterTest.cxx
index 20993c850a82..61d0eaa2717e 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

Reply via email to