summaryrefslogtreecommitdiffstats
path: root/uitest/writer_tests6
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 16:51:28 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 16:51:28 +0000
commit940b4d1848e8c70ab7642901a68594e8016caffc (patch)
treeeb72f344ee6c3d9b80a7ecc079ea79e9fba8676d /uitest/writer_tests6
parentInitial commit. (diff)
downloadlibreoffice-940b4d1848e8c70ab7642901a68594e8016caffc.tar.xz
libreoffice-940b4d1848e8c70ab7642901a68594e8016caffc.zip
Adding upstream version 1:7.0.4.upstream/1%7.0.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'uitest/writer_tests6')
-rw-r--r--uitest/writer_tests6/insertBreakDialog.py85
-rw-r--r--uitest/writer_tests6/insertPageHeader.py72
2 files changed, 157 insertions, 0 deletions
diff --git a/uitest/writer_tests6/insertBreakDialog.py b/uitest/writer_tests6/insertBreakDialog.py
new file mode 100644
index 000000000..291ffdac5
--- /dev/null
+++ b/uitest/writer_tests6/insertBreakDialog.py
@@ -0,0 +1,85 @@
+#
+# 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
+
+class WriterInsertBreakDialog(UITestCase):
+
+ def launch_dialog_and_select_option(self, child):
+
+ self.ui_test.execute_dialog_through_command(".uno:InsertBreak")
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ xOption = xDialog.getChild(child)
+ xOption.executeAction("CLICK", tuple())
+
+ return xDialog
+
+ def getPages(self, total):
+ document = self.ui_test.get_component()
+
+ xCursor = document.getCurrentController().getViewCursor()
+ xCursor.jumpToLastPage()
+
+ self.assertEqual(xCursor.getPage(), total)
+
+ def test_insert_line_break(self):
+
+ self.ui_test.create_doc_in_start_center("writer")
+
+ xDialog = self.launch_dialog_and_select_option("linerb")
+ xOkBtn = xDialog.getChild("ok")
+ xOkBtn.executeAction("CLICK", tuple())
+
+ self.getPages(1)
+
+ self.ui_test.close_doc()
+
+ def test_insert_column_break(self):
+
+ self.ui_test.create_doc_in_start_center("writer")
+
+ xDialog = self.launch_dialog_and_select_option("columnrb")
+ xOkBtn = xDialog.getChild("ok")
+ xOkBtn.executeAction("CLICK", tuple())
+
+ self.getPages(1)
+
+ self.ui_test.close_doc()
+
+ def test_insert_page_break(self):
+
+ self.ui_test.create_doc_in_start_center("writer")
+
+ for i in range(9):
+ with self.subTest(i=i):
+ xDialog = self.launch_dialog_and_select_option("pagerb")
+
+ xStyleList = xDialog.getChild("stylelb")
+ xStyleList.executeAction("SELECT", mkPropertyValues({"POS": str(i)}))
+
+ xOkBtn = xDialog.getChild("ok")
+ xOkBtn.executeAction("CLICK", tuple())
+
+ self.getPages(i + 2)
+
+ self.ui_test.close_doc()
+
+ def test_cancel_button_insert_line_break_dialog(self):
+
+ self.ui_test.create_doc_in_start_center("writer")
+
+ self.ui_test.execute_dialog_through_command(".uno:InsertBreak")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xCancelBtn = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xCancelBtn)
+
+ self.getPages(1)
+
+ self.ui_test.close_doc()
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/uitest/writer_tests6/insertPageHeader.py b/uitest/writer_tests6/insertPageHeader.py
new file mode 100644
index 000000000..245073ace
--- /dev/null
+++ b/uitest/writer_tests6/insertPageHeader.py
@@ -0,0 +1,72 @@
+#
+# 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
+
+class WriterInsertPageHeader(UITestCase):
+
+ def insert_header(self):
+ document = self.ui_test.get_component()
+
+ self.assertEqual(
+ document.StyleFamilies.PageStyles.Standard.HeaderIsOn, False)
+
+ self.xUITest.executeCommand(
+ ".uno:InsertPageHeader?PageStyle:string=Default%20Page%20Style&On:bool=true")
+
+ self.assertEqual(
+ document.StyleFamilies.PageStyles.Standard.HeaderIsOn, True)
+
+ def delete_header(self):
+ document = self.ui_test.get_component()
+
+ self.assertEqual(
+ document.StyleFamilies.PageStyles.Standard.HeaderIsOn, True)
+
+ self.ui_test.execute_dialog_through_command(
+ ".uno:InsertPageHeader?PageStyle:string=Default%20Page%20Style&On:bool=false")
+
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ xOption = xDialog.getChild("yes")
+ xOption.executeAction("CLICK", tuple())
+
+ self.assertEqual(
+ document.StyleFamilies.PageStyles.Standard.HeaderIsOn, False)
+
+ def test_header(self):
+ self.ui_test.create_doc_in_start_center("writer")
+
+ self.insert_header()
+
+ self.delete_header()
+
+ self.ui_test.close_doc()
+
+ def test_tdf107427(self):
+ self.ui_test.create_doc_in_start_center("writer")
+
+ self.insert_header()
+
+ self.ui_test.execute_dialog_through_command(".uno:InsertTable")
+
+ xInsertDlg = self.xUITest.getTopFocusWindow()
+
+ xOkBtn = xInsertDlg.getChild("ok")
+ xOkBtn.executeAction("CLICK", tuple())
+
+ document = self.ui_test.get_component()
+
+ tables = document.getTextTables()
+ self.assertEqual(len(tables[0].getRows()), 2)
+ self.assertEqual(len(tables[0].getColumns()), 2)
+
+ self.xUITest.executeCommand(".uno:SelectAll")
+
+ self.delete_header()
+
+ self.ui_test.close_doc()
+