sw/qa/uitest/writer_tests3/pageNumber.py | 60 +++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+)
New commits: commit 7e243f28bbe7ac84dccc2c165328b5844d83b9cd Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Thu Apr 24 12:17:50 2025 +0200 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Fri May 2 13:20:43 2025 +0200 tdf#86630: sw: Add UItest Change-Id: Ib079bb2eca04a5f9ff86f76e9d47195e369f2008 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184546 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> (cherry picked from commit f7d4cdf6564b8405a69b0a4f1fc2a98d8daee0ac) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184893 diff --git a/sw/qa/uitest/writer_tests3/pageNumber.py b/sw/qa/uitest/writer_tests3/pageNumber.py new file mode 100644 index 000000000000..f148d047b33d --- /dev/null +++ b/sw/qa/uitest/writer_tests3/pageNumber.py @@ -0,0 +1,60 @@ +# -*- 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 libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict, select_by_text + +class PageNumberWizard(UITestCase): + + def test_insert_page_number(self): + with self.ui_test.create_doc_in_start_center("writer") as document: + + with self.ui_test.execute_dialog_through_command(".uno:PageNumberWizard") as xDialog: + xPositionCombo = xDialog.getChild("positionCombo") + self.assertEqual("Bottom of page (Footer)", get_state_as_dict(xPositionCombo)["SelectEntryText"]) + xAlignmentCombo = xDialog.getChild("alignmentCombo") + self.assertEqual("Center", get_state_as_dict(xAlignmentCombo)["SelectEntryText"]) + xMirrorCheckbox = xDialog.getChild("mirrorCheckbox") + self.assertEqual("true", get_state_as_dict(xMirrorCheckbox)["Selected"]) + self.assertEqual("false", get_state_as_dict(xMirrorCheckbox)["Enabled"]) + xPagetotalCheckbox = xDialog.getChild("pagetotalCheckbox") + self.assertEqual("false", get_state_as_dict(xPagetotalCheckbox)["Selected"]) + self.assertEqual("true", get_state_as_dict(xPagetotalCheckbox)["Enabled"]) + xFitintoexistingmarginsCheckbox = xDialog.getChild("fitintoexistingmarginsCheckbox") + self.assertEqual("false", get_state_as_dict(xFitintoexistingmarginsCheckbox)["Selected"]) + self.assertEqual("true", get_state_as_dict(xFitintoexistingmarginsCheckbox)["Enabled"]) + xNumfmtlb = xDialog.getChild("numfmtlb") + self.assertEqual("1, 2, 3, ...", get_state_as_dict(xNumfmtlb)["SelectEntryText"]) + + self.assertIsNone(document.StyleFamilies.PageStyles.Standard.HeaderText) + xFooter = document.StyleFamilies.PageStyles.Standard.FooterText.createEnumeration().nextElement() + self.assertEqual("1", xFooter.String) + + self.xUITest.executeCommand(".uno:Undo") + + self.assertIsNone(document.StyleFamilies.PageStyles.Standard.HeaderText) + self.assertIsNone(document.StyleFamilies.PageStyles.Standard.FooterText) + + with self.ui_test.execute_dialog_through_command(".uno:PageNumberWizard") as xDialog: + xPositionCombo = xDialog.getChild("positionCombo") + select_by_text(xPositionCombo, "Top of page (Header)") + xNumfmtlb = xDialog.getChild("numfmtlb") + select_by_text(xNumfmtlb, "A, B, C, ...") + + xHeader = document.StyleFamilies.PageStyles.Standard.HeaderText.createEnumeration().nextElement() + self.assertEqual("A", xHeader.String) + self.assertIsNone(document.StyleFamilies.PageStyles.Standard.FooterText) + + self.xUITest.executeCommand(".uno:Undo") + + self.assertIsNone(document.StyleFamilies.PageStyles.Standard.HeaderText) + self.assertIsNone(document.StyleFamilies.PageStyles.Standard.FooterText) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: