summaryrefslogtreecommitdiffstats
path: root/sw/qa/uitest/writer_tests3
diff options
context:
space:
mode:
Diffstat (limited to 'sw/qa/uitest/writer_tests3')
-rw-r--r--sw/qa/uitest/writer_tests3/autoredactDialog.py153
-rw-r--r--sw/qa/uitest/writer_tests3/customizeDialog.py115
-rw-r--r--sw/qa/uitest/writer_tests3/goToPage.py39
-rw-r--r--sw/qa/uitest/writer_tests3/hyperlinkdialog.py124
-rw-r--r--sw/qa/uitest/writer_tests3/insertEndnote.py36
-rw-r--r--sw/qa/uitest/writer_tests3/insertEnvelope.py39
-rw-r--r--sw/qa/uitest/writer_tests3/insertFootEndnote.py63
-rw-r--r--sw/qa/uitest/writer_tests3/insertPageFooter.py64
-rw-r--r--sw/qa/uitest/writer_tests3/insertQrCodeGen.py37
-rw-r--r--sw/qa/uitest/writer_tests3/insertSignatureLine.py44
-rw-r--r--sw/qa/uitest/writer_tests3/lineNumbering.py89
-rw-r--r--sw/qa/uitest/writer_tests3/pageDialog.py216
-rw-r--r--sw/qa/uitest/writer_tests3/sort.py61
-rw-r--r--sw/qa/uitest/writer_tests3/specialCharacter.py100
-rw-r--r--sw/qa/uitest/writer_tests3/tdf79236.py118
15 files changed, 1298 insertions, 0 deletions
diff --git a/sw/qa/uitest/writer_tests3/autoredactDialog.py b/sw/qa/uitest/writer_tests3/autoredactDialog.py
new file mode 100644
index 000000000..8acc33e46
--- /dev/null
+++ b/sw/qa/uitest/writer_tests3/autoredactDialog.py
@@ -0,0 +1,153 @@
+# -*- 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_state_as_dict
+from uitest.uihelper.common import type_text
+from uitest.uihelper.common import select_pos
+import re
+
+class AutoRedactDialog(UITestCase):
+
+ add_target_counter = 0
+
+ def getText(self, xObj):
+ return get_state_as_dict(xObj)["Text"]
+
+ def parseTargetContent(self, xObj):
+ return re.split(r'\t+', self.getText(xObj))
+
+ def clearTargetsbox(self, xDialog):
+ xTargetsListbox = xDialog.getChild("targets")
+ xDeleteBtn = xDialog.getChild("delete")
+
+ child_count = len(xTargetsListbox.getChildren())
+
+ if child_count < 1:
+ return
+
+ for i in range(0, child_count):
+ child = xTargetsListbox.getChild(0)
+ child.executeAction("SELECT", tuple())
+ xDeleteBtn.executeAction("CLICK", tuple())
+
+ # Verify
+ self.assertEqual(len(xTargetsListbox.getChildren()), 0)
+
+ def test_add_target(self):
+ with self.ui_test.create_doc_in_start_center("writer"):
+ with self.ui_test.execute_dialog_through_command(".uno:AutoRedactDoc", close_button="cancel") as xDialog:
+ xAddBtn = xDialog.getChild("add")
+
+ # Make sure we are starting with an empty targets list
+ self.clearTargetsbox(xDialog)
+
+ # Names need to be distinct
+ # ["target name", "target content"],
+ targets_list = [
+ ["target1", "content1"],
+ ["target2", "content2"],
+ ["target3", "content3"],
+ ]
+
+ for i in range(0, len(targets_list)):
+ self.add_target_counter = i
+ with self.ui_test.execute_blocking_action(xAddBtn.executeAction, args=('CLICK', ()), close_button="close") as dialog:
+ xNewNameTxt=dialog.getChild("name")
+ xNewContentTxt=dialog.getChild("content")
+ xTypeList = dialog.getChild("type") #0: Text, 1: Regex, 2: Predefined
+
+ select_pos(xTypeList, "0") #Text
+ self.assertEqual(int(get_state_as_dict(xTypeList)["SelectEntryPos"]), 0)
+
+ type_text(xNewNameTxt, targets_list[self.add_target_counter][0])
+ type_text(xNewContentTxt, targets_list[self.add_target_counter][1])
+
+ # Make sure targets are added successfully
+ xTargetsListbox = xDialog.getChild("targets")
+ targets_box_state_dict = get_state_as_dict(xTargetsListbox)
+ self.assertEqual(int(targets_box_state_dict["Children"]), len(targets_list))
+
+ # Make sure targets are added with correct names and contents
+ for i in range(0, len(targets_list)):
+ child = xTargetsListbox.getChild(i)
+ child_text = self.parseTargetContent(child)
+ self.assertEqual(child_text[0], targets_list[i][0]) #name
+ self.assertEqual(child_text[2], targets_list[i][1]) #content
+
+ # Now let's make sure the dialog remembers last state
+ with self.ui_test.execute_dialog_through_command(".uno:AutoRedactDoc", close_button="cancel") as xDialog:
+ xTargetsListbox = xDialog.getChild("targets")
+ targets_box_state_dict = get_state_as_dict(xTargetsListbox)
+ self.assertEqual(int(targets_box_state_dict["Children"]), len(targets_list))
+
+ # Make sure targets are remembered with correct names and contents
+ for i in range(0, len(targets_list)):
+ child = xTargetsListbox.getChild(i)
+ child_text = self.parseTargetContent(child)
+ self.assertEqual(child_text[0], targets_list[i][0]) #name
+ self.assertEqual(child_text[2], targets_list[i][1]) #content
+
+
+
+ def test_edit_target(self):
+ with self.ui_test.create_doc_in_start_center("writer"):
+ with self.ui_test.execute_dialog_through_command(".uno:AutoRedactDoc", close_button="cancel") as xDialog:
+ xAddBtn = xDialog.getChild("add")
+ xEditBtn = xDialog.getChild("edit")
+
+ # Make sure we are starting with an empty targets list
+ self.clearTargetsbox(xDialog)
+
+ # We first need to add a target so that we can edit it
+ with self.ui_test.execute_blocking_action(xAddBtn.executeAction, args=('CLICK', ()), close_button="close") as dialog:
+ xNewNameTxt=dialog.getChild("name")
+ xNewContentTxt=dialog.getChild("content")
+ xTypeList = dialog.getChild("type") #0: Text, 1: Regex, 2: Predefined
+
+ select_pos(xTypeList, "0") #Text
+ self.assertEqual(int(get_state_as_dict(xTypeList)["SelectEntryPos"]), 0)
+
+ type_text(xNewNameTxt, "TestTarget")
+ type_text(xNewContentTxt, "TestContent")
+
+ # Make sure target is added successfully
+ xTargetsListbox = xDialog.getChild("targets")
+ targets_box_state_dict = get_state_as_dict(xTargetsListbox)
+ self.assertEqual(int(targets_box_state_dict["Children"]), 1)
+
+ # Select the added target
+ target_entry = xTargetsListbox.getChild(0)
+ target_entry.executeAction("SELECT", tuple())
+
+ # Now edit the target
+ with self.ui_test.execute_blocking_action(xEditBtn.executeAction, args=('CLICK', ()), close_button="close") as dialog:
+ xNameTxt=dialog.getChild("name")
+ xContentTxt=dialog.getChild("content")
+
+ xNameTxt.executeAction("CLEAR", tuple())
+ xContentTxt.executeAction("CLEAR", tuple())
+
+ type_text(xNameTxt, "TestTargetEdited")
+ type_text(xContentTxt, "TestContentEdited")
+
+ # Make sure target is still there
+ xTargetsListbox = xDialog.getChild("targets")
+ targets_box_state_dict = get_state_as_dict(xTargetsListbox)
+ self.assertEqual(int(targets_box_state_dict["Children"]), 1)
+
+ # Make sure target has the new values
+ target_entry = xTargetsListbox.getChild(0)
+ target_text = self.parseTargetContent(target_entry)
+ self.assertEqual(target_text[0], "TestTargetEdited") #name
+ self.assertEqual(target_text[2], "TestContentEdited") #content
+
+
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests3/customizeDialog.py b/sw/qa/uitest/writer_tests3/customizeDialog.py
new file mode 100644
index 000000000..982c1cef7
--- /dev/null
+++ b/sw/qa/uitest/writer_tests3/customizeDialog.py
@@ -0,0 +1,115 @@
+# -*- 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/.
+#
+
+import time
+
+from uitest.framework import UITestCase
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from uitest.uihelper.common import get_state_as_dict
+from uitest.uihelper.common import select_pos
+
+class ConfigureDialog(UITestCase):
+
+ def test_open_ConfigureDialog_writer(self):
+
+ with self.ui_test.create_doc_in_start_center("writer"):
+ with self.ui_test.execute_dialog_through_command(".uno:ConfigureDialog", close_button="cancel"):
+ pass
+
+
+ def test_search_filter(self):
+ with self.ui_test.create_doc_in_start_center("writer"):
+ with self.ui_test.execute_dialog_through_command(".uno:ConfigureDialog", close_button="cancel") as xDialog:
+
+ xfunc = xDialog.getChild("functions")
+ xSearch = xDialog.getChild("searchEntry")
+
+ initialEntryCount = get_state_as_dict(xfunc)["Children"]
+ self.assertTrue(initialEntryCount != 0)
+
+ xSearch.executeAction("TYPE", mkPropertyValues({"TEXT":"format"}))
+
+ # Wait for the search/filter op to be completed
+ timeout = time.time() + 1
+ while time.time() < timeout:
+ filteredEntryCount = get_state_as_dict(xfunc)["Children"]
+ if filteredEntryCount != initialEntryCount:
+ break
+ time.sleep(0.1)
+
+ self.assertTrue(filteredEntryCount < initialEntryCount)
+
+ xSearch.executeAction("CLEAR", tuple())
+
+ # Wait for the search/filter op to be completed
+ timeout = time.time() + 1
+ while time.time() < timeout:
+ finalEntryCount = get_state_as_dict(xfunc)["Children"]
+ if finalEntryCount != filteredEntryCount:
+ break
+ time.sleep(0.1)
+
+ self.assertEqual(initialEntryCount, finalEntryCount)
+
+
+
+
+ def test_category_listbox(self):
+ with self.ui_test.create_doc_in_start_center("writer"):
+ with self.ui_test.execute_dialog_through_command(".uno:ConfigureDialog", close_button="cancel") as xDialog:
+
+ xFunc = xDialog.getChild("functions")
+ xCategory = xDialog.getChild("commandcategorylist")
+
+ initialEntryCount = get_state_as_dict(xFunc)["Children"]
+ self.assertTrue(initialEntryCount != 0)
+
+ select_pos(xCategory, "1")
+ filteredEntryCount = get_state_as_dict(xFunc)["Children"]
+ self.assertTrue(filteredEntryCount < initialEntryCount)
+
+ select_pos(xCategory, "0")
+ finalEntryCount = get_state_as_dict(xFunc)["Children"]
+ self.assertEqual(initialEntryCount, finalEntryCount)
+
+
+
+ def test_tdf133862(self):
+ with self.ui_test.create_doc_in_start_center("writer"):
+
+ self.xUITest.executeCommand(".uno:InsertObjectStarMath")
+
+ # Without the fix in place, calling customize dialog after inserting
+ # a formula object would crash
+ with self.ui_test.execute_dialog_through_command(".uno:ConfigureDialog", close_button="cancel"):
+ pass
+
+
+ def test_gear_button_menu(self):
+ with self.ui_test.create_doc_in_start_center("writer"):
+
+ with self.ui_test.execute_dialog_through_command(".uno:ConfigureDialog", close_button="cancel") as xDialog:
+
+ # Open the New Menu Dialog with id = 0
+ xmenugearbtn=xDialog.getChild("menugearbtn")
+ def show_dialog0():
+ xmenugearbtn.executeAction("OPENFROMLIST", mkPropertyValues({"POS": "0" }))
+ with self.ui_test.execute_blocking_action( action=show_dialog0, close_button="cancel"):
+ pass
+
+ # Open the Rename Menu Dialog with id = 2
+ xmenugearbtn=xDialog.getChild("menugearbtn")
+ def show_dialog2():
+ xmenugearbtn.executeAction("OPENFROMLIST", mkPropertyValues({"POS": "2"}))
+ with self.ui_test.execute_blocking_action( action=show_dialog2, close_button="cancel"):
+ pass
+
+
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests3/goToPage.py b/sw/qa/uitest/writer_tests3/goToPage.py
new file mode 100644
index 000000000..4b763eeca
--- /dev/null
+++ b/sw/qa/uitest/writer_tests3/goToPage.py
@@ -0,0 +1,39 @@
+# -*- 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, get_url_for_data_file
+
+class GoToPage_dialog(UITestCase):
+
+ def test_go_to_page(self):
+ with self.ui_test.load_file(get_url_for_data_file("3pages.odt")) as writer_doc:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+
+ with self.ui_test.execute_dialog_through_command(".uno:GotoPage") as xDialog:
+ xPageText = xDialog.getChild("page")
+ xPageText.executeAction("TYPE", mkPropertyValues({"TEXT":"2"}))
+
+ self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2")
+
+ with self.ui_test.execute_dialog_through_command(".uno:GotoPage") as xDialog:
+ xPageText = xDialog.getChild("page")
+ xPageText.executeAction("TYPE", mkPropertyValues({"TEXT":"3a"}))
+
+ self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "3")
+
+ # check cancel button
+ with self.ui_test.execute_dialog_through_command(".uno:GotoPage", close_button="cancel"):
+ pass
+
+ self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "3")
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab: \ No newline at end of file
diff --git a/sw/qa/uitest/writer_tests3/hyperlinkdialog.py b/sw/qa/uitest/writer_tests3/hyperlinkdialog.py
new file mode 100644
index 000000000..c737f33ad
--- /dev/null
+++ b/sw/qa/uitest/writer_tests3/hyperlinkdialog.py
@@ -0,0 +1,124 @@
+# -*- 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
+import os
+import re
+from uitest.uihelper.common import get_state_as_dict, select_pos
+from libreoffice.uno.propertyvalue import mkPropertyValues
+
+#test Hyperlink dialog
+class HyperlinkDialog(UITestCase):
+
+ def test_hyperlink_dialog_vertical_tab(self):
+
+ with self.ui_test.create_doc_in_start_center("writer"):
+ MainWindow = self.xUITest.getTopFocusWindow()
+
+ with self.ui_test.execute_dialog_through_command(".uno:HyperlinkDialog", close_button="cancel") as xDialog:
+
+ # Test the vertical tab
+ xtab=xDialog.getChild("tabcontrol")
+ self.assertEqual(get_state_as_dict(xtab)["PageCount"], "4")
+
+ select_pos(xtab, "0")
+ self.assertEqual(get_state_as_dict(xtab)["CurrPageTitel"], "~Internet")
+ self.assertEqual(get_state_as_dict(xtab)["CurrPagePos"], "0")
+
+ select_pos(xtab, "1")
+ self.assertEqual(get_state_as_dict(xtab)["CurrPageTitel"], "~Mail")
+ self.assertEqual(get_state_as_dict(xtab)["CurrPagePos"], "1")
+
+ select_pos(xtab, "2")
+ self.assertEqual(get_state_as_dict(xtab)["CurrPageTitel"], "~Document")
+ self.assertEqual(get_state_as_dict(xtab)["CurrPagePos"], "2")
+
+ select_pos(xtab, "3")
+ self.assertEqual(get_state_as_dict(xtab)["CurrPageTitel"], "~New Document")
+ self.assertEqual(get_state_as_dict(xtab)["CurrPagePos"], "3")
+
+
+
+ def test_insert_hyperlink(self):
+
+ with self.ui_test.create_doc_in_start_center("writer"):
+ xMainWindow = self.xUITest.getTopFocusWindow()
+
+ with self.ui_test.execute_dialog_through_command(".uno:HyperlinkDialog") as xDialog:
+
+ # insert link
+ xtab=xDialog.getChild("tabcontrol")
+ select_pos(xtab, "0")
+
+ xtarget = xDialog.getChild("target")
+ xtarget.executeAction("TYPE", mkPropertyValues({"TEXT": "http://www.libreoffice.org/"}))
+ self.assertEqual(get_state_as_dict(xtarget)["Text"], "http://www.libreoffice.org/")
+
+ xindication = xDialog.getChild("indication")
+ xindication.executeAction("TYPE", mkPropertyValues({"TEXT": "link"}))
+ self.assertEqual(get_state_as_dict(xindication)["Text"], "link")
+
+
+ # Check that the link is added
+ xMainWindow = self.xUITest.getTopFocusWindow()
+ xedit = xMainWindow.getChild("writer_edit")
+ xedit.executeAction("SELECT", mkPropertyValues({"START_POS": "0", "END_POS": "4"}))
+ self.assertEqual(get_state_as_dict(xedit)["SelectedText"], "link")
+
+
+ def test_insert_hyperlink_without_scheme(self):
+
+ with self.ui_test.create_doc_in_start_center("writer"):
+ xMainWindow = self.xUITest.getTopFocusWindow()
+
+ with self.ui_test.execute_dialog_through_command(".uno:HyperlinkDialog") as xDialog:
+
+ # insert link
+ xtab=xDialog.getChild("tabcontrol")
+ select_pos(xtab, "0")
+
+ xtarget = xDialog.getChild("target")
+ xtarget.executeAction("TYPE", mkPropertyValues({"TEXT": "www.libreoffice.org:80"}))
+
+ # Check that the link is added with http scheme
+ xMainWindow = self.xUITest.getTopFocusWindow()
+ xedit = xMainWindow.getChild("writer_edit")
+ xedit.executeAction("SELECT", mkPropertyValues({"START_POS": "0", "END_POS": "29"}))
+ self.assertEqual(get_state_as_dict(xedit)["SelectedText"], "http://www.libreoffice.org:80")
+
+
+ def test_tdf141166(self):
+ # Skip this test for --with-help=html and --with-help=online, as that would fail with a
+ # DialogNotExecutedException("did not execute a dialog for a blocking action") thrown from
+ # the below execute_blocking_action call (and would leave behind the relevant HTML page
+ # opened in the user's default browser):
+ if os.getenv('ENABLE_HTMLHELP') == 'TRUE':
+ return
+ # Skip this test for --enable-xmlhelp, as that would fail with a
+ # "uno.com.sun.star.uno.RuntimeException: Could not find child with id: cancel" thrown from
+ # the below execute_blocking_action call, as it would open the "LibreOffice Help" window
+ # instead of the apparently expected "LibreOffice Help Not Installed" dialog that has a
+ # "Cancel" button:
+ if re.compile(r'XMLHELP\b').search(os.getenv('BUILD_TYPE')):
+ return
+
+ with self.ui_test.create_doc_in_start_center("writer"):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+
+ with self.ui_test.execute_dialog_through_command(".uno:HyperlinkDialog", close_button="") as xDialog:
+ xHelp = xDialog.getChild("help")
+ xHelp.executeAction('FOCUS', tuple())
+
+ # Without the fix in place, this test would have crashed here
+ with self.ui_test.execute_blocking_action(xHelp.executeAction,
+ args=("CLICK", tuple()), close_button="cancel"):
+ pass
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests3/insertEndnote.py b/sw/qa/uitest/writer_tests3/insertEndnote.py
new file mode 100644
index 000000000..46226499d
--- /dev/null
+++ b/sw/qa/uitest/writer_tests3/insertEndnote.py
@@ -0,0 +1,36 @@
+# -*- 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 type_text
+
+class insertEndnote(UITestCase):
+
+ def test_insert_endnote(self):
+ with self.ui_test.create_doc_in_start_center("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+
+ self.xUITest.executeCommand(".uno:InsertEndnote")
+
+ type_text(xWriterEdit, "LibreOffice")
+
+ self.assertEqual(document.Endnotes[0].String, "LibreOffice")
+ self.assertEqual(document.Endnotes.getCount(), 1)
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(document.Endnotes[0].String, "")
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(document.Endnotes.getCount(), 0)
+ self.xUITest.executeCommand(".uno:Redo")
+ self.assertEqual(document.Endnotes[0].String, "")
+ self.assertEqual(document.Endnotes.getCount(), 1)
+ self.xUITest.executeCommand(".uno:Redo")
+ self.assertEqual(document.Endnotes[0].String, "LibreOffice")
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests3/insertEnvelope.py b/sw/qa/uitest/writer_tests3/insertEnvelope.py
new file mode 100644
index 000000000..0a91780a1
--- /dev/null
+++ b/sw/qa/uitest/writer_tests3/insertEnvelope.py
@@ -0,0 +1,39 @@
+# -*- 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
+
+#envaddresspage.ui
+
+class WriterInsertEnvelope(UITestCase):
+
+ def test_insert_envelope(self):
+ with self.ui_test.create_doc_in_start_center("writer"):
+ with self.ui_test.execute_dialog_through_command(".uno:InsertEnvelope", close_button="user") as xDialog:
+ xAddrTxt= xDialog.getChild("addredit")
+ xSenderTxt = xDialog.getChild("senderedit")
+ xSenderCheckBox = xDialog.getChild("sender")
+
+ xAddrTxt.executeAction("SELECT", mkPropertyValues({"FROM": "1", "TO": "200"}))
+ xAddrTxt.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xAddrTxt.executeAction("TYPE", mkPropertyValues({"TEXT":"Address"}))
+
+ xSenderTxt.executeAction("SELECT", mkPropertyValues({"FROM": "1", "TO": "200"}))
+ xSenderTxt.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xSenderTxt.executeAction("TYPE", mkPropertyValues({"TEXT":"Sender"}))
+
+ with self.ui_test.execute_dialog_through_command(".uno:InsertEnvelope", close_button="cancel") as xDialog:
+ xAddrTxt= xDialog.getChild("addredit")
+ xSenderTxt = xDialog.getChild("senderedit")
+ self.assertEqual(get_state_as_dict(xAddrTxt)["Text"], "Address")
+ self.assertEqual(get_state_as_dict(xSenderTxt)["Text"], "Sender")
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests3/insertFootEndnote.py b/sw/qa/uitest/writer_tests3/insertFootEndnote.py
new file mode 100644
index 000000000..f2fbc3559
--- /dev/null
+++ b/sw/qa/uitest/writer_tests3/insertFootEndnote.py
@@ -0,0 +1,63 @@
+# -*- 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
+
+class insertFootEndnote(UITestCase):
+
+ def test_insert_foot_endnote(self):
+ with self.ui_test.create_doc_in_start_center("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+#Automatic - Footnote
+ with self.ui_test.execute_dialog_through_command(".uno:InsertFootnoteDialog"):
+ pass
+
+ self.assertEqual(document.Footnotes.getCount(), 1)
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(document.Footnotes.getCount(), 0)
+#Automatic - Endnote
+ with self.ui_test.execute_dialog_through_command(".uno:InsertFootnoteDialog") as xDialog:
+ xEndnote = xDialog.getChild("endnote")
+ xEndnote.executeAction("CLICK", tuple())
+
+ self.assertEqual(document.Endnotes.getCount(), 1)
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(document.Endnotes.getCount(), 0)
+#Character - Footnote
+ with self.ui_test.execute_dialog_through_command(".uno:InsertFootnoteDialog") as xDialog:
+ xChar = xDialog.getChild("character")
+ xChar.executeAction("CLICK", tuple())
+ xCharentry = xDialog.getChild("characterentry")
+ xCharentry.executeAction("TYPE", mkPropertyValues({"TEXT":"A"}))
+
+ self.assertEqual(document.Footnotes.getCount(), 1)
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(document.Footnotes.getCount(), 0)
+
+#Character - Endnote
+ with self.ui_test.execute_dialog_through_command(".uno:InsertFootnoteDialog") as xDialog:
+ xChar = xDialog.getChild("character")
+ xChar.executeAction("CLICK", tuple())
+ xCharentry = xDialog.getChild("characterentry")
+ xCharentry.executeAction("TYPE", mkPropertyValues({"TEXT":"A"}))
+
+ xEndnote = xDialog.getChild("endnote")
+ xEndnote.executeAction("CLICK", tuple())
+
+ self.assertEqual(document.Endnotes.getCount(), 1)
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(document.Endnotes.getCount(), 0)
+
+#Cancel button
+ with self.ui_test.execute_dialog_through_command(".uno:InsertFootnoteDialog", close_button="cancel"):
+ pass
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests3/insertPageFooter.py b/sw/qa/uitest/writer_tests3/insertPageFooter.py
new file mode 100644
index 000000000..3a5c6a13e
--- /dev/null
+++ b/sw/qa/uitest/writer_tests3/insertPageFooter.py
@@ -0,0 +1,64 @@
+# -*- 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
+
+class WriterInsertPageFooter(UITestCase):
+
+ def insert_footer(self):
+ document = self.ui_test.get_component()
+
+ self.assertEqual(
+ document.StyleFamilies.PageStyles.Standard.FooterIsOn, False)
+
+ self.xUITest.executeCommand(
+ ".uno:InsertPageFooter?PageStyle:string=Default%20Page%20Style&On:bool=true")
+
+ self.assertEqual(
+ document.StyleFamilies.PageStyles.Standard.FooterIsOn, True)
+
+ def delete_footer(self):
+ document = self.ui_test.get_component()
+
+ self.assertEqual(
+ document.StyleFamilies.PageStyles.Standard.FooterIsOn, True)
+
+ with self.ui_test.execute_dialog_through_command(
+ ".uno:InsertPageFooter?PageStyle:string=Default%20Page%20Style&On:bool=false", close_button="yes"):
+ pass
+
+ self.assertEqual(
+ document.StyleFamilies.PageStyles.Standard.FooterIsOn, False)
+
+ def test_footer(self):
+ with self.ui_test.create_doc_in_start_center("writer") as document:
+
+ self.insert_footer()
+
+ self.delete_footer()
+
+
+ def test_tdf107427(self):
+ with self.ui_test.create_doc_in_start_center("writer") as document:
+
+ self.insert_footer()
+
+ with self.ui_test.execute_dialog_through_command(".uno:InsertTable"):
+ pass
+
+
+ tables = document.getTextTables()
+ self.assertEqual(len(tables[0].getRows()), 2)
+ self.assertEqual(len(tables[0].getColumns()), 2)
+
+ self.xUITest.executeCommand(".uno:SelectAll")
+
+ self.delete_footer()
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests3/insertQrCodeGen.py b/sw/qa/uitest/writer_tests3/insertQrCodeGen.py
new file mode 100644
index 000000000..5895211af
--- /dev/null
+++ b/sw/qa/uitest/writer_tests3/insertQrCodeGen.py
@@ -0,0 +1,37 @@
+# -*- 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 type_text
+
+class insertQrCode(UITestCase):
+
+ def test_insert_qr_code(self):
+ with self.ui_test.create_doc_in_start_center("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ with self.ui_test.execute_dialog_through_command(".uno:InsertQrCode") as xDialog:
+
+ # Get elements in the Dialog Box
+ xURL = xDialog.getChild("edit_text")
+ xECC_Low = xDialog.getChild("button_low") #How radio button input is written in text.
+ xBorder = xDialog.getChild("edit_margin")
+
+ type_text(xURL, "www.libreoffice.org") #set the QR code
+ xECC_Low.executeAction("CLICK", tuple())
+ xBorder.executeAction("UP", tuple())
+ xBorder.executeAction("DOWN", tuple())
+
+ # check the QR code in the document
+ element = document.DrawPage.getByIndex(0)
+ self.assertEqual(element.BarCodeProperties.Payload, "www.libreoffice.org")
+ self.assertEqual(element.BarCodeProperties.ErrorCorrection, 1)
+ self.assertEqual(element.BarCodeProperties.Border, 1)
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests3/insertSignatureLine.py b/sw/qa/uitest/writer_tests3/insertSignatureLine.py
new file mode 100644
index 000000000..0082891da
--- /dev/null
+++ b/sw/qa/uitest/writer_tests3/insertSignatureLine.py
@@ -0,0 +1,44 @@
+# -*- 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
+
+class insertSignatureLine(UITestCase):
+
+ def test_insert_signature_line(self):
+ with self.ui_test.create_doc_in_start_center("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ # set the signature line
+ with self.ui_test.execute_dialog_through_command(".uno:InsertSignatureLine") as xDialog:
+
+ xName = xDialog.getChild("edit_name")
+ xTitle = xDialog.getChild("edit_title")
+ xEmail = xDialog.getChild("edit_email")
+ xComment = xDialog.getChild("checkbox_can_add_comments")
+ xInstructions = xDialog.getChild("edit_instructions")
+
+ xName.executeAction("TYPE", mkPropertyValues({"TEXT":"Name"})) #set the signature line
+ xTitle.executeAction("TYPE", mkPropertyValues({"TEXT":"Title"}))
+ xEmail.executeAction("TYPE", mkPropertyValues({"TEXT":"Email"}))
+ xComment.executeAction("CLICK", tuple())
+ xInstructions.executeAction("TYPE", mkPropertyValues({"TEXT":"Instructions"}))
+
+ #check the signature Line in the document
+ element = document.DrawPage.getByIndex(0)
+ self.assertEqual(element.SignatureLineSuggestedSignerName, "Name")
+ self.assertEqual(element.SignatureLineSuggestedSignerTitle, "Title")
+ self.assertEqual(element.SignatureLineSuggestedSignerEmail, "Email")
+ self.assertEqual(element.SignatureLineSuggestedSignerTitle, "Title")
+ self.assertEqual(element.SignatureLineCanAddComment, False)
+ self.assertEqual(element.SignatureLineShowSignDate, True)
+ self.assertEqual(element.SignatureLineSigningInstructions, "Instructions")
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests3/lineNumbering.py b/sw/qa/uitest/writer_tests3/lineNumbering.py
new file mode 100644
index 000000000..ddcd0a583
--- /dev/null
+++ b/sw/qa/uitest/writer_tests3/lineNumbering.py
@@ -0,0 +1,89 @@
+# -*- 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 select_by_text
+from uitest.uihelper.common import get_state_as_dict
+from uitest.uihelper.common import change_measurement_unit
+
+class WriterLineNumbering(UITestCase):
+
+ def test_line_numbering_dialog(self):
+ with self.ui_test.create_doc_in_start_center("writer"):
+
+ change_measurement_unit(self, "Centimeter")
+
+ with self.ui_test.execute_dialog_through_command(".uno:LineNumberingDialog") as xDialog:
+ xshownumbering = xDialog.getChild("shownumbering")
+ xstyledropdown = xDialog.getChild("styledropdown")
+ xformatdropdown = xDialog.getChild("formatdropdown")
+ xpositiondropdown = xDialog.getChild("positiondropdown")
+ xspacingspin = xDialog.getChild("spacingspin")
+ xintervalspin = xDialog.getChild("intervalspin")
+ xtextentry = xDialog.getChild("textentry")
+ xlinesspin = xDialog.getChild("linesspin")
+ xblanklines = xDialog.getChild("blanklines")
+ xlinesintextframes = xDialog.getChild("linesintextframes")
+ xshowfooterheadernumbering = xDialog.getChild("showfooterheadernumbering")
+ xrestarteverynewpage = xDialog.getChild("restarteverynewpage")
+
+ xshownumbering.executeAction("CLICK", tuple())
+ select_by_text(xstyledropdown, "Bullets")
+ select_by_text(xformatdropdown, "A, B, C, ...")
+ select_by_text(xpositiondropdown, "Right")
+ xspacingspin.executeAction("UP", tuple())
+ xintervalspin.executeAction("UP", tuple())
+ xtextentry.executeAction("TYPE", mkPropertyValues({"TEXT":";"}))
+ xlinesspin.executeAction("UP", tuple())
+ xblanklines.executeAction("CLICK", tuple())
+ xlinesintextframes.executeAction("CLICK", tuple())
+ xshowfooterheadernumbering.executeAction("CLICK", tuple())
+ xrestarteverynewpage.executeAction("CLICK", tuple())
+
+ with self.ui_test.execute_dialog_through_command(".uno:LineNumberingDialog", close_button="cancel") as xDialog:
+ xshownumbering = xDialog.getChild("shownumbering")
+ xstyledropdown = xDialog.getChild("styledropdown")
+ xformatdropdown = xDialog.getChild("formatdropdown")
+ xpositiondropdown = xDialog.getChild("positiondropdown")
+ xspacingspin = xDialog.getChild("spacingspin")
+ xintervalspin = xDialog.getChild("intervalspin")
+ xtextentry = xDialog.getChild("textentry")
+ xlinesspin = xDialog.getChild("linesspin")
+ xblanklines = xDialog.getChild("blanklines")
+ xlinesintextframes = xDialog.getChild("linesintextframes")
+ xshowfooterheadernumbering = xDialog.getChild("showfooterheadernumbering")
+ xrestarteverynewpage = xDialog.getChild("restarteverynewpage")
+
+ self.assertEqual(get_state_as_dict(xshownumbering)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(xstyledropdown)["SelectEntryText"], "Bullets")
+ self.assertEqual(get_state_as_dict(xformatdropdown)["SelectEntryText"], "A, B, C, ...")
+ self.assertEqual(get_state_as_dict(xpositiondropdown)["SelectEntryText"], "Right")
+ self.assertEqual(get_state_as_dict(xspacingspin)["Text"], "0.60 cm")
+ self.assertEqual(get_state_as_dict(xintervalspin)["Text"], "6")
+ self.assertEqual(get_state_as_dict(xtextentry)["Text"], ";")
+ self.assertEqual(get_state_as_dict(xlinesspin)["Text"], "4")
+ self.assertEqual(get_state_as_dict(xblanklines)["Selected"], "false")
+ self.assertEqual(get_state_as_dict(xlinesintextframes)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(xshowfooterheadernumbering)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(xrestarteverynewpage)["Selected"], "true")
+
+ def test_tdf86185(self):
+ with self.ui_test.create_doc_in_start_center("writer"):
+
+ with self.ui_test.execute_dialog_through_command(".uno:LineNumberingDialog", close_button="cancel") as xDialog:
+ xshownumbering = xDialog.getChild("shownumbering")
+ xformatdropdown = xDialog.getChild("formatdropdown")
+
+ xshownumbering.executeAction("CLICK", tuple())
+ itemFormat = ["1, 2, 3, ...", "A, B, C, ...", "a, b, c, ...", "I, II, III, ...", "i, ii, iii, ...", "A, .., AA, .., AAA, ..."]
+ for i in range(6):
+ select_by_text(xformatdropdown, itemFormat[i])
+ self.assertEqual(get_state_as_dict(xformatdropdown)["SelectEntryText"], itemFormat[i])
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests3/pageDialog.py b/sw/qa/uitest/writer_tests3/pageDialog.py
new file mode 100644
index 000000000..18bc1c999
--- /dev/null
+++ b/sw/qa/uitest/writer_tests3/pageDialog.py
@@ -0,0 +1,216 @@
+# -*- 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 select_pos, get_state_as_dict
+from com.sun.star.awt.GradientStyle import LINEAR
+from com.sun.star.drawing.HatchStyle import SINGLE
+from com.sun.star.drawing.BitmapMode import REPEAT
+from com.sun.star.drawing.RectanglePoint import MIDDLE_MIDDLE
+
+
+class WriterPageDialog(UITestCase):
+
+ def click_button(self, dialog, button):
+ xButton = dialog.getChild(button)
+ xButton.executeAction("CLICK", tuple())
+
+ def check_default_area(self, btn):
+ document = self.ui_test.get_component()
+ if btn == 'btnnone':
+ self.assertEqual(
+ document.StyleFamilies.PageStyles.Standard.BackColor, -1)
+ elif btn == 'btncolor':
+ self.assertEqual(
+ hex(document.StyleFamilies.PageStyles.Standard.BackColor), '0x729fcf')
+ self.assertEqual(
+ hex(document.StyleFamilies.PageStyles.Standard.FillColor), '0x729fcf')
+ self.assertEqual(
+ hex(document.StyleFamilies.PageStyles.Standard.FillColor), '0x729fcf')
+ elif btn == 'btngradient':
+ self.assertEqual(
+ document.StyleFamilies.PageStyles.Standard.FillGradient.Style, LINEAR)
+ self.assertEqual(
+ hex(document.StyleFamilies.PageStyles.Standard.FillGradient.StartColor), '0xdde8cb')
+ self.assertEqual(
+ document.StyleFamilies.PageStyles.Standard.FillGradient.Angle, 300)
+ self.assertEqual(
+ document.StyleFamilies.PageStyles.Standard.FillGradient.Border, 0)
+ self.assertEqual(
+ document.StyleFamilies.PageStyles.Standard.FillGradient.XOffset, 0)
+ self.assertEqual(
+ document.StyleFamilies.PageStyles.Standard.FillGradient.YOffset, 0)
+ self.assertEqual(
+ document.StyleFamilies.PageStyles.Standard.FillGradient.StartIntensity, 100)
+ self.assertEqual(
+ document.StyleFamilies.PageStyles.Standard.FillGradient.EndIntensity, 100)
+ self.assertEqual(
+ document.StyleFamilies.PageStyles.Standard.FillGradientName, 'Pastel Bouquet')
+ elif btn == 'btnhatch':
+ self.assertEqual(
+ document.StyleFamilies.PageStyles.Standard.FillHatch.Style, SINGLE )
+ self.assertEqual(
+ document.StyleFamilies.PageStyles.Standard.FillHatch.Color, 0)
+ self.assertEqual(
+ document.StyleFamilies.PageStyles.Standard.FillHatch.Distance, 102)
+ self.assertEqual(
+ document.StyleFamilies.PageStyles.Standard.FillHatch.Angle, 0)
+ self.assertEqual(
+ document.StyleFamilies.PageStyles.Standard.FillHatchName, 'Black 0 Degrees')
+ elif btn == 'btnbitmap':
+ self.assertEqual(
+ document.StyleFamilies.PageStyles.Standard.FillBitmapMode, REPEAT)
+ self.assertEqual(
+ document.StyleFamilies.PageStyles.Standard.FillBitmapPositionOffsetX, 0)
+ self.assertEqual(
+ document.StyleFamilies.PageStyles.Standard.FillBitmapPositionOffsetY, 0)
+ self.assertEqual(
+ document.StyleFamilies.PageStyles.Standard.FillBitmapRectanglePoint, MIDDLE_MIDDLE)
+ self.assertEqual(
+ document.StyleFamilies.PageStyles.Standard.FillBitmapStretch, False)
+ self.assertEqual(
+ document.StyleFamilies.PageStyles.Standard.FillBitmapTile, True)
+ self.assertEqual(
+ document.StyleFamilies.PageStyles.Standard.FillBitmapOffsetX, 0)
+ self.assertEqual(
+ document.StyleFamilies.PageStyles.Standard.FillBitmapOffsetY, 0)
+ self.assertEqual(
+ document.StyleFamilies.PageStyles.Standard.FillBitmapLogicalSize, True)
+ self.assertEqual(
+ document.StyleFamilies.PageStyles.Standard.FillBitmapSizeX, 0)
+ self.assertEqual(
+ document.StyleFamilies.PageStyles.Standard.FillBitmapSizeY, 0)
+ self.assertEqual(
+ document.StyleFamilies.PageStyles.Standard.FillBitmapName, 'Painted White')
+ elif btn == 'btnpattern':
+ self.assertEqual(
+ document.StyleFamilies.PageStyles.Standard.FillBitmapMode, REPEAT)
+ self.assertEqual(
+ document.StyleFamilies.PageStyles.Standard.FillBitmapPositionOffsetX, 0)
+ self.assertEqual(
+ document.StyleFamilies.PageStyles.Standard.FillBitmapPositionOffsetY, 0)
+ self.assertEqual(
+ document.StyleFamilies.PageStyles.Standard.FillBitmapRectanglePoint, MIDDLE_MIDDLE)
+ self.assertEqual(
+ document.StyleFamilies.PageStyles.Standard.FillBitmapStretch, False)
+ self.assertEqual(
+ document.StyleFamilies.PageStyles.Standard.FillBitmapTile, True)
+ self.assertEqual(
+ document.StyleFamilies.PageStyles.Standard.FillBitmapOffsetX, 0)
+ self.assertEqual(
+ document.StyleFamilies.PageStyles.Standard.FillBitmapOffsetY, 0)
+ self.assertEqual(
+ document.StyleFamilies.PageStyles.Standard.FillBitmapLogicalSize, True)
+ self.assertEqual(
+ document.StyleFamilies.PageStyles.Standard.FillBitmapSizeX, 0)
+ self.assertEqual(
+ document.StyleFamilies.PageStyles.Standard.FillBitmapSizeY, 0)
+ self.assertEqual(
+ document.StyleFamilies.PageStyles.Standard.FillBitmapName, '5 Percent')
+
+ def test_area_tab(self):
+
+ with self.ui_test.create_doc_in_start_center("writer"):
+
+ buttons = ['btnbitmap', 'btncolor', 'btngradient', 'btnhatch', 'btnpattern']
+ for index, button in enumerate(buttons):
+
+ with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as xDialog:
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "2")
+ self.click_button(xDialog, button)
+
+ self.check_default_area(button)
+
+ with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as xDialog:
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "2")
+
+ self.click_button(xDialog, 'btnnone')
+
+ self.check_default_area('btnnone')
+
+
+ def test_paper_format(self):
+
+ lPaperFormat = ["A6", "A5", "A4", "A3", "B6 (ISO)", "B5 (ISO)", "B4 (ISO)", "Letter",
+ "Legal", "Long Bond", "Tabloid", "B6 (JIS)", "B5 (JIS)", "B4 (JIS)", "16 Kai",
+ "32 Kai", "Big 32 Kai", "User", "DL Envelope", "C6 Envelope", "C6/5 Envelope",
+ "C5 Envelope", "C4 Envelope", "#6¾ Envelope", "#7¾ (Monarch) Envelope",
+ "#9 Envelope", "#10 Envelope", "#11 Envelope", "#12 Envelope", "Japanese Postcard"]
+
+ with self.ui_test.create_doc_in_start_center("writer"):
+
+ for i in range(30):
+ with self.subTest(i=i):
+ with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as xDialog:
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "1")
+ xFormatList = xDialog.getChild("comboPageFormat")
+ select_pos(xFormatList, str(i))
+
+ self.assertEqual(
+ get_state_as_dict(xFormatList)["SelectEntryText"], lPaperFormat[i])
+
+
+ def test_orientation(self):
+
+ with self.ui_test.create_doc_in_start_center("writer") as document:
+
+ self.assertEqual(
+ document.StyleFamilies.PageStyles.Standard.IsLandscape, False)
+
+ with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as xDialog:
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "1")
+ self.click_button(xDialog, 'radiobuttonLandscape')
+
+ self.assertEqual(
+ document.StyleFamilies.PageStyles.Standard.IsLandscape, True)
+
+ with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as xDialog:
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "1")
+ self.click_button(xDialog, 'radiobuttonPortrait')
+
+ self.assertEqual(
+ document.StyleFamilies.PageStyles.Standard.IsLandscape, False)
+
+
+ def test_text_direction(self):
+
+ lTextDirection = ['Left-to-right (horizontal)', 'Right-to-left (horizontal)',
+ 'Right-to-left (vertical)', 'Left-to-right (vertical)']
+
+ with self.ui_test.create_doc_in_start_center("writer") as document:
+
+ for i in range(4):
+ with self.subTest(i=i):
+ with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as xDialog:
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "1")
+
+ xTextDirectionList = xDialog.getChild("comboTextFlowBox")
+ select_pos(xTextDirectionList, str(i))
+
+ self.assertEqual(
+ get_state_as_dict(xTextDirectionList)["SelectEntryText"], lTextDirection[i])
+
+ self.assertEqual(
+ document.StyleFamilies.PageStyles.Standard.WritingMode, i)
+
+
+ def test_cancel_button_page_dialog(self):
+ with self.ui_test.create_doc_in_start_center("writer"):
+
+ with self.ui_test.execute_dialog_through_command(".uno:PageDialog", close_button="cancel") as xDialog:
+ pass
+
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests3/sort.py b/sw/qa/uitest/writer_tests3/sort.py
new file mode 100644
index 000000000..aafe7a00c
--- /dev/null
+++ b/sw/qa/uitest/writer_tests3/sort.py
@@ -0,0 +1,61 @@
+# -*- 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 select_by_text
+from uitest.uihelper.common import type_text
+
+class WriterSort(UITestCase):
+
+ def test_sort(self):
+ with self.ui_test.create_doc_in_start_center("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+
+ type_text(xWriterEdit, "a")
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
+ type_text(xWriterEdit, "c")
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
+ type_text(xWriterEdit, "v")
+
+ self.xUITest.executeCommand(".uno:SelectAll") #select whole text
+ #Tools - Sort
+ with self.ui_test.execute_dialog_through_command(".uno:SortDialog") as xDialog:
+ xDown = xDialog.getChild("down1")
+ xDown.executeAction("CLICK", tuple())
+ #check
+ self.assertEqual(document.Text.String[0:1], "v")
+
+
+ def test_sort_numerical(self):
+ with self.ui_test.create_doc_in_start_center("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+
+ type_text(xWriterEdit, "1;2;3")
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
+ type_text(xWriterEdit, "2;8;3")
+
+ self.xUITest.executeCommand(".uno:SelectAll") #select whole text
+ #Tools - Sort
+ with self.ui_test.execute_dialog_through_command(".uno:SortDialog") as xDialog:
+ xDown = xDialog.getChild("down1")
+ xcolsb1 = xDialog.getChild("colsb1")
+ xtypelb1 = xDialog.getChild("typelb1")
+ xcharacter = xDialog.getChild("character")
+ xseparator = xDialog.getChild("separator")
+ xDown.executeAction("CLICK", tuple())
+ select_by_text(xtypelb1, "Numerical")
+ xcharacter.executeAction("CLICK", tuple())
+ xseparator.executeAction("TYPE", mkPropertyValues({"TEXT":";"}))
+ #check
+ self.assertEqual(document.Text.String[0:5], "2;8;3")
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests3/specialCharacter.py b/sw/qa/uitest/writer_tests3/specialCharacter.py
new file mode 100644
index 000000000..c9e4299f2
--- /dev/null
+++ b/sw/qa/uitest/writer_tests3/specialCharacter.py
@@ -0,0 +1,100 @@
+# -*- 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
+from uitest.uihelper.common import select_pos
+
+# specialcharacters.ui
+class specialCharacter(UITestCase):
+
+ def test_tdf56363(self):
+ with self.ui_test.create_doc_in_start_center("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ # Insert a font including a font feature into the font name combobox
+ xFontName = xWriterDoc.getChild("fontnamecombobox")
+ fontName = get_state_as_dict(xFontName)["Text"]
+ xFontName.executeAction("TYPE", mkPropertyValues({"KEYCODE": "CTRL+A"}))
+ xFontName.executeAction("TYPE", mkPropertyValues({"TEXT": fontName + ":smcp"}))
+ xFontName.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
+
+ # Open special character dialog and check selected font name
+ with self.ui_test.execute_dialog_through_command(".uno:InsertSymbol", close_button="cancel") as xDialog:
+ xComboFont = xDialog.getChild("fontlb")
+ # Without the fix in place, no font would be selected
+ self.assertEqual(get_state_as_dict(xComboFont)["Text"], fontName)
+
+ def test_special_character(self):
+ with self.ui_test.create_doc_in_start_center("writer") as document:
+
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+
+ with self.ui_test.execute_dialog_through_command(".uno:InsertSymbol", close_button="cancel") as xDialog:
+ xCharSet = xDialog.getChild("showcharset") # default charset
+
+ xCharSet.executeAction("SELECT", mkPropertyValues({"COLUMN": "1", "ROW": "4"})) # digit 4 selected
+
+ xHexText = xDialog.getChild("hexvalue")
+ xDecText = xDialog.getChild("decimalvalue")
+
+ self.assertEqual(get_state_as_dict(xHexText)["Text"], "34") # check the values Hex and decimal
+ self.assertEqual(get_state_as_dict(xDecText)["Text"], "52")
+
+
+ with self.ui_test.execute_dialog_through_command(".uno:InsertSymbol", close_button="cancel") as xDialog:
+
+ xComboFont = xDialog.getChild("fontlb")
+ select_pos(xComboFont, "0") # select font
+ xComboFont2 = xDialog.getChild("subsetlb")
+ select_pos(xComboFont2, "0") # select font subset
+
+ xSearchText = xDialog.getChild("search") # test search textBox
+ xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT": "d"}))
+ xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT": "i"}))
+ xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT": "g"}))
+ xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT": "i"}))
+ xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT": "t"}))
+ xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT": " "}))
+ xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT": "f"}))
+ xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT": "o"}))
+ xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT": "u"}))
+ xSearchText.executeAction("TYPE", mkPropertyValues({"TEXT": "r"}))
+
+ # works locally and linux_gcc_release_64, but fails at linux_clang_dbgutil_64.
+ # Markus: Actually after a round of debugging I think the problem is actually that the test depends on the used font.
+ # Therefore, if the font is not available or not selected by default the test fails.
+ # xCharSet = xDialog.getChild("searchcharset") #another charset -> search charset
+ # xCharSet.executeAction("SELECT", mkPropertyValues({"COLUMN": "0", "ROW": "0"})) #digit 4 selected, we have only one result;
+ # sleep(1) #try sleep here
+ # xCharSet.executeAction("SELECT", mkPropertyValues({"COLUMN": "0", "ROW": "0"})) #try it twice, because it works at local,but fail on gerrit
+ ##gerrit:self.assertEqual(get_state_as_dict(xHexText)["Text"], "34") # check the values for digit 4; AssertionError: '1' != '34'
+
+ # xHexText = xDialog.getChild("hexvalue")
+ # xDecText = xDialog.getChild("decimalvalue")
+ # self.assertEqual(get_state_as_dict(xHexText)["Text"], "34") # check the values for digit 4
+ # self.assertEqual(get_state_as_dict(xDecText)["Text"], "52")
+
+ # xAddFavBtn = xDialog.getChild("favbtn")
+ # xAddFavBtn.executeAction("CLICK", tuple()) # Add to favorites button
+
+ # xInsrBtn = xDialog.getChild("insert")
+ # xInsrBtn.executeAction("CLICK", tuple()) # Insert to document
+
+ # self.assertEqual(document.Text.String[0:1], "4") # check inserted character
+
+ # self.xUITest.executeCommand(".uno:Undo")
+ # self.xUITest.executeCommand(".uno:Redo") #undo, redo
+
+ # self.assertEqual(document.Text.String[0:1], "4") # check inserted character after undo, redo
+
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests3/tdf79236.py b/sw/qa/uitest/writer_tests3/tdf79236.py
new file mode 100644
index 000000000..c8e857188
--- /dev/null
+++ b/sw/qa/uitest/writer_tests3/tdf79236.py
@@ -0,0 +1,118 @@
+# -*- 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 type_text
+
+class tdf79236(UITestCase):
+
+ def test_paragraph(self):
+
+ with self.ui_test.create_doc_in_start_center("writer") as document:
+
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+
+ type_text(xWriterEdit, "Test for tdf79236")
+
+
+ self.xUITest.executeCommand(".uno:SelectAll")
+
+ self.assertEqual(document.CurrentSelection.getByIndex(0).ParaLeftMargin, 0)
+ self.assertEqual(document.CurrentSelection.getByIndex(0).ParaRightMargin, 0)
+ self.assertEqual(document.CurrentSelection.getByIndex(0).ParaTopMargin, 0)
+ self.assertEqual(document.CurrentSelection.getByIndex(0).ParaBottomMargin, 0)
+ self.assertEqual(document.CurrentSelection.getByIndex(0).ParaFirstLineIndent, 0)
+
+ self.assertEqual(document.CurrentSelection.getByIndex(0).String, "Test for tdf79236")
+
+ with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") as xParagraphDlg:
+
+
+
+ xLeftSpnBtn = xParagraphDlg.getChild("spinED_LEFTINDENT")
+ for _ in range(0,20):
+ xLeftSpnBtn.executeAction("UP", tuple())
+
+ xRightSpnBtn = xParagraphDlg.getChild("spinED_RIGHTINDENT")
+ for _ in range(0,20):
+ xRightSpnBtn.executeAction("UP", tuple())
+
+
+ xLineSpnBtn = xParagraphDlg.getChild("spinED_FLINEINDENT")
+ for _ in range(0,20):
+ xLineSpnBtn.executeAction("UP", tuple())
+
+
+ xBottomSpnBtn = xParagraphDlg.getChild("spinED_BOTTOMDIST")
+ for _ in range(0,20):
+ xBottomSpnBtn.executeAction("UP", tuple())
+
+ xTopSpnBtn = xParagraphDlg.getChild("spinED_TOPDIST")
+ for _ in range(0,20):
+ xTopSpnBtn.executeAction("UP", tuple())
+
+
+ self.assertEqual(document.CurrentSelection.getByIndex(0).ParaLeftMargin, 3704)
+ self.assertEqual(document.CurrentSelection.getByIndex(0).ParaRightMargin, 3704)
+ self.assertEqual(document.CurrentSelection.getByIndex(0).ParaTopMargin, 5503)
+ self.assertEqual(document.CurrentSelection.getByIndex(0).ParaBottomMargin, 5503)
+ self.assertEqual(document.CurrentSelection.getByIndex(0).ParaFirstLineIndent, 3704)
+
+ with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") as xParagraphDlg:
+
+
+ xLeftSpnBtn = xParagraphDlg.getChild("spinED_LEFTINDENT")
+ for _ in range(0,20):
+ xLeftSpnBtn.executeAction("DOWN", tuple())
+
+ xRightSpnBtn = xParagraphDlg.getChild("spinED_RIGHTINDENT")
+ for _ in range(0,20):
+ xRightSpnBtn.executeAction("DOWN", tuple())
+
+
+ xLineSpnBtn = xParagraphDlg.getChild("spinED_FLINEINDENT")
+ for _ in range(0,20):
+ xLineSpnBtn.executeAction("DOWN", tuple())
+
+ xBottomSpnBtn = xParagraphDlg.getChild("spinED_BOTTOMDIST")
+ for _ in range(0,20):
+ xBottomSpnBtn.executeAction("DOWN", tuple())
+
+ xTopSpnBtn = xParagraphDlg.getChild("spinED_TOPDIST")
+ for _ in range(0,20):
+ xTopSpnBtn.executeAction("DOWN", tuple())
+
+
+ self.assertEqual(document.CurrentSelection.getByIndex(0).ParaLeftMargin, 0)
+ self.assertEqual(document.CurrentSelection.getByIndex(0).ParaRightMargin, 0)
+ self.assertEqual(document.CurrentSelection.getByIndex(0).ParaTopMargin, 0)
+ self.assertEqual(document.CurrentSelection.getByIndex(0).ParaBottomMargin, 0)
+ self.assertEqual(document.CurrentSelection.getByIndex(0).ParaFirstLineIndent, 0)
+
+ self.xUITest.executeCommand(".uno:Undo")
+
+ self.assertEqual(document.CurrentSelection.getByIndex(0).ParaLeftMargin, 3704)
+ self.assertEqual(document.CurrentSelection.getByIndex(0).ParaRightMargin, 3704)
+ self.assertEqual(document.CurrentSelection.getByIndex(0).ParaTopMargin, 5503)
+ self.assertEqual(document.CurrentSelection.getByIndex(0).ParaBottomMargin, 5503)
+ self.assertEqual(document.CurrentSelection.getByIndex(0).ParaFirstLineIndent, 3704)
+
+ self.xUITest.executeCommand(".uno:Undo")
+
+ self.assertEqual(document.CurrentSelection.getByIndex(0).ParaLeftMargin, 0)
+ self.assertEqual(document.CurrentSelection.getByIndex(0).ParaRightMargin, 0)
+ self.assertEqual(document.CurrentSelection.getByIndex(0).ParaTopMargin, 0)
+ self.assertEqual(document.CurrentSelection.getByIndex(0).ParaBottomMargin, 0)
+ self.assertEqual(document.CurrentSelection.getByIndex(0).ParaFirstLineIndent, 0)
+
+ self.assertEqual(document.CurrentSelection.getByIndex(0).String, "Test for tdf79236")
+
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab: