summaryrefslogtreecommitdiff
path: root/uitest/writer_tests6
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2020-03-02 15:42:21 +0100
committerMiklos Vajna <vmiklos@collabora.com>2020-03-03 07:57:24 +0100
commit62b92a8973db0ecb1942a80d50b2c532b5d4d2f9 (patch)
tree8d4c5d5b94a53c47c8340bb1a2a1108373087b1f /uitest/writer_tests6
parent198685ded79d64b21023ee85e9a15fa1b32705a0 (diff)
uitest: split up UITest_writer_demo
I used solenv/gbuild/Trace.mk to measure where the time is spent at the end of an incremental 'make check'. The last 141 seconds is spent executing UITest_writer_demo alone. If that test is executed in isolation, it takes 289 seconds. I measured the cost of all the individual .py suites and arranged them into 8 separate UITests, this way the make -j8 cost is 101 seconds (i.e. 35% of the baseline). IOW this is supposed to speed up 'make check' with 3m13s, provided you have the code already built. Change-Id: I1ffee3a06b8fd84d7b9a0295547900df11f11f68 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89835 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
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 000000000000..291ffdac53b4
--- /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 000000000000..245073ace5a5
--- /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()
+