sw/qa/uitest/data/tdf142785.docx        |binary
 sw/qa/uitest/writer_tests8/tdf142785.py |   67 ++++++++++++++++++++++++++++++++
 2 files changed, 67 insertions(+)

New commits:
commit 48d81a28f08314628616d12b487229eb445486dd
Author:     Xisco Fauli <[email protected]>
AuthorDate: Fri Sep 12 17:04:48 2025 +0200
Commit:     Xisco Fauli <[email protected]>
CommitDate: Fri Sep 12 20:27:32 2025 +0200

    tdf#142785: sw: Add UItest
    
    Change-Id: I246004fabb06a1d63e2a457589b05eeb7482d370
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190894
    Reviewed-by: Xisco Fauli <[email protected]>
    Tested-by: Jenkins

diff --git a/sw/qa/uitest/data/tdf142785.docx b/sw/qa/uitest/data/tdf142785.docx
new file mode 100644
index 000000000000..960196cd277e
Binary files /dev/null and b/sw/qa/uitest/data/tdf142785.docx differ
diff --git a/sw/qa/uitest/writer_tests8/tdf142785.py 
b/sw/qa/uitest/writer_tests8/tdf142785.py
new file mode 100644
index 000000000000..00fdf8436ae0
--- /dev/null
+++ b/sw/qa/uitest/writer_tests8/tdf142785.py
@@ -0,0 +1,67 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+from uitest.framework import UITestCase
+from uitest.uihelper.common import get_url_for_data_file
+from uitest.uihelper.common import select_pos
+
+class tdf142785(UITestCase):
+    def test_tdf142785(self):
+
+        with self.ui_test.load_file(get_url_for_data_file("tdf142785.docx")) 
as document:
+
+            sHeader = "ODD   ODD   ODD   ODD   ODD   header"
+            sFooter = "ODD   ODD   ODD   ODD   ODD   footer"
+
+            xStandardStyle = document.StyleFamilies.PageStyles.Standard
+            self.assertEqual(sHeader, xStandardStyle.HeaderText.String)
+            self.assertEqual(sHeader, xStandardStyle.HeaderTextFirst.String)
+            self.assertEqual(sHeader, xStandardStyle.HeaderTextLeft.String)
+            self.assertEqual(sHeader, xStandardStyle.HeaderTextRight.String)
+
+            self.assertEqual(sFooter, xStandardStyle.FooterText.String)
+            self.assertEqual(sFooter, xStandardStyle.FooterTextFirst.String)
+            self.assertEqual(sFooter, xStandardStyle.FooterTextLeft.String)
+            self.assertEqual(sFooter, xStandardStyle.FooterTextRight.String)
+
+            with 
self.ui_test.execute_dialog_through_command(".uno:PageStyleName") as xDialog:
+                xTabs = xDialog.getChild("tabcontrol")
+                select_pos(xTabs, "4")
+                checkSameLR = xDialog.getChild("checkSameLR-header")
+                checkSameLR.executeAction("CLICK",tuple())
+
+            self.assertEqual(sHeader, xStandardStyle.HeaderText.String)
+            self.assertEqual(sHeader, xStandardStyle.HeaderTextFirst.String)
+            self.assertEqual("EVEN   EVEN   EVEN   EVEN   EVEN   header", 
xStandardStyle.HeaderTextLeft.String)
+            self.assertEqual(sHeader, xStandardStyle.HeaderTextRight.String)
+
+            self.assertEqual(sFooter, xStandardStyle.FooterText.String)
+            self.assertEqual(sFooter, xStandardStyle.FooterTextFirst.String)
+            self.assertEqual(sFooter, xStandardStyle.FooterTextLeft.String)
+            self.assertEqual(sFooter, xStandardStyle.FooterTextRight.String)
+
+            with 
self.ui_test.execute_dialog_through_command(".uno:PageStyleName") as xDialog:
+                xTabs = xDialog.getChild("tabcontrol")
+                select_pos(xTabs, "5")
+                checkSameLR = xDialog.getChild("checkSameLR-footer")
+                checkSameLR.executeAction("CLICK",tuple())
+
+            self.assertEqual(sHeader, xStandardStyle.HeaderText.String)
+            self.assertEqual(sHeader, xStandardStyle.HeaderTextFirst.String)
+            self.assertEqual("EVEN   EVEN   EVEN   EVEN   EVEN   header", 
xStandardStyle.HeaderTextLeft.String)
+            self.assertEqual(sHeader, xStandardStyle.HeaderTextRight.String)
+
+            self.assertEqual(sFooter, xStandardStyle.FooterText.String)
+            self.assertEqual(sFooter, xStandardStyle.FooterTextFirst.String)
+
+            # Without the fix in place, this test would have failed with
+            # AssertionError: 'EVEN   EVEN   EVEN   EVEN   EVEN   footer' != 
'ODD   ODD   ODD   ODD   ODD   footer'
+            self.assertEqual("EVEN   EVEN   EVEN   EVEN   EVEN   footer", 
xStandardStyle.FooterTextLeft.String)
+            self.assertEqual(sFooter, xStandardStyle.FooterTextRight.String)
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:

Reply via email to