summaryrefslogtreecommitdiffstats
path: root/sw/qa/uitest/writer_tests
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--sw/qa/uitest/writer_tests/comments.py153
-rw-r--r--sw/qa/uitest/writer_tests/compareDocuments.py70
-rw-r--r--sw/qa/uitest/writer_tests/insertCaption.py62
-rw-r--r--sw/qa/uitest/writer_tests/tdf134734.py83
-rw-r--r--sw/qa/uitest/writer_tests/tdf137459_editeng_ctrl-DEL.py34
-rw-r--r--sw/qa/uitest/writer_tests/tdf78068.py30
-rw-r--r--sw/qa/uitest/writer_tests/tdf81457.py41
-rw-r--r--sw/qa/uitest/writer_tests/trackedChanges.py471
-rw-r--r--sw/qa/uitest/writer_tests/versionDialog.py36
-rw-r--r--sw/qa/uitest/writer_tests/watermark.py52
-rw-r--r--sw/qa/uitest/writer_tests/wordCount.py282
-rw-r--r--sw/qa/uitest/writer_tests2/asianPhoneticGuide.py38
-rw-r--r--sw/qa/uitest/writer_tests2/bookmark.py94
-rw-r--r--sw/qa/uitest/writer_tests2/deleteAllComments.py50
-rw-r--r--sw/qa/uitest/writer_tests2/deleteFootnotes.py46
-rw-r--r--sw/qa/uitest/writer_tests2/documentProperties.py123
-rw-r--r--sw/qa/uitest/writer_tests2/exchangeDatabase.py45
-rw-r--r--sw/qa/uitest/writer_tests2/fontworks.py38
-rw-r--r--sw/qa/uitest/writer_tests2/formatBulletsNumbering.py270
-rw-r--r--sw/qa/uitest/writer_tests2/formatCharacter.py246
-rw-r--r--sw/qa/uitest/writer_tests2/formatParagraph.py541
-rw-r--r--sw/qa/uitest/writer_tests2/horizontalLine.py35
-rw-r--r--sw/qa/uitest/writer_tests2/insertFootnote.py36
-rw-r--r--sw/qa/uitest/writer_tests2/pasteSpecial.py39
-rw-r--r--sw/qa/uitest/writer_tests2/tdf116474.py47
-rw-r--r--sw/qa/uitest/writer_tests2/tdf146375.py76
-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
-rw-r--r--sw/qa/uitest/writer_tests4/exportToPDF.py76
-rw-r--r--sw/qa/uitest/writer_tests4/insertBreakDialog.py70
-rw-r--r--sw/qa/uitest/writer_tests4/insertPageHeader.py78
-rw-r--r--sw/qa/uitest/writer_tests4/spellDialog.py141
-rw-r--r--sw/qa/uitest/writer_tests4/start.py49
-rw-r--r--sw/qa/uitest/writer_tests4/tdf113252.py37
-rw-r--r--sw/qa/uitest/writer_tests4/tdf113284.py40
-rw-r--r--sw/qa/uitest/writer_tests4/tdf122449.py43
-rw-r--r--sw/qa/uitest/writer_tests4/tdf134439.py54
-rw-r--r--sw/qa/uitest/writer_tests4/tdf135636.py40
-rw-r--r--sw/qa/uitest/writer_tests4/tdf136578.py31
-rw-r--r--sw/qa/uitest/writer_tests4/tdf138546.py38
-rw-r--r--sw/qa/uitest/writer_tests4/tdf148395.py47
-rw-r--r--sw/qa/uitest/writer_tests4/tdf92611.py23
-rw-r--r--sw/qa/uitest/writer_tests5/DateFormFieldPropertiesDialog.py133
-rw-r--r--sw/qa/uitest/writer_tests5/DropDownFormFieldPropertiesDialog.py238
-rw-r--r--sw/qa/uitest/writer_tests5/about_test.py22
-rw-r--r--sw/qa/uitest/writer_tests5/autocorrectOptions.py98
-rw-r--r--sw/qa/uitest/writer_tests5/columns.py48
-rw-r--r--sw/qa/uitest/writer_tests5/tdf106899.py43
-rw-r--r--sw/qa/uitest/writer_tests5/tdf117039.py26
-rw-r--r--sw/qa/uitest/writer_tests5/tdf118540.py28
-rw-r--r--sw/qa/uitest/writer_tests5/tdf122045.py39
-rw-r--r--sw/qa/uitest/writer_tests5/tdf122722.py67
-rw-r--r--sw/qa/uitest/writer_tests5/tdf123378.py28
-rw-r--r--sw/qa/uitest/writer_tests5/tdf123446.py42
-rw-r--r--sw/qa/uitest/writer_tests5/tdf138531.py67
-rw-r--r--sw/qa/uitest/writer_tests5/tdf142847.py49
-rw-r--r--sw/qa/uitest/writer_tests5/tdf145326.py86
-rw-r--r--sw/qa/uitest/writer_tests5/tdf147935.py43
-rw-r--r--sw/qa/uitest/writer_tests5/tdf148920.py33
-rw-r--r--sw/qa/uitest/writer_tests5/titlePage.py31
-rw-r--r--sw/qa/uitest/writer_tests5/titlePageWizard.py195
-rw-r--r--sw/qa/uitest/writer_tests5/titlePageWizard2.py124
-rw-r--r--sw/qa/uitest/writer_tests5/xwindow.py176
-rw-r--r--sw/qa/uitest/writer_tests5/zoom.py86
-rw-r--r--sw/qa/uitest/writer_tests6/edit_file_properties_before_saving.py106
-rw-r--r--sw/qa/uitest/writer_tests6/infobar.py61
-rw-r--r--sw/qa/uitest/writer_tests6/save_readonly_with_password.py105
-rw-r--r--sw/qa/uitest/writer_tests6/tdf107847.py34
-rw-r--r--sw/qa/uitest/writer_tests6/tdf118883.py34
-rw-r--r--sw/qa/uitest/writer_tests6/tdf120731.py23
-rw-r--r--sw/qa/uitest/writer_tests6/tdf124586.py30
-rw-r--r--sw/qa/uitest/writer_tests6/tdf124675.py36
-rw-r--r--sw/qa/uitest/writer_tests6/tdf125104.py63
-rw-r--r--sw/qa/uitest/writer_tests6/tdf126017.py42
-rw-r--r--sw/qa/uitest/writer_tests6/tdf126168.py44
-rw-r--r--sw/qa/uitest/writer_tests6/tdf126226.py28
-rw-r--r--sw/qa/uitest/writer_tests6/tdf128431.py41
-rw-r--r--sw/qa/uitest/writer_tests6/tdf131041.py44
-rw-r--r--sw/qa/uitest/writer_tests6/tdf141957.py37
-rw-r--r--sw/qa/uitest/writer_tests6/tdf144691.py46
-rw-r--r--sw/qa/uitest/writer_tests6/tdf89383.py30
-rw-r--r--sw/qa/uitest/writer_tests7/apply_line_cap.py93
-rw-r--r--sw/qa/uitest/writer_tests7/forms.py205
-rw-r--r--sw/qa/uitest/writer_tests7/tdf104795.py26
-rw-r--r--sw/qa/uitest/writer_tests7/tdf115853.py40
-rw-r--r--sw/qa/uitest/writer_tests7/tdf119661.py81
-rw-r--r--sw/qa/uitest/writer_tests7/tdf122780.py23
-rw-r--r--sw/qa/uitest/writer_tests7/tdf128744.py71
-rw-r--r--sw/qa/uitest/writer_tests7/tdf131936.py24
-rw-r--r--sw/qa/uitest/writer_tests7/tdf132169.py43
-rw-r--r--sw/qa/uitest/writer_tests7/tdf132714.py23
-rw-r--r--sw/qa/uitest/writer_tests7/tdf133348.py58
-rw-r--r--sw/qa/uitest/writer_tests7/tdf134243.py21
-rw-r--r--sw/qa/uitest/writer_tests7/tdf134452.py51
-rw-r--r--sw/qa/uitest/writer_tests7/tdf135413.py25
-rwxr-xr-xsw/qa/uitest/writer_tests7/tdf135938.py51
-rw-r--r--sw/qa/uitest/writer_tests7/tdf137802.py77
-rw-r--r--sw/qa/uitest/writer_tests7/tdf137803.py49
-rw-r--r--sw/qa/uitest/writer_tests7/tdf139301.py60
-rw-r--r--sw/qa/uitest/writer_tests7/tdf140117.py59
-rw-r--r--sw/qa/uitest/writer_tests7/tdf140863.py60
-rw-r--r--sw/qa/uitest/writer_tests7/tdf141158.py41
-rw-r--r--sw/qa/uitest/writer_tests7/tdf141557.py37
-rw-r--r--sw/qa/uitest/writer_tests7/tdf143574.py40
-rw-r--r--sw/qa/uitest/writer_tests7/tdf143785.py43
-rw-r--r--sw/qa/uitest/writer_tests7/tdf144439.py94
-rw-r--r--sw/qa/uitest/writer_tests7/tdf144578.py68
-rw-r--r--sw/qa/uitest/writer_tests7/tdf145093.py36
-rw-r--r--sw/qa/uitest/writer_tests7/tdf145158.py38
-rw-r--r--sw/qa/uitest/writer_tests7/tdf145178.py79
-rw-r--r--sw/qa/uitest/writer_tests7/tdf146605.py63
-rw-r--r--sw/qa/uitest/writer_tests7/tdf150443.py46
-rw-r--r--sw/qa/uitest/writer_tests7/tdf152964.py50
-rw-r--r--sw/qa/uitest/writer_tests7/tdf46561.py97
-rw-r--r--sw/qa/uitest/writer_tests7/tdf90401.py165
128 files changed, 9646 insertions, 0 deletions
diff --git a/sw/qa/uitest/writer_tests/comments.py b/sw/qa/uitest/writer_tests/comments.py
new file mode 100644
index 000000000..3e9d3a630
--- /dev/null
+++ b/sw/qa/uitest/writer_tests/comments.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 libreoffice.uno.propertyvalue import mkPropertyValues
+#test comments
+
+class Comments(UITestCase):
+
+ def test_comments_features(self):
+
+ with self.ui_test.create_doc_in_start_center("writer"):
+
+ xMainWindow = self.xUITest.getTopFocusWindow()
+
+ xwriter_edit = xMainWindow.getChild("writer_edit")
+ xwriter_edit.executeAction("TYPE", mkPropertyValues({"TEXT": "Before "}))
+
+ # adding new Comment
+ self.xUITest.executeCommand(".uno:InsertAnnotation")
+
+ # wait until the comment is available
+ xComment1 = self.ui_test.wait_until_child_is_available('Comment1')
+
+ xEditView1 = xComment1.getChild("editview")
+ xEditView1.executeAction("TYPE", mkPropertyValues({"TEXT": "This is the First Comment"}))
+ self.assertEqual(get_state_as_dict(xComment1)["Text"], "This is the First Comment" )
+ self.assertEqual(get_state_as_dict(xComment1)["Resolved"], "false" )
+ self.assertEqual(get_state_as_dict(xComment1)["Author"], "Unknown Author" )
+ self.assertEqual(get_state_as_dict(xComment1)["ReadOnly"], "false" )
+
+ xComment1.executeAction("LEAVE", mkPropertyValues({}))
+
+ xwriter_edit.executeAction("TYPE", mkPropertyValues({"TEXT": "After"}))
+ xwriter_edit.executeAction("SELECT", mkPropertyValues({"END_POS": "0", "START_POS": "13"}))
+ self.assertEqual(get_state_as_dict(xwriter_edit)["SelectedText"], "Before After" )
+
+ # test Resolve Comment
+ xComment1.executeAction("RESOLVE", mkPropertyValues({}))
+ self.assertEqual(get_state_as_dict(xComment1)["Resolved"], "true" )
+
+ # test Select text from Comment
+ xComment1.executeAction("SELECT", mkPropertyValues({"FROM": "0", "TO": "4"}))
+ self.assertEqual(get_state_as_dict(xComment1)["SelectedText"], "This" )
+
+ # test Hide then Show Comment
+ xComment1.executeAction("HIDE", mkPropertyValues({}))
+ self.assertEqual(get_state_as_dict(xComment1)["Visible"], "false" )
+ xComment1.executeAction("SHOW", mkPropertyValues({}))
+ self.assertEqual(get_state_as_dict(xComment1)["Visible"], "true" )
+
+ # test delete Comment
+ xComment1.executeAction("DELETE", mkPropertyValues({}))
+ self.assertTrue("Comment1" not in xMainWindow.getChildren())
+
+
+ def test_multi_comments(self):
+
+ with self.ui_test.create_doc_in_start_center("writer"):
+
+ xMainWindow = self.xUITest.getTopFocusWindow()
+
+ xwriter_edit = xMainWindow.getChild("writer_edit")
+
+ # adding 3 new Comment
+ xwriter_edit.executeAction("TYPE", mkPropertyValues({"TEXT": "Line 1"}))
+ self.xUITest.executeCommand(".uno:InsertAnnotation")
+ # wait until the comment is available
+ xComment1 = self.ui_test.wait_until_child_is_available('Comment1')
+ xEditView1 = xComment1.getChild("editview")
+ xEditView1.executeAction("TYPE", mkPropertyValues({"TEXT": "First Comment"}))
+ xComment1.executeAction("LEAVE", mkPropertyValues({}))
+ xwriter_edit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
+
+ xwriter_edit.executeAction("TYPE", mkPropertyValues({"TEXT": "Line 2"}))
+ self.xUITest.executeCommand(".uno:InsertAnnotation")
+ # wait until the comment is available
+ xComment2 = self.ui_test.wait_until_child_is_available('Comment2')
+ xEditView2 = xComment2.getChild("editview")
+ xEditView2.executeAction("TYPE", mkPropertyValues({"TEXT": "Second Comment"}))
+ xComment2.executeAction("LEAVE", mkPropertyValues({}))
+ xwriter_edit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
+
+ xwriter_edit.executeAction("TYPE", mkPropertyValues({"TEXT": "Line 3"}))
+ self.xUITest.executeCommand(".uno:InsertAnnotation")
+ # wait until the comment is available
+ xComment3 = self.ui_test.wait_until_child_is_available('Comment3')
+ xEditView3 = xComment3.getChild("editview")
+ xEditView3.executeAction("TYPE", mkPropertyValues({"TEXT": "Third Comment"}))
+ xComment3.executeAction("LEAVE", mkPropertyValues({}))
+ xwriter_edit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
+
+ # Check text
+ self.assertEqual(get_state_as_dict(xComment1)["Text"], "First Comment" )
+ self.assertEqual(get_state_as_dict(xComment2)["Text"], "Second Comment" )
+ self.assertEqual(get_state_as_dict(xComment3)["Text"], "Third Comment" )
+
+ xComment2.executeAction("RESOLVE", mkPropertyValues({}))
+ xComment3.executeAction("RESOLVE", mkPropertyValues({}))
+
+ # Check Resolved
+ self.assertEqual(get_state_as_dict(xComment1)["Resolved"], "false" )
+ self.assertEqual(get_state_as_dict(xComment2)["Resolved"], "true" )
+ self.assertEqual(get_state_as_dict(xComment3)["Resolved"], "true" )
+
+ # Check ReadOnly
+ self.assertEqual(get_state_as_dict(xComment1)["ReadOnly"], "false" )
+ self.assertEqual(get_state_as_dict(xComment2)["ReadOnly"], "false" )
+ self.assertEqual(get_state_as_dict(xComment3)["ReadOnly"], "false" )
+
+ # Check Select
+ xComment1.executeAction("SELECT", mkPropertyValues({"FROM": "0", "TO": "5"}))
+ self.assertEqual(get_state_as_dict(xComment1)["SelectedText"], "First" )
+
+ xComment2.executeAction("SELECT", mkPropertyValues({"FROM": "0", "TO": "6"}))
+ self.assertEqual(get_state_as_dict(xComment2)["SelectedText"], "Second" )
+
+ xComment3.executeAction("SELECT", mkPropertyValues({"FROM": "0", "TO": "5"}))
+ self.assertEqual(get_state_as_dict(xComment3)["SelectedText"], "Third" )
+
+ # Check that they all are Visible
+ self.assertEqual(get_state_as_dict(xComment1)["Visible"], "true" )
+ self.assertEqual(get_state_as_dict(xComment2)["Visible"], "true" )
+ self.assertEqual(get_state_as_dict(xComment3)["Visible"], "true" )
+
+ # Hide all
+ xComment1.executeAction("HIDE", mkPropertyValues({}))
+ self.assertEqual(get_state_as_dict(xComment1)["Visible"], "false" )
+ xComment2.executeAction("HIDE", mkPropertyValues({}))
+ self.assertEqual(get_state_as_dict(xComment2)["Visible"], "false" )
+ xComment3.executeAction("HIDE", mkPropertyValues({}))
+ self.assertEqual(get_state_as_dict(xComment3)["Visible"], "false" )
+
+ # Show comment 2 only
+ xComment2.executeAction("SHOW", mkPropertyValues({}))
+ self.assertEqual(get_state_as_dict(xComment2)["Visible"], "true" )
+
+ # Then remove the 3 comments
+ xComment1.executeAction("DELETE", mkPropertyValues({}))
+ xComment2.executeAction("DELETE", mkPropertyValues({}))
+ xComment3.executeAction("DELETE", mkPropertyValues({}))
+ self.assertTrue("Comment1" not in xMainWindow.getChildren())
+ self.assertTrue("Comment2" not in xMainWindow.getChildren())
+ self.assertTrue("Comment3" not in xMainWindow.getChildren())
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests/compareDocuments.py b/sw/qa/uitest/writer_tests/compareDocuments.py
new file mode 100644
index 000000000..55cbdd047
--- /dev/null
+++ b/sw/qa/uitest/writer_tests/compareDocuments.py
@@ -0,0 +1,70 @@
+# -*- 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, get_url_for_data_file
+from libreoffice.uno.propertyvalue import mkPropertyValues
+import datetime
+
+class compareDocuments(UITestCase):
+
+ def test_tdf130960(self):
+
+ with self.ui_test.load_file(get_url_for_data_file("tdf130960.odt")) as writer_doc:
+
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ with self.ui_test.execute_dialog_through_command(".uno:CompareDocuments", close_button="") as xOpenDialog:
+ xFileName = xOpenDialog.getChild("file_name")
+ xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": get_url_for_data_file("tdf130960_2.odt")}))
+ xOpenBtn = xOpenDialog.getChild("open")
+
+ # Close the dialog and open it again so the list of changes is updated
+ with self.ui_test.execute_dialog_through_action(xOpenBtn, 'CLICK', close_button="close"):
+ pass
+
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges", close_button="close") as xTrackDlg:
+ changesList = xTrackDlg.getChild("writerchanges")
+
+ text = "Unknown Author\t" + datetime.datetime.now().strftime("%m/%d/%Y")
+ self.assertEqual(2, len(changesList.getChildren()))
+ self.assertTrue(get_state_as_dict(changesList.getChild('0'))["Text"].startswith(text))
+ self.assertTrue(get_state_as_dict(changesList.getChild('1'))["Text"].startswith(text))
+
+
+ def test_tdf137855(self):
+
+ with self.ui_test.load_file(get_url_for_data_file("tdf137855.odt")) as writer_doc:
+
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ with self.ui_test.execute_dialog_through_command(".uno:CompareDocuments", close_button="") as xOpenDialog:
+
+ xFileName = xOpenDialog.getChild("file_name")
+ xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": get_url_for_data_file("tdf137855_2.odt")}))
+ xOpenBtn = xOpenDialog.getChild("open")
+
+ # Close the dialog and open it again so the list of changes is updated
+ with self.ui_test.execute_dialog_through_action(xOpenBtn, 'CLICK', close_button="close"):
+ pass
+
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges", close_button="close") as xTrackDlg:
+ changesList = xTrackDlg.getChild("writerchanges")
+
+ # Check the number of changes
+ self.assertEqual(263, len(changesList.getChildren()))
+
+ # Without the fix in place, this test would have crashed here
+ xAccBtn = xTrackDlg.getChild("acceptall")
+ xAccBtn.executeAction("CLICK", tuple())
+
+ self.assertEqual(0, len(changesList.getChildren()))
+
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests/insertCaption.py b/sw/qa/uitest/writer_tests/insertCaption.py
new file mode 100644
index 000000000..5831f3cf3
--- /dev/null
+++ b/sw/qa/uitest/writer_tests/insertCaption.py
@@ -0,0 +1,62 @@
+# -*- 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_pos
+
+class insertCaption(UITestCase):
+
+ def test_insert_caption(self):
+ with self.ui_test.create_doc_in_start_center("writer") as document:
+ with self.ui_test.execute_dialog_through_command(".uno:InsertFrame") as xDialogFr:
+
+ xWidth = xDialogFr.getChild("width")
+ xWidth.executeAction("UP", tuple())
+ xWidth.executeAction("UP", tuple())
+
+ xHeight = xDialogFr.getChild("height")
+ xHeight.executeAction("UP", tuple())
+ xHeight.executeAction("UP", tuple())
+
+
+ self.assertEqual(document.TextFrames.getCount(), 1)
+
+ with self.ui_test.execute_dialog_through_command(".uno:InsertCaptionDialog") as xDialogCaption:
+
+ xCapt = xDialogCaption.getChild("caption_edit")
+ xCapt.executeAction("TYPE", mkPropertyValues({"TEXT":"Caption"}))
+
+
+ xFrame = document.TextFrames[0]
+
+ self.assertEqual(document.TextFrames[0].Text.String.replace('\r\n', '\n'), "\nText 1: Caption")
+
+ with self.ui_test.execute_dialog_through_command(".uno:InsertCaptionDialog") as xDialogCaption:
+ xCapt = xDialogCaption.getChild("caption_edit")
+ xCapt.executeAction("TYPE", mkPropertyValues({"TEXT":"Caption2"}))
+ xSep = xDialogCaption.getChild("separator_edit")
+ xSep.executeAction("TYPE", mkPropertyValues({"TEXT":"-"}))
+
+
+ self.assertEqual(document.TextFrames[0].Text.String.replace('\r\n', '\n'), "\nText 1: Caption\nText 2-: Caption2")
+
+ with self.ui_test.execute_dialog_through_command(".uno:InsertCaptionDialog") as xDialogCaption:
+ xCapt = xDialogCaption.getChild("caption_edit")
+ xCapt.executeAction("TYPE", mkPropertyValues({"TEXT":"Caption3"}))
+ xSep = xDialogCaption.getChild("separator_edit")
+ xSep.executeAction("TYPE", mkPropertyValues({"TEXT":"-"}))
+ xPos = xDialogCaption.getChild("position")
+ select_pos(xPos, "1")
+
+
+ self.assertEqual(document.TextFrames[0].Text.String.replace('\r\n', '\n'), "\nText 1: Caption\nText 2-: Caption2\nText 3--: Caption3")
+
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests/tdf134734.py b/sw/qa/uitest/writer_tests/tdf134734.py
new file mode 100644
index 000000000..4497649f6
--- /dev/null
+++ b/sw/qa/uitest/writer_tests/tdf134734.py
@@ -0,0 +1,83 @@
+# -*- 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_pos
+from com.sun.star.drawing.FillStyle import SOLID
+import importlib
+
+class TestClass(UITestCase):
+ def test_master_page_background(self):
+ with self.ui_test.create_doc_in_start_center("writer") as document:
+
+ # set margins and fill color
+ with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as DrawPageDialog:
+ xTabs = DrawPageDialog.getChild("tabcontrol")
+ select_pos(xTabs, "1")
+ checkBackgroundFullSize = DrawPageDialog.getChild("checkBackgroundFullSize")
+ self.assertEqual(get_state_as_dict(checkBackgroundFullSize)["Selected"], "true")
+ spinMargLeft = DrawPageDialog.getChild("spinMargLeft")
+ for _ in range(20):
+ spinMargLeft.executeAction("UP",tuple())
+ spinMargRight = DrawPageDialog.getChild("spinMargRight")
+ for _ in range(15):
+ spinMargRight.executeAction("UP",tuple())
+ spinMargTop = DrawPageDialog.getChild("spinMargTop")
+ for _ in range(10):
+ spinMargTop.executeAction("UP",tuple())
+ spinMargBot = DrawPageDialog.getChild("spinMargBot")
+ for _ in range(5):
+ spinMargBot.executeAction("UP",tuple())
+ xTabs = DrawPageDialog.getChild("tabcontrol")
+ select_pos(xTabs, "2")
+ btncolor = DrawPageDialog.getChild("btncolor")
+ btncolor.executeAction("CLICK",tuple())
+
+ xStyle = document.StyleFamilies["PageStyles"]["Standard"]
+
+ self.assertEqual(xStyle.FillStyle, SOLID)
+ self.assertEqual(xStyle.LeftMargin, 2997)
+ self.assertEqual(xStyle.RightMargin, 2743)
+ self.assertEqual(xStyle.TopMargin, 2489)
+ self.assertEqual(xStyle.BottomMargin, 2235)
+ self.assertEqual(xStyle.BackgroundFullSize, True)
+
+ # uncheck it
+ with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as DrawPageDialog:
+ xTabs = DrawPageDialog.getChild("tabcontrol")
+ select_pos(xTabs, "1")
+ checkBackgroundFullSize = DrawPageDialog.getChild("checkBackgroundFullSize")
+ self.assertEqual(get_state_as_dict(checkBackgroundFullSize)["Selected"], "true")
+ checkBackgroundFullSize.executeAction("CLICK",tuple())
+
+ self.assertEqual(xStyle.FillStyle, SOLID)
+ self.assertEqual(xStyle.LeftMargin, 2997)
+ self.assertEqual(xStyle.RightMargin, 2743)
+ self.assertEqual(xStyle.TopMargin, 2489)
+ self.assertEqual(xStyle.BottomMargin, 2235)
+ self.assertEqual(xStyle.BackgroundFullSize, False)
+
+ # check it again
+ with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as DrawPageDialog:
+ xTabs = DrawPageDialog.getChild("tabcontrol")
+ select_pos(xTabs, "1")
+ checkBackgroundFullSize = DrawPageDialog.getChild("checkBackgroundFullSize")
+ self.assertEqual(get_state_as_dict(checkBackgroundFullSize)["Selected"], "false")
+ checkBackgroundFullSize.executeAction("CLICK",tuple())
+
+ self.assertEqual(xStyle.FillStyle, SOLID)
+ self.assertEqual(xStyle.LeftMargin, 2997)
+ self.assertEqual(xStyle.RightMargin, 2743)
+ self.assertEqual(xStyle.TopMargin, 2489)
+ self.assertEqual(xStyle.BottomMargin, 2235)
+ self.assertEqual(xStyle.BackgroundFullSize, True)
+
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests/tdf137459_editeng_ctrl-DEL.py b/sw/qa/uitest/writer_tests/tdf137459_editeng_ctrl-DEL.py
new file mode 100644
index 000000000..c33890ca9
--- /dev/null
+++ b/sw/qa/uitest/writer_tests/tdf137459_editeng_ctrl-DEL.py
@@ -0,0 +1,34 @@
+# -*- 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 libreoffice.uno.propertyvalue import mkPropertyValues
+
+class tdf137459(UITestCase):
+
+ def test_tdf137459(self):
+
+ with self.ui_test.create_doc_in_start_center("writer"):
+
+ # adding new Comment
+ self.xUITest.executeCommand(".uno:InsertAnnotation")
+ # wait until the comment is available
+ xComment1 = self.ui_test.wait_until_child_is_available('Comment1')
+
+ xEditView1 = xComment1.getChild("editview")
+ sText = "Ctrl+Del should not delete BACKWARDS"
+ xEditView1.executeAction("TYPE", mkPropertyValues({"TEXT": sText}))
+ self.assertEqual(get_state_as_dict(xComment1)["Text"], sText )
+
+ xEditView1.executeAction("TYPE", mkPropertyValues({"KEYCODE": "CTRL+DELETE"}))
+ self.assertEqual(get_state_as_dict(xComment1)["Text"], sText )
+
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests/tdf78068.py b/sw/qa/uitest/writer_tests/tdf78068.py
new file mode 100644
index 000000000..9c03e76ee
--- /dev/null
+++ b/sw/qa/uitest/writer_tests/tdf78068.py
@@ -0,0 +1,30 @@
+# -*- 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
+
+from uitest.uihelper.common import select_pos
+
+class tdf78068(UITestCase):
+
+ def test_tdf78068_format_paragraph_crash(self):
+ with self.ui_test.create_doc_in_start_center("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+ #- add some text
+ type_text(xWriterEdit, "Test")
+ #- go to Format > Paragraph
+ with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "0")
+
+ self.assertEqual(document.Text.String[0:4], "Test")
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests/tdf81457.py b/sw/qa/uitest/writer_tests/tdf81457.py
new file mode 100644
index 000000000..ff021a4f7
--- /dev/null
+++ b/sw/qa/uitest/writer_tests/tdf81457.py
@@ -0,0 +1,41 @@
+# -*- 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, get_url_for_data_file
+from uitest.uihelper.common import select_pos
+
+class tdf81457(UITestCase):
+
+#tdf 81457
+ def test_open_documentProperties_tdf81457(self):
+ with self.ui_test.load_file(get_url_for_data_file("tdf81457.odt")) as writer_doc:
+ with self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "2") #tab Custom properties
+
+ # tdf#123919 - custom document properties are sorted now
+ aExpectedDocProp = {
+ 2: {'aAndra': 'Ja'},
+ 4: {'BookMarkCount': '78'},
+ 5: {'BookMarkInfo1': '00FF0000FF010'},
+ 6: {'BookMarkInfo2': '00FF0000FF030'}}
+
+ for pos, aDocProp in aExpectedDocProp.items():
+ xNameBox = xDialog.getChild("namebox" + str(pos))
+ xTypeBox = xDialog.getChild("typebox" + str(pos))
+ xValueEdit = xDialog.getChild("valueedit" + str(pos))
+ name, value = aDocProp.popitem()
+ self.assertEqual(name, get_state_as_dict(xNameBox)['Text'])
+ self.assertEqual('Text', get_state_as_dict(xTypeBox)['DisplayText'])
+ self.assertEqual(value, get_state_as_dict(xValueEdit)['Text'][:13])
+
+
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests/trackedChanges.py b/sw/qa/uitest/writer_tests/trackedChanges.py
new file mode 100644
index 000000000..04834aef0
--- /dev/null
+++ b/sw/qa/uitest/writer_tests/trackedChanges.py
@@ -0,0 +1,471 @@
+# -*- 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/.
+#
+
+# tests for tracked changes ; tdf912270
+from uitest.framework import UITestCase
+from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file, type_text, select_by_text
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from tempfile import TemporaryDirectory
+from org.libreoffice.unotest import systemPathToFileUrl
+import os.path
+
+class trackedchanges(UITestCase):
+
+ def test_tdf91270(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")
+
+ self.xUITest.executeCommand(".uno:TrackChanges")
+
+ self.xUITest.executeCommand(".uno:SelectAll") #select whole text
+ self.xUITest.executeCommand(".uno:Cut") #cut text
+
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges", close_button="close"):
+ pass
+
+ def test_tracked_changes_accept(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:TrackChanges")
+ type_text(xWriterEdit, "Test LibreOffice")
+ self.xUITest.executeCommand(".uno:ShowTrackedChanges")
+
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges", close_button="close") as xTrackDlg:
+ xAccBtn = xTrackDlg.getChild("accept")
+ xAccBtn.executeAction("CLICK", tuple())
+
+ self.assertEqual(document.Text.String[0:16], "Test LibreOffice")
+
+ def test_tracked_changes_acceptall(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:TrackChanges")
+ type_text(xWriterEdit, "Test LibreOffice")
+ self.xUITest.executeCommand(".uno:ShowTrackedChanges")
+
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges", close_button="close") as xTrackDlg:
+
+ xAccBtn = xTrackDlg.getChild("acceptall")
+ xAccBtn.executeAction("CLICK", tuple())
+
+
+ self.assertEqual(document.Text.String[0:16], "Test LibreOffice")
+
+ def test_tracked_changes_reject(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:TrackChanges")
+ type_text(xWriterEdit, "Test LibreOffice")
+ self.xUITest.executeCommand(".uno:ShowTrackedChanges")
+
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges", close_button="close") as xTrackDlg:
+
+ xRejBtn = xTrackDlg.getChild("reject")
+ xRejBtn.executeAction("CLICK", tuple())
+
+ self.assertEqual(document.Text.String[0:1], "")
+
+ def test_tracked_changes_rejectall(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:TrackChanges")
+ type_text(xWriterEdit, "Test LibreOffice")
+ self.xUITest.executeCommand(".uno:ShowTrackedChanges")
+
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges", close_button="close") as xTrackDlg:
+
+ xAccBtn = xTrackDlg.getChild("rejectall")
+ xAccBtn.executeAction("CLICK", tuple())
+
+ self.assertEqual(document.Text.String[0:1], "")
+
+ def test_tracked_changes_zprev_next(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:TrackChanges")
+ type_text(xWriterEdit, "Test LibreOffice")
+ self.xUITest.executeCommand(".uno:TrackChanges")
+ type_text(xWriterEdit, " Test2")
+ self.xUITest.executeCommand(".uno:TrackChanges")
+ type_text(xWriterEdit, " Test3")
+ self.xUITest.executeCommand(".uno:TrackChanges")
+ type_text(xWriterEdit, " Test4")
+ self.xUITest.executeCommand(".uno:TrackChanges")
+ type_text(xWriterEdit, " Test5")
+ self.xUITest.executeCommand(".uno:PreviousTrackedChange")
+ self.xUITest.executeCommand(".uno:RejectTrackedChange")
+ self.assertEqual(document.Text.String[0:37], "Test LibreOffice Test2 Test3 Test4")
+
+ self.xUITest.executeCommand(".uno:PreviousTrackedChange")
+ self.xUITest.executeCommand(".uno:PreviousTrackedChange")
+ self.xUITest.executeCommand(".uno:AcceptTrackedChange")
+ self.assertEqual(document.Text.String[0:37], "Test LibreOffice Test2 Test3 Test4")
+
+ self.xUITest.executeCommand(".uno:NextTrackedChange")
+ self.xUITest.executeCommand(".uno:RejectTrackedChange")
+ self.assertEqual(document.Text.String[0:30], "Test LibreOffice Test2 Test4")
+
+
+ def test_list_of_changes(self):
+ with self.ui_test.load_file(get_url_for_data_file("trackedChanges.odt")) as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+
+ listText = [
+ "Unknown Author\t01/24/2020 16:19:32\t",
+ "Unknown Author\t01/24/2020 16:19:35\t",
+ "Unknown Author\t01/24/2020 16:19:39\t",
+ "Unknown Author\t01/24/2020 16:19:39\t",
+ "Xisco Fauli\t01/27/2020 17:42:55\t"]
+
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges", close_button="close") as xTrackDlg:
+ changesList = xTrackDlg.getChild("writerchanges")
+
+ resultsAccept = [
+ "The tennis ball is a small ball. The baskedtball is much bigger.",
+ "The tennis ball is a small ball. The baskedtball is much bigger.",
+ "The tennis ball is a small ball. The baskedtball is much bigger.",
+ "The tennis ball is a small ball. The basketball is much bigger.",
+ "The tennis ball is a small ball. The basketball is much bigger.",
+ "The tennis ball is a small ball. The basketball is much bigger."]
+
+ for i in range(len(listText)):
+ self.assertEqual(document.Text.String.strip(), resultsAccept[i])
+ self.assertEqual(get_state_as_dict(changesList.getChild('0'))["Text"], listText[i] )
+ xAccBtn = xTrackDlg.getChild("accept")
+ xAccBtn.executeAction("CLICK", tuple())
+
+ self.assertEqual(document.Text.String.strip(), resultsAccept[5])
+ #List is empty
+ self.assertFalse('0' in changesList.getChildren())
+
+ for i in reversed(range(len(listText))):
+ xUndoBtn = xTrackDlg.getChild("undo")
+ xUndoBtn.executeAction("CLICK", tuple())
+ self.assertEqual(document.Text.String.strip(), resultsAccept[i])
+ self.assertEqual(get_state_as_dict(changesList.getChild('0'))["Text"], listText[i] )
+
+ resultsReject = [
+ "The tennis ball is a small ball. The baskedtball is much bigger.",
+ "The tenis ball is a small ball. The baskedtball is much bigger.",
+ "The tenis ball is a small bal. The baskedtball is much bigger.",
+ "The tenis ball is a small bal. The baskedtball is much bigger.",
+ "The tenis ball is a small bal. The baskedball is much bigger.",
+ "The tenis ball is a small bal. The baskedball is much biger."]
+
+ for i in range(len(listText)):
+ self.assertEqual(document.Text.String.strip(), resultsReject[i])
+ self.assertEqual(get_state_as_dict(changesList.getChild('0'))["Text"], listText[i] )
+ xAccBtn = xTrackDlg.getChild("reject")
+ xAccBtn.executeAction("CLICK", tuple())
+
+ self.assertEqual(document.Text.String.strip(), resultsReject[5])
+ #List is empty
+ self.assertFalse('0' in changesList.getChildren())
+
+ for i in reversed(range(len(listText))):
+ xUndoBtn = xTrackDlg.getChild("undo")
+ xUndoBtn.executeAction("CLICK", tuple())
+ self.assertEqual(document.Text.String.strip(), resultsReject[i])
+ self.assertEqual(get_state_as_dict(changesList.getChild('0'))["Text"], listText[i] )
+
+
+ def test_tdf135018(self):
+ with self.ui_test.load_file(get_url_for_data_file("tdf135018.odt")) as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+
+ self.assertEqual(5, document.CurrentController.PageCount)
+
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges", close_button="close") as xTrackDlg:
+ changesList = xTrackDlg.getChild("writerchanges")
+ self.assertEqual(111, len(changesList.getChildren()))
+
+ # Without the fix in place, it would have crashed here
+ xAccBtn = xTrackDlg.getChild("acceptall")
+ xAccBtn.executeAction("CLICK", tuple())
+
+ self.assertEqual(0, len(changesList.getChildren()))
+
+ xUndoBtn = xTrackDlg.getChild("undo")
+ xUndoBtn.executeAction("CLICK", tuple())
+
+ self.assertEqual(111, len(changesList.getChildren()))
+
+
+ # Check the changes are shown after opening the Manage Tracked Changes dialog
+ self.assertGreater(document.CurrentController.PageCount, 5)
+
+ def test_tdf144270_tracked_table_rows(self):
+ with self.ui_test.load_file(get_url_for_data_file("TC-table-del-add.docx")) as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+
+ tables = document.getTextTables()
+ self.assertEqual(3, len(tables))
+
+ # Accept
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges", close_button="close") as xTrackDlg:
+ changesList = xTrackDlg.getChild("writerchanges")
+
+ # This was 14 (every cell is a different change instead of counting rows or tables)
+ # Now: 4 changes (2 deleted/inserted rows and 2 deleted/inserted tables)
+ self.assertEqual(4, len(changesList.getChildren()))
+
+ # Without the fix in place, it would have crashed here
+ for i in (3, 2, 1, 0):
+ xAccBtn = xTrackDlg.getChild("accept")
+ xAccBtn.executeAction("CLICK", tuple())
+ self.assertEqual(i, len(changesList.getChildren()))
+
+ tables = document.getTextTables()
+ self.assertEqual(2, len(tables))
+
+ for i in range(1, 5):
+ xUndoBtn = xTrackDlg.getChild("undo")
+ xUndoBtn.executeAction("CLICK", tuple())
+ self.assertEqual(i, len(changesList.getChildren()))
+
+ tables = document.getTextTables()
+ self.assertEqual(3, len(tables))
+
+ # Accept All
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges", close_button="close") as xTrackDlg:
+ changesList = xTrackDlg.getChild("writerchanges")
+
+ # This was 14 (every cell is a different change instead of counting rows or tables)
+ # Now: 4 changes (2 deleted/inserted rows and 2 deleted/inserted tables)
+ self.assertEqual(4, len(changesList.getChildren()))
+
+ xAccBtn = xTrackDlg.getChild("acceptall")
+ xAccBtn.executeAction("CLICK", tuple())
+ self.assertEqual(0, len(changesList.getChildren()))
+
+ tables = document.getTextTables()
+ self.assertEqual(2, len(tables))
+
+ xUndoBtn = xTrackDlg.getChild("undo")
+ xUndoBtn.executeAction("CLICK", tuple())
+ self.assertEqual(4, len(changesList.getChildren()))
+
+ tables = document.getTextTables()
+ self.assertEqual(3, len(tables))
+
+ # goto to the start of the document to reject from the first tracked table row change
+ self.xUITest.executeCommand(".uno:GoToStartOfDoc")
+
+ # Reject
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges", close_button="close") as xTrackDlg:
+ changesList = xTrackDlg.getChild("writerchanges")
+
+ # This was 14 (every cell is a different change instead of counting rows or tables)
+ # Now: 4 changes (2 deleted/inserted rows and 2 deleted/inserted tables)
+ self.assertEqual(4, len(changesList.getChildren()))
+
+ # Without the fix in place, it would have crashed here
+ for i in (3, 2, 1, 0):
+ xAccBtn = xTrackDlg.getChild("reject")
+ xAccBtn.executeAction("CLICK", tuple())
+ self.assertEqual(i, len(changesList.getChildren()))
+
+ tables = document.getTextTables()
+ self.assertEqual(2, len(tables))
+
+ for i in range(1, 5):
+ xUndoBtn = xTrackDlg.getChild("undo")
+ xUndoBtn.executeAction("CLICK", tuple())
+ self.assertEqual(i, len(changesList.getChildren()))
+
+ tables = document.getTextTables()
+ self.assertEqual(3, len(tables))
+
+ # Reject All
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges", close_button="close") as xTrackDlg:
+ changesList = xTrackDlg.getChild("writerchanges")
+
+ # This was 14 (every cell is a different change instead of counting rows or tables)
+ # Now: 4 changes (2 deleted/inserted rows and 2 deleted/inserted tables)
+ self.assertEqual(4, len(changesList.getChildren()))
+
+ xAccBtn = xTrackDlg.getChild("rejectall")
+ xAccBtn.executeAction("CLICK", tuple())
+ self.assertEqual(0, len(changesList.getChildren()))
+
+ tables = document.getTextTables()
+ self.assertEqual(2, len(tables))
+
+ xUndoBtn = xTrackDlg.getChild("undo")
+ xUndoBtn.executeAction("CLICK", tuple())
+ self.assertEqual(4, len(changesList.getChildren()))
+
+ tables = document.getTextTables()
+ self.assertEqual(3, len(tables))
+
+ def test_tdf148032(self):
+
+ with self.ui_test.load_file(get_url_for_data_file("trackedChanges.odt")) as document:
+
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+
+ # adding new Comment
+ self.xUITest.executeCommand(".uno:InsertAnnotation")
+
+ # wait until the comment is available
+ xComment1 = self.ui_test.wait_until_child_is_available('Comment1')
+
+ xEditView1 = xComment1.getChild("editview")
+ xEditView1.executeAction("TYPE", mkPropertyValues({"TEXT": "This is the First Comment"}))
+ self.assertEqual(get_state_as_dict(xComment1)["Text"], "This is the First Comment" )
+ self.assertEqual(get_state_as_dict(xComment1)["Resolved"], "false" )
+ self.assertEqual(get_state_as_dict(xComment1)["Author"], "Unknown Author" )
+ self.assertEqual(get_state_as_dict(xComment1)["ReadOnly"], "false" )
+
+ xComment1.executeAction("LEAVE", mkPropertyValues({}))
+
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges", close_button="close") as xTrackDlg:
+ changesList = xTrackDlg.getChild("writerchanges")
+ self.assertEqual(6, len(changesList.getChildren()))
+
+ xChild = changesList.getChild(0)
+ # This was False (missing comment)
+ self.assertEqual(True, get_state_as_dict(xChild)["Text"].endswith('\tComment added'))
+
+ def test_tdf147179(self):
+ with self.ui_test.load_file(get_url_for_data_file("TC-table-del-add.docx")) as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+
+ tables = document.getTextTables()
+ self.assertEqual(3, len(tables))
+
+ # Select text of the tracked row, not only text of its first cell
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges", close_button="close") as xTrackDlg:
+ changesList = xTrackDlg.getChild("writerchanges")
+
+ # select second tracked table row in tree list
+ changesList.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"}))
+ xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit')
+ while get_state_as_dict(xWriterEdit)["SelectedText"] != 'klj':
+ xToolkit.processEventsToIdle()
+
+ # this was "j" (only text of the first cell was selected, not text of the row)
+ self.assertEqual(get_state_as_dict(xWriterEdit)["SelectedText"], "klj" )
+
+ # select first tracked table row in tree list
+ changesList.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"}))
+ while get_state_as_dict(xWriterEdit)["SelectedText"] != 'bca':
+ xToolkit.processEventsToIdle()
+
+ # this was "a" (only text of the first cell was selected, not text of the row)
+ self.assertEqual(get_state_as_dict(xWriterEdit)["SelectedText"], "bca" )
+
+ def test_RedlineSuccessorData(self):
+ with TemporaryDirectory() as tempdir:
+ xFilePath = os.path.join(tempdir, "redlinesuccessordata-temp.odt")
+ with self.ui_test.load_file(get_url_for_data_file("redlinesuccessordata.docx")) as document:
+
+ # check tracked deletion in tracked insertion
+ with self.ui_test.execute_modeless_dialog_through_command('.uno:AcceptTrackedChanges', close_button="close") as xTrackDlg:
+ changesList = xTrackDlg.getChild('writerchanges')
+ # four children, but only three visible
+ state = get_state_as_dict(changesList)
+ self.assertEqual(state['Children'], '4')
+ self.assertEqual(state['VisibleCount'], '3')
+
+ # select tracked deletion with RedlineSuccessorData in tree list
+ changesList.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"}))
+ state = get_state_as_dict(changesList)
+ self.assertEqual(state['SelectEntryText'], 'Kelemen Gábor 2\t05/19/2021 12:35:00\t')
+ self.assertEqual(get_state_as_dict(changesList.getChild(1))['Children'], '1')
+ self.assertEqual(get_state_as_dict(changesList.getChild(1))['VisibleChildCount'], '0')
+
+ # open tree node with the tracked insertion: four visible children
+ changesList.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"}))
+ state = get_state_as_dict(changesList)
+ self.assertEqual(state['Children'], '4')
+ self.assertEqual(state['VisibleCount'], '4')
+ self.assertEqual(get_state_as_dict(changesList.getChild(1))['Children'], '1')
+ self.assertEqual(get_state_as_dict(changesList.getChild(1))['VisibleChildCount'], '1')
+
+ # select tracked insertion in tree list
+ changesList.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"}))
+ state = get_state_as_dict(changesList)
+ self.assertEqual(state['SelectEntryText'], 'First Person\t10/21/2012 23:45:00\t')
+
+ # Save the DOCX document as ODT with a tracked deletion in a tracked insertion
+ with self.ui_test.execute_dialog_through_command(".uno:SaveAs", close_button="open") as xSaveDialog:
+ xFileName = xSaveDialog.getChild("file_name")
+ xFileName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xFileName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": xFilePath}))
+ xFileTypeCombo = xSaveDialog.getChild("file_type")
+ select_by_text(xFileTypeCombo, "ODF Text Document (.odt)")
+
+ self.ui_test.wait_until_file_is_available(xFilePath)
+ # load the temporary file, and check ODF roundtrip of the tracked deletion in a tracked insertion
+ with self.ui_test.load_file(systemPathToFileUrl(xFilePath)) as document:
+ # check tracked deletion in tracked insertion
+ with self.ui_test.execute_modeless_dialog_through_command('.uno:AcceptTrackedChanges', close_button="close") as xTrackDlg:
+ changesList = xTrackDlg.getChild('writerchanges')
+ # four children, but only three visible
+ state = get_state_as_dict(changesList)
+ self.assertEqual(state['Children'], '4')
+ self.assertEqual(state['VisibleCount'], '3')
+
+ # select tracked deletion with RedlineSuccessorData in tree list
+ changesList.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"}))
+ state = get_state_as_dict(changesList)
+ self.assertEqual(state['SelectEntryText'], 'Kelemen Gábor 2\t05/19/2021 12:35:00\t')
+ self.assertEqual(get_state_as_dict(changesList.getChild(1))['Children'], '1')
+ self.assertEqual(get_state_as_dict(changesList.getChild(1))['VisibleChildCount'], '0')
+
+ # open tree node with the tracked insertion: four visible children
+ changesList.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"}))
+ state = get_state_as_dict(changesList)
+ self.assertEqual(state['Children'], '4')
+ self.assertEqual(state['VisibleCount'], '4')
+ self.assertEqual(get_state_as_dict(changesList.getChild(1))['Children'], '1')
+ self.assertEqual(get_state_as_dict(changesList.getChild(1))['VisibleChildCount'], '1')
+
+ # select tracked insertion in tree list
+ changesList.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"}))
+ state = get_state_as_dict(changesList)
+ self.assertEqual(state['SelectEntryText'], 'First Person\t10/21/2012 23:45:00\t')
+
+ # reject all
+ xAccBtn = xTrackDlg.getChild("rejectall")
+ xAccBtn.executeAction("CLICK", tuple())
+ # FIXME why we need double rejectall (dialog-only)?
+ xAccBtn.executeAction("CLICK", tuple())
+ self.assertEqual(0, len(changesList.getChildren()))
+ # This was false, because of not rejected tracked deletion
+ # of the text "inserts": "Document text inserts document"...
+ self.assertTrue(document.getText().getString().startswith('Document text document text'))
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests/versionDialog.py b/sw/qa/uitest/writer_tests/versionDialog.py
new file mode 100644
index 000000000..5f34de511
--- /dev/null
+++ b/sw/qa/uitest/writer_tests/versionDialog.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 get_state_as_dict, get_url_for_data_file
+
+class versionDialog(UITestCase):
+
+ def test_tdf131931(self):
+
+ with self.ui_test.load_file(get_url_for_data_file("tdf131931.odt")) as writer_doc:
+
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ with self.ui_test.execute_dialog_through_command(".uno:VersionDialog", close_button="close") as xVersionDialog:
+
+
+ versiondList = xVersionDialog.getChild("versions")
+
+ text = "04/06/2020 15:18\t\tHELLO"
+ self.assertEqual(1, len(versiondList.getChildren()))
+ self.assertEqual(get_state_as_dict(versiondList.getChild('0'))["Text"].strip(), text)
+
+ xDeleteBtn = xVersionDialog.getChild("delete")
+ xDeleteBtn.executeAction("CLICK", tuple())
+
+ self.assertEqual(0, len(versiondList.getChildren()))
+
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests/watermark.py b/sw/qa/uitest/writer_tests/watermark.py
new file mode 100644
index 000000000..1ba46cecc
--- /dev/null
+++ b/sw/qa/uitest/writer_tests/watermark.py
@@ -0,0 +1,52 @@
+# -*- 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
+
+
+class watermark(UITestCase):
+
+ def test_insert_watermark(self):
+ with self.ui_test.create_doc_in_start_center("writer"):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ with self.ui_test.execute_dialog_through_command(".uno:Watermark") as xDialog:
+ xTextInput = xDialog.getChild("TextInput")
+ xAngle = xDialog.getChild("Angle")
+ xTransparency = xDialog.getChild("Transparency")
+
+ xTextInput.executeAction("TYPE", mkPropertyValues({"TEXT":"Watermark"}))
+ xAngle.executeAction("UP", tuple())
+ xTransparency.executeAction("UP", tuple())
+
+
+ with self.ui_test.execute_dialog_through_command(".uno:Watermark", close_button="cancel") as xDialog:
+ xTextInput = xDialog.getChild("TextInput")
+ xAngle = xDialog.getChild("Angle")
+ xTransparency = xDialog.getChild("Transparency")
+
+ self.assertEqual(get_state_as_dict(xTextInput)["Text"], "Watermark")
+ self.assertEqual(get_state_as_dict(xAngle)["Text"], "90°")
+ self.assertEqual(get_state_as_dict(xTransparency)["Text"], "51%")
+
+
+ with self.ui_test.execute_dialog_through_command(".uno:Watermark") as xDialog:
+ xTextInput = xDialog.getChild("TextInput")
+ xTextInput.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xTextInput.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+
+ with self.ui_test.execute_dialog_through_command(".uno:Watermark", close_button="cancel") as xDialog:
+ xTextInput = xDialog.getChild("TextInput")
+
+ self.assertEqual(get_state_as_dict(xTextInput)["Text"], "")
+
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests/wordCount.py b/sw/qa/uitest/writer_tests/wordCount.py
new file mode 100644
index 000000000..c1e816337
--- /dev/null
+++ b/sw/qa/uitest/writer_tests/wordCount.py
@@ -0,0 +1,282 @@
+# -*- 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, type_text
+
+class writerWordCount(UITestCase):
+
+ def test_word_count_dialog(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 word count dialog") #type text
+ xWriterEdit.executeAction("SELECT", mkPropertyValues({"START_POS": "0", "END_POS": "8"})) #select two words
+
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog", close_button="close") as xDialog:
+
+ xselectwords = xDialog.getChild("selectwords")
+ xdocwords = xDialog.getChild("docwords")
+ xselectchars = xDialog.getChild("selectchars")
+ xdocchars = xDialog.getChild("docchars")
+ xselectcharsnospaces = xDialog.getChild("selectcharsnospaces")
+ xdoccharsnospaces = xDialog.getChild("doccharsnospaces")
+ xselectcjkchars = xDialog.getChild("selectcjkchars")
+ xdoccjkchars = xDialog.getChild("doccjkchars")
+
+ self.assertEqual(get_state_as_dict(xselectwords)["Text"], "2")
+ self.assertEqual(get_state_as_dict(xdocwords)["Text"], "5")
+ self.assertEqual(get_state_as_dict(xselectchars)["Text"], "8")
+ self.assertEqual(get_state_as_dict(xdocchars)["Text"], "26")
+ self.assertEqual(get_state_as_dict(xselectcharsnospaces)["Text"], "7")
+ self.assertEqual(get_state_as_dict(xdoccharsnospaces)["Text"], "22")
+ self.assertEqual(get_state_as_dict(xselectcjkchars)["Text"], "0")
+ self.assertEqual(get_state_as_dict(xdoccjkchars)["Text"], "0")
+
+
+ def test_tdf68347(self):
+ #Bug 68347 - Incorrect word count in a document with recorded changes
+ with self.ui_test.load_file(get_url_for_data_file("tdf68347.odt")) as writer_doc:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+
+ xWriterEdit.executeAction("SELECT", mkPropertyValues({"START_POS": "24", "END_POS": "39"})) #select two words
+
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog", close_button="close") as xDialog:
+ xselectwords = xDialog.getChild("selectwords")
+ xdocwords = xDialog.getChild("docwords")
+ xselectchars = xDialog.getChild("selectchars")
+ xdocchars = xDialog.getChild("docchars")
+ xselectcharsnospaces = xDialog.getChild("selectcharsnospaces")
+ xdoccharsnospaces = xDialog.getChild("doccharsnospaces")
+ xselectcjkchars = xDialog.getChild("selectcjkchars")
+ xdoccjkchars = xDialog.getChild("doccjkchars")
+
+ self.assertEqual(get_state_as_dict(xselectwords)["Text"], "4")
+ self.assertEqual(get_state_as_dict(xdocwords)["Text"], "12")
+ self.assertEqual(get_state_as_dict(xselectchars)["Text"], "15")
+ self.assertEqual(get_state_as_dict(xdocchars)["Text"], "54")
+ self.assertEqual(get_state_as_dict(xselectcharsnospaces)["Text"], "12")
+ #Bug 117703 Word Count: Wrong result for "Characters excluding spaces"
+ #self.assertEqual(get_state_as_dict(xdoccharsnospaces)["Text"], "44")
+ self.assertEqual(get_state_as_dict(xselectcjkchars)["Text"], "0")
+ self.assertEqual(get_state_as_dict(xdoccjkchars)["Text"], "0")
+
+ def test_tdf91100(self):
+ with self.ui_test.create_doc_in_start_center("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog", close_button="close"):
+ pass
+
+ def test_tdf58050(self):
+ with self.ui_test.load_file(get_url_for_data_file("tdf58050.html")) as writer_doc:
+
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog", close_button="close") as xDialog:
+
+ xselectwords = xDialog.getChild("selectwords")
+ xdocwords = xDialog.getChild("docwords")
+ xselectchars = xDialog.getChild("selectchars")
+ xdocchars = xDialog.getChild("docchars")
+ xselectcharsnospaces = xDialog.getChild("selectcharsnospaces")
+ xdoccharsnospaces = xDialog.getChild("doccharsnospaces")
+ xselectcjkchars = xDialog.getChild("selectcjkchars")
+ xdoccjkchars = xDialog.getChild("doccjkchars")
+
+ self.assertEqual(get_state_as_dict(xselectwords)["Text"], "0")
+ self.assertEqual(get_state_as_dict(xdocwords)["Text"], "3")
+ self.assertEqual(get_state_as_dict(xselectchars)["Text"], "0")
+ self.assertEqual(get_state_as_dict(xdocchars)["Text"], "14")
+ self.assertEqual(get_state_as_dict(xselectcharsnospaces)["Text"], "0")
+ self.assertEqual(get_state_as_dict(xdoccharsnospaces)["Text"], "12")
+ self.assertEqual(get_state_as_dict(xselectcjkchars)["Text"], "0")
+ self.assertEqual(get_state_as_dict(xdoccjkchars)["Text"], "0")
+
+ def test_word_count_interpunction_counted_tdf56975_a(self):
+
+ with self.ui_test.create_doc_in_start_center("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+ #Open writer, enter "Testing one two! Test?"
+ type_text(xWriterEdit, "Testing one two! Test?")
+ #-> LO says: 4 words. SUCCESS! :)
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog", close_button="close") as xDialog:
+
+ xselectwords = xDialog.getChild("selectwords")
+ xdocwords = xDialog.getChild("docwords")
+ xselectchars = xDialog.getChild("selectchars")
+ xdocchars = xDialog.getChild("docchars")
+ xselectcharsnospaces = xDialog.getChild("selectcharsnospaces")
+ xdoccharsnospaces = xDialog.getChild("doccharsnospaces")
+ xselectcjkchars = xDialog.getChild("selectcjkchars")
+ xdoccjkchars = xDialog.getChild("doccjkchars")
+
+ self.assertEqual(get_state_as_dict(xselectwords)["Text"], "0")
+ self.assertEqual(get_state_as_dict(xdocwords)["Text"], "4")
+ self.assertEqual(get_state_as_dict(xselectchars)["Text"], "0")
+ self.assertEqual(get_state_as_dict(xdocchars)["Text"], "22")
+ self.assertEqual(get_state_as_dict(xselectcharsnospaces)["Text"], "0")
+ self.assertEqual(get_state_as_dict(xdoccharsnospaces)["Text"], "19")
+ self.assertEqual(get_state_as_dict(xselectcjkchars)["Text"], "0")
+ self.assertEqual(get_state_as_dict(xdoccjkchars)["Text"], "0")
+
+
+ def test_word_count_interpunction_counted_tdf56975_b(self):
+
+ with self.ui_test.create_doc_in_start_center("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+ #1. Create a new text document.
+ #2. Type-in the words:
+ # This is a test sentence.
+ type_text(xWriterEdit, "This is a test sentence.")
+ #3. Open the word count dialogue.
+ # Word count in both, dialogue and status line, shows 5 words.
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog", close_button="close") as xDialog:
+
+ xselectwords = xDialog.getChild("selectwords")
+ xdocwords = xDialog.getChild("docwords")
+ xselectchars = xDialog.getChild("selectchars")
+ xdocchars = xDialog.getChild("docchars")
+ xselectcharsnospaces = xDialog.getChild("selectcharsnospaces")
+ xdoccharsnospaces = xDialog.getChild("doccharsnospaces")
+ xselectcjkchars = xDialog.getChild("selectcjkchars")
+ xdoccjkchars = xDialog.getChild("doccjkchars")
+
+ self.assertEqual(get_state_as_dict(xselectwords)["Text"], "0")
+ self.assertEqual(get_state_as_dict(xdocwords)["Text"], "5")
+ self.assertEqual(get_state_as_dict(xselectchars)["Text"], "0")
+ self.assertEqual(get_state_as_dict(xdocchars)["Text"], "24")
+ self.assertEqual(get_state_as_dict(xselectcharsnospaces)["Text"], "0")
+ self.assertEqual(get_state_as_dict(xdoccharsnospaces)["Text"], "20")
+ self.assertEqual(get_state_as_dict(xselectcjkchars)["Text"], "0")
+ self.assertEqual(get_state_as_dict(xdoccjkchars)["Text"], "0")
+ #4. Select the space between 'a' and 'test'.
+ xWriterEdit.executeAction("SELECT", mkPropertyValues({"START_POS": "9", "END_POS": "10"}))
+ #5. Replace selection by a non-breaking space by pressing Shift+Ctrl+Space. Don't move the cursor.
+ self.xUITest.executeCommand(".uno:InsertNonBreakingSpace")
+ # Word count in dialogue shows 4 words, whereas in the status line it shows 5 words.
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog", close_button="close") as xDialog:
+
+ xselectwords = xDialog.getChild("selectwords")
+ xdocwords = xDialog.getChild("docwords")
+ xselectchars = xDialog.getChild("selectchars")
+ xdocchars = xDialog.getChild("docchars")
+ xselectcharsnospaces = xDialog.getChild("selectcharsnospaces")
+ xdoccharsnospaces = xDialog.getChild("doccharsnospaces")
+ xselectcjkchars = xDialog.getChild("selectcjkchars")
+ xdoccjkchars = xDialog.getChild("doccjkchars")
+
+ self.assertEqual(get_state_as_dict(xselectwords)["Text"], "0")
+ self.assertEqual(get_state_as_dict(xdocwords)["Text"], "5")
+ self.assertEqual(get_state_as_dict(xselectchars)["Text"], "0")
+ self.assertEqual(get_state_as_dict(xdocchars)["Text"], "24")
+ self.assertEqual(get_state_as_dict(xselectcharsnospaces)["Text"], "0")
+ self.assertEqual(get_state_as_dict(xdoccharsnospaces)["Text"], "20")
+ self.assertEqual(get_state_as_dict(xselectcjkchars)["Text"], "0")
+ self.assertEqual(get_state_as_dict(xdoccjkchars)["Text"], "0")
+ #6. Move the cursor by pressing Left.
+ self.xUITest.executeCommand(".uno:GoLeft")
+ # Word count in both, dialogue and status line, shows 5 words.
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog", close_button="close") as xDialog:
+
+ xselectwords = xDialog.getChild("selectwords")
+ xdocwords = xDialog.getChild("docwords")
+ xselectchars = xDialog.getChild("selectchars")
+ xdocchars = xDialog.getChild("docchars")
+ xselectcharsnospaces = xDialog.getChild("selectcharsnospaces")
+ xdoccharsnospaces = xDialog.getChild("doccharsnospaces")
+ xselectcjkchars = xDialog.getChild("selectcjkchars")
+ xdoccjkchars = xDialog.getChild("doccjkchars")
+
+ self.assertEqual(get_state_as_dict(xselectwords)["Text"], "0")
+ self.assertEqual(get_state_as_dict(xdocwords)["Text"], "5")
+ self.assertEqual(get_state_as_dict(xselectchars)["Text"], "0")
+ self.assertEqual(get_state_as_dict(xdocchars)["Text"], "24")
+ self.assertEqual(get_state_as_dict(xselectcharsnospaces)["Text"], "0")
+ self.assertEqual(get_state_as_dict(xdoccharsnospaces)["Text"], "20")
+ self.assertEqual(get_state_as_dict(xselectcjkchars)["Text"], "0")
+ self.assertEqual(get_state_as_dict(xdoccjkchars)["Text"], "0")
+
+ def test_tdf51816(self):
+ with self.ui_test.load_file(get_url_for_data_file("tdf51816.odt")) as writer_doc:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+ #1. Open attached document
+ #2. Tools> Word count
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog", close_button="close") as xDialog:
+ xselectwords = xDialog.getChild("selectwords")
+ xdocwords = xDialog.getChild("docwords")
+ xselectchars = xDialog.getChild("selectchars")
+ xdocchars = xDialog.getChild("docchars")
+ xselectcharsnospaces = xDialog.getChild("selectcharsnospaces")
+ xdoccharsnospaces = xDialog.getChild("doccharsnospaces")
+ xselectcjkchars = xDialog.getChild("selectcjkchars")
+ xdoccjkchars = xDialog.getChild("doccjkchars")
+
+ #3. Click after "At nunc" then <Ctrl><Shift><Left>
+ self.xUITest.executeCommand(".uno:GoRight")
+ self.xUITest.executeCommand(".uno:GoRight")
+ self.xUITest.executeCommand(".uno:GoRight")
+ self.xUITest.executeCommand(".uno:GoRight")
+ self.xUITest.executeCommand(".uno:GoRight")
+ self.xUITest.executeCommand(".uno:GoRight")
+ self.xUITest.executeCommand(".uno:GoRight")
+ self.xUITest.executeCommand(".uno:WordLeftSel")
+
+ #needs to wait, because Word count dialog is already open and it takes time to refresh the counter
+ #Expected result : Words 1 & Characters 4 #Actual result : Words 0 & Characters 0
+ self.ui_test.wait_until_property_is_updated(xselectwords, "Text", "1")
+ self.assertEqual(get_state_as_dict(xselectwords)["Text"], "1")
+ self.assertEqual(get_state_as_dict(xselectchars)["Text"], "4")
+
+ #4. Click after "At nunc" then <Shift><Home>
+ self.xUITest.executeCommand(".uno:StartOfParaSel")
+
+ #needs to wait, because Word count dialog is already open and it takes time to refresh the counter
+ #Expected result : Words 2 & Characters 7 & excluding space 6 #Actual result : Words 0 & Characters 0
+ self.ui_test.wait_until_property_is_updated(xselectwords, "Text", "2")
+ self.assertEqual(get_state_as_dict(xselectwords)["Text"], "2")
+ self.assertEqual(get_state_as_dict(xselectchars)["Text"], "7")
+
+ self.assertEqual(get_state_as_dict(xselectcharsnospaces)["Text"], "6")
+
+
+ def test_tdf117703(self):
+ with self.ui_test.load_file(get_url_for_data_file("tdf117703.odt")):
+ self.xUITest.getTopFocusWindow()
+
+ self.xUITest.executeCommand(".uno:SelectAll")
+
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog", close_button="close") as xDialog:
+
+ xselectwords = xDialog.getChild("selectwords")
+ xdocwords = xDialog.getChild("docwords")
+ xselectchars = xDialog.getChild("selectchars")
+ xdocchars = xDialog.getChild("docchars")
+ xselectcharsnospaces = xDialog.getChild("selectcharsnospaces")
+ xdoccharsnospaces = xDialog.getChild("doccharsnospaces")
+ xselectcjkchars = xDialog.getChild("selectcjkchars")
+ xdoccjkchars = xDialog.getChild("doccjkchars")
+
+ self.assertEqual(get_state_as_dict(xselectwords)["Text"], "12")
+ self.assertEqual(get_state_as_dict(xdocwords)["Text"], "12")
+ self.assertEqual(get_state_as_dict(xselectchars)["Text"], "54")
+ self.assertEqual(get_state_as_dict(xdocchars)["Text"], "54")
+
+ # Without the fix in place it would have failed with: AssertionError: '0' != '44'
+ self.assertEqual(get_state_as_dict(xselectcharsnospaces)["Text"], "44")
+ self.assertEqual(get_state_as_dict(xdoccharsnospaces)["Text"], "44")
+ self.assertEqual(get_state_as_dict(xselectcjkchars)["Text"], "0")
+ self.assertEqual(get_state_as_dict(xdoccjkchars)["Text"], "0")
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests2/asianPhoneticGuide.py b/sw/qa/uitest/writer_tests2/asianPhoneticGuide.py
new file mode 100644
index 000000000..7302dd89e
--- /dev/null
+++ b/sw/qa/uitest/writer_tests2/asianPhoneticGuide.py
@@ -0,0 +1,38 @@
+# -*- 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
+
+class asianPhoneticGuide(UITestCase):
+
+ def test_asian_phonetic_guide(self):
+ with self.ui_test.create_doc_in_start_center("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:RubyDialog", close_button="close") as xDialog:
+
+ xLeft1ED = xDialog.getChild("Left1ED")
+ xRight1ED = xDialog.getChild("Right1ED")
+ xadjustlb = xDialog.getChild("adjustlb")
+ xpositionlb = xDialog.getChild("positionlb")
+ xstylelb = xDialog.getChild("stylelb")
+
+ xLeft1ED.executeAction("TYPE", mkPropertyValues({"TEXT":"a"}))
+ xRight1ED.executeAction("TYPE", mkPropertyValues({"TEXT":"w"}))
+ select_by_text(xadjustlb, "Right")
+ select_by_text(xpositionlb, "Right")
+ select_by_text(xstylelb, "Quotation")
+
+ xApplyBtn = xDialog.getChild("ok")
+ xApplyBtn.executeAction("CLICK", tuple())
+
+ self.assertEqual(document.Text.String[0:1], "a")
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests2/bookmark.py b/sw/qa/uitest/writer_tests2/bookmark.py
new file mode 100644
index 000000000..62cf57735
--- /dev/null
+++ b/sw/qa/uitest/writer_tests2/bookmark.py
@@ -0,0 +1,94 @@
+# -*- 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, type_text
+from libreoffice.uno.propertyvalue import mkPropertyValues
+#test bookmark dialog
+class bookmarkDialog(UITestCase):
+
+ def test_bookmark_dialog(self):
+
+ with self.ui_test.create_doc_in_start_center("writer"):
+
+ with self.ui_test.execute_dialog_through_command(".uno:InsertBookmark", close_button="insert"):
+ pass
+
+ with self.ui_test.execute_dialog_through_command(".uno:InsertBookmark", close_button="insert") as xBookDlg:
+ xBmk = xBookDlg.getChild("bookmarks")
+ self.assertEqual(get_state_as_dict(xBmk)["VisibleCount"], "1") #check for 1st bookmark exist
+
+ with self.ui_test.execute_dialog_through_command(".uno:InsertBookmark", close_button="close"):
+ pass
+
+ with self.ui_test.execute_dialog_through_command(".uno:InsertBookmark", close_button="close") as xBookDlg:
+ xBmk = xBookDlg.getChild("bookmarks")
+ self.assertEqual(get_state_as_dict(xBmk)["VisibleCount"], "2") #check for 2 bookmarks
+
+#now delete one bookmark
+ with self.ui_test.execute_dialog_through_command(".uno:InsertBookmark", close_button="close") as xBookDlg:
+ xBmk = xBookDlg.getChild("bookmarks")
+ xSecondListEntry = xBmk.getChild("1") # select second bookmark
+ xSecondListEntry.executeAction("SELECT", tuple())
+ xDelBtn = xBookDlg.getChild("delete")
+ xDelBtn.executeAction("CLICK", tuple()) # delete one bookmark
+
+ with self.ui_test.execute_dialog_through_command(".uno:InsertBookmark", close_button="close") as xBookDlg:
+ xBmk2 = xBookDlg.getChild("bookmarks")
+ self.assertEqual(get_state_as_dict(xBmk2)["VisibleCount"], "1") #check for 1 bookmark
+
+
+ def test_bookmark_dialog_rename(self):
+ with self.ui_test.create_doc_in_start_center("writer"):
+
+ with self.ui_test.execute_dialog_through_command(".uno:InsertBookmark", close_button="insert"):
+ pass
+
+ with self.ui_test.execute_dialog_through_command(".uno:InsertBookmark", close_button="close") as xBookDlg:
+ xBmk = xBookDlg.getChild("bookmarks")
+ xFirstListEntry = xBmk.getChild("0") # select first bookmark
+ xFirstListEntry.executeAction("SELECT", tuple())
+ xRenameBtn = xBookDlg.getChild("rename")
+
+ with self.ui_test.execute_blocking_action(xRenameBtn.executeAction, args=('CLICK', ())) as dialog:
+ xNewNameTxt=dialog.getChild("entry")
+ xNewNameTxt.executeAction("TYPE", mkPropertyValues({"TEXT":"newname"}))
+
+ x1stListEntry = xBmk.getChild("O") # select first bookmark - name "newname"
+ x1stListEntry.executeAction("SELECT", tuple())
+
+ self.assertEqual(get_state_as_dict(x1stListEntry)["Text"], "1\tnewname\t\tNo\t") #check the new name "newname"
+
+
+
+ def test_bookmark_dialog_goto(self):
+ 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:InsertBookmark", close_button="insert"):
+ pass
+
+ type_text(xWriterEdit, "Test for bookmark")
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
+ type_text(xWriterEdit, "Test2 for bookmark")
+
+ with self.ui_test.execute_dialog_through_command(".uno:InsertBookmark", close_button="insert"):
+ pass
+
+ with self.ui_test.execute_dialog_through_command(".uno:InsertBookmark", close_button="close") as xBookDlg:
+ xBmk = xBookDlg.getChild("bookmarks")
+ xFirstListEntry = xBmk.getChild("0") # select first bookmark
+ xFirstListEntry.executeAction("SELECT", tuple())
+ xGoToBtn = xBookDlg.getChild("goto")
+ xGoToBtn.executeAction("CLICK", tuple()) # goto 1st bookmark
+
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests2/deleteAllComments.py b/sw/qa/uitest/writer_tests2/deleteAllComments.py
new file mode 100644
index 000000000..e655a2f8a
--- /dev/null
+++ b/sw/qa/uitest/writer_tests2/deleteAllComments.py
@@ -0,0 +1,50 @@
+# -*- 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 DeleteAllComments(UITestCase):
+
+ def test_comments_delete(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 LibreOffice")
+
+
+ self.xUITest.executeCommand(".uno:SelectAll")
+ self.xUITest.executeCommand(".uno:InsertAnnotation")
+ cursor = document.getCurrentController().getViewCursor()
+ type_text(xWriterEdit, "EEEEE")
+ self.xUITest.executeCommand(".uno:InsertAnnotation")
+ self.xUITest.executeCommand(".uno:DeleteAllNotes")
+ self.assertEqual(document.Text.String[0:4], "Test")
+
+
+ def test_comment_trackchanges(self):
+#tdf111524
+ with self.ui_test.create_doc_in_start_center("writer") as document:
+
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+
+ type_text(xWriterEdit, "foo")
+
+
+ self.xUITest.executeCommand(".uno:SelectAll")
+ self.xUITest.executeCommand(".uno:InsertAnnotation")
+ self.xUITest.executeCommand(".uno:TrackChanges")
+ self.xUITest.executeCommand(".uno:DeleteAllNotes")
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests2/deleteFootnotes.py b/sw/qa/uitest/writer_tests2/deleteFootnotes.py
new file mode 100644
index 000000000..162cc7d3e
--- /dev/null
+++ b/sw/qa/uitest/writer_tests2/deleteFootnotes.py
@@ -0,0 +1,46 @@
+# -*- 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
+from libreoffice.uno.propertyvalue import mkPropertyValues
+import time
+
+
+class tdf150457(UITestCase):
+
+ def test_delete_footnotes(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")
+ self.xUITest.executeCommand(".uno:InsertFootnote")
+ type_text(xWriterEdit, "abc")
+ self.assertEqual(document.Footnotes[0].String, "abc")
+ self.assertEqual(document.Footnotes.getCount(), 1)
+
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "PAGEUP"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
+ type_text(xWriterEdit, "d")
+
+ self.xUITest.executeCommand(".uno:InsertFootnote")
+ type_text(xWriterEdit, "def")
+ self.assertEqual(document.Footnotes[1].String, "def")
+ self.assertEqual(document.Footnotes.getCount(), 2)
+
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "HOME"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "SHIFT+DOWN"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DELETE"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "PAGEUP"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "CTRL+A"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DELETE"}))
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests2/documentProperties.py b/sw/qa/uitest/writer_tests2/documentProperties.py
new file mode 100644
index 000000000..5b1eeb583
--- /dev/null
+++ b/sw/qa/uitest/writer_tests2/documentProperties.py
@@ -0,0 +1,123 @@
+# -*- 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
+
+class documentProperties(UITestCase):
+
+ def assert_custom_properties(self, dialog, bIsFirstItemVisible):
+ for i in range(6):
+ aExpected = 'false'
+ if bIsFirstItemVisible and i == 0:
+ aExpected = 'true'
+ xNameBox = dialog.getChild("namebox" + str(i + 1))
+ xTypeBox = dialog.getChild("typebox" + str(i + 1))
+ xValueEdit = dialog.getChild("valueedit" + str(i + 1))
+ xRemoveBtn = dialog.getChild("remove" + str(i + 1))
+ self.assertEqual(aExpected, get_state_as_dict(xNameBox)['ReallyVisible'])
+ self.assertEqual(aExpected, get_state_as_dict(xTypeBox)['ReallyVisible'])
+ self.assertEqual(aExpected, get_state_as_dict(xValueEdit)['ReallyVisible'])
+ self.assertEqual(aExpected, get_state_as_dict(xRemoveBtn)['ReallyVisible'])
+
+ def test_open_documentProperties_writer(self):
+ with self.ui_test.create_doc_in_start_center("writer"):
+ with self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties") as xDialog:
+ xResetBtn = xDialog.getChild("reset")
+ xResetBtn.executeAction("CLICK", tuple())
+
+ xUserDataCheckbox = xDialog.getChild("userdatacb") # apply user data
+ xUserDataCheckbox.executeAction("CLICK", tuple())
+ xThumbSaveCheckbox = xDialog.getChild("thumbnailsavecb") # save preview image with document
+ xThumbSaveCheckbox.executeAction("CLICK", tuple())
+
+#digital signature
+ xDigSignBtn = xDialog.getChild("signature")
+
+ with self.ui_test.execute_blocking_action(xDigSignBtn.executeAction, args=('CLICK', ()), close_button="no"):
+ pass
+
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "1") #tab Description
+
+ xTitleText = xDialog.getChild("title")
+ xTitleText.executeAction("TYPE", mkPropertyValues({"TEXT":"Title text"}))
+ xSubjectText = xDialog.getChild("subject")
+ xSubjectText.executeAction("TYPE", mkPropertyValues({"TEXT":"Subject text"}))
+ xKeywordsText = xDialog.getChild("keywords")
+ xKeywordsText.executeAction("TYPE", mkPropertyValues({"TEXT":"Keywords text"}))
+ xCommentsText = xDialog.getChild("comments")
+ xCommentsText.executeAction("TYPE", mkPropertyValues({"TEXT":"Comments text"}))
+
+
+#Font tab
+ select_pos(xTabs, "4") #tab Fonts
+ xFontEmbedCheckbox = xDialog.getChild("embedFonts")
+ xFontEmbedCheckbox.executeAction("CLICK", tuple())
+
+#Security tab
+ select_pos(xTabs, "3") #tab Security
+ xReadOnlyCheckbox = xDialog.getChild("readonly")
+ xReadOnlyCheckbox.executeAction("CLICK", tuple())
+ xRecordChangesCheckbox = xDialog.getChild("recordchanges")
+ xRecordChangesCheckbox.executeAction("CLICK", tuple())
+ xProtectBtn = xDialog.getChild("protect")
+
+ with self.ui_test.execute_blocking_action(xProtectBtn.executeAction, args=('CLICK', ())) as dialog:
+ xPasswordText = dialog.getChild("pass1ed")
+ xPasswordText.executeAction("TYPE", mkPropertyValues({"TEXT":"password"}))
+ xConfirmText = dialog.getChild("confirm1ed")
+ xConfirmText.executeAction("TYPE", mkPropertyValues({"TEXT":"password"}))
+
+ select_pos(xTabs, "2") #tab Custom properties
+
+ self.assert_custom_properties(xDialog, False)
+
+ xAddBtn = xDialog.getChild("add")
+ xAddBtn.executeAction("CLICK", tuple())
+
+ self.assert_custom_properties(xDialog, True)
+
+ xRemoveBtn = xDialog.getChild("remove1")
+ xRemoveBtn.executeAction("CLICK", tuple())
+
+ self.assert_custom_properties(xDialog, False)
+
+ select_pos(xTabs, "5") #tab Statistics
+ xUpdateBtn = xDialog.getChild("update")
+ xUpdateBtn.executeAction("CLICK", tuple())
+
+#now open the dialog again and read the properties
+ with self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties", close_button="cancel") as xDialog:
+ xTitleText = xDialog.getChild("title")
+ xSubjectText = xDialog.getChild("subject")
+ xKeywordsText = xDialog.getChild("keywords")
+ xCommentsText = xDialog.getChild("comments")
+ xReadOnlyCheckbox = xDialog.getChild("readonly")
+ xRecordChangesCheckbox = xDialog.getChild("recordchanges")
+ xFontEmbedCheckbox = xDialog.getChild("embedFonts")
+ xUserDataCheckbox = xDialog.getChild("userdatacb")
+ xThumbSaveCheckbox = xDialog.getChild("thumbnailsavecb")
+ self.assertEqual(get_state_as_dict(xTitleText)["Text"], "Title text")
+ self.assertEqual(get_state_as_dict(xSubjectText)["Text"], "Subject text")
+ self.assertEqual(get_state_as_dict(xKeywordsText)["Text"], "Keywords text")
+ self.assertEqual(get_state_as_dict(xReadOnlyCheckbox)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(xRecordChangesCheckbox)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(xReadOnlyCheckbox)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(xFontEmbedCheckbox)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(xUserDataCheckbox)["Selected"], "false")
+ self.assertEqual(get_state_as_dict(xThumbSaveCheckbox)["Selected"], "false")
+ self.assertEqual(get_state_as_dict(xCommentsText)["Text"], "Comments text")
+ xResetBtn = xDialog.getChild("reset")
+ xResetBtn.executeAction("CLICK", tuple())
+
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests2/exchangeDatabase.py b/sw/qa/uitest/writer_tests2/exchangeDatabase.py
new file mode 100644
index 000000000..f234dc3a2
--- /dev/null
+++ b/sw/qa/uitest/writer_tests2/exchangeDatabase.py
@@ -0,0 +1,45 @@
+# -*- 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
+
+class exchangeDB(UITestCase):
+
+ def test_exchange_database(self):
+
+ with self.ui_test.create_doc_in_start_center("writer"):
+
+ with self.ui_test.execute_dialog_through_command(".uno:ChangeDatabaseField", close_button="close"):
+ pass
+
+
+ def test_exchange_database2(self):
+
+ with self.ui_test.create_doc_in_start_center("writer"):
+
+ with self.ui_test.execute_dialog_through_command(".uno:ChangeDatabaseField") as xExDBDlg:
+ xTreelist = xExDBDlg.getChild("availablelb")
+
+ xLabeldb = xExDBDlg.getChild("dbnameft")
+ self.assertEqual(get_state_as_dict(xLabeldb)["Text"], "[None]")
+
+ xTreeEntry = xTreelist.getChild('0') #Available Databases
+ xTreeEntry.executeAction("EXPAND", tuple()) #Click on the Bibliography
+ xTreeEntry.executeAction("COLLAPSE", tuple())
+ xTreeEntry.executeAction("EXPAND", tuple())
+ xTreeEntry2 = xTreeEntry.getChild('0') #Available Databases
+ xTreeEntry2.executeAction("SELECT", tuple()) #Click on the biblio
+
+ with self.ui_test.execute_dialog_through_command(".uno:ChangeDatabaseField", close_button="close") as xExDBDlg:
+ xLabeldb = xExDBDlg.getChild("dbnameft")
+ self.assertEqual(get_state_as_dict(xLabeldb)["Text"], "Bibliography.biblio")
+
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests2/fontworks.py b/sw/qa/uitest/writer_tests2/fontworks.py
new file mode 100644
index 000000000..a70fc297b
--- /dev/null
+++ b/sw/qa/uitest/writer_tests2/fontworks.py
@@ -0,0 +1,38 @@
+# -*- 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 libreoffice.uno.propertyvalue import mkPropertyValues
+
+#test FontWorks dialog
+class fontWorksDialog(UITestCase):
+
+ def test_fontwork_selector(self):
+ 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:FontworkGalleryFloater", close_button="cancel") as xDialog:
+ FontWorkSelector = xDialog.getChild("ctlFavoriteswin")
+ # Select element with id (3)
+ element3 = FontWorkSelector.getChild("2")
+ element3.executeAction("SELECT", mkPropertyValues({}))
+ self.assertEqual(get_state_as_dict(FontWorkSelector)["SelectedItemPos"], "2")
+ self.assertEqual(get_state_as_dict(FontWorkSelector)["SelectedItemId"], "3")
+ self.assertEqual(get_state_as_dict(FontWorkSelector)["VisibleCount"], "36")
+
+ # Select element with id (7)
+ element7 = FontWorkSelector.getChild("6")
+ element7.executeAction("SELECT", mkPropertyValues({}))
+ self.assertEqual(get_state_as_dict(FontWorkSelector)["SelectedItemPos"], "6")
+ self.assertEqual(get_state_as_dict(FontWorkSelector)["SelectedItemId"], "7")
+
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests2/formatBulletsNumbering.py b/sw/qa/uitest/writer_tests2/formatBulletsNumbering.py
new file mode 100644
index 000000000..4892dde49
--- /dev/null
+++ b/sw/qa/uitest/writer_tests2/formatBulletsNumbering.py
@@ -0,0 +1,270 @@
+# -*- 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 libreoffice.uno.propertyvalue import mkPropertyValues
+from uitest.uihelper.common import select_pos
+from uitest.uihelper.common import select_by_text
+from uitest.uihelper.common import change_measurement_unit
+
+class formatBulletsNumbering(UITestCase):
+
+ def test_bullets_and_numbering_dialog_tab_position(self):
+ with self.ui_test.create_doc_in_start_center("writer"):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ change_measurement_unit(self, "Millimeter")
+
+ with self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "4")
+ xalignedatmf = xDialog.getChild("alignedatmf")
+ xnum2alignlb = xDialog.getChild("num2alignlb")
+ xatmf = xDialog.getChild("atmf")
+ xindentatmf = xDialog.getChild("indentatmf")
+
+ xalignedatmf.executeAction("UP", tuple())
+ select_by_text(xnum2alignlb, "Centered")
+ xatmf.executeAction("UP", tuple())
+ xindentatmf.executeAction("UP", tuple())
+
+
+ with self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog", close_button="cancel") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "4")
+ xalignedatmf = xDialog.getChild("alignedatmf")
+ xnum2alignlb = xDialog.getChild("num2alignlb")
+ xatmf = xDialog.getChild("atmf")
+ xindentatmf = xDialog.getChild("indentatmf")
+
+ self.assertEqual(get_state_as_dict(xalignedatmf)["Text"], "6.5 mm")
+ self.assertEqual(get_state_as_dict(xnum2alignlb)["SelectEntryText"], "Centered")
+ self.assertEqual(get_state_as_dict(xatmf)["Text"], "12.8 mm")
+ self.assertEqual(get_state_as_dict(xindentatmf)["Text"], "12.8 mm")
+
+
+
+ def test_bullets_and_numbering_dialog_tab_position2(self):
+ with self.ui_test.create_doc_in_start_center("writer"):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ with self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "4")
+ xnumfollowedbylb = xDialog.getChild("numfollowedbylb")
+ select_by_text(xnumfollowedbylb, "Space")
+
+
+ with self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog", close_button="cancel") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "4")
+ xnumfollowedbylb = xDialog.getChild("numfollowedbylb")
+ self.assertEqual(get_state_as_dict(xnumfollowedbylb)["SelectEntryText"], "Space")
+
+
+
+ def test_bullets_and_numbering_dialog_tab_customize(self):
+ with self.ui_test.create_doc_in_start_center("writer"):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ with self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "5")
+ xnumfmtlb = xDialog.getChild("numfmtlb")
+ xstartat = xDialog.getChild("startat")
+ xcharstyle = xDialog.getChild("charstyle")
+ xprefix = xDialog.getChild("prefix")
+ xsuffix = xDialog.getChild("suffix")
+ xallsame = xDialog.getChild("allsame")
+
+ select_by_text(xnumfmtlb, "A, B, C, ...")
+ xstartat.executeAction("UP", tuple())
+ select_by_text(xcharstyle, "Bullets")
+ xprefix.executeAction("TYPE", mkPropertyValues({"TEXT":"o"}))
+ xsuffix.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xsuffix.executeAction("TYPE", mkPropertyValues({"TEXT":"a"}))
+ xallsame.executeAction("CLICK", tuple())
+
+
+ with self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog", close_button="cancel") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "5")
+ xnumfmtlb = xDialog.getChild("numfmtlb")
+ xstartat = xDialog.getChild("startat")
+ xcharstyle = xDialog.getChild("charstyle")
+ xprefix = xDialog.getChild("prefix")
+ xsuffix = xDialog.getChild("suffix")
+ xallsame = xDialog.getChild("allsame")
+
+ self.assertEqual(get_state_as_dict(xnumfmtlb)["SelectEntryText"], "A, B, C, ...")
+ self.assertEqual(get_state_as_dict(xstartat)["Text"], "2")
+ self.assertEqual(get_state_as_dict(xcharstyle)["SelectEntryText"], "Bullets")
+ self.assertEqual(get_state_as_dict(xprefix)["Text"], "o")
+ self.assertEqual(get_state_as_dict(xsuffix)["Text"], "a")
+ self.assertEqual(get_state_as_dict(xallsame)["Selected"], "true")
+
+
+ with self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog", close_button="user") as xDialog:
+ pass
+
+ with self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog", close_button="cancel") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "5")
+ xnumfmtlb = xDialog.getChild("numfmtlb")
+ xstartat = xDialog.getChild("startat")
+ xcharstyle = xDialog.getChild("charstyle")
+ xprefix = xDialog.getChild("prefix")
+ xsuffix = xDialog.getChild("suffix")
+ xallsame = xDialog.getChild("allsame")
+
+ self.assertEqual(get_state_as_dict(xnumfmtlb)["SelectEntryText"], "1, 2, 3, ...")
+ self.assertEqual(get_state_as_dict(xstartat)["Text"], "1")
+ self.assertEqual(get_state_as_dict(xcharstyle)["SelectEntryText"], "None")
+ self.assertEqual(get_state_as_dict(xprefix)["Text"], "")
+ self.assertEqual(get_state_as_dict(xsuffix)["Text"], ".")
+ self.assertEqual(get_state_as_dict(xallsame)["Selected"], "false")
+
+
+
+ def test_bullets_and_numbering_tab_move(self):
+ with self.ui_test.create_doc_in_start_center("writer"):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+
+ change_measurement_unit(self, "Millimeter")
+
+ with self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "4")
+ xindentatmf = xDialog.getChild("indentatmf")
+ indentValue = get_state_as_dict(xindentatmf)["Text"][0:len(get_state_as_dict(xindentatmf)["Text"])-3]
+
+
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"})) #TAB to move indent right
+ with self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog", close_button="cancel") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "4")
+ xindentatmf = xDialog.getChild("indentatmf")
+ indentValue2 = get_state_as_dict(xindentatmf)["Text"][0:len(get_state_as_dict(xindentatmf)["Text"])-3]
+ self.assertEqual(indentValue < indentValue2 , True)
+
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"}))
+ with self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog", close_button="cancel") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "4")
+ xindentatmf = xDialog.getChild("indentatmf")
+ indentValue3 = get_state_as_dict(xindentatmf)["Text"][0:len(get_state_as_dict(xindentatmf)["Text"])-3]
+ self.assertEqual(indentValue == indentValue3 , True)
+
+
+ def test_bullets_and_numbering_button_move(self):
+ with self.ui_test.create_doc_in_start_center("writer"):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ change_measurement_unit(self, "Millimeter")
+
+ with self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "4")
+ xindentatmf = xDialog.getChild("indentatmf")
+ indentValue = get_state_as_dict(xindentatmf)["Text"][0:len(get_state_as_dict(xindentatmf)["Text"])-3]
+
+
+ self.xUITest.executeCommand(".uno:DecrementSubLevels")
+ with self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog", close_button="cancel") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "4")
+ xindentatmf = xDialog.getChild("indentatmf")
+ indentValue2 = get_state_as_dict(xindentatmf)["Text"][0:len(get_state_as_dict(xindentatmf)["Text"])-3]
+ self.assertEqual(indentValue < indentValue2 , True)
+
+ self.xUITest.executeCommand(".uno:IncrementLevel")
+ with self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog", close_button="cancel") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "4")
+ xindentatmf = xDialog.getChild("indentatmf")
+ indentValue3 = get_state_as_dict(xindentatmf)["Text"][0:len(get_state_as_dict(xindentatmf)["Text"])-3]
+ self.assertEqual(indentValue == indentValue3 , True)
+
+
+ def test_bullets_and_numbering_selection(self):
+ with self.ui_test.create_doc_in_start_center("writer"):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ # Test Bullet Page
+ with self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") as xDialog:
+
+ # Select the BulletPage's Selector
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "0")
+ xBulletPage = xDialog.getChild("PickBulletPage")
+ xselector = xBulletPage.getChild("valueset")
+ self.assertEqual(get_state_as_dict(xselector)["ItemsCount"], "8")
+ # Select element num 3
+ xselector.executeAction("CHOOSE", mkPropertyValues({"POS": "3"}))
+ self.assertEqual(get_state_as_dict(xselector)["SelectedItemPos"], "2")
+ self.assertEqual(get_state_as_dict(xselector)["SelectedItemId"], "3")
+ self.assertEqual(get_state_as_dict(xselector)["ItemText"], "Solid diamond bullets")
+ # Select element num 7
+ xselector.executeAction("CHOOSE", mkPropertyValues({"POS": "7"}))
+ self.assertEqual(get_state_as_dict(xselector)["SelectedItemPos"], "6")
+ self.assertEqual(get_state_as_dict(xselector)["SelectedItemId"], "7")
+ self.assertEqual(get_state_as_dict(xselector)["ItemText"], "Cross mark bullets")
+
+
+ # Test other Pages
+ with self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") as xDialog:
+ # Select the NumberingPage's Selector
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "1")
+ xNumberingPage = xDialog.getChild("PickNumberingPage")
+ xselector = xNumberingPage.getChild("valueset")
+ self.assertEqual(get_state_as_dict(xselector)["ItemsCount"], "8")
+ # Select element num 5
+ xselector.executeAction("CHOOSE", mkPropertyValues({"POS": "5"}))
+ self.assertEqual(get_state_as_dict(xselector)["SelectedItemPos"], "4")
+ self.assertEqual(get_state_as_dict(xselector)["SelectedItemId"], "5")
+ self.assertEqual(get_state_as_dict(xselector)["ItemText"], "Uppercase letter A) B) C)")
+ # Select element num 8
+ xselector.executeAction("CHOOSE", mkPropertyValues({"POS": "8"}))
+ self.assertEqual(get_state_as_dict(xselector)["SelectedItemPos"], "7")
+ self.assertEqual(get_state_as_dict(xselector)["SelectedItemId"], "8")
+ self.assertEqual(get_state_as_dict(xselector)["ItemText"], "Lowercase Roman number i. ii. iii.")
+
+ # Select the OutlinePage's Selector
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "2")
+ xOutlinePage = xDialog.getChild("PickOutlinePage")
+ xselector = xOutlinePage.getChild("valueset")
+ self.assertEqual(get_state_as_dict(xselector)["ItemsCount"], "8")
+ # Select element num 1
+ xselector.executeAction("CHOOSE", mkPropertyValues({"POS": "1"}))
+ self.assertEqual(get_state_as_dict(xselector)["SelectedItemPos"], "0")
+ self.assertEqual(get_state_as_dict(xselector)["SelectedItemId"], "1")
+ self.assertEqual(get_state_as_dict(xselector)["ItemText"], "Numeric, numeric, lowercase letters, solid small circular bullet")
+
+ # Select the GraphicPage's Selector
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "3")
+ xGraphicPage = xDialog.getChild("PickGraphicPage")
+ xselector = xGraphicPage.getChild("valueset")
+ self.assertEqual(get_state_as_dict(xselector)["ItemsCount"], "92")
+ # Select element num 22
+ xselector.executeAction("CHOOSE", mkPropertyValues({"POS": "22"}))
+ self.assertEqual(get_state_as_dict(xselector)["SelectedItemPos"], "21")
+ self.assertEqual(get_state_as_dict(xselector)["SelectedItemId"], "22")
+ # Select element num 73
+ xselector.executeAction("CHOOSE", mkPropertyValues({"POS": "73"}))
+ self.assertEqual(get_state_as_dict(xselector)["SelectedItemPos"], "72")
+ self.assertEqual(get_state_as_dict(xselector)["SelectedItemId"], "73")
+
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests2/formatCharacter.py b/sw/qa/uitest/writer_tests2/formatCharacter.py
new file mode 100644
index 000000000..196313368
--- /dev/null
+++ b/sw/qa/uitest/writer_tests2/formatCharacter.py
@@ -0,0 +1,246 @@
+# -*- 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 libreoffice.uno.propertyvalue import mkPropertyValues
+from uitest.uihelper.common import select_pos
+from uitest.uihelper.common import select_by_text
+
+class formatCharacter(UITestCase):
+
+ def test_format_character_tab_font(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:FontDialog") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "0")
+
+ # xNoteBook = xDialog.getChild("nbWestern") //western notebook is always active
+ xSizeFont = xDialog.getChild("cbWestSize")
+ xLangFont = xDialog.getChild("cbWestLanguage")
+ xSizeFont.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xSizeFont.executeAction("TYPE", mkPropertyValues({"TEXT":"18"}))
+ #set font size 18
+ select_pos(xLangFont, "0")
+
+ xNoteBook = xDialog.getChild("nbCJKCTL")
+ select_pos(xNoteBook, "0")
+ xSizeFontEast = xDialog.getChild("cbCJKSize")
+ xLangFontEast = xDialog.getChild("cbCJKLanguage")
+ xSizeFontEast.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xSizeFontEast.executeAction("TYPE", mkPropertyValues({"TEXT":"18"})) #set font size 18
+ select_pos(xLangFontEast, "0")
+
+ select_pos(xNoteBook, "1")
+ xSizeFontCTL = xDialog.getChild("cbCTLSize")
+ xLangFontCTL = xDialog.getChild("cbCTLLanguage")
+ xSizeFontCTL.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xSizeFontCTL.executeAction("TYPE", mkPropertyValues({"TEXT":"18"})) #set font size 18
+ select_pos(xLangFontCTL, "0")
+
+ with self.ui_test.execute_dialog_through_command(".uno:FontDialog", close_button="cancel") as xDialog:
+ xSizeFont = xDialog.getChild("cbWestSize")
+ self.assertEqual(get_state_as_dict(xSizeFont)["Text"], "18 pt")
+ xLangFont = xDialog.getChild("cbWestLanguage")
+ self.assertEqual(get_state_as_dict(xLangFont)["Text"], "[None]")
+
+ xNoteBook = xDialog.getChild("nbCJKCTL")
+ select_pos(xNoteBook, "0")
+ xSizeFontEast = xDialog.getChild("cbCJKSize")
+ self.assertEqual(get_state_as_dict(xSizeFontEast)["Text"], "18 pt")
+ xLangFontEast = xDialog.getChild("cbCJKLanguage")
+ self.assertEqual(get_state_as_dict(xLangFontEast)["Text"], "[None]")
+
+ select_pos(xNoteBook, "1")
+ xSizeFontCTL = xDialog.getChild("cbCTLSize")
+ self.assertEqual(get_state_as_dict(xSizeFontCTL)["Text"], "18 pt")
+ xLangFontCTL = xDialog.getChild("cbCTLLanguage")
+ self.assertEqual(get_state_as_dict(xLangFontCTL)["Text"], "[None]")
+
+
+
+ def test_format_character_tab_font_effects(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:FontDialog") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "1")
+
+ xEffects = xDialog.getChild("effectslb")
+ xRelief = xDialog.getChild("relieflb")
+ xHidden = xDialog.getChild("hiddencb")
+ xOverline = xDialog.getChild("overlinelb")
+ xStrikeout = xDialog.getChild("strikeoutlb")
+ xUnderline = xDialog.getChild("underlinelb")
+ xEmphasis = xDialog.getChild("emphasislb")
+ xPosition = xDialog.getChild("positionlb")
+
+ select_pos(xEffects, "1")
+ select_pos(xRelief, "1")
+ xHidden.executeAction("CLICK", tuple())
+ select_pos(xOverline, "1")
+ select_pos(xStrikeout, "1")
+ select_pos(xUnderline, "1")
+ select_pos(xEmphasis, "1")
+ select_pos(xPosition, "1")
+
+
+ with self.ui_test.execute_dialog_through_command(".uno:FontDialog", close_button="cancel") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "1")
+
+ xEffects = xDialog.getChild("effectslb")
+ xRelief = xDialog.getChild("relieflb")
+ xHidden = xDialog.getChild("hiddencb")
+ xOverline = xDialog.getChild("overlinelb")
+ xStrikeout = xDialog.getChild("strikeoutlb")
+ xUnderline = xDialog.getChild("underlinelb")
+ xEmphasis = xDialog.getChild("emphasislb")
+ xPosition = xDialog.getChild("positionlb")
+
+ self.assertEqual(get_state_as_dict(xEffects)["SelectEntryText"], "UPPERCASE")
+ self.assertEqual(get_state_as_dict(xRelief)["SelectEntryText"], "Embossed")
+ self.assertEqual(get_state_as_dict(xHidden)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(xOverline)["SelectEntryText"], "Single")
+ self.assertEqual(get_state_as_dict(xStrikeout)["SelectEntryText"], "Single")
+ self.assertEqual(get_state_as_dict(xUnderline)["SelectEntryText"], "Single")
+ self.assertEqual(get_state_as_dict(xEmphasis)["SelectEntryText"], "Dot")
+ self.assertEqual(get_state_as_dict(xPosition)["SelectEntryText"], "Below text")
+
+
+
+ def test_format_character_tab_hyperlink(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:FontDialog") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "4")
+
+ xURL = xDialog.getChild("urled")
+ xURL.executeAction("TYPE", mkPropertyValues({"TEXT":"libreoffice.org"}))
+ xTexted = xDialog.getChild("texted")
+ xTexted.executeAction("TYPE", mkPropertyValues({"TEXT":"LibreOffice"}))
+ xName = xDialog.getChild("nameed")
+ xName.executeAction("TYPE", mkPropertyValues({"TEXT":"hyperlink"}))
+
+ xVisited = xDialog.getChild("visitedlb")
+ select_by_text(xVisited, "Bullets")
+ xUnVisited = xDialog.getChild("unvisitedlb")
+ select_by_text(xUnVisited, "Bullets")
+
+
+ self.xUITest.executeCommand(".uno:GoLeft")
+ self.assertEqual(document.Text.String[0:11], "LibreOffice")
+
+ with self.ui_test.execute_dialog_through_command(".uno:FontDialog", close_button="cancel") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "4")
+ xURL = xDialog.getChild("urled")
+ xTexted = xDialog.getChild("texted")
+ xName = xDialog.getChild("nameed")
+ xVisited = xDialog.getChild("visitedlb")
+ xUnVisited = xDialog.getChild("unvisitedlb")
+
+ self.assertEqual(get_state_as_dict(xURL)["Text"], "http://libreoffice.org/")
+ self.assertEqual(get_state_as_dict(xTexted)["Text"], "LibreOffice")
+ self.assertEqual(get_state_as_dict(xName)["Text"], "hyperlink")
+ self.assertEqual(get_state_as_dict(xVisited)["SelectEntryText"], "Bullets")
+ self.assertEqual(get_state_as_dict(xUnVisited)["SelectEntryText"], "Bullets")
+
+
+ def test_format_character_tab_asian_layout(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:FontDialog") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "3")
+
+ xTwolines = xDialog.getChild("twolines")
+ xTwolines.executeAction("CLICK", tuple())
+
+
+ with self.ui_test.execute_dialog_through_command(".uno:FontDialog", close_button="cancel") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "3")
+ xTwolines = xDialog.getChild("twolines")
+
+ self.assertEqual(get_state_as_dict(xTwolines)["Selected"], "true")
+
+ def test_format_character_tab_position(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:FontDialog") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "2")
+
+ xSuperscript = xDialog.getChild("superscript")
+ xRelFontSize = xDialog.getChild("fontsizesb")
+ x90deg = xDialog.getChild("90deg")
+ xScalewidth = xDialog.getChild("scalewidthsb")
+ xKerning = xDialog.getChild("kerningsb")
+ xPairKerning = xDialog.getChild("pairkerning")
+ xFitToLine = xDialog.getChild("fittoline")
+
+ xSuperscript.executeAction("CLICK", tuple())
+ xRelFontSize.executeAction("UP", tuple())
+ x90deg.executeAction("CLICK", tuple())
+ xScalewidth.executeAction("UP", tuple())
+ xKerning.executeAction("UP", tuple())
+ xPairKerning.executeAction("CLICK", tuple())
+ xFitToLine.executeAction("CLICK", tuple())
+
+
+ with self.ui_test.execute_dialog_through_command(".uno:FontDialog", close_button="cancel") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "2")
+ xSuperscript = xDialog.getChild("superscript")
+ xRelFontSize = xDialog.getChild("fontsizesb")
+ x90deg = xDialog.getChild("90deg")
+ xScalewidth = xDialog.getChild("scalewidthsb")
+ xKerning = xDialog.getChild("kerningsb")
+ xPairKerning = xDialog.getChild("pairkerning")
+ xFitToLine = xDialog.getChild("fittoline")
+
+ self.assertEqual(get_state_as_dict(xSuperscript)["Checked"], "true")
+ self.assertEqual(get_state_as_dict(x90deg)["Checked"], "true")
+ self.assertEqual(get_state_as_dict(xScalewidth)["Text"], "100%")
+ self.assertEqual(get_state_as_dict(xKerning)["Text"], "0.1 pt")
+ self.assertEqual(get_state_as_dict(xPairKerning)["Selected"], "false")
+ self.assertEqual(get_state_as_dict(xFitToLine)["Selected"], "true")
+
+
+
+ def test_format_character_tab_position_scalewidthsb(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:FontDialog") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "2")
+
+ xScalewidth = xDialog.getChild("scalewidthsb")
+ xScalewidth.executeAction("UP", tuple())
+
+
+ with self.ui_test.execute_dialog_through_command(".uno:FontDialog", close_button="cancel") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "2")
+ xScalewidth = xDialog.getChild("scalewidthsb")
+ self.assertEqual(get_state_as_dict(xScalewidth)["Text"], "101%")
+
+
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests2/formatParagraph.py b/sw/qa/uitest/writer_tests2/formatParagraph.py
new file mode 100644
index 000000000..14882dc6b
--- /dev/null
+++ b/sw/qa/uitest/writer_tests2/formatParagraph.py
@@ -0,0 +1,541 @@
+# -*- 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 libreoffice.uno.propertyvalue import mkPropertyValues
+from uitest.uihelper.common import select_pos
+from uitest.uihelper.common import select_by_text
+from uitest.uihelper.common import change_measurement_unit
+
+class formatParagraph(UITestCase):
+
+ def test_format_paragraph_tab_indents_spacing(self):
+ with self.ui_test.create_doc_in_start_center("writer"):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "0")
+
+ xBeforeText = xDialog.getChild("spinED_LEFTINDENT")
+ xAfterText = xDialog.getChild("spinED_RIGHTINDENT")
+ xFirstLine = xDialog.getChild("spinED_FLINEINDENT")
+ xAutomaticChk = xDialog.getChild("checkCB_AUTO")
+ xAbovePar = xDialog.getChild("spinED_TOPDIST")
+ xBelowPar = xDialog.getChild("spinED_BOTTOMDIST")
+ xChkspace = xDialog.getChild("checkCB_CONTEXTUALSPACING")
+ xLineSpacing = xDialog.getChild("comboLB_LINEDIST")
+ xActivate = xDialog.getChild("checkCB_REGISTER")
+
+ xBeforeText.executeAction("UP", tuple())
+ xAfterText.executeAction("UP", tuple())
+ xFirstLine.executeAction("UP", tuple())
+ xAutomaticChk.executeAction("CLICK", tuple())
+ xAbovePar.executeAction("UP", tuple())
+ xBelowPar.executeAction("UP", tuple())
+ xChkspace.executeAction("CLICK", tuple())
+ select_by_text(xLineSpacing, "Double")
+ xActivate.executeAction("CLICK", tuple())
+
+
+ with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog", close_button="cancel") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "0")
+ xBeforeText = xDialog.getChild("spinED_LEFTINDENT")
+ xAfterText = xDialog.getChild("spinED_RIGHTINDENT")
+ xFirstLine = xDialog.getChild("spinED_FLINEINDENT")
+ xAutomaticChk = xDialog.getChild("checkCB_AUTO")
+ xAbovePar = xDialog.getChild("spinED_TOPDIST")
+ xBelowPar = xDialog.getChild("spinED_BOTTOMDIST")
+ xChkspace = xDialog.getChild("checkCB_CONTEXTUALSPACING")
+ xLineSpacing = xDialog.getChild("comboLB_LINEDIST")
+ xActivate = xDialog.getChild("checkCB_REGISTER")
+
+ self.assertEqual(get_state_as_dict(xBeforeText)["Text"], "0.50 ch")
+ self.assertEqual(get_state_as_dict(xAfterText)["Text"], "0.50 ch")
+ self.assertEqual(get_state_as_dict(xFirstLine)["Text"], "0.50 ch")
+ self.assertEqual(get_state_as_dict(xAutomaticChk)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(xAbovePar)["Text"], "0.50 line")
+ self.assertEqual(get_state_as_dict(xBelowPar)["Text"], "0.50 line")
+ self.assertEqual(get_state_as_dict(xChkspace)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(xLineSpacing)["SelectEntryText"], "Double")
+ self.assertEqual(get_state_as_dict(xActivate)["Selected"], "true")
+
+
+
+ def test_format_paragraph_tab_alignment(self):
+ with self.ui_test.create_doc_in_start_center("writer"):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "1")
+
+ xTextDirection = xDialog.getChild("comboLB_TEXTDIRECTION")
+ xAlignment = xDialog.getChild("comboLB_VERTALIGN")
+ xSnapToText = xDialog.getChild("checkCB_SNAP")
+ xJustified = xDialog.getChild("radioBTN_JUSTIFYALIGN")
+ xLastLine = xDialog.getChild("comboLB_LASTLINE")
+ xExpandChk = xDialog.getChild("checkCB_EXPAND")
+
+ select_by_text(xTextDirection, "Left-to-right (LTR)")
+ select_by_text(xAlignment, "Top")
+ xSnapToText.executeAction("CLICK", tuple())
+ xJustified.executeAction("CLICK", tuple())
+ select_by_text(xLastLine, "Justified")
+ xExpandChk.executeAction("CLICK", tuple())
+
+
+ with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog", close_button="cancel") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "1")
+
+ xTextDirection = xDialog.getChild("comboLB_TEXTDIRECTION")
+ xAlignment = xDialog.getChild("comboLB_VERTALIGN")
+ xSnapToText = xDialog.getChild("checkCB_SNAP")
+ xJustified = xDialog.getChild("radioBTN_JUSTIFYALIGN")
+ xLastLine = xDialog.getChild("comboLB_LASTLINE")
+ xExpandChk = xDialog.getChild("checkCB_EXPAND")
+
+ self.assertEqual(get_state_as_dict(xTextDirection)["SelectEntryText"], "Left-to-right (LTR)")
+ self.assertEqual(get_state_as_dict(xAlignment)["SelectEntryText"], "Top")
+ self.assertEqual(get_state_as_dict(xSnapToText)["Selected"], "false")
+ self.assertEqual(get_state_as_dict(xJustified)["Checked"], "true")
+ self.assertEqual(get_state_as_dict(xLastLine)["SelectEntryText"], "Justified")
+ self.assertEqual(get_state_as_dict(xExpandChk)["Selected"], "true")
+
+
+
+ def test_format_paragraph_tab_text_flow(self):
+ with self.ui_test.create_doc_in_start_center("writer"):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "2")
+
+ xAutomaticaly = xDialog.getChild("checkAuto")
+ xEnd = xDialog.getChild("spinLineEnd")
+ xBegin = xDialog.getChild("spinLineBegin")
+ xMax = xDialog.getChild("spinMaxNum")
+ xIns = xDialog.getChild("checkInsert")
+ xType = xDialog.getChild("comboBreakType")
+ xPosition = xDialog.getChild("comboBreakPosition")
+ xspinOrphan = xDialog.getChild("spinOrphan")
+ xspinWidow = xDialog.getChild("spinWidow")
+ xcheckWidow = xDialog.getChild("checkWidow")
+ xcheckOrphan = xDialog.getChild("checkOrphan")
+ xcheckSplitPara = xDialog.getChild("checkSplitPara")
+ xcheckKeepPara = xDialog.getChild("checkKeepPara")
+
+ xAutomaticaly.executeAction("CLICK", tuple())
+ xEnd.executeAction("UP", tuple())
+ xBegin.executeAction("UP", tuple())
+ xMax.executeAction("UP", tuple())
+ xIns.executeAction("CLICK", tuple())
+ select_by_text(xType, "Column")
+ select_by_text(xPosition, "After")
+ xspinOrphan.executeAction("UP", tuple())
+ xspinWidow.executeAction("UP", tuple())
+ xcheckWidow.executeAction("CLICK", tuple())
+ xcheckOrphan.executeAction("CLICK", tuple())
+ xcheckSplitPara.executeAction("CLICK", tuple())
+ xcheckKeepPara.executeAction("CLICK", tuple())
+
+
+ with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog", close_button="cancel") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "2")
+
+ xAutomaticaly = xDialog.getChild("checkAuto")
+ xEnd = xDialog.getChild("spinLineEnd")
+ xBegin = xDialog.getChild("spinLineBegin")
+ xMax = xDialog.getChild("spinMaxNum")
+ xIns = xDialog.getChild("checkInsert")
+ xType = xDialog.getChild("comboBreakType")
+ xPosition = xDialog.getChild("comboBreakPosition")
+ xspinOrphan = xDialog.getChild("spinOrphan")
+ xspinWidow = xDialog.getChild("spinWidow")
+ xcheckWidow = xDialog.getChild("checkWidow")
+ xcheckOrphan = xDialog.getChild("checkOrphan")
+ xcheckSplitPara = xDialog.getChild("checkSplitPara")
+ xcheckKeepPara = xDialog.getChild("checkKeepPara")
+
+ self.assertEqual(get_state_as_dict(xAutomaticaly)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(xEnd)["Text"], "3")
+ self.assertEqual(get_state_as_dict(xBegin)["Text"], "3")
+ self.assertEqual(get_state_as_dict(xMax)["Text"], "1")
+ self.assertEqual(get_state_as_dict(xIns)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(xType)["SelectEntryText"], "Column")
+ self.assertEqual(get_state_as_dict(xPosition)["SelectEntryText"], "After")
+ self.assertEqual(get_state_as_dict(xspinOrphan)["Text"], "2")
+ self.assertEqual(get_state_as_dict(xspinWidow)["Text"], "2")
+ self.assertEqual(get_state_as_dict(xcheckWidow)["Selected"], "false")
+ self.assertEqual(get_state_as_dict(xcheckOrphan)["Selected"], "false")
+ self.assertEqual(get_state_as_dict(xcheckSplitPara)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(xcheckKeepPara)["Selected"], "true")
+
+
+
+ def test_format_paragraph_tab_asian_typography(self):
+ with self.ui_test.create_doc_in_start_center("writer"):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "3")
+
+ xcheckForbidList = xDialog.getChild("checkForbidList")
+ xcheckHangPunct = xDialog.getChild("checkHangPunct")
+ xcheckApplySpacing = xDialog.getChild("checkApplySpacing")
+
+ xcheckForbidList.executeAction("CLICK", tuple())
+ xcheckHangPunct.executeAction("CLICK", tuple())
+ xcheckApplySpacing.executeAction("CLICK", tuple())
+
+
+ with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog", close_button="cancel") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "3")
+
+ xcheckForbidList = xDialog.getChild("checkForbidList")
+ xcheckHangPunct = xDialog.getChild("checkHangPunct")
+ xcheckApplySpacing = xDialog.getChild("checkApplySpacing")
+
+ self.assertEqual(get_state_as_dict(xcheckForbidList)["Selected"], "false")
+ self.assertEqual(get_state_as_dict(xcheckHangPunct)["Selected"], "false")
+ self.assertEqual(get_state_as_dict(xcheckApplySpacing)["Selected"], "false")
+
+
+
+ def test_format_paragraph_tab_outline_numbering(self):
+ with self.ui_test.create_doc_in_start_center("writer"):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "4")
+
+ xOutline = xDialog.getChild("comboLB_OUTLINE_LEVEL")
+ xNumbering = xDialog.getChild("comboLB_NUMBER_STYLE")
+ xPara = xDialog.getChild("checkCB_RESTART_PARACOUNT")
+ xParaSpin = xDialog.getChild("spinNF_RESTART_PARA")
+
+ select_by_text(xOutline, "Level 1")
+ select_by_text(xNumbering, "Bullet •")
+ xPara.executeAction("CLICK", tuple())
+ xParaSpin.executeAction("UP", tuple())
+
+
+ with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog", close_button="cancel") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "4")
+
+ xOutline = xDialog.getChild("comboLB_OUTLINE_LEVEL")
+ xNumbering = xDialog.getChild("comboLB_NUMBER_STYLE")
+ xPara = xDialog.getChild("checkCB_RESTART_PARACOUNT")
+ xParaSpin = xDialog.getChild("spinNF_RESTART_PARA")
+
+ self.assertEqual(get_state_as_dict(xOutline)["SelectEntryText"], "Level 1")
+ self.assertEqual(get_state_as_dict(xNumbering)["SelectEntryText"], "Bullet •")
+ self.assertEqual(get_state_as_dict(xPara)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(xParaSpin)["Text"], "2")
+
+
+
+ def test_format_paragraph_tab_tabs(self):
+ with self.ui_test.create_doc_in_start_center("writer"):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ change_measurement_unit(self, "Centimeter")
+
+ with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "5")
+
+ xDecimal = xDialog.getChild("radiobuttonBTN_TABTYPE_DECIMAL")
+ xDecimalTxt = xDialog.getChild("entryED_TABTYPE_DECCHAR")
+ xFill = xDialog.getChild("radiobuttonBTN_FILLCHAR_OTHER")
+ xFillTxt = xDialog.getChild("entryED_FILLCHAR_OTHER")
+ xNewButtn = xDialog.getChild("buttonBTN_NEW")
+ xED_TABPOS = xDialog.getChild("ED_TABPOS")
+
+ xDecimal.executeAction("CLICK", tuple())
+ xDecimalTxt.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xDecimalTxt.executeAction("TYPE", mkPropertyValues({"TEXT":"i"}))
+ xFill.executeAction("CLICK", tuple())
+ xFillTxt.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xFillTxt.executeAction("TYPE", mkPropertyValues({"TEXT":"p"}))
+ xED_TABPOS.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xED_TABPOS.executeAction("TYPE", mkPropertyValues({"TEXT":"1"}))
+ xNewButtn.executeAction("CLICK", tuple())
+
+
+ with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog", close_button="cancel") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "5")
+
+ xDecimal = xDialog.getChild("radiobuttonBTN_TABTYPE_DECIMAL")
+ xDecimalTxt = xDialog.getChild("entryED_TABTYPE_DECCHAR")
+ xFill = xDialog.getChild("radiobuttonBTN_FILLCHAR_OTHER")
+ xFillTxt = xDialog.getChild("entryED_FILLCHAR_OTHER")
+ xNewButtn = xDialog.getChild("buttonBTN_NEW")
+ xED_TABPOS = xDialog.getChild("ED_TABPOS")
+
+ self.assertEqual(get_state_as_dict(xDecimal)["Checked"], "true")
+ self.assertEqual(get_state_as_dict(xDecimalTxt)["Text"], "i")
+ self.assertEqual(get_state_as_dict(xFill)["Checked"], "true")
+ self.assertEqual(get_state_as_dict(xFillTxt)["Text"], "p")
+ self.assertEqual(get_state_as_dict(xED_TABPOS)["Text"], "1.00 cm")
+
+
+ with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "5")
+
+ xCentered = xDialog.getChild("radiobuttonBTN_TABTYPE_CENTER")
+ xUnderscore = xDialog.getChild("radiobuttonBTN_FILLCHAR_UNDERSCORE")
+ xNewButtn = xDialog.getChild("buttonBTN_NEW")
+
+ xCentered.executeAction("CLICK", tuple())
+ xUnderscore.executeAction("CLICK", tuple())
+ xNewButtn.executeAction("CLICK", tuple())
+
+ with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog", close_button="cancel") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "5")
+
+ xCentered = xDialog.getChild("radiobuttonBTN_TABTYPE_CENTER")
+ xUnderscore = xDialog.getChild("radiobuttonBTN_FILLCHAR_UNDERSCORE")
+ self.assertEqual(get_state_as_dict(xCentered)["Checked"], "true")
+ self.assertEqual(get_state_as_dict(xUnderscore)["Checked"], "true")
+
+
+ with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "5")
+
+ xRight = xDialog.getChild("radiobuttonST_RIGHTTAB_ASIAN")
+ xDashLine = xDialog.getChild("radiobuttonBTN_FILLCHAR_DASHLINE")
+ xNewButtn = xDialog.getChild("buttonBTN_NEW")
+
+ xRight.executeAction("CLICK", tuple())
+ xDashLine.executeAction("CLICK", tuple())
+ xNewButtn.executeAction("CLICK", tuple())
+
+ with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog", close_button="cancel") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "5")
+
+ xRight = xDialog.getChild("radiobuttonST_RIGHTTAB_ASIAN")
+ xDashLine = xDialog.getChild("radiobuttonBTN_FILLCHAR_DASHLINE")
+ self.assertEqual(get_state_as_dict(xRight)["Checked"], "true")
+ self.assertEqual(get_state_as_dict(xDashLine)["Checked"], "true")
+
+
+ with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "5")
+
+ xLeft = xDialog.getChild("radiobuttonST_LEFTTAB_ASIAN")
+ xPointsLine = xDialog.getChild("radiobuttonBTN_FILLCHAR_POINTS")
+ xNewButtn = xDialog.getChild("buttonBTN_NEW")
+
+ xLeft.executeAction("CLICK", tuple())
+ xPointsLine.executeAction("CLICK", tuple())
+ xNewButtn.executeAction("CLICK", tuple())
+
+ with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog", close_button="cancel") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "5")
+
+ xLeft = xDialog.getChild("radiobuttonST_LEFTTAB_ASIAN")
+ xPointsLine = xDialog.getChild("radiobuttonBTN_FILLCHAR_POINTS")
+ self.assertEqual(get_state_as_dict(xLeft)["Checked"], "true")
+ self.assertEqual(get_state_as_dict(xPointsLine)["Checked"], "true")
+
+
+
+ def test_format_paragraph_tab_drop_caps(self):
+ with self.ui_test.create_doc_in_start_center("writer"):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "6")
+
+ xDisplay = xDialog.getChild("checkCB_SWITCH")
+ xWholeWord = xDialog.getChild("checkCB_WORD")
+ xLines = xDialog.getChild("spinFLD_LINES")
+ xSpaceToText = xDialog.getChild("spinFLD_DISTANCE")
+ xText = xDialog.getChild("entryEDT_TEXT")
+ xCharStyle = xDialog.getChild("comboBOX_TEMPLATE")
+
+ xDisplay.executeAction("CLICK", tuple())
+ xWholeWord.executeAction("CLICK", tuple())
+ xLines.executeAction("UP", tuple())
+ xSpaceToText.executeAction("UP", tuple())
+ xText.executeAction("TYPE", mkPropertyValues({"TEXT":"A"}))
+ select_by_text(xCharStyle, "Definition")
+
+ with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog", close_button="cancel") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "6")
+
+ xDisplay = xDialog.getChild("checkCB_SWITCH")
+ xWholeWord = xDialog.getChild("checkCB_WORD")
+ xLines = xDialog.getChild("spinFLD_LINES")
+ xSpaceToText = xDialog.getChild("spinFLD_DISTANCE")
+ xText = xDialog.getChild("entryEDT_TEXT")
+ xCharStyle = xDialog.getChild("comboBOX_TEMPLATE")
+
+ self.assertEqual(get_state_as_dict(xDisplay)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(xWholeWord)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(xText)["Text"], "A")
+ self.assertEqual(get_state_as_dict(xCharStyle)["SelectEntryText"], "Definition")
+
+
+
+ def test_format_paragraph_tab_borders(self):
+ with self.ui_test.create_doc_in_start_center("writer"):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ change_measurement_unit(self, "Centimeter")
+
+ with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "7")
+
+ xStyle = xDialog.getChild("linestylelb")
+ xwidth = xDialog.getChild("linewidthmf")
+ xSync = xDialog.getChild("sync")
+ xLeft = xDialog.getChild("leftmf")
+ xRight = xDialog.getChild("rightmf")
+ xTop = xDialog.getChild("topmf")
+ xBottom = xDialog.getChild("bottommf")
+ xMerge = xDialog.getChild("mergewithnext")
+
+ xwidth.executeAction("UP", tuple())
+ xSync.executeAction("CLICK", tuple())
+ xLeft.executeAction("UP", tuple())
+ xLeft.executeAction("UP", tuple())
+ xRight.executeAction("UP", tuple())
+ xTop.executeAction("UP", tuple())
+ xBottom.executeAction("UP", tuple())
+ xMerge.executeAction("CLICK", tuple())
+
+
+ with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog", close_button="cancel") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "7")
+
+ xStyle = xDialog.getChild("linestylelb")
+ xwidth = xDialog.getChild("linewidthmf")
+ xSync = xDialog.getChild("sync")
+ xLeft = xDialog.getChild("leftmf")
+ xRight = xDialog.getChild("rightmf")
+ xTop = xDialog.getChild("topmf")
+ xBottom = xDialog.getChild("bottommf")
+ xMerge = xDialog.getChild("mergewithnext")
+
+ self.assertEqual(get_state_as_dict(xSync)["Selected"], "false")
+ self.assertEqual(get_state_as_dict(xMerge)["Selected"], "false")
+ self.assertEqual(get_state_as_dict(xLeft)["Text"], "0.20 cm")
+ self.assertEqual(get_state_as_dict(xRight)["Text"], "0.10 cm")
+ self.assertEqual(get_state_as_dict(xTop)["Text"], "0.10 cm")
+ self.assertEqual(get_state_as_dict(xBottom)["Text"], "0.10 cm")
+
+
+ def test_format_paragraph_area(self):
+ with self.ui_test.create_doc_in_start_center("writer"):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog", close_button="cancel") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "8")
+
+ xColor = xDialog.getChild("btncolor")
+ xGradient = xDialog.getChild("btngradient")
+ xBitmap = xDialog.getChild("btnbitmap")
+ xPattern = xDialog.getChild("btnpattern")
+ xHatch = xDialog.getChild("btnhatch")
+
+ xColor.executeAction("CLICK", tuple())
+ xGradient.executeAction("CLICK", tuple())
+ xBitmap.executeAction("CLICK", tuple())
+ xPattern.executeAction("CLICK", tuple())
+ xHatch.executeAction("CLICK", tuple())
+
+ def test_format_paragraph_transparency(self):
+ with self.ui_test.create_doc_in_start_center("writer"):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "9")
+
+ xTran = xDialog.getChild("RBT_TRANS_LINEAR")
+ xTranText = xDialog.getChild("MTR_TRANSPARENT")
+
+ xTran.executeAction("CLICK", tuple())
+ xTranText.executeAction("UP", tuple())
+
+
+ with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog", close_button="cancel") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "9")
+
+ xTran = xDialog.getChild("RBT_TRANS_LINEAR")
+ xTranText = xDialog.getChild("MTR_TRANSPARENT")
+
+ self.assertEqual(get_state_as_dict(xTran)["Checked"], "true")
+ self.assertEqual(get_state_as_dict(xTranText)["Text"], "51%")
+
+
+ with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "9")
+
+ xGradient = xDialog.getChild("RBT_TRANS_GRADIENT")
+ xType = xDialog.getChild("LB_TRGR_GRADIENT_TYPES")
+ xAngle = xDialog.getChild("MTR_TRGR_ANGLE")
+ xBorder = xDialog.getChild("MTR_TRGR_BORDER")
+ xStart = xDialog.getChild("MTR_TRGR_START_VALUE")
+ xEnd = xDialog.getChild("MTR_TRGR_END_VALUE")
+
+ xGradient.executeAction("CLICK", tuple())
+ select_by_text(xType, "Axial")
+ xAngle.executeAction("UP", tuple())
+ xBorder.executeAction("UP", tuple())
+ xStart.executeAction("UP", tuple())
+ xEnd.executeAction("UP", tuple())
+
+
+ with self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog", close_button="cancel") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "9")
+
+ xGradient = xDialog.getChild("RBT_TRANS_GRADIENT")
+ xType = xDialog.getChild("LB_TRGR_GRADIENT_TYPES")
+ xAngle = xDialog.getChild("MTR_TRGR_ANGLE")
+ xBorder = xDialog.getChild("MTR_TRGR_BORDER")
+ xStart = xDialog.getChild("MTR_TRGR_START_VALUE")
+ xEnd = xDialog.getChild("MTR_TRGR_END_VALUE")
+
+ self.assertEqual(get_state_as_dict(xGradient)["Checked"], "true")
+ self.assertEqual(get_state_as_dict(xType)["SelectEntryText"], "Axial")
+ self.assertEqual(get_state_as_dict(xAngle)["Text"], "1°")
+ self.assertEqual(get_state_as_dict(xBorder)["Text"], "1%")
+ self.assertEqual(get_state_as_dict(xStart)["Text"], "1%")
+ self.assertEqual(get_state_as_dict(xEnd)["Text"], "1%")
+
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests2/horizontalLine.py b/sw/qa/uitest/writer_tests2/horizontalLine.py
new file mode 100644
index 000000000..cecd517f0
--- /dev/null
+++ b/sw/qa/uitest/writer_tests2/horizontalLine.py
@@ -0,0 +1,35 @@
+# -*- 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, type_text
+
+class WriterInsertHorizontalLine(UITestCase):
+
+ def test_insert_horizontal_line(self):
+ with self.ui_test.create_doc_in_start_center("writer"):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+
+ type_text(xWriterEdit, "Test horizontal line") #write the text
+
+ self.xUITest.executeCommand(".uno:StyleApply?Style:string=Horizontal%20Line&FamilyName:string=ParagraphStyles") #insert horizontal line
+
+ with self.ui_test.execute_dialog_through_command(".uno:EditStyle", close_button="cancel") as xDialog:
+ xStyleNametxt = xDialog.getChild("name")
+ self.assertEqual(get_state_as_dict(xStyleNametxt)["Text"], "Horizontal Line") #check style name
+
+ self.xUITest.executeCommand(".uno:Undo")
+ self.xUITest.executeCommand(".uno:Redo")
+
+ with self.ui_test.execute_dialog_through_command(".uno:EditStyle", close_button="cancel") as xDialog:
+ xStyleNametxt = xDialog.getChild("name")
+ self.assertEqual(get_state_as_dict(xStyleNametxt)["Text"], "Horizontal Line") #check style name
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests2/insertFootnote.py b/sw/qa/uitest/writer_tests2/insertFootnote.py
new file mode 100644
index 000000000..176794684
--- /dev/null
+++ b/sw/qa/uitest/writer_tests2/insertFootnote.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 insertFootnote(UITestCase):
+
+ def test_insert_footnote(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:InsertFootnote")
+
+ type_text(xWriterEdit, "LibreOffice")
+ self.assertEqual(document.Footnotes[0].String, "LibreOffice")
+ self.assertEqual(document.Footnotes.getCount(), 1)
+
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(document.Footnotes[0].String, "")
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(document.Footnotes.getCount(), 0)
+ self.xUITest.executeCommand(".uno:Redo")
+ self.assertEqual(document.Footnotes[0].String, "")
+ self.assertEqual(document.Footnotes.getCount(), 1)
+ self.xUITest.executeCommand(".uno:Redo")
+ self.assertEqual(document.Footnotes[0].String, "LibreOffice")
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests2/pasteSpecial.py b/sw/qa/uitest/writer_tests2/pasteSpecial.py
new file mode 100644
index 000000000..abbc067ef
--- /dev/null
+++ b/sw/qa/uitest/writer_tests2/pasteSpecial.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 uitest.uihelper.common import type_text
+
+class PasteSpecial(UITestCase):
+
+ def test_pasteSpecial(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 i in range(5):
+ self.xUITest.executeCommand(".uno:SelectAll")
+ self.xUITest.executeCommand(".uno:Copy")
+
+ with self.ui_test.execute_dialog_through_command(".uno:PasteSpecial") as xDialog:
+
+ xList = xDialog.getChild('list')
+ xChild = xList.getChild(str(i))
+
+ xChild.executeAction("SELECT", tuple())
+
+
+ self.xUITest.executeCommand(".uno:Undo")
+
+ self.assertEqual(document.Text.String, "test")
+
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests2/tdf116474.py b/sw/qa/uitest/writer_tests2/tdf116474.py
new file mode 100644
index 000000000..dca0e790a
--- /dev/null
+++ b/sw/qa/uitest/writer_tests2/tdf116474.py
@@ -0,0 +1,47 @@
+# -*- 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_url_for_data_file
+
+#Bug 116474 - Undo/redo: The redo of adding caption to an image isn't working: no image
+
+class tdf116474(UITestCase):
+
+ def test_tdf116474_insert_caption_undo(self):
+ with self.ui_test.create_doc_in_start_center("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ text = document.getText()
+ cursor = text.createTextCursor()
+ textGraphic = document.createInstance('com.sun.star.text.TextGraphicObject')
+ provider = self.xContext.ServiceManager.createInstance('com.sun.star.graphic.GraphicProvider')
+ graphic = provider.queryGraphic( mkPropertyValues({"URL": get_url_for_data_file("LibreOffice.jpg")}))
+ textGraphic.Graphic = graphic
+ text.insertTextContent(cursor, textGraphic, False)
+ #select image
+ document.getCurrentController().select(document.getDrawPage()[0])
+
+ with self.ui_test.execute_dialog_through_command(".uno:InsertCaptionDialog") as xDialogCaption:
+
+ xCapt = xDialogCaption.getChild("caption_edit")
+ xCapt.executeAction("TYPE", mkPropertyValues({"TEXT":"Caption"}))
+
+
+ xFrame = document.TextFrames[0]
+ self.assertEqual(document.TextFrames[0].Text.String, "Figure 1: Caption")
+ self.assertEqual(document.GraphicObjects.getCount(), 1) #nr. of images
+ #Undo, redo
+ self.xUITest.executeCommand(".uno:Undo")
+ self.xUITest.executeCommand(".uno:Redo")
+ #Verify
+ self.assertEqual(document.TextFrames[0].Text.String, "Figure 1: Caption")
+ self.assertEqual(document.GraphicObjects.getCount(), 1) #nr. of images
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests2/tdf146375.py b/sw/qa/uitest/writer_tests2/tdf146375.py
new file mode 100644
index 000000000..e22e6c4d3
--- /dev/null
+++ b/sw/qa/uitest/writer_tests2/tdf146375.py
@@ -0,0 +1,76 @@
+# -*- 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, select_by_text
+from libreoffice.uno.propertyvalue import mkPropertyValues
+import random
+import string
+
+class Tdf146375(UITestCase):
+
+ def test_tdf146375(self):
+ with self.ui_test.create_doc_in_start_center("writer") as document:
+
+ count = 0
+ # Use a random name
+ categoryName = ''.join(random.choice(string.ascii_lowercase) for i in range(15))
+ renamedCategory = categoryName + "-renamed"
+
+ with self.ui_test.execute_dialog_through_command(".uno:NewDoc", close_button="close") as xDialog:
+ xFilterFolder = xDialog.getChild("filter_folder")
+ self.assertEqual("All Categories", get_state_as_dict(xFilterFolder)["SelectEntryText"])
+ count = int(get_state_as_dict(xFilterFolder)["EntryCount"])
+
+ xActionMenu = xDialog.getChild("action_menu")
+
+ # Create a new category
+ with self.ui_test.execute_blocking_action(
+ xActionMenu.executeAction, args=('OPENFROMLIST', mkPropertyValues({"POS": "0"}))) as xNameDialog:
+ xEntry = xNameDialog.getChild("entry")
+ xEntry.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xEntry.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xEntry.executeAction("TYPE", mkPropertyValues({"TEXT": categoryName}))
+
+ self.assertEqual(count + 1, int(get_state_as_dict(xFilterFolder)["EntryCount"]))
+
+ select_by_text(xFilterFolder, categoryName)
+ self.assertEqual(categoryName, get_state_as_dict(xFilterFolder)["SelectEntryText"])
+
+ # Rename the category
+ with self.ui_test.execute_blocking_action(
+ xActionMenu.executeAction, args=('OPENFROMLIST', mkPropertyValues({"POS": "1"}))) as xNameDialog:
+ xEntry = xNameDialog.getChild("entry")
+ xEntry.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xEntry.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xEntry.executeAction("TYPE", mkPropertyValues({"TEXT": renamedCategory}))
+
+ self.assertEqual(count + 1, int(get_state_as_dict(xFilterFolder)["EntryCount"]))
+ self.assertEqual(renamedCategory, get_state_as_dict(xFilterFolder)["SelectEntryText"])
+
+ with self.ui_test.execute_dialog_through_command(".uno:NewDoc", close_button="close") as xDialog:
+ xFilterFolder = xDialog.getChild("filter_folder")
+ self.assertEqual(count + 1, int(get_state_as_dict(xFilterFolder)["EntryCount"]))
+
+ select_by_text(xFilterFolder, renamedCategory)
+
+ # Without the fix in place, this test would have failed with
+ # AssertionError: 'zwpyzgwuwleanap-renamed' != 'All Categories'
+ self.assertEqual(renamedCategory, get_state_as_dict(xFilterFolder)["SelectEntryText"])
+
+ xActionMenu = xDialog.getChild("action_menu")
+
+ # Delete the category
+ with self.ui_test.execute_blocking_action(
+ xActionMenu.executeAction, args=('OPENFROMLIST', mkPropertyValues({"POS": "2"})), close_button="yes") as xNameDialog:
+ pass
+
+ self.assertEqual(count, int(get_state_as_dict(xFilterFolder)["EntryCount"]))
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
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:
diff --git a/sw/qa/uitest/writer_tests4/exportToPDF.py b/sw/qa/uitest/writer_tests4/exportToPDF.py
new file mode 100644
index 000000000..e88255948
--- /dev/null
+++ b/sw/qa/uitest/writer_tests4/exportToPDF.py
@@ -0,0 +1,76 @@
+# -*- 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, get_url_for_data_file
+from uitest.uihelper.common import type_text
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from org.libreoffice.unotest import systemPathToFileUrl
+from tempfile import TemporaryDirectory
+import os.path
+
+class exportToPDF(UITestCase):
+
+ def test_checkDefaultValues(self):
+
+ with TemporaryDirectory() as tempdir:
+ xFilePath = os.path.join(tempdir, 'exportToPDFFromWriter-tmp.pdf')
+
+ with self.ui_test.create_doc_in_start_center("writer"):
+
+ xMainWindow = self.xUITest.getTopFocusWindow()
+ xEdit = xMainWindow.getChild("writer_edit")
+
+ type_text(xEdit, "Hello World")
+
+ # Export as PDF
+ with self.ui_test.execute_dialog_through_command('.uno:ExportToPDF', close_button="") as xDialog:
+
+ selectedChildren = ['bookmarks', 'display', 'effects', 'enablea11y', 'enablecopy', 'exporturl', 'forms', 'reduceresolution']
+
+ for child in selectedChildren:
+ self.assertEqual("true", get_state_as_dict(xDialog.getChild(child))['Selected'])
+
+ nonSelectedChildren = ['allowdups', 'center', 'comments', 'convert', 'embed', 'emptypages', 'export', 'exportplaceholders',
+ 'firstonleft', 'hiddenpages', 'menubar', 'notes', 'onlynotes', 'open', 'pdfa', 'pdfua', 'resize', 'singlepagesheets',
+ 'tagged', 'toolbar', 'usereferencexobject', 'viewpdf', 'watermark', 'window']
+
+ for child in nonSelectedChildren:
+ self.assertEqual("false", get_state_as_dict(xDialog.getChild(child))['Selected'])
+
+ checkedChildren = ['all', 'allbookmarks', 'changeany', 'default', 'defaultlayout', 'fitdefault', 'jpegcompress', 'pageonly', 'printhigh']
+
+ for child in checkedChildren:
+ self.assertEqual("true", get_state_as_dict(xDialog.getChild(child))['Checked'])
+
+ nonCheckedChildren = ['changecomment', 'changeform', 'changeinsdel', 'changenone', 'contfacinglayout', 'contlayout', 'fitvis',
+ 'fitwidth', 'fitwin', 'fitzoom', 'losslesscompress', 'openinternet', 'openpdf', 'outline', 'printlow', 'printnone', 'range',
+ 'selection', 'singlelayout', 'thumbs', 'visiblebookmark']
+
+ for child in nonCheckedChildren:
+ self.assertEqual("false", get_state_as_dict(xDialog.getChild(child))['Checked'])
+
+ self.assertEqual("300 DPI", get_state_as_dict(xDialog.getChild("resolution"))['Text'])
+ self.assertEqual("90", get_state_as_dict(xDialog.getChild("quality"))['Value'])
+ self.assertEqual("FDF", get_state_as_dict(xDialog.getChild("format"))['DisplayText'])
+
+ xOk = xDialog.getChild("ok")
+ with self.ui_test.execute_dialog_through_action(xOk, "CLICK", close_button="open") as xSaveDialog:
+ xFileName = xSaveDialog.getChild('file_name')
+ xFileName.executeAction('TYPE', mkPropertyValues({'KEYCODE':'CTRL+A'}))
+ xFileName.executeAction('TYPE', mkPropertyValues({'KEYCODE':'BACKSPACE'}))
+ xFileName.executeAction('TYPE', mkPropertyValues({'TEXT': xFilePath}))
+
+ self.ui_test.wait_until_file_is_available(xFilePath)
+
+ with self.ui_test.load_file(systemPathToFileUrl(xFilePath)) as document:
+
+ self.assertEqual("Hello World", document.DrawPages[0].getByIndex(0).String)
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests4/insertBreakDialog.py b/sw/qa/uitest/writer_tests4/insertBreakDialog.py
new file mode 100644
index 000000000..9299d46aa
--- /dev/null
+++ b/sw/qa/uitest/writer_tests4/insertBreakDialog.py
@@ -0,0 +1,70 @@
+# -*- 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_pos
+
+class WriterInsertBreakDialog(UITestCase):
+
+ def getPages(self, total):
+ document = self.ui_test.get_component()
+
+ self.assertEqual(document.CurrentController.PageCount, total)
+
+ def test_insert_line_break(self):
+
+ with self.ui_test.create_doc_in_start_center("writer"):
+
+ with self.ui_test.execute_dialog_through_command(".uno:InsertBreak") as xDialog:
+ xOption = xDialog.getChild("linerb")
+ xOption.executeAction("CLICK", tuple())
+
+ self.getPages(1)
+
+
+ def test_insert_column_break(self):
+
+ with self.ui_test.create_doc_in_start_center("writer"):
+
+ with self.ui_test.execute_dialog_through_command(".uno:InsertBreak") as xDialog:
+ xOption = xDialog.getChild("columnrb")
+ xOption.executeAction("CLICK", tuple())
+
+ self.getPages(1)
+
+
+ def test_insert_page_break(self):
+
+ with self.ui_test.create_doc_in_start_center("writer"):
+
+ for i in range(9):
+ with self.subTest(i=i):
+ with self.ui_test.execute_dialog_through_command(".uno:InsertBreak") as xDialog:
+
+ xOption = xDialog.getChild("pagerb")
+ xOption.executeAction("CLICK", tuple())
+
+ xStyleList = xDialog.getChild("stylelb")
+ select_pos(xStyleList, str(i))
+
+ self.getPages(i + 2)
+
+
+ def test_cancel_button_insert_line_break_dialog(self):
+
+ with self.ui_test.create_doc_in_start_center("writer"):
+
+ with self.ui_test.execute_dialog_through_command(".uno:InsertBreak", close_button="cancel"):
+ pass
+
+ self.getPages(1)
+
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests4/insertPageHeader.py b/sw/qa/uitest/writer_tests4/insertPageHeader.py
new file mode 100644
index 000000000..9da58db9a
--- /dev/null
+++ b/sw/qa/uitest/writer_tests4/insertPageHeader.py
@@ -0,0 +1,78 @@
+# -*- 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
+
+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)
+
+ with self.ui_test.execute_dialog_through_command(
+ ".uno:InsertPageHeader?PageStyle:string=Default%20Page%20Style&On:bool=false", close_button="yes"):
+ pass
+
+ self.assertEqual(
+ document.StyleFamilies.PageStyles.Standard.HeaderIsOn, False)
+
+ def test_header(self):
+ with self.ui_test.create_doc_in_start_center("writer") as document:
+
+ self.insert_header()
+
+ self.delete_header()
+
+
+ def test_tdf107427(self):
+ with self.ui_test.create_doc_in_start_center("writer") as document:
+
+ self.insert_header()
+
+ 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_header()
+
+ def test_tdf146248(self):
+ with self.ui_test.load_file(get_url_for_data_file("tdf146248.docx")):
+
+ self.delete_header()
+
+ # crashed before
+ self.xUITest.executeCommand(".uno:Undo")
+
+ document = self.ui_test.get_component()
+ self.assertEqual(
+ document.StyleFamilies.PageStyles.Standard.HeaderIsOn, True)
+
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests4/spellDialog.py b/sw/qa/uitest/writer_tests4/spellDialog.py
new file mode 100644
index 000000000..4d2b4b622
--- /dev/null
+++ b/sw/qa/uitest/writer_tests4/spellDialog.py
@@ -0,0 +1,141 @@
+# -*- 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 re
+from uitest.framework import UITestCase
+from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
+
+from libreoffice.linguistic.linguservice import get_spellchecker
+from com.sun.star.lang import Locale
+
+class SpellingAndGrammarDialog(UITestCase):
+
+ def is_supported_locale(self, language, country):
+ xSpellChecker = get_spellchecker(self.ui_test._xContext)
+ locales = xSpellChecker.getLocales()
+ for locale in locales:
+ if language != None:
+ if locale.Language != language:
+ continue
+
+ if country != None:
+ if locale.Country != country:
+ continue
+
+ # we found the correct combination
+ return True
+
+ TDF46852_INPUT = """\
+dogg
+dogg
+catt dogg
+frogg frogg
+frogg catt dogg
+dogg catt
+frog, dogg, catt"""
+
+ TDF46852_REGEX = """\
+([a-z]+)
+\\1
+([a-z]+) \\1
+([a-z]+) \\3
+\\3 \\2 \\1
+\\1 \\2
+\\3, \\1, \\2"""
+
+ def test_tdf46852(self):
+ supported_locale = self.is_supported_locale("en", "US")
+ if not supported_locale:
+ self.skipTest("no dictionary support for en_US available")
+ # This automates the steps described in the bug report tdf#46852
+
+ # Step 1: Create a document with repetitious misspelled words
+ with self.ui_test.create_doc_in_start_center("writer") as document:
+ cursor = document.getCurrentController().getViewCursor()
+ # Inserted text must be en_US, so make sure to set language in current location
+ cursor.CharLocale = Locale("en", "US", "")
+ input_text = self.TDF46852_INPUT.replace('\n', '\r') # \r = para break
+ document.Text.insertString(cursor, input_text, False)
+
+ # Step 2: Place cursor on 4th line after second "frogg"
+ cursor.goUp(2, False)
+ cursor.goLeft(1, False)
+
+ # Step 3: Initiate spellchecking, and make sure "Check grammar" is
+ # unchecked
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:SpellingAndGrammarDialog", close_button="") as xDialog:
+ checkgrammar = xDialog.getChild('checkgrammar')
+ if get_state_as_dict(checkgrammar)['Selected'] == 'true':
+ checkgrammar.executeAction('CLICK', ())
+ self.assertTrue(get_state_as_dict(checkgrammar)['Selected'] == 'false')
+
+ # Step 4: Repetitively click on "Correct all" for each misspelling
+ # prompt until end of document is reached.
+ changeall = xDialog.getChild('changeall')
+ changeall.executeAction("CLICK", ())
+ changeall.executeAction("CLICK", ())
+ # The third time we click on changeall, the click action is going to
+ # block while two message boxes are shown, so we need to do this third
+ # click specially
+ # Use empty close_button to open consecutive dialogs
+ with self.ui_test.execute_blocking_action(
+ changeall.executeAction, args=('CLICK', ()), close_button="") as dialog:
+ # Step 5: Confirm to "Continue check at beginning of document"
+ xYesBtn = dialog.getChild("yes")
+
+ with self.ui_test.execute_blocking_action(
+ xYesBtn.executeAction, args=('CLICK', ())):
+ pass
+
+ output_text = document.Text.getString().replace('\r\n', '\n')
+ self.assertTrue(re.match(self.TDF46852_REGEX, output_text))
+
+ def test_tdf136855(self):
+ supported_locale = self.is_supported_locale("en", "US")
+ if not supported_locale:
+ self.skipTest("no dictionary support for en_US available")
+
+ with self.ui_test.load_file(get_url_for_data_file("tdf136855.odt")) as writer_doc:
+
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:SpellingAndGrammarDialog", close_button="close") as xDialog:
+
+ xChangeBtn = xDialog.getChild('change')
+ for i in range(6):
+ # Without the fix in place, this test would have crashed here
+ xChangeBtn.executeAction("CLICK", ())
+
+ output_text = writer_doc.Text.getString().replace('\n', '').replace('\r', '')
+ self.assertTrue(output_text.startswith("xx xx xx xxxxxxxxxxix xxxxxxxxxxxxxxviii"))
+
+ def test_tdf66043(self):
+ supported_locale = self.is_supported_locale("en", "US")
+ if not supported_locale:
+ self.skipTest("no dictionary support for en_US available")
+ with self.ui_test.load_file(get_url_for_data_file("tdf66043.fodt")) as writer_doc:
+ # Step 1: Initiate spellchecking, and make sure "Check grammar" is
+ # unchecked
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:SpellingAndGrammarDialog", close_button="close") as xDialog:
+ checkgrammar = xDialog.getChild('checkgrammar')
+ if get_state_as_dict(checkgrammar)['Selected'] == 'true':
+ checkgrammar.executeAction('CLICK', ())
+ self.assertTrue(get_state_as_dict(checkgrammar)['Selected'] == 'false')
+
+ # Step 2: Click on "Correct all" for each misspelling
+ # prompt until end of document is reached.
+ changeall = xDialog.getChild('changeall')
+ changeall.executeAction("CLICK", ())
+
+ output_text = writer_doc.Text.getString().replace('\r\n', '\n')
+ # This was "gooodgood baaad eeend" ("goood" is a deletion,
+ # "good" is an insertion by fixing the first misspelling),
+ # but now "goood" is not a misspelling because it is accepted
+ # correctly without the redline containing a deleted "o"
+ self.assertEqual(output_text, 'goood baaadbaaed eeend')
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab: \ No newline at end of file
diff --git a/sw/qa/uitest/writer_tests4/start.py b/sw/qa/uitest/writer_tests4/start.py
new file mode 100644
index 000000000..64d41ff02
--- /dev/null
+++ b/sw/qa/uitest/writer_tests4/start.py
@@ -0,0 +1,49 @@
+# -*- 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 libreoffice.uno.propertyvalue import mkPropertyValues
+
+from uitest.framework import UITestCase
+from uitest.uihelper.common import get_state_as_dict
+
+class SimpleWriterTest(UITestCase):
+
+ def test_start_writer(self):
+
+ with self.ui_test.create_doc_in_start_center("writer"):
+
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+
+ xWriterEdit.executeAction("SET", mkPropertyValues({"ZOOM": "200"}))
+
+ self.assertEqual(get_state_as_dict(xWriterEdit)["Zoom"], "200")
+
+
+ def test_goto_first_page(self):
+
+ with self.ui_test.create_doc_in_start_center("writer"):
+
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+
+ state = get_state_as_dict(xWriterEdit)
+ while state["CurrentPage"] == "1":
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
+ state = get_state_as_dict(xWriterEdit)
+
+ self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2")
+
+ xWriterEdit.executeAction("GOTO", mkPropertyValues({"PAGE": "1"}))
+
+ self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "1")
+
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests4/tdf113252.py b/sw/qa/uitest/writer_tests4/tdf113252.py
new file mode 100644
index 000000000..4278d2536
--- /dev/null
+++ b/sw/qa/uitest/writer_tests4/tdf113252.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 get_state_as_dict
+from uitest.uihelper.common import select_pos
+#Bug 113252 - Basic Library Organizer is broken and closing dialogs crashes
+
+class tdf113252(UITestCase):
+
+ def test_tdf113252_macro_dialog(self):
+ with self.ui_test.create_doc_in_start_center("writer"):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+
+ #Start LibreOffice. Go to Tools > Macros > Organize Macros > Basic
+ with self.ui_test.execute_dialog_through_command(".uno:MacroDialog", close_button="close") as xDialog:
+
+ #Click Button Organizer
+ xorganize = xDialog.getChild("organize")
+ with self.ui_test.execute_blocking_action(xorganize.executeAction, args=('CLICK', ()), close_button="close") as dialog:
+ xTabs = dialog.getChild("tabcontrol")
+ select_pos(xTabs, "0")
+ select_pos(xTabs, "1")
+ select_pos(xTabs, "2")
+ #Click button Close in the next dialog -> crash.
+
+
+ self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "1")
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests4/tdf113284.py b/sw/qa/uitest/writer_tests4/tdf113284.py
new file mode 100644
index 000000000..3f04b3ff6
--- /dev/null
+++ b/sw/qa/uitest/writer_tests4/tdf113284.py
@@ -0,0 +1,40 @@
+# -*- 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 tdf113284(UITestCase):
+
+ def test_tdf113284(self):
+ with self.ui_test.load_file(get_url_for_data_file("tdf113284.odt")) as writer_doc:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+
+ xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit')
+ xToolkit.processEventsToIdle()
+
+ xPageCount = writer_doc.CurrentController.PageCount
+ with self.ui_test.execute_dialog_through_command(".uno:GotoPage") as xDialog:
+ xPageText = xDialog.getChild("page")
+ xPageText.executeAction("TYPE", mkPropertyValues({"TEXT":str(xPageCount)})) # goto last page
+
+ xToolkit.processEventsToIdle()
+
+ self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], str(xPageCount))
+ with self.ui_test.execute_dialog_through_command(".uno:EditCurIndex", close_button="cancel"):
+ pass
+
+ #page count is not constant
+ #self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "66") #page 66 start of the Index
+ #pagecount unchanged
+ self.assertEqual(writer_doc.CurrentController.PageCount, xPageCount)
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests4/tdf122449.py b/sw/qa/uitest/writer_tests4/tdf122449.py
new file mode 100644
index 000000000..4c4f91e75
--- /dev/null
+++ b/sw/qa/uitest/writer_tests4/tdf122449.py
@@ -0,0 +1,43 @@
+# -*- 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
+
+#Bug 122449 - Crash in: mergedlo.dll when closing "Edit Index Entry" dialog (gen/gtk)
+
+class tdf122449(UITestCase):
+
+ def test_tdf122449_crash_edit_index_entry(self):
+ with self.ui_test.load_file(get_url_for_data_file("tdf122449.odt")) as writer_doc:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+ #search word Autocorrect (second find) .uno:SearchDialog
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button="close") as xDialog:
+
+ searchterm = xDialog.getChild("searchterm")
+ searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"Autocorrection"}))
+ xsearch = xDialog.getChild("search")
+ xsearch.executeAction("CLICK", tuple()) #first search
+ xsearch.executeAction("CLICK", tuple()) #2nd search
+ self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "6")
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "HOME"}))
+ # invoke Index dialog Index entry .uno:IndexEntryDialog
+ with self.ui_test.execute_dialog_through_command(".uno:IndexEntryDialog", close_button="close"):
+ pass
+ # close
+ # Go to page 2
+ with self.ui_test.execute_dialog_through_command(".uno:GotoPage") as xDialog:
+ xPageText = xDialog.getChild("page")
+ xPageText.executeAction("TYPE", mkPropertyValues({"TEXT":"2"}))
+ # verify
+ self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2")
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests4/tdf134439.py b/sw/qa/uitest/writer_tests4/tdf134439.py
new file mode 100644
index 000000000..7348049d1
--- /dev/null
+++ b/sw/qa/uitest/writer_tests4/tdf134439.py
@@ -0,0 +1,54 @@
+# -*- 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, get_url_for_data_file
+from uitest.uihelper.common import select_by_text
+from libreoffice.uno.propertyvalue import mkPropertyValues
+
+class tdf134439(UITestCase):
+
+ def test_tdf134439(self):
+
+ with self.ui_test.load_file(get_url_for_data_file("tdf134439.odt")) as document:
+
+ self.assertEqual(document.CurrentController.PageCount, 3)
+
+ xCursor = document.CurrentController.ViewCursor
+ self.assertEqual("Chap 1", xCursor.PageStyleName)
+
+ xPageBreak = self.ui_test.wait_until_child_is_available('PageBreak')
+ with self.ui_test.execute_dialog_through_action(xPageBreak, "EDIT") as xDialog:
+
+
+ self.assertEqual("Page", get_state_as_dict(xDialog.getChild("comboBreakType"))["SelectEntryText"])
+ self.assertEqual("Before", get_state_as_dict(xDialog.getChild("comboBreakPosition"))["SelectEntryText"])
+
+ xPageStyle = xDialog.getChild("comboPageStyle")
+ self.assertEqual("Chap 2", get_state_as_dict(xPageStyle)["SelectEntryText"])
+
+ select_by_text(xPageStyle, "Chap 3")
+
+ self.assertEqual("Chap 3", get_state_as_dict(xPageStyle)["SelectEntryText"])
+
+ # tdf#116070: Without the fix in place, this test would have crashed here
+
+ # Without the fix in place, this test would have failed with
+ # AssertionError: 'Chap 1' != 'Chap 3'
+ self.assertEqual("Chap 1", xCursor.PageStyleName)
+
+ self.assertEqual(document.CurrentController.PageCount, 3)
+
+ xCursor.jumpToNextPage()
+ self.assertEqual("Chap 3", xCursor.PageStyleName)
+
+ self.xUITest.executeCommand(".uno:Undo")
+
+ self.assertEqual("Chap 2", xCursor.PageStyleName)
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests4/tdf135636.py b/sw/qa/uitest/writer_tests4/tdf135636.py
new file mode 100644
index 000000000..0fd3aec66
--- /dev/null
+++ b/sw/qa/uitest/writer_tests4/tdf135636.py
@@ -0,0 +1,40 @@
+# -*- 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, get_url_for_data_file
+
+class tdf135636(UITestCase):
+
+ def test_tdf135636(self):
+
+ with self.ui_test.load_file(get_url_for_data_file("tdf135636.odt")) as document:
+
+ self.assertEqual(document.CurrentController.PageCount, 2)
+
+ xPageBreak = self.ui_test.wait_until_child_is_available('PageBreak')
+ with self.ui_test.execute_dialog_through_action(xPageBreak, "EDIT") as xDialog:
+
+
+ xBreak = xDialog.getChild("break")
+ self.assertEqual("true", get_state_as_dict(xBreak)["Selected"])
+
+ xBreak.executeAction("CLICK", tuple())
+
+ self.assertEqual("false", get_state_as_dict(xBreak)["Selected"])
+
+
+ # Without the fix in place, this test would have failed with
+ # AssertionError: 2 != 1
+ self.assertEqual(document.CurrentController.PageCount, 1)
+
+ self.xUITest.executeCommand(".uno:Undo")
+
+ self.assertEqual(document.CurrentController.PageCount, 2)
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests4/tdf136578.py b/sw/qa/uitest/writer_tests4/tdf136578.py
new file mode 100644
index 000000000..13dc063a3
--- /dev/null
+++ b/sw/qa/uitest/writer_tests4/tdf136578.py
@@ -0,0 +1,31 @@
+# -*- 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
+
+class tdf136578(UITestCase):
+
+ def test_tdf136578(self):
+
+ with self.ui_test.load_file(get_url_for_data_file("tdf136578.odt")) as document:
+
+ self.assertEqual(document.CurrentController.PageCount, 2)
+
+ xPageBreak = self.ui_test.wait_until_child_is_available('PageBreak')
+ xPageBreak.executeAction("DELETE", tuple())
+
+ # Without the fix in place, this test would have failed with
+ # AssertionError: 1 != 2
+ self.assertEqual(document.CurrentController.PageCount, 1)
+
+ self.xUITest.executeCommand(".uno:Undo")
+
+ self.assertEqual(document.CurrentController.PageCount, 2)
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests4/tdf138546.py b/sw/qa/uitest/writer_tests4/tdf138546.py
new file mode 100644
index 000000000..89abcf7da
--- /dev/null
+++ b/sw/qa/uitest/writer_tests4/tdf138546.py
@@ -0,0 +1,38 @@
+# -*- 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 change_measurement_unit
+from uitest.uihelper.common import get_state_as_dict
+from uitest.uihelper.common import select_pos
+from uitest.uihelper.common import get_url_for_data_file
+
+class tdf138546(UITestCase):
+ def test_tdf138546(self):
+ with self.ui_test.load_file(get_url_for_data_file("tdf138546.odt")):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ change_measurement_unit(self, "Centimeter")
+
+ #dialog Columns
+ with self.ui_test.execute_dialog_through_command(".uno:FormatColumns", close_button="cancel") as xDialog:
+
+ colsnf = xDialog.getChild("colsnf")
+ width1mf = xDialog.getChild("width1mf")
+ self.assertEqual(get_state_as_dict(colsnf)["Text"], "2")
+ self.assertEqual((get_state_as_dict(width1mf)["Text"])[0:3], "2.0") #2.00 cm
+
+ with self.ui_test.execute_dialog_through_command(".uno:PageDialog", close_button="cancel") as xDialog:
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "7") #Columns
+ colsnf = xDialog.getChild("colsnf")
+ width1mf = xDialog.getChild("width1mf")
+ self.assertEqual(get_state_as_dict(colsnf)["Text"], "2")
+ self.assertEqual((get_state_as_dict(width1mf)["Text"])[0:3], "2.0") #2.00 cm
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests4/tdf148395.py b/sw/qa/uitest/writer_tests4/tdf148395.py
new file mode 100644
index 000000000..312733525
--- /dev/null
+++ b/sw/qa/uitest/writer_tests4/tdf148395.py
@@ -0,0 +1,47 @@
+# -*- 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
+
+class Tdf148395(UITestCase):
+
+ def test_tdf148395(self):
+
+ with self.ui_test.create_doc_in_start_center("writer") as document:
+
+ with self.ui_test.execute_dialog_through_command(".uno:InsertObject") as xDialog:
+ xTypes = xDialog.getChild("types")
+ xCreateNew = xDialog.getChild("createnew")
+
+ self.assertEqual('true', get_state_as_dict(xCreateNew)['Checked'])
+
+ xSelectedEntry = get_state_as_dict(xTypes)['SelectEntryText']
+ self.assertTrue('Spreadsheet' in xSelectedEntry )
+
+ for i in range(10):
+ xTypes.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"}))
+ xSelectedEntry = get_state_as_dict(xTypes)['SelectEntryText']
+ if 'Chart' in xSelectedEntry:
+ break
+
+ self.assertEqual(1, document.EmbeddedObjects.Count)
+ self.assertEqual("SwXTextEmbeddedObject", document.CurrentSelection.getImplementationName())
+
+ xChartMainTop = self.xUITest.getTopFocusWindow()
+ xChartMain = xChartMainTop.getChild("chart_window")
+ xSeriesObj = xChartMain.getChild("CID/Page=")
+
+ # Without the fix in place, this test would have crashed here
+ with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramArea"})) as xDialog:
+ pass
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests4/tdf92611.py b/sw/qa/uitest/writer_tests4/tdf92611.py
new file mode 100644
index 000000000..a0feb2f6b
--- /dev/null
+++ b/sw/qa/uitest/writer_tests4/tdf92611.py
@@ -0,0 +1,23 @@
+# -*- 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 tdf92611(UITestCase):
+
+ def test_launch_and_close_bibliography(self):
+
+ with self.ui_test.create_doc_in_start_center("writer"):
+
+ self.xUITest.executeCommand(".uno:BibliographyComponent")
+
+ self.xUITest.executeCommand(".uno:CloseWin")
+
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests5/DateFormFieldPropertiesDialog.py b/sw/qa/uitest/writer_tests5/DateFormFieldPropertiesDialog.py
new file mode 100644
index 000000000..9eb36eefb
--- /dev/null
+++ b/sw/qa/uitest/writer_tests5/DateFormFieldPropertiesDialog.py
@@ -0,0 +1,133 @@
+# -*- 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, get_url_for_data_file
+
+class dateFormFieldDialog(UITestCase):
+
+ def test_setting_date_format(self):
+ # open a file with a date form field
+ with self.ui_test.load_file(get_url_for_data_file("date_form_field.odt")) as writer_doc:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ # open the dialog (cursor is at the field)
+ with self.ui_test.execute_dialog_through_command(".uno:ControlProperties") as xDialog:
+
+ itemsList = xDialog.getChild("date_formats_treeview")
+
+ # check whether we have the right format selected
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "20")
+ self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "12/31/99")
+
+ # select a new format
+ itemsList.getChild("11").executeAction("SELECT", tuple());
+ self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "12-31")
+
+
+ # open the dialog again
+ with self.ui_test.execute_dialog_through_command(".uno:ControlProperties") as xDialog:
+ itemsList = xDialog.getChild("date_formats_treeview")
+ self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "12-31")
+
+
+ def test_date_field_with_custom_format(self):
+ # open a file with a date form field
+ with self.ui_test.load_file(get_url_for_data_file("date_form_field_custom_format.odt")) as writer_doc:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ # open the dialog (cursor is at the field)
+ with self.ui_test.execute_dialog_through_command(".uno:ControlProperties") as xDialog:
+
+ itemsList = xDialog.getChild("date_formats_treeview")
+
+ # check whether we have the right format selected
+ # This is awkward though because checking for a fixed number of
+ # entries if the selected default format happens to equal a
+ # standard system format the entry gets duplicated with
+ # "[System]" appended. So this may be either 20 or 21 ... and
+ # in that case it is the selected format and the
+ # SelectEntryText doesn't match the sample string, so all this
+ # is rather fragile depending on actual locale data.
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "21")
+ self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "1999. december 31., péntek[System]")
+
+
+ def test_date_reformat(self):
+ # open a file with a date form field
+ with self.ui_test.load_file(get_url_for_data_file("date_form_field.odt")) as writer_doc:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ self.assertEqual(writer_doc.getText().getString(), "07/17/19")
+
+ # open the dialog (cursor is at the field)
+ with self.ui_test.execute_dialog_through_command(".uno:ControlProperties") as xDialog:
+
+ itemsList = xDialog.getChild("date_formats_treeview")
+
+ # check whether we have the right format selected
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "20")
+ self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "12/31/99")
+
+ # select a new format
+ itemsList.getChild("11").executeAction("SELECT", tuple());
+ self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "12-31")
+
+
+ # after applying the new format, the field content should be updated
+ self.assertEqual(writer_doc.getText().getString(), "07-17")
+
+ def test_date_field_with_placeholder(self):
+ # open a file with a date form field
+ with self.ui_test.load_file(get_url_for_data_file("date_form_field_with_placeholder.odt")) as writer_doc:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ self.assertEqual(writer_doc.getText().getString(), "[select date]")
+
+ # open the dialog (cursor is at the field)
+ with self.ui_test.execute_dialog_through_command(".uno:ControlProperties") as xDialog:
+
+ itemsList = xDialog.getChild("date_formats_treeview")
+
+ # check whether we have the right format selected
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "20")
+ self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "Fri 31/Dec 99")
+
+ # select a new format
+ itemsList.getChild("11").executeAction("SELECT", tuple());
+ self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "12-31")
+
+
+ # a placeholder text is not changed by format change
+ self.assertEqual(writer_doc.getText().getString(), "[select date]")
+
+ def test_date_field_without_current_date(self):
+ # current date means the current date fieldmark parameter which contains the current date in YYYY-MM-DD format
+ # when this parameter is missing LO tries to parse the content string to find out the set date
+
+ # open a file with a date form field
+ with self.ui_test.load_file(get_url_for_data_file("date_form_field_without_current_date.odt")) as writer_doc:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ self.assertEqual(writer_doc.getText().getString(), "07/17/19")
+
+ # open the dialog (cursor is at the field)
+ with self.ui_test.execute_dialog_through_command(".uno:ControlProperties") as xDialog:
+
+ itemsList = xDialog.getChild("date_formats_treeview")
+
+ # check whether we have the right format selected
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "20")
+ self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "12/31/99")
+
+ # select a new format
+ itemsList.getChild("3").executeAction("SELECT", tuple());
+ self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "Dec 31, 1999")
+
+
+ # a placeholder text is not changed by format change
+ self.assertEqual(writer_doc.getText().getString(), "Jul 17, 2019")
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests5/DropDownFormFieldPropertiesDialog.py b/sw/qa/uitest/writer_tests5/DropDownFormFieldPropertiesDialog.py
new file mode 100644
index 000000000..e64e32b02
--- /dev/null
+++ b/sw/qa/uitest/writer_tests5/DropDownFormFieldPropertiesDialog.py
@@ -0,0 +1,238 @@
+# -*- 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, get_url_for_data_file
+from libreoffice.uno.propertyvalue import mkPropertyValues
+
+class dropDownFormFieldDialog(UITestCase):
+
+ def test_add_new_items(self):
+
+ # open a file with an empty form field
+ with self.ui_test.load_file(get_url_for_data_file("empty_drop_down_form_field.odt")) as writer_doc:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ # open the dialog (cursor is at the field)
+ with self.ui_test.execute_dialog_through_command(".uno:ControlProperties") as xDialog:
+
+ itemEntry = xDialog.getChild("item_entry")
+ addButton = xDialog.getChild("add_button")
+ itemsList = xDialog.getChild("items_treeview")
+
+ # initial state
+ self.assertEqual(get_state_as_dict(itemEntry)["Text"], "")
+ self.assertEqual(get_state_as_dict(addButton)["Enabled"], "false")
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "0")
+
+ # add some new items
+ itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"1000"}))
+ self.assertEqual(get_state_as_dict(addButton)["Enabled"], "true")
+ addButton.executeAction("CLICK", tuple())
+ self.assertEqual(get_state_as_dict(addButton)["Enabled"], "false")
+ itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"2000"}))
+ addButton.executeAction("CLICK", tuple())
+ itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"3000"}))
+ addButton.executeAction("CLICK", tuple())
+ itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"4000"}))
+ addButton.executeAction("CLICK", tuple())
+
+ # check whether the items are there in the list
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "4")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "2000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "3000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("3"))["Text"], "4000")
+
+
+ # check whether items are the same after reopening
+ with self.ui_test.execute_dialog_through_command(".uno:ControlProperties") as xDialog:
+
+ itemsList = xDialog.getChild("items_treeview")
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "4")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "2000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "3000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("3"))["Text"], "4000")
+
+
+ def test_remove_items(self):
+
+ # open a file with an empty form field
+ with self.ui_test.load_file(get_url_for_data_file("empty_drop_down_form_field.odt")) as writer_doc:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ # open the dialog (cursor is at the field)
+ with self.ui_test.execute_dialog_through_command(".uno:ControlProperties") as xDialog:
+
+ itemEntry = xDialog.getChild("item_entry")
+ addButton = xDialog.getChild("add_button")
+ itemsList = xDialog.getChild("items_treeview")
+ removeButton = xDialog.getChild("remove_button")
+
+ # initial state
+ self.assertEqual(get_state_as_dict(itemEntry)["Text"], "")
+ self.assertEqual(get_state_as_dict(addButton)["Enabled"], "false")
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "0")
+ self.assertEqual(get_state_as_dict(removeButton)["Enabled"], "false")
+
+ # add some new items
+ itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"1000"}))
+ self.assertEqual(get_state_as_dict(addButton)["Enabled"], "true")
+ addButton.executeAction("CLICK", tuple())
+ self.assertEqual(get_state_as_dict(removeButton)["Enabled"], "true")
+ itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"2000"}))
+ addButton.executeAction("CLICK", tuple())
+ itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"3000"}))
+ addButton.executeAction("CLICK", tuple())
+ itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"4000"}))
+ addButton.executeAction("CLICK", tuple())
+
+ # check whether the items are there in the list
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "4")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "2000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "3000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("3"))["Text"], "4000")
+
+ # select an item from the list and remove it
+ itemsList.getChild("1").executeAction("SELECT", tuple());
+ removeButton.executeAction("CLICK", tuple())
+
+ # check whether the right item was removed
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "3")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "3000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "4000")
+
+
+ # check whether items are the same after reopening
+ with self.ui_test.execute_dialog_through_command(".uno:ControlProperties") as xDialog:
+
+ itemsList = xDialog.getChild("items_treeview")
+ removeButton = xDialog.getChild("remove_button")
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "3")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "3000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "4000")
+
+ # remove all items
+ itemsList.getChild("1").executeAction("SELECT", tuple());
+ removeButton.executeAction("CLICK", tuple())
+ removeButton.executeAction("CLICK", tuple())
+ removeButton.executeAction("CLICK", tuple())
+
+ self.assertEqual(get_state_as_dict(removeButton)["Enabled"], "false")
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "0")
+
+
+ def test_move_items(self):
+
+ # open a file with an empty form field
+ with self.ui_test.load_file(get_url_for_data_file("empty_drop_down_form_field.odt")) as writer_doc:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ # open the dialog (cursor is at the field)
+ with self.ui_test.execute_dialog_through_command(".uno:ControlProperties") as xDialog:
+
+ itemEntry = xDialog.getChild("item_entry")
+ addButton = xDialog.getChild("add_button")
+ itemsList = xDialog.getChild("items_treeview")
+ upButton = xDialog.getChild("up_button")
+ downButton = xDialog.getChild("down_button")
+
+ # initial state
+ self.assertEqual(get_state_as_dict(itemEntry)["Text"], "")
+ self.assertEqual(get_state_as_dict(addButton)["Enabled"], "false")
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "0")
+ self.assertEqual(get_state_as_dict(upButton)["Enabled"], "false")
+ self.assertEqual(get_state_as_dict(downButton)["Enabled"], "false")
+
+ # add some new items
+ itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"1000"}))
+ self.assertEqual(get_state_as_dict(addButton)["Enabled"], "true")
+ addButton.executeAction("CLICK", tuple())
+ itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"2000"}))
+ addButton.executeAction("CLICK", tuple())
+ itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"3000"}))
+ addButton.executeAction("CLICK", tuple())
+ itemEntry.executeAction("TYPE", mkPropertyValues({"TEXT":"4000"}))
+ addButton.executeAction("CLICK", tuple())
+
+ # check whether the items are there in the list
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "4")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "2000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "3000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("3"))["Text"], "4000")
+
+ # select an item from the list and move it up
+ itemsList.getChild("1").executeAction("SELECT", tuple())
+ self.assertEqual(get_state_as_dict(upButton)["Enabled"], "true")
+ self.assertEqual(get_state_as_dict(downButton)["Enabled"], "true")
+ upButton.executeAction("CLICK", tuple())
+ self.assertEqual(get_state_as_dict(upButton)["Enabled"], "false")
+ self.assertEqual(get_state_as_dict(downButton)["Enabled"], "true")
+
+ # check whether the item was correctly moved
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "4")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "2000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "1000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "3000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("3"))["Text"], "4000")
+
+ # move down the selected item
+ downButton.executeAction("CLICK", tuple())
+ downButton.executeAction("CLICK", tuple())
+ downButton.executeAction("CLICK", tuple())
+ self.assertEqual(get_state_as_dict(upButton)["Enabled"], "true")
+ self.assertEqual(get_state_as_dict(downButton)["Enabled"], "false")
+
+ # check whether the item was correctly moved
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "4")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "3000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "4000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("3"))["Text"], "2000")
+
+
+ # check whether items are the same after reopening
+ with self.ui_test.execute_dialog_through_command(".uno:ControlProperties") as xDialog:
+
+ itemsList = xDialog.getChild("items_treeview")
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "4")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "3000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "4000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("3"))["Text"], "2000")
+
+
+ def test_drop_down_after_import(self):
+
+ files = ["drop_down_form_field.odt", "drop_down_form_field.doc", "drop_down_form_field.docx"]
+ for file in files:
+ # open a file with a drop-down for field with items and selection
+ with self.ui_test.load_file(get_url_for_data_file(file)) as writer_doc:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ # open the dialog (cursor is at the field)
+ with self.ui_test.execute_dialog_through_command(".uno:ControlProperties") as xDialog:
+
+ itemsList = xDialog.getChild("items_treeview")
+
+ # check whether the items are there in the list
+ self.assertEqual(get_state_as_dict(itemsList)["Children"], "4")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("0"))["Text"], "1000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("1"))["Text"], "2000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("2"))["Text"], "3000")
+ self.assertEqual(get_state_as_dict(itemsList.getChild("3"))["Text"], "4000")
+
+ self.assertEqual(get_state_as_dict(itemsList)["SelectEntryText"], "3000")
+
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests5/about_test.py b/sw/qa/uitest/writer_tests5/about_test.py
new file mode 100644
index 000000000..980eca989
--- /dev/null
+++ b/sw/qa/uitest/writer_tests5/about_test.py
@@ -0,0 +1,22 @@
+# -*- 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 AboutDlgTest(UITestCase):
+
+ def test_about_dlg(self):
+
+ with self.ui_test.create_doc_in_start_center("writer"):
+
+ with self.ui_test.execute_dialog_through_command(".uno:About", close_button="btnClose"):
+ pass
+
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests5/autocorrectOptions.py b/sw/qa/uitest/writer_tests5/autocorrectOptions.py
new file mode 100644
index 000000000..a1305018e
--- /dev/null
+++ b/sw/qa/uitest/writer_tests5/autocorrectOptions.py
@@ -0,0 +1,98 @@
+# -*- 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
+
+class autocorrectOptions(UITestCase):
+
+ def test_autocorrect_options_writer(self):
+ with self.ui_test.create_doc_in_start_center("writer"):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ with self.ui_test.execute_dialog_through_command(".uno:AutoCorrectDlg", close_button="cancel") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "0") #tab replace
+ origtext = xDialog.getChild("origtext")
+ newtext = xDialog.getChild("newtext")
+ xnew = xDialog.getChild("new")
+ xdelete = xDialog.getChild("delete")
+ xtabview = xDialog.getChild("tabview")
+ xreset = xDialog.getChild("reset")
+ nrRows = get_state_as_dict(xtabview)["VisibleCount"]
+
+ self.assertTrue(int(nrRows) > 0)
+
+ #add new rule
+ origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ origtext.executeAction("TYPE", mkPropertyValues({"TEXT":"::::"}))
+ newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ newtext.executeAction("TYPE", mkPropertyValues({"TEXT":"dvojtecky"}))
+ xnew.executeAction("CLICK", tuple())
+ nrRowsNew = get_state_as_dict(xtabview)["VisibleCount"]
+ nrRowsDiff = int(nrRowsNew) - int(nrRows)
+ self.assertEqual(nrRowsDiff, 1) #we have +1 rule
+ #delete rule
+ origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ origtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ origtext.executeAction("TYPE", mkPropertyValues({"TEXT":"::::"}))
+ newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ newtext.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ newtext.executeAction("TYPE", mkPropertyValues({"TEXT":"dvojtecky"}))
+ xdelete.executeAction("CLICK", tuple())
+ self.assertEqual(get_state_as_dict(xtabview)["VisibleCount"], nrRows) #we have default nr of rules
+
+ select_pos(xTabs, "1") #tab Exceptions
+ #abbreviations
+ abbrev = xDialog.getChild("abbrev")
+ newabbrev = xDialog.getChild("newabbrev")
+ delabbrev = xDialog.getChild("delabbrev")
+ abbrevlist = xDialog.getChild("abbrevlist")
+
+ nrRowsAbb = get_state_as_dict(abbrevlist)["VisibleCount"]
+
+ self.assertTrue(int(nrRowsAbb) > 0)
+
+ abbrev.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ abbrev.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ abbrev.executeAction("TYPE", mkPropertyValues({"TEXT":"qqqqq"}))
+ newabbrev.executeAction("CLICK", tuple())
+ nrRowsAbbNew = get_state_as_dict(abbrevlist)["VisibleCount"]
+ nrRowsAbbDiff = int(nrRowsAbbNew) - int(nrRowsAbb)
+ self.assertEqual(nrRowsAbbDiff, 1) #we have +1 rule
+ delabbrev.executeAction("CLICK", tuple())
+ self.assertEqual(get_state_as_dict(abbrevlist)["VisibleCount"], nrRowsAbb) #we have default nr of rules
+
+ #words with two initial capitals
+ double = xDialog.getChild("double")
+ newdouble = xDialog.getChild("newdouble")
+ deldouble = xDialog.getChild("deldouble")
+ doublelist = xDialog.getChild("doublelist")
+
+ nrRowsDouble = get_state_as_dict(doublelist)["VisibleCount"]
+
+ self.assertTrue(int(nrRowsDouble) > 0)
+
+ double.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ double.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ double.executeAction("TYPE", mkPropertyValues({"TEXT":"QQqqq"}))
+ newdouble.executeAction("CLICK", tuple())
+ nrRowsDoubleNew = get_state_as_dict(doublelist)["VisibleCount"]
+ nrRowsDoubleDiff = int(nrRowsDoubleNew) - int(nrRowsDouble) #convert string and
+ self.assertEqual(nrRowsDoubleDiff, 1) #we have +1 rule
+ deldouble.executeAction("CLICK", tuple())
+ self.assertEqual(get_state_as_dict(doublelist)["VisibleCount"], nrRowsDouble) #we have default nr of rules
+
+
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests5/columns.py b/sw/qa/uitest/writer_tests5/columns.py
new file mode 100644
index 000000000..a70f31143
--- /dev/null
+++ b/sw/qa/uitest/writer_tests5/columns.py
@@ -0,0 +1,48 @@
+# -*- 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 change_measurement_unit
+from libreoffice.uno.propertyvalue import mkPropertyValues
+#uitest sw / Columns dialog
+
+class columns(UITestCase):
+ def test_columns(self):
+ with self.ui_test.create_doc_in_start_center("writer"):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ change_measurement_unit(self, "Centimeter")
+
+ #dialog Columns
+ with self.ui_test.execute_dialog_through_command(".uno:FormatColumns") as xDialog:
+
+ colsnf = xDialog.getChild("colsnf")
+ colsnf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ colsnf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ colsnf.executeAction("TYPE", mkPropertyValues({"TEXT":"2"}))
+ colsnf.executeAction("UP", tuple())
+ colsnf.executeAction("DOWN", tuple())
+ spacing1mf = xDialog.getChild("spacing1mf")
+ spacing1mf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ spacing1mf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ spacing1mf.executeAction("TYPE", mkPropertyValues({"TEXT":"1"}))
+ autowidth = xDialog.getChild("autowidth")
+ autowidth.executeAction("CLICK", tuple())
+ #verify
+ with self.ui_test.execute_dialog_through_command(".uno:FormatColumns", close_button="cancel") as xDialog:
+ colsnf = xDialog.getChild("colsnf")
+ spacing1mf = xDialog.getChild("spacing1mf")
+ autowidth = xDialog.getChild("autowidth")
+
+ self.assertEqual(get_state_as_dict(colsnf)["Text"], "2")
+ self.assertEqual(get_state_as_dict(spacing1mf)["Text"], "1.00 cm")
+ self.assertEqual(get_state_as_dict(autowidth)["Selected"], "false")
+
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests5/tdf106899.py b/sw/qa/uitest/writer_tests5/tdf106899.py
new file mode 100644
index 000000000..bd77c2945
--- /dev/null
+++ b/sw/qa/uitest/writer_tests5/tdf106899.py
@@ -0,0 +1,43 @@
+# -*- 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 org.libreoffice.unotest
+from uitest.framework import UITestCase
+from uitest.uihelper.common import get_url_for_data_file
+
+class tdf106899(UITestCase):
+
+ def test_tdf106899_alphabetical_index_utf8(self):
+ # Copy concordance file containing an utf8 index entry
+ org.libreoffice.unotest.makeCopyFromTDOC("tdf106899.sdi")
+ with self.ui_test.load_file(get_url_for_data_file("tdf106899.odt")) as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ # Update the alphabetical index and check if it contains the utf8 index entry
+ xDocumentIndexes = document.DocumentIndexes
+ self.assertEqual(xDocumentIndexes.getCount(), 1)
+ self.assertEqual(xDocumentIndexes.hasByName("Alphabetical Index1"), True)
+ xDocumentIndex = xDocumentIndexes.getByName("Alphabetical Index1")
+ xIndexAnchor = xDocumentIndex.getAnchor()
+ self.assertEqual("Nguyễn Khánh" in xIndexAnchor.getString(), False)
+
+ # TODO Bug Report - Refresh of the index does only work using .uno:UpdateAllIndexes
+ # It does not work with xDocumentIndex.refresh() nor with xDocumentIndex.update()
+ self.xUITest.executeCommand(".uno:UpdateAllIndexes")
+
+ # TODO Bug Report - Retrieving the text of the updated index only works using the cursor
+ # It does not work with xIndexAnchor.getString()
+ xCursor = document.getText().createTextCursor()
+ xCursor.gotoRange(xDocumentIndex.getAnchor().getEnd(), False)
+ xCursor.gotoStartOfParagraph(True)
+
+ # Without the fix in place the index does not contain the utf8 index entry
+ self.assertEqual("Nguyễn Khánh" in xCursor.getString(), True)
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests5/tdf117039.py b/sw/qa/uitest/writer_tests5/tdf117039.py
new file mode 100644
index 000000000..a08885308
--- /dev/null
+++ b/sw/qa/uitest/writer_tests5/tdf117039.py
@@ -0,0 +1,26 @@
+# -*- 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
+
+#Bug 117039 - Print Preview crashes on signed document
+
+class tdf117039(UITestCase):
+ def test_tdf117039_preview_signed_document(self):
+ with self.ui_test.load_file(get_url_for_data_file("tdf117039.odt")) as writer_doc:
+ self.xUITest.executeCommand(".uno:PrintPreview") #open print preview
+ self.xUITest.executeCommand(".uno:ClosePreview") # close print preview
+
+ self.xUITest.getTopFocusWindow() #Get focus after closing preview
+
+ #verify
+ self.assertEqual(writer_doc.Text.String[0:22], "Test digital signature")
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests5/tdf118540.py b/sw/qa/uitest/writer_tests5/tdf118540.py
new file mode 100644
index 000000000..e33cad63b
--- /dev/null
+++ b/sw/qa/uitest/writer_tests5/tdf118540.py
@@ -0,0 +1,28 @@
+# -*- 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
+
+#Bug 118540 - LO6.1b2: DOCX crashes when properties are opened in print preview mode
+
+class tdf118540(UITestCase):
+ def test_tdf118540_preview_document_properties(self):
+ with self.ui_test.load_file(get_url_for_data_file("tdf118540.docx")) as writer_doc:
+ self.xUITest.executeCommand(".uno:PrintPreview") #open print preview
+ with self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties"):
+ pass
+ self.xUITest.executeCommand(".uno:ClosePreview") # close print preview
+
+ self.xUITest.getTopFocusWindow() #Get focus after closing preview
+
+ #verify
+ self.assertEqual(writer_doc.Text.String[0:4], "Test")
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests5/tdf122045.py b/sw/qa/uitest/writer_tests5/tdf122045.py
new file mode 100644
index 000000000..6e938e093
--- /dev/null
+++ b/sw/qa/uitest/writer_tests5/tdf122045.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 uitest.uihelper.common import select_pos
+
+class tdf122045(UITestCase):
+
+ def test_tdf122045(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:PageDialog", close_button="cancel") as xDialog:
+
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "2")
+
+ btncolor = xDialog.getChild("btncolor")
+ btncolor.executeAction("CLICK", tuple())
+
+ xApplyBtn = xDialog.getChild("apply")
+ xApplyBtn.executeAction("CLICK", tuple())
+
+ self.assertTrue(document.isModified())
+ self.assertEqual("0x729fcf", hex(document.StyleFamilies.PageStyles.Standard.BackColor))
+
+
+ self.assertTrue(document.isModified())
+ self.assertEqual("0x729fcf", hex(document.StyleFamilies.PageStyles.Standard.BackColor))
+
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests5/tdf122722.py b/sw/qa/uitest/writer_tests5/tdf122722.py
new file mode 100644
index 000000000..ebbbd18db
--- /dev/null
+++ b/sw/qa/uitest/writer_tests5/tdf122722.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_state_as_dict, type_text
+from uitest.uihelper.common import select_pos
+
+#Bug 122722 - Hiding characters will crash. Crash in: SwAttrIter::CtorInitAttrIter(SwTextNode &,SwScriptInfo &,SwTextFrame const *)
+
+class tdf122722(UITestCase):
+ def test_tdf122722_format_character_hidden(self):
+ with self.ui_test.create_doc_in_start_center("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+ #1. Start LibreOffice
+ #2. Create New Writer Document
+ #3. Type "LibreOffice" in Writer
+ type_text(xWriterEdit, "LibreOffice")
+ #4. Select "LibreOffice" with mouse, and right click
+ self.xUITest.executeCommand(".uno:SelectAll")
+ self.assertEqual(document.Text.String[0:11], "LibreOffice")
+ #5. Appear Context Menu, Character -> Character
+ #6. Opened Character, Select "Font Effect" tab
+ #7. Check Hidden, and click [OK]
+ #8. Crash a LibreOffice
+ with self.ui_test.execute_dialog_through_command(".uno:FontDialog") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "1")
+
+ xEffects = xDialog.getChild("effectslb")
+ xRelief = xDialog.getChild("relieflb")
+ xHidden = xDialog.getChild("hiddencb")
+ xOverline = xDialog.getChild("overlinelb")
+ xStrikeout = xDialog.getChild("strikeoutlb")
+ xUnderline = xDialog.getChild("underlinelb")
+ xEmphasis = xDialog.getChild("emphasislb")
+ xPosition = xDialog.getChild("positionlb")
+
+ xHidden.executeAction("CLICK", tuple())
+
+ #un-hidden
+ with self.ui_test.execute_dialog_through_command(".uno:FontDialog") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "1")
+
+ xEffects = xDialog.getChild("effectslb")
+ xRelief = xDialog.getChild("relieflb")
+ xHidden = xDialog.getChild("hiddencb")
+ xOverline = xDialog.getChild("overlinelb")
+ xStrikeout = xDialog.getChild("strikeoutlb")
+ xUnderline = xDialog.getChild("underlinelb")
+ xEmphasis = xDialog.getChild("emphasislb")
+ xPosition = xDialog.getChild("positionlb")
+
+ self.assertEqual(get_state_as_dict(xHidden)["Selected"], "true")
+ xHidden.executeAction("CLICK", tuple())
+
+
+ self.assertEqual(document.Text.String[0:11], "LibreOffice")
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests5/tdf123378.py b/sw/qa/uitest/writer_tests5/tdf123378.py
new file mode 100644
index 000000000..b0b35d266
--- /dev/null
+++ b/sw/qa/uitest/writer_tests5/tdf123378.py
@@ -0,0 +1,28 @@
+# -*- 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
+
+#Bug 123378 - Printing always sets "document modified" status
+
+class tdf123378(UITestCase):
+ def test_tdf123378_print_sets_modified(self):
+ # FIXME unstable test
+ return
+ with self.ui_test.create_doc_in_start_center("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ self.xUITest.executeCommand(".uno:Print")
+ xDialog = self.xUITest.getTopFocusWindow()
+ xOK = xDialog.getChild("cancel")
+ self.ui_test.close_dialog_through_button(xOK)
+
+ self.assertEqual(document.isModified(), False)
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests5/tdf123446.py b/sw/qa/uitest/writer_tests5/tdf123446.py
new file mode 100644
index 000000000..53f8208f8
--- /dev/null
+++ b/sw/qa/uitest/writer_tests5/tdf123446.py
@@ -0,0 +1,42 @@
+# -*- 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
+#Bug 123446 - Writer crashes after undoing + redoing ToC insertion in middle of word
+
+class tdf123446(UITestCase):
+
+ def test_tdf123446_undo_redo_ToC_crash(self):
+ with self.ui_test.create_doc_in_start_center("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+ #- Add a word to an empty document.
+ type_text(xWriterEdit, "LibreOffice")
+ #- Change its style to Heading 2.
+ self.xUITest.executeCommand(".uno:StyleApply?Style:string=Heading%202&FamilyName:string=ParagraphStyles")
+ #- Position cursor somewhere in the middle of the word, and add Table of Contents
+ #(no need to change anything in the dialog).
+ self.xUITest.executeCommand(".uno:GoLeft")
+ self.xUITest.executeCommand(".uno:GoLeft")
+ self.xUITest.executeCommand(".uno:GoLeft")
+ self.xUITest.executeCommand(".uno:GoLeft")
+
+ with self.ui_test.execute_dialog_through_command(".uno:InsertMultiIndex"):
+ pass
+ #- Undo the ToC insertion.
+ self.xUITest.executeCommand(".uno:Undo")
+ #- Redo the ToC insertion.
+ self.xUITest.executeCommand(".uno:Redo")
+ #=> Crash. Now we verify the text
+ # This second undo crash in Clang build https://bugs.documentfoundation.org/show_bug.cgi?id=123313#c9
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(document.Text.String[0:7], "LibreOf")
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests5/tdf138531.py b/sw/qa/uitest/writer_tests5/tdf138531.py
new file mode 100644
index 000000000..328a8250b
--- /dev/null
+++ b/sw/qa/uitest/writer_tests5/tdf138531.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_state_as_dict
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from uitest.uihelper.calc import enter_text_to_cell
+
+class Tdf138531(UITestCase):
+
+ def test_tdf138531(self):
+
+ with self.ui_test.create_doc_in_start_center("calc") as document:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ #enter data
+ enter_text_to_cell(gridwin, "A1", "First")
+ enter_text_to_cell(gridwin, "A2", "Second")
+
+ #select A1:A2
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"}))
+
+ self.xUITest.executeCommand(".uno:Copy")
+
+ # Work with both documents at the same time
+ with self.ui_test.load_empty_file("writer") as writer_doc:
+
+ # Paste as DDE
+ formatProperty = mkPropertyValues({"SelectedFormat": 59})
+ self.xUITest.executeCommandWithParameters(".uno:ClipboardFormatItems", formatProperty)
+
+ self.assertEqual(1, writer_doc.TextTables.getCount())
+ table = writer_doc.getTextTables()[0]
+ self.assertEqual("First", table.getCellByName("A1").getString())
+ self.assertEqual("Second", table.getCellByName("A2").getString())
+
+ frames = self.ui_test.get_frames()
+ # switch view to the calc document
+ frames[0].activate()
+ enter_text_to_cell(gridwin, "A1", "Second")
+ enter_text_to_cell(gridwin, "A2", "First")
+
+ # switch view back to the writer document
+ frames[1].activate()
+
+ with self.ui_test.execute_dialog_through_command(".uno:LinkDialog", close_button="close") as xDialog:
+ xLinks = xDialog.getChild("TB_LINKS")
+ self.assertEqual(1, len(xLinks.getChildren()))
+
+ xFileName = xDialog.getChild("FULL_FILE_NAME")
+ self.assertEqual("Untitled 1", get_state_as_dict(xFileName)["Text"])
+
+ xUpdate = xDialog.getChild("UPDATE_NOW")
+ xUpdate.executeAction("CLICK", tuple())
+
+ # Without the fix in place, this test would have failed with
+ # AssertionError: 'Second' != 'First'
+ self.assertEqual("Second", table.getCellByName("A1").getString())
+ self.assertEqual("First", table.getCellByName("A2").getString())
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests5/tdf142847.py b/sw/qa/uitest/writer_tests5/tdf142847.py
new file mode 100644
index 000000000..845b7eb7a
--- /dev/null
+++ b/sw/qa/uitest/writer_tests5/tdf142847.py
@@ -0,0 +1,49 @@
+# -*- 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 org.libreoffice.unotest
+from uitest.uihelper.common import get_url_for_data_file
+from libreoffice.uno.propertyvalue import mkPropertyValues
+
+class tdf142847(UITestCase):
+ def test_tdf142847(self):
+ # load the sample file
+ with self.ui_test.load_file(get_url_for_data_file("tdf142847.fodt")):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+ document = self.ui_test.get_component()
+
+ # get the shape
+ shape = document.DrawPage.getByIndex(0)
+
+ # get the textbox
+ frame = shape.getText()
+
+ oldFramePos = frame.getPropertyValue("HoriOrientPosition")
+ oldShapePos = shape.getPropertyValue("LeftMargin")
+ oldDiff = oldFramePos - oldShapePos
+
+ # select the shape.
+ self.xUITest.executeCommand(".uno:JumpToNextFrame")
+ self.ui_test.wait_until_child_is_available('metricfield')
+
+ # set the wrap spacing of the shape
+ with self.ui_test.execute_dialog_through_command(".uno:TextWrap") as wrap_dialog:
+ wrap_dialog.getChild('left').executeAction("UP", tuple())
+
+ newDiff = frame.getPropertyValue("HoriOrientPosition") - shape.getPropertyValue("LeftMargin")
+
+ # without the fix, this will fail.
+ # the textbox has fallen apart.
+ self.assertEqual(oldDiff, newDiff)
+
+ self.assertGreater(frame.getPropertyValue("HoriOrientPosition"), oldFramePos)
+ self.assertGreater(shape.getPropertyValue("LeftMargin"), oldShapePos)
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests5/tdf145326.py b/sw/qa/uitest/writer_tests5/tdf145326.py
new file mode 100644
index 000000000..d063e6388
--- /dev/null
+++ b/sw/qa/uitest/writer_tests5/tdf145326.py
@@ -0,0 +1,86 @@
+# -*- 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, get_url_for_data_file
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from org.libreoffice.unotest import systemPathToFileUrl
+from tempfile import TemporaryDirectory
+import os.path
+
+class Tdf145326(UITestCase):
+
+ def test_tdf145326(self):
+
+ with TemporaryDirectory() as tempdir:
+ xFilePath = os.path.join(tempdir, "tdf145326-temp.odt")
+
+ with self.ui_test.execute_dialog_through_command(".uno:Open", close_button="") as xOpenDialog:
+
+ xFileName = xOpenDialog.getChild("file_name")
+ xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": get_url_for_data_file("tdf145326.odt")}))
+
+ xOpenBtn = xOpenDialog.getChild("open")
+ # Update all links dialog
+ with self.ui_test.wait_until_component_loaded():
+ with self.ui_test.execute_blocking_action(xOpenBtn.executeAction, args=('CLICK', ()), close_button="yes"):
+ pass
+
+ with self.ui_test.execute_dialog_through_command(".uno:LinkDialog", close_button="close") as xDialog:
+
+ sLinks = "TB_LINKS"
+ xLinks = xDialog.getChild(sLinks)
+ self.assertEqual(1, len(xLinks.getChildren()))
+
+ sFileName = "FULL_FILE_NAME"
+ xFileName = xDialog.getChild(sFileName)
+ self.assertTrue(get_state_as_dict(xFileName)["Text"].endswith("SAmple odp.ods"))
+
+ sBreakLink = "BREAK_LINK"
+ xBreakLink = xDialog.getChild(sBreakLink)
+
+ with self.ui_test.execute_blocking_action(xBreakLink.executeAction,
+ args=("CLICK", tuple()), close_button="yes"):
+ pass
+
+ # Save Copy as
+ with self.ui_test.execute_dialog_through_command('.uno:SaveAs', close_button="open") as xDialog:
+ xFileName = xDialog.getChild('file_name')
+ xFileName.executeAction('TYPE', mkPropertyValues({'KEYCODE':'CTRL+A'}))
+ xFileName.executeAction('TYPE', mkPropertyValues({'KEYCODE':'BACKSPACE'}))
+ xFileName.executeAction('TYPE', mkPropertyValues({'TEXT': xFilePath}))
+
+ self.ui_test.close_doc()
+
+ self.ui_test.wait_until_file_is_available(xFilePath)
+
+ with self.ui_test.load_file(systemPathToFileUrl(xFilePath)) as doc2:
+
+ self.xUITest.executeCommand(".uno:LinkDialog")
+
+ # Since the image is no longer linked, the link dialog is not open.
+ # Without the fix in place, this dialog would have been opened
+ xMainWin = self.xUITest.getTopFocusWindow()
+ self.assertTrue(sLinks not in xMainWin.getChildren())
+ self.assertTrue(sFileName not in xMainWin.getChildren())
+ self.assertTrue(sBreakLink not in xMainWin.getChildren())
+ self.assertTrue("writer_edit" in xMainWin.getChildren())
+
+ self.assertEqual(doc2.TextTables.getCount(), 1)
+ table = doc2.getTextTables()[0]
+
+ self.assertEqual(len(table.getRows()), 7)
+ self.assertEqual("10,000", table.getCellByName("D2").getString())
+ self.assertEqual("20,000", table.getCellByName("D3").getString())
+ self.assertEqual("5,000", table.getCellByName("D4").getString())
+ self.assertEqual("7,000", table.getCellByName("D5").getString())
+ self.assertEqual("5,000", table.getCellByName("D6").getString())
+ self.assertEqual("7,000", table.getCellByName("D7").getString())
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests5/tdf147935.py b/sw/qa/uitest/writer_tests5/tdf147935.py
new file mode 100644
index 000000000..fa0e773a9
--- /dev/null
+++ b/sw/qa/uitest/writer_tests5/tdf147935.py
@@ -0,0 +1,43 @@
+# -*- 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 libreoffice.uno.propertyvalue import mkPropertyValues
+from uitest.uihelper.calc import enter_text_to_cell
+
+class Tdf147935(UITestCase):
+
+ def test_tdf147935(self):
+
+ with self.ui_test.create_doc_in_start_center("calc") as document:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ #enter data
+ enter_text_to_cell(gridwin, "A1", "DDE")
+
+ #select A1
+ gridwin.executeAction("SELECT", mkPropertyValues({"Cell": "A1"}))
+
+ self.xUITest.executeCommand(".uno:Copy")
+
+ with self.ui_test.load_empty_file("writer") as writer_doc:
+
+ # Paste as DDE
+ formatProperty = mkPropertyValues({"SelectedFormat": 59})
+ self.xUITest.executeCommandWithParameters(".uno:ClipboardFormatItems", formatProperty)
+
+ # Without the fix in place, this test would have failed because the warning message
+ # "A table with no rows or no cells cannot be inserted" would have been displayed
+
+ self.assertEqual(1, writer_doc.TextTables.getCount())
+ table = writer_doc.getTextTables()[0]
+ self.assertEqual("DDE", table.getCellByName("A1").getString())
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests5/tdf148920.py b/sw/qa/uitest/writer_tests5/tdf148920.py
new file mode 100644
index 000000000..c8bde7769
--- /dev/null
+++ b/sw/qa/uitest/writer_tests5/tdf148920.py
@@ -0,0 +1,33 @@
+# -*- 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
+
+class tdf148920(UITestCase):
+
+ def test_tdf148920(self):
+
+ with self.ui_test.create_doc_in_start_center("writer") as document:
+
+ self.xUITest.executeCommand(".uno:StyleApply?Style:string=Text%20body&FamilyName:string=ParagraphStyles")
+
+ with self.ui_test.execute_dialog_through_command(".uno:EditStyle", close_button="cancel") as xDialog:
+ xFilter = xDialog.getChild("filter")
+
+ # Without the fix in place, this test would have failed with
+ # AssertionError: 'true' != 'false'
+ self.assertEqual("true", get_state_as_dict(xFilter)["Enabled"])
+
+ # tdf#91035: Without the fix in place, this test would have failed with
+ # AssertionError: 'All Styles' != 'Hidden Styles'
+ self.assertEqual("All Styles", get_state_as_dict(xFilter)["SelectEntryText"])
+
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests5/titlePage.py b/sw/qa/uitest/writer_tests5/titlePage.py
new file mode 100644
index 000000000..e2b774492
--- /dev/null
+++ b/sw/qa/uitest/writer_tests5/titlePage.py
@@ -0,0 +1,31 @@
+# -*- 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
+#uitest sw / Title Page dialog
+
+class titlePage(UITestCase):
+ def test_title_page(self):
+ with self.ui_test.create_doc_in_start_center("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ #dialog Title Page
+ with self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog") as xDialog:
+ #select new Pages; nr of pages =2 (click UP), save; verify pageCount = 3
+ newPages = xDialog.getChild("RB_INSERT_NEW_PAGES")
+ newPages.executeAction("CLICK", tuple())
+ xpageCount = xDialog.getChild("NF_PAGE_COUNT")
+ xpageCount.executeAction("UP", tuple())
+ self.assertEqual(document.CurrentController.PageCount, 3)
+
+ # check cancel button
+ with self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog", close_button="cancel"):
+ pass
+ self.assertEqual(document.CurrentController.PageCount, 3)
+
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests5/titlePageWizard.py b/sw/qa/uitest/writer_tests5/titlePageWizard.py
new file mode 100644
index 000000000..4146dab22
--- /dev/null
+++ b/sw/qa/uitest/writer_tests5/titlePageWizard.py
@@ -0,0 +1,195 @@
+# -*- 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
+
+# This tests the Format->Title Page wizard, specifically the reset page number portion,
+# replacing some pages with title pages,
+# inserting pages in the middle of the document,
+# and inserting at the very end of the document.
+class tdf138907(UITestCase):
+ def test_tdf138907(self):
+ with self.ui_test.load_file(get_url_for_data_file("tdf138907_titlePageDialog.odt")) as document:
+
+ # Confirm the starting state. Just a page break, without a valid restart page number on page 2
+ self.assertEqual(document.CurrentController.PageCount, 5)
+ Paragraphs = document.Text.createEnumeration()
+ Para1 = Paragraphs.nextElement()
+ self.assertEqual(Para1.String, "6")
+ self.assertEqual(Para1.PageDescName, "First Page")
+ Para2 = Paragraphs.nextElement()
+ self.assertEqual(Para2.String, "7")
+ self.assertEqual(Para2.PageDescName, None)
+ Para3 = Paragraphs.nextElement()
+ self.assertEqual(Para3.String, "8")
+ self.assertEqual(Para3.PageDescName, None)
+ Para4 = Paragraphs.nextElement()
+ self.assertEqual(Para4.String, "9")
+ self.assertEqual(Para4.PageDescName, None)
+ Para5 = Paragraphs.nextElement()
+ self.assertEqual(Para5.String, "10")
+ self.assertEqual(Para5.PageDescName, None)
+
+
+ #dialog Title Page
+ with self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog") as xDialog:
+ #set restart page number to 2. With this doc, it defaults to resetting to 1.
+ xRestartNumbering = xDialog.getChild("NF_RESTART_NUMBERING")
+ xRestartNumbering.executeAction("UP", tuple()) # restart numbering at 2
+
+ Paragraphs = document.Text.createEnumeration()
+ Para1 = Paragraphs.nextElement()
+ self.assertEqual(Para1.String, "6")
+ self.assertEqual(Para1.PageDescName, "First Page")
+ self.assertEqual(Para2.String, "2")
+ Para2 = Paragraphs.nextElement()
+ # Without this fix, there was no PageDescName specified, just Landscape as default.
+ self.assertEqual(Para2.PageDescName, "Landscape")
+
+ #re-run dialog Title Page
+ with self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog"):
+ pass
+
+ # Without this fix, re-running the wizard was failing with the title page restarting at page 2.
+ Paragraphs = document.Text.createEnumeration()
+ Para1 = Paragraphs.nextElement()
+ self.assertEqual(Para1.String, "6")
+ self.assertEqual(Para1.PageDescName, "First Page")
+ Para2 = Paragraphs.nextElement()
+ self.assertEqual(Para2.String, "2")
+ self.assertEqual(Para2.PageDescName, "Landscape")
+
+ #Note: 6 virtual pages, including blank, even page seen in book view
+ self.assertEqual(document.CurrentController.PageCount, 6)
+
+ #Now test replacing several pages with title and index styles
+
+ #dialog Title Page
+ with self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog") as xDialog:
+ #Convert three pages to title/index pages starting at page two.
+ xPageCount = xDialog.getChild("NF_PAGE_COUNT")
+ for _ in range(0,2):
+ xPageCount.executeAction("UP", tuple())
+ xUseStartingPage = xDialog.getChild("RB_PAGE_START")
+ xUseStartingPage.executeAction("CLICK", tuple())
+ xStartingPage = xDialog.getChild("NF_PAGE_START")
+ xStartingPage.executeAction("UP", tuple()) #Start at page 2.
+
+
+ Paragraphs = document.Text.createEnumeration()
+ Para1 = Paragraphs.nextElement()
+ self.assertEqual(Para1.String, "6")
+ self.assertEqual(Para1.PageDescName, "First Page")
+ # Without the fix, the following results are all off by one.
+ Para2 = Paragraphs.nextElement()
+ self.assertEqual(Para2.String, "6")
+ self.assertEqual(Para2.PageDescName, "First Page")
+ Para3 = Paragraphs.nextElement()
+ self.assertEqual(Para3.String, "7")
+ self.assertEqual(Para3.PageDescName, "Index")
+ Para4 = Paragraphs.nextElement()
+ self.assertEqual(Para4.String, "8")
+ self.assertEqual(Para4.PageDescName, "Index")
+ Para5 = Paragraphs.nextElement()
+ self.assertEqual(Para5.String, "2")
+ self.assertEqual(Para5.PageDescName, "Landscape")
+
+ #Now test inserting at the end of the document
+
+ #dialog Title Page
+ with self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog") as xDialog:
+ #Insert three title/index pages at the end of the document (plus a content page).
+ newPages = xDialog.getChild("RB_INSERT_NEW_PAGES")
+ newPages.executeAction("CLICK", tuple())
+ xPageCount = xDialog.getChild("NF_PAGE_COUNT")
+ for _ in range(0,2):
+ xPageCount.executeAction("UP", tuple())
+ xUseStartingPage = xDialog.getChild("RB_PAGE_START")
+ xUseStartingPage.executeAction("CLICK", tuple())
+ xStartingPage = xDialog.getChild("NF_PAGE_START")
+ for _ in range(0,18):
+ xStartingPage.executeAction("UP", tuple()) #Start at mythical page 20.
+
+
+ # Without the fix, the pages were being inserted before the last page.
+ text = document.Text.String.replace('\r\n', '\n')
+ self.assertEqual(text[0:1], "6")
+ self.assertEqual(text[2:3], "6")
+ self.assertEqual(text[4:5], "7")
+ self.assertEqual(text[6:7], "8")
+ # Without the fix, the new pages were inserted before the last page.
+ self.assertFalse("\n" in text[8:9])
+ #Note: 13 total virtual pages, including four blanks, as seen in book view
+ self.assertEqual(document.CurrentController.PageCount, 13)
+
+ #Now test inserting in the middle of the document
+
+ #dialog Title Page
+ with self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog") as xDialog:
+ #Insert three title/index pages starting at page 2.
+ newPages = xDialog.getChild("RB_INSERT_NEW_PAGES")
+ newPages.executeAction("CLICK", tuple())
+ xPageCount = xDialog.getChild("NF_PAGE_COUNT")
+ for _ in range(0,2):
+ xPageCount.executeAction("UP", tuple())
+ xUseStartingPage = xDialog.getChild("RB_PAGE_START")
+ xUseStartingPage.executeAction("CLICK", tuple())
+ xStartingPage = xDialog.getChild("NF_PAGE_START")
+ for _ in range(0,10):
+ xStartingPage.executeAction("DOWN", tuple()) #Reset to page 1
+ xStartingPage.executeAction("UP", tuple()) #Start at page 2.
+
+
+ # Without first re-calculating the layout, the styles were applied to the wrong pages.
+ Paragraphs = document.Text.createEnumeration()
+ Para1 = Paragraphs.nextElement()
+ self.assertEqual(Para1.String, "6")
+ self.assertEqual(Para1.PageDescName, "First Page")
+ # The next three pages are the ones that were just inserted.
+ Para2 = Paragraphs.nextElement()
+ self.assertEqual(Para2.String, "")
+ self.assertEqual(Para2.PageDescName, "First Page")
+ Para3 = Paragraphs.nextElement()
+ self.assertEqual(Para3.String, "")
+ self.assertEqual(Para3.PageDescName, "Index")
+ Para4 = Paragraphs.nextElement()
+ self.assertEqual(Para4.String, "")
+ self.assertEqual(Para4.PageDescName, "Index")
+ # A bit of a quirk is that the style of the first page after the
+ # title page is still First Page - so that is used as the Normal page style.
+ # OK - this is a bit of a strange workflow, so just accept that.
+ Para5 = Paragraphs.nextElement()
+ self.assertEqual(Para5.String, "6")
+ self.assertEqual(Para5.PageDescName, "First Page")
+ Para6 = Paragraphs.nextElement()
+ self.assertEqual(Para6.String, "7")
+ self.assertEqual(Para6.PageDescName, "Index")
+ Para7 = Paragraphs.nextElement()
+ self.assertEqual(Para7.String, "8")
+ self.assertEqual(Para7.PageDescName, "Index")
+ Para8 = Paragraphs.nextElement()
+ self.assertEqual(Para8.String, "2")
+ self.assertEqual(Para8.PageDescName, "Landscape")
+ Para9 = Paragraphs.nextElement()
+ self.assertEqual(Para9.String, "")
+ self.assertEqual(Para9.PageDescName, "First Page")
+ Para10 = Paragraphs.nextElement()
+ self.assertEqual(Para10.String, "")
+ self.assertEqual(Para10.PageDescName, "Index")
+ Para11 = Paragraphs.nextElement()
+ self.assertEqual(Para11.String, "")
+ self.assertEqual(Para11.PageDescName, "Index")
+ # The quirk resets this extra content page to the "style after First page == First Page"
+ Para12 = Paragraphs.nextElement()
+ self.assertEqual(Para12.String, "")
+ self.assertEqual(Para12.PageDescName, "First Page")
+ #Note: 17 total virtual pages, including five blanks, as seen in book view
+ self.assertEqual(document.CurrentController.PageCount, 17)
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests5/titlePageWizard2.py b/sw/qa/uitest/writer_tests5/titlePageWizard2.py
new file mode 100644
index 000000000..4f3473530
--- /dev/null
+++ b/sw/qa/uitest/writer_tests5/titlePageWizard2.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
+from uitest.uihelper.common import get_url_for_data_file
+
+# This tests both an edge cases, and some more realistic situations.
+class tdf138907(UITestCase):
+ def test_tdf138907(self):
+ with self.ui_test.load_file(get_url_for_data_file("tdf138907_titlePageDialog.odt")) as document:
+
+ # Test an undefined situation - try to modify pages beyond the end of the document.
+
+ #dialog Title Page
+ with self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog") as xDialog:
+ #set restart page number to 2. With this doc, it defaults to resetting to 1.
+ xRestartNumbering = xDialog.getChild("NF_RESTART_NUMBERING")
+ xRestartNumbering.executeAction("UP", tuple()) # restart numbering at 2
+
+ #Convert three pages to title/index pages starting at non-existing page twenty.
+ xPageCount = xDialog.getChild("NF_PAGE_COUNT")
+ for _ in range(0,2):
+ xPageCount.executeAction("UP", tuple())
+ xUseStartingPage = xDialog.getChild("RB_PAGE_START")
+ xUseStartingPage.executeAction("CLICK", tuple())
+ xStartingPage = xDialog.getChild("NF_PAGE_START")
+ for _ in range(0,19):
+ xStartingPage.executeAction("UP", tuple()) #Start at mythical page 20.
+
+
+ # Nothing should happen when modifying pages that don't exist.
+ # Just a page break, without a valid restart page number on page 2
+ self.assertEqual(document.CurrentController.PageCount, 5)
+ Paragraphs = document.Text.createEnumeration()
+ Para1 = Paragraphs.nextElement()
+ self.assertEqual(Para1.String, "6")
+ self.assertEqual(Para1.PageDescName, "First Page")
+ Para2 = Paragraphs.nextElement()
+ self.assertEqual(Para2.String, "7")
+ self.assertEqual(Para2.PageDescName, None)
+ Para3 = Paragraphs.nextElement()
+ self.assertEqual(Para3.String, "8")
+ self.assertEqual(Para3.PageDescName, None)
+ Para4 = Paragraphs.nextElement()
+ self.assertEqual(Para4.String, "9")
+ self.assertEqual(Para4.PageDescName, None)
+ Para5 = Paragraphs.nextElement()
+ self.assertEqual(Para5.String, "10")
+ self.assertEqual(Para5.PageDescName, None)
+
+
+ #dialog Title Page
+ with self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog") as xDialog:
+ #set restart page number to 1 - which is the default.
+ #set restart title page to 1 - the current value for this document is 6.
+ xRestartNumbering = xDialog.getChild("NF_SET_PAGE_NUMBER")
+ for _ in range(0,5):
+ xRestartNumbering.executeAction("DOWN", tuple()) # restart title numbering at 1
+ #Insert two title/index pages at beginning of the document.
+ newPages = xDialog.getChild("RB_INSERT_NEW_PAGES")
+ newPages.executeAction("CLICK", tuple())
+ xPageCount = xDialog.getChild("NF_PAGE_COUNT")
+ for _ in range(0,1):
+ xPageCount.executeAction("UP", tuple())
+
+
+ Paragraphs = document.Text.createEnumeration()
+ Para1 = Paragraphs.nextElement()
+ self.assertEqual(Para1.String, "")
+ self.assertEqual(Para1.PageDescName, "First Page")
+ Para2 = Paragraphs.nextElement()
+ self.assertEqual(Para2.String, "")
+ self.assertEqual(Para2.PageDescName, "Index")
+ Para3 = Paragraphs.nextElement()
+ self.assertEqual(Para3.String, "1")
+ self.assertEqual(Para3.PageDescName, "Landscape")
+ Para4 = Paragraphs.nextElement()
+ self.assertEqual(Para4.String, "2")
+ Para5 = Paragraphs.nextElement()
+ self.assertEqual(Para5.String, "3")
+ Para6 = Paragraphs.nextElement()
+ self.assertEqual(Para6.String, "4")
+ Para7 = Paragraphs.nextElement()
+ self.assertEqual(Para7.String, "5")
+
+ #Now test replacing several pages with title and index styles
+
+ #dialog Title Page
+ with self.ui_test.execute_dialog_through_command(".uno:TitlePageDialog") as xDialog:
+ #Convert four pages to title/index pages starting at page one.
+ xPageCount = xDialog.getChild("NF_PAGE_COUNT")
+ for _ in range(0,3):
+ xPageCount.executeAction("DOWN", tuple()) #reset to 1 first
+ for _ in range(0,3):
+ xPageCount.executeAction("UP", tuple())
+
+
+ Paragraphs = document.Text.createEnumeration()
+ Para1 = Paragraphs.nextElement()
+ self.assertEqual(Para1.String, "")
+ self.assertEqual(Para1.PageDescName, "First Page")
+ Para2 = Paragraphs.nextElement()
+ self.assertEqual(Para2.String, "")
+ self.assertEqual(Para2.PageDescName, "Index")
+ Para3 = Paragraphs.nextElement()
+ self.assertEqual(Para3.String, "3")
+ self.assertEqual(Para3.PageDescName, "Index")
+ Para4 = Paragraphs.nextElement()
+ self.assertEqual(Para4.String, "4")
+ self.assertEqual(Para4.PageDescName, "Index")
+ Para5 = Paragraphs.nextElement()
+ self.assertEqual(Para5.String, "1")
+ self.assertEqual(Para5.PageDescName, "Landscape")
+ Para6 = Paragraphs.nextElement()
+ self.assertEqual(Para6.String, "2")
+ Para7 = Paragraphs.nextElement()
+ self.assertEqual(Para7.String, "3")
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests5/xwindow.py b/sw/qa/uitest/writer_tests5/xwindow.py
new file mode 100644
index 000000000..d7a0f885f
--- /dev/null
+++ b/sw/qa/uitest/writer_tests5/xwindow.py
@@ -0,0 +1,176 @@
+# -*- 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 unohelper
+from com.sun.star.awt import XMouseListener
+from com.sun.star.awt import MouseButton
+from com.sun.star.awt import MouseEvent
+from com.sun.star.awt import KeyEvent
+from com.sun.star.awt import XKeyListener
+
+
+mouseListenerCount = 0
+mouseEventsIntercepted = 0
+mousePressedEventsIntercepted = 0
+mouseReleasedEventsIntercepted = 0
+mouseEnteredEventsIntercepted = 0
+mouseExitedEventsIntercepted = 0
+keymousePressedEventsIntercepted = 0
+keymouseReleasedEventsIntercepted = 0
+
+
+class XMouseListenerExtended(unohelper.Base, XMouseListener):
+ def __init__(self):
+ global mouseListenerCount
+ mouseListenerCount += 1
+ super().__init__()
+
+ # is invoked when a mouse button has been pressed on a window.
+ @classmethod
+ def mousePressed(self, xMouseEvent):
+ global mousePressedEventsIntercepted
+ mousePressedEventsIntercepted += 1
+
+ # is invoked when a mouse button has been released on a window.
+ @classmethod
+ def mouseReleased(self, xMouseEvent):
+ global mouseReleasedEventsIntercepted
+ mouseReleasedEventsIntercepted += 1
+
+ # is invoked when the mouse enters a window.
+ @classmethod
+ def mouseEntered(self, xMouseEvent):
+ global mouseEventsIntercepted
+ mouseEventsIntercepted += 1
+ return super(XMouseListenerExtended, self).mouseEntered(xMouseEvent)
+
+ # is invoked when the mouse exits a window.
+ @classmethod
+ def mouseExited(self, xMouseEvent):
+ global mouseEventsIntercepted
+ mouseEventsIntercepted += 1
+ return super(XMouseListenerExtended, self).mouseExited(xMouseEvent)
+
+
+class XKeyListenerExtended(unohelper.Base, XKeyListener):
+ # is invoked when a key has been pressed
+ @classmethod
+ def keyPressed(self, xKeyEvent):
+ global keymousePressedEventsIntercepted
+ keymousePressedEventsIntercepted += 1
+ return super(XKeyListenerExtended, self).keyPressed(xKeyEvent)
+
+ # is invoked when a key has been released
+ @classmethod
+ def keyReleased(self, xKeyEvent):
+ global keymouseReleasedEventsIntercepted
+ keymouseReleasedEventsIntercepted += 1
+ return super(XKeyListenerExtended, self).keyReleased(xKeyEvent)
+
+# Test that registered mouse/key listeners for top window receive mouse/key events
+class XWindow(UITestCase):
+ def test_listeners(self):
+ global mouseListenerCount
+
+ with self.ui_test.create_doc_in_start_center("writer") as xDoc:
+
+ # create new mouse listener
+ xFrame = xDoc.getCurrentController().getFrame()
+ self.assertIsNotNone(xFrame)
+ xWindow = xFrame.getContainerWindow()
+ self.assertIsNotNone(xWindow)
+
+ # add new mouse listener
+ xMouseListener = XMouseListenerExtended()
+ self.assertIsNotNone(xMouseListener)
+ xWindow.addMouseListener(xMouseListener)
+ self.assertEqual(1, mouseListenerCount)
+
+ # add new key listener
+ xKeyListener = XKeyListenerExtended()
+ self.assertIsNotNone(xKeyListener)
+ xWindow.addKeyListener(xKeyListener)
+
+ # create dummy mouse event
+ xMouseEvent = MouseEvent()
+ xMouseEvent.Modifiers = 0
+ xMouseEvent.Buttons = MouseButton.LEFT
+ xMouseEvent.X = 10
+ xMouseEvent.Y = 10
+ xMouseEvent.ClickCount = 1
+ xMouseEvent.PopupTrigger = False
+ xMouseEvent.Source = xWindow
+
+ xMouseEvent2 = MouseEvent()
+ xMouseEvent2.Modifiers = 0
+ xMouseEvent2.Buttons = MouseButton.LEFT
+ xMouseEvent2.X = 300
+ xMouseEvent2.Y = 300
+ xMouseEvent2.ClickCount = 1
+ xMouseEvent2.PopupTrigger = False
+ xMouseEvent2.Source = xWindow
+
+ # send mouse event
+ xToolkitRobot = xWindow.getToolkit()
+ self.assertIsNotNone(xToolkitRobot)
+
+ # Click in the menubar/toolbar area
+ xToolkitRobot.mouseMove(xMouseEvent)
+ xToolkitRobot.mousePress(xMouseEvent)
+ xToolkitRobot.mouseRelease(xMouseEvent)
+
+ # Click into the document content
+ xToolkitRobot.mousePress(xMouseEvent2)
+ xToolkitRobot.mouseRelease(xMouseEvent2)
+
+ # send key press event
+ xKeyEvent = KeyEvent()
+ xKeyEvent.Modifiers = 0
+ xKeyEvent.KeyCode = 70
+ xKeyEvent.KeyChar = 70
+ xKeyEvent.Source = xWindow
+
+ xToolkitRobot.keyPress(xKeyEvent)
+ xToolkitRobot.keyRelease(xKeyEvent)
+
+ # Wait for async events to be processed
+ xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit')
+ xToolkit.processEventsToIdle()
+
+ # remove mouse listener
+ xWindow.removeMouseListener(xMouseListener)
+ self.assertEqual(1, mouseListenerCount)
+ del xMouseListener
+
+ # remove key listener
+ xWindow.removeKeyListener(xKeyListener)
+ del xKeyListener
+
+ global keymousePressedEventsIntercepted
+ # Not expected any interceptions
+ self.assertEqual(0, keymousePressedEventsIntercepted)
+
+ global keymouseReleasedEventsIntercepted
+ # Not expected any interceptions
+ self.assertEqual(0, keymouseReleasedEventsIntercepted)
+
+ global mousePressedEventsIntercepted
+ self.assertEqual(0, mousePressedEventsIntercepted)
+
+ global mouseReleasedEventsIntercepted
+ self.assertEqual(0, mouseReleasedEventsIntercepted)
+
+ global mouseEventsIntercepted
+ # Not expected 3 interceptions
+ self.assertEqual(0, mouseEventsIntercepted)
+
+ # close document
+
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests5/zoom.py b/sw/qa/uitest/writer_tests5/zoom.py
new file mode 100644
index 000000000..cb6d0ebad
--- /dev/null
+++ b/sw/qa/uitest/writer_tests5/zoom.py
@@ -0,0 +1,86 @@
+# -*- 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 libreoffice.uno.propertyvalue import mkPropertyValues
+#uitest sw / View-Zoom
+
+class writerZoom(UITestCase):
+ def test_zoom_writer(self):
+ with self.ui_test.create_doc_in_start_center("writer"):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ #dialog View-Zoom-Zoom
+ with self.ui_test.execute_dialog_through_command(".uno:Zoom") as xDialog:
+
+ #select Optimal & Automatic - OK - open and verify
+ optimal = xDialog.getChild("optimal")
+ optimal.executeAction("CLICK", tuple())
+ automatic = xDialog.getChild("automatic")
+ automatic.executeAction("CLICK", tuple())
+
+ with self.ui_test.execute_dialog_through_command(".uno:Zoom") as xDialog:
+ optimal = xDialog.getChild("optimal")
+ automatic = xDialog.getChild("automatic")
+ self.assertEqual(get_state_as_dict(optimal)["Checked"], "true")
+ self.assertEqual(get_state_as_dict(automatic)["Checked"], "true")
+ #select fit weight & Single page - OK - open and verify
+ fitwandh = xDialog.getChild("fitwandh")
+ singlepage = xDialog.getChild("singlepage")
+ fitwandh.executeAction("CLICK", tuple())
+ singlepage.executeAction("CLICK", tuple())
+
+ with self.ui_test.execute_dialog_through_command(".uno:Zoom") as xDialog:
+ singlepage = xDialog.getChild("singlepage")
+ fitwandh = xDialog.getChild("fitwandh")
+ self.assertEqual(get_state_as_dict(singlepage)["Checked"], "true")
+ self.assertEqual(get_state_as_dict(fitwandh)["Checked"], "true")
+ #select fit width & columns - OK - open and verify
+ fitw = xDialog.getChild("fitw")
+ columnssb = xDialog.getChild("columnssb")
+ columns = xDialog.getChild("columns")
+ fitw.executeAction("CLICK", tuple())
+ columns.executeAction("CLICK", tuple())
+ columnssb.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ columnssb.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ columnssb.executeAction("TYPE", mkPropertyValues({"TEXT":"3"}))
+
+ with self.ui_test.execute_dialog_through_command(".uno:Zoom") as xDialog:
+ fitw = xDialog.getChild("fitw")
+ columnssb = xDialog.getChild("columnssb")
+ columns = xDialog.getChild("columns")
+ self.assertEqual(get_state_as_dict(fitw)["Checked"], "true")
+ self.assertEqual(get_state_as_dict(columns)["Checked"], "true")
+ self.assertEqual(get_state_as_dict(columnssb)["Text"], "3")
+ #select 100% & Automatic - OK - open and verify
+ automatic = xDialog.getChild("automatic")
+ x100pc = xDialog.getChild("100pc")
+ x100pc.executeAction("CLICK", tuple())
+ automatic.executeAction("CLICK", tuple())
+
+ with self.ui_test.execute_dialog_through_command(".uno:Zoom") as xDialog:
+ automatic = xDialog.getChild("automatic")
+ x100pc = xDialog.getChild("100pc")
+ self.assertEqual(get_state_as_dict(automatic)["Checked"], "true")
+ self.assertEqual(get_state_as_dict(x100pc)["Checked"], "true")
+ #select variable 103% & Automatic - OK - open and verify
+ variable = xDialog.getChild("variable")
+ zoomsb = xDialog.getChild("zoomsb")
+ variable.executeAction("CLICK", tuple())
+ zoomsb.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ zoomsb.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ zoomsb.executeAction("TYPE", mkPropertyValues({"TEXT":"101"}))
+
+ with self.ui_test.execute_dialog_through_command(".uno:Zoom") as xDialog:
+ variable = xDialog.getChild("variable")
+ zoomsb = xDialog.getChild("zoomsb")
+ self.assertEqual(get_state_as_dict(variable)["Checked"], "true")
+ self.assertEqual(get_state_as_dict(zoomsb)["Text"], "101%")
+
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests6/edit_file_properties_before_saving.py b/sw/qa/uitest/writer_tests6/edit_file_properties_before_saving.py
new file mode 100644
index 000000000..d8d30d0af
--- /dev/null
+++ b/sw/qa/uitest/writer_tests6/edit_file_properties_before_saving.py
@@ -0,0 +1,106 @@
+# -*- 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 libreoffice.uno.propertyvalue import mkPropertyValues
+from org.libreoffice.unotest import systemPathToFileUrl
+from tempfile import TemporaryDirectory
+import os.path
+
+class edit_file_properties_before_saving(UITestCase):
+
+ def change_doc_info_setting(self, enabled):
+ with self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") as xDialog:
+ xPages = xDialog.getChild("pages")
+ xLoadSaveEntry = xPages.getChild('1')
+ xLoadSaveEntry.executeAction("EXPAND", tuple())
+ xGeneralEntry = xLoadSaveEntry.getChild('0')
+ xGeneralEntry.executeAction("SELECT", tuple())
+
+ xDocInfo = xDialog.getChild("docinfo")
+ if get_state_as_dict(xDocInfo)['Selected'] != enabled:
+ xDocInfo.executeAction("CLICK", tuple())
+ self.assertEqual(enabled, get_state_as_dict(xDocInfo)['Selected'])
+
+ def test_tdf117895(self):
+
+ with TemporaryDirectory() as tempdir:
+ xFilePath = os.path.join(tempdir, "tdf117895-temp.odt")
+
+ try:
+ self.change_doc_info_setting("true")
+
+ with self.ui_test.create_doc_in_start_center("writer"):
+
+ # Save Copy as
+ with self.ui_test.execute_dialog_through_command('.uno:SaveAs', close_button="") as xDialog:
+ xFileName = xDialog.getChild('file_name')
+ xFileName.executeAction('TYPE', mkPropertyValues({'KEYCODE':'CTRL+A'}))
+ xFileName.executeAction('TYPE', mkPropertyValues({'KEYCODE':'BACKSPACE'}))
+ xFileName.executeAction('TYPE', mkPropertyValues({'TEXT': xFilePath}))
+
+ xOpen = xDialog.getChild("open")
+ with self.ui_test.execute_dialog_through_action(xOpen, "CLICK") as xPropertiesDialog:
+ xReadOnly = xPropertiesDialog.getChild("readonly")
+ xReadOnly.executeAction("CLICK", tuple())
+ self.assertEqual("true", get_state_as_dict(xReadOnly)['Selected'])
+
+ self.ui_test.wait_until_file_is_available(xFilePath)
+
+ with self.ui_test.load_file(systemPathToFileUrl(xFilePath)) as doc2:
+ # Without the fix in place, this test would have failed here
+ self.assertTrue(doc2.isReadonly())
+
+ finally:
+ # Put this setting back to false, otherwise it might affect other tests
+ self.change_doc_info_setting("false")
+
+ def test_tdf119206(self):
+
+ with TemporaryDirectory() as tempdir:
+ xFilePath = os.path.join(tempdir, "tdf119206-temp.odt")
+
+ try:
+ self.change_doc_info_setting("true")
+
+ with self.ui_test.create_doc_in_start_center("writer"):
+
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+ type_text(xWriterEdit, "XXXX")
+
+ # Close document and save
+ with self.ui_test.execute_dialog_through_command('.uno:CloseDoc', close_button="") as xConfirmationDialog:
+ xSave = xConfirmationDialog.getChild("save")
+
+ with self.ui_test.execute_dialog_through_action(xSave, "CLICK", close_button="") as xDialog:
+ xFileName = xDialog.getChild('file_name')
+ xFileName.executeAction('TYPE', mkPropertyValues({'KEYCODE':'CTRL+A'}))
+ xFileName.executeAction('TYPE', mkPropertyValues({'KEYCODE':'BACKSPACE'}))
+ xFileName.executeAction('TYPE', mkPropertyValues({'TEXT': xFilePath}))
+
+ xOpen = xDialog.getChild("open")
+ with self.ui_test.execute_dialog_through_action(xOpen, "CLICK") as xPropertiesDialog:
+ # Without the fix in place, this test would have crashed here
+ xReadOnly = xPropertiesDialog.getChild("readonly")
+ xReadOnly.executeAction("CLICK", tuple())
+ self.assertEqual("true", get_state_as_dict(xReadOnly)['Selected'])
+
+ self.ui_test.wait_until_file_is_available(xFilePath)
+
+ with self.ui_test.load_file(systemPathToFileUrl(xFilePath)) as doc2:
+ self.assertTrue(doc2.isReadonly())
+
+ finally:
+ # Put this setting back to false, otherwise it might affect other tests
+ self.change_doc_info_setting("false")
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests6/infobar.py b/sw/qa/uitest/writer_tests6/infobar.py
new file mode 100644
index 000000000..cb525fc9b
--- /dev/null
+++ b/sw/qa/uitest/writer_tests6/infobar.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 com.sun.star.beans import StringPair
+from com.sun.star.frame import InfobarType
+from com.sun.star.lang import IllegalArgumentException
+from com.sun.star.container import NoSuchElementException
+
+
+# Test for Infobar API
+
+class tdf97926(UITestCase):
+ def test_infobar_add(self):
+ with self.ui_test.create_doc_in_start_center("writer") as document:
+ controller = document.getCurrentController()
+ buttons = [StringPair("Close", ".uno:CloseDoc")]
+ controller.appendInfobar(
+ "my", "Hello world", "The quick, brown fox jumps over a lazy dog.", InfobarType.INFO, buttons, True)
+
+ # Adding another infobar with the same ID should throw an exception
+ with self.assertRaises(IllegalArgumentException):
+ controller.appendInfobar(
+ "my", "Hello world", "The quick, brown fox jumps over a lazy dog.", InfobarType.INFO, buttons, True)
+
+ def test_infobar_update(self):
+ with self.ui_test.create_doc_in_start_center("writer") as document:
+ controller = document.getCurrentController()
+ buttons = [StringPair("Close", ".uno:CloseDoc")]
+ controller.appendInfobar(
+ "my", "Hello world", "The quick, brown fox jumps over a lazy dog.", InfobarType.INFO, buttons, True)
+ controller.updateInfobar("my", "Hello universe", "", InfobarType.WARNING)
+
+ # Updating non-existing infobars should throw an exception
+ with self.assertRaises(NoSuchElementException):
+ controller.updateInfobar("notexisting", "", "", InfobarType.WARNING)
+
+ # Passing invalid values for InfobarType should throw an exception
+ with self.assertRaises(IllegalArgumentException):
+ controller.updateInfobar("my", "", "", 120)
+
+ def test_infobar_remove(self):
+ with self.ui_test.create_doc_in_start_center("writer") as document:
+ controller = document.getCurrentController()
+ buttons = [StringPair("Close", ".uno:CloseDoc")]
+ controller.appendInfobar(
+ "my", "Hello world", "The quick, brown fox jumps over a lazy dog.", InfobarType.INFO, buttons, True)
+
+ controller.removeInfobar("my")
+
+ # Removing an already removed infobar should throw an exception
+ with self.assertRaises(NoSuchElementException):
+ controller.removeInfobar("my")
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests6/save_readonly_with_password.py b/sw/qa/uitest/writer_tests6/save_readonly_with_password.py
new file mode 100644
index 000000000..5593e852d
--- /dev/null
+++ b/sw/qa/uitest/writer_tests6/save_readonly_with_password.py
@@ -0,0 +1,105 @@
+# -*- 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 org.libreoffice.unotest import systemPathToFileUrl
+from uitest.uihelper.common import select_by_text
+from uitest.uihelper.common import get_state_as_dict
+from tempfile import TemporaryDirectory
+import os.path
+
+
+class save_readonly_with_password(UITestCase):
+
+ #Bug 144374 - Writer: FILESAVE to DOCX as read-only with additional password protection for editing not working
+ def test_save_to_docx(self):
+ with TemporaryDirectory() as tempdir:
+ xFilePath = os.path.join(tempdir, "tdf144374-tmp.docx")
+
+ with self.ui_test.create_doc_in_start_center("writer"):
+ # Save the document
+ with self.ui_test.execute_dialog_through_command(".uno:Save", close_button="") as xSaveDialog:
+ xFileName = xSaveDialog.getChild("file_name")
+ xFileName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xFileName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": xFilePath}))
+ xFileTypeCombo = xSaveDialog.getChild("file_type")
+ select_by_text(xFileTypeCombo, "Office Open XML Text (Transitional) (.docx)")
+ xPasswordCheckButton = xSaveDialog.getChild("password")
+ xPasswordCheckButton.executeAction("CLICK", tuple())
+ xOpen = xSaveDialog.getChild("open")
+
+ with self.ui_test.execute_dialog_through_action(xOpen, "CLICK", close_button="") as xPasswordDialog:
+ xReadonly = xPasswordDialog.getChild("readonly")
+ xReadonly.executeAction("CLICK", tuple())
+ xNewPassword = xPasswordDialog.getChild("newpassroEntry")
+ xNewPassword.executeAction("TYPE", mkPropertyValues({"TEXT": "password"}))
+ xConfirmPassword = xPasswordDialog.getChild("confirmropassEntry")
+ xConfirmPassword.executeAction("TYPE", mkPropertyValues({"TEXT": "password"}))
+
+ xOk = xPasswordDialog.getChild("ok")
+ # DOCX confirmation dialog is displayed
+ with self.ui_test.execute_dialog_through_action(xOk, "CLICK", close_button="save"):
+ pass
+
+ win = self.xUITest.getTopFocusWindow()
+ print(get_state_as_dict(win))
+ print(win.getChildren())
+ self.ui_test.wait_until_file_is_available(xFilePath)
+
+ with self.ui_test.load_file(systemPathToFileUrl(xFilePath)) as document:
+
+ self.assertTrue(document.isReadonly())
+
+ #Without the fix in place, this dialog wouldn't have been displayed
+ with self.ui_test.execute_dialog_through_command(".uno:EditDoc") as xDialog:
+ xPassword = xDialog.getChild("newpassEntry")
+ xPassword.executeAction("TYPE", mkPropertyValues({"TEXT": "password"}))
+
+ self.assertFalse(document.isReadonly())
+
+ def test_save_to_odt(self):
+
+ with TemporaryDirectory() as tempdir:
+ xFilePath = os.path.join(tempdir, "readonly_with_password_tmp.odt")
+
+ with self.ui_test.create_doc_in_start_center("writer"):
+ # Save the document
+ with self.ui_test.execute_dialog_through_command(".uno:Save", close_button="") as xSaveDialog:
+ xFileName = xSaveDialog.getChild("file_name")
+ xFileName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xFileName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": xFilePath}))
+ xPasswordCheckButton = xSaveDialog.getChild("password")
+ xPasswordCheckButton.executeAction("CLICK", tuple())
+ xOpen = xSaveDialog.getChild("open")
+
+ with self.ui_test.execute_dialog_through_action(xOpen, "CLICK") as xPasswordDialog:
+ xReadonly = xPasswordDialog.getChild("readonly")
+ xReadonly.executeAction("CLICK", tuple())
+ xNewPassword = xPasswordDialog.getChild("newpassroEntry")
+ xNewPassword.executeAction("TYPE", mkPropertyValues({"TEXT": "password"}))
+ xConfirmPassword = xPasswordDialog.getChild("confirmropassEntry")
+ xConfirmPassword.executeAction("TYPE", mkPropertyValues({"TEXT": "password"}))
+
+ self.ui_test.wait_until_file_is_available(xFilePath)
+
+ with self.ui_test.load_file(systemPathToFileUrl(xFilePath)) as document:
+
+ xWriterEdit = self.xUITest.getTopFocusWindow().getChild("writer_edit")
+
+ self.assertTrue(document.isReadonly())
+
+ with self.ui_test.execute_dialog_through_command(".uno:EditDoc") as xDialog:
+ xPassword = xDialog.getChild("newpassEntry")
+ xPassword.executeAction("TYPE", mkPropertyValues({"TEXT": "password"}))
+
+ self.assertFalse(document.isReadonly())
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests6/tdf107847.py b/sw/qa/uitest/writer_tests6/tdf107847.py
new file mode 100644
index 000000000..98fd794a4
--- /dev/null
+++ b/sw/qa/uitest/writer_tests6/tdf107847.py
@@ -0,0 +1,34 @@
+# -*- 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
+#Bug 107847 - CRASH Opening macro tab of properties dialog (images, frames) causes crash
+
+class tdf107847(UITestCase):
+
+ def test_tdf_107847_macro_tab_crash(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:InsertFrame") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "1")
+ select_pos(xTabs, "2")
+ select_pos(xTabs, "3")
+ select_pos(xTabs, "4")
+ select_pos(xTabs, "5")
+ select_pos(xTabs, "6")
+ select_pos(xTabs, "7")
+ select_pos(xTabs, "8") #tab Macro
+
+ self.assertEqual(document.TextFrames.getCount(), 1)
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(document.TextFrames.getCount(), 0)
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests6/tdf118883.py b/sw/qa/uitest/writer_tests6/tdf118883.py
new file mode 100644
index 000000000..20e58c32d
--- /dev/null
+++ b/sw/qa/uitest/writer_tests6/tdf118883.py
@@ -0,0 +1,34 @@
+# -*- 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 Tdf118883(UITestCase):
+
+ def test_tdf118883(self):
+ with self.ui_test.create_doc_in_start_center("writer") as writer_document:
+
+ # Insert shape with Ctrl key
+ xArgs = mkPropertyValues({"KeyModifier": 8192})
+ self.xUITest.executeCommandWithParameters(".uno:BasicShapes.rectangle", xArgs)
+
+ self.assertEqual(1, writer_document.DrawPage.getCount())
+
+ self.xUITest.executeCommand(".uno:Copy")
+
+ with self.ui_test.load_empty_file("calc") as calc_document:
+
+ self.xUITest.executeCommand(".uno:Paste")
+
+ # Without the fix in place, this test would have failed with
+ # AssertionError: 1 != 0
+ self.assertEqual(1, calc_document.DrawPages[0].getCount())
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests6/tdf120731.py b/sw/qa/uitest/writer_tests6/tdf120731.py
new file mode 100644
index 000000000..d503fbd6d
--- /dev/null
+++ b/sw/qa/uitest/writer_tests6/tdf120731.py
@@ -0,0 +1,23 @@
+# -*- 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
+
+#Bug 120731 - Crash cuilo!makeAutoCorrEdit when open character dialog with large amount of text selected
+
+class tdf120731(UITestCase):
+ def test_tdf120731_crash_open_char_dialog(self):
+ with self.ui_test.load_file(get_url_for_data_file("tdf120731.odt")) as writer_doc:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ self.xUITest.executeCommand(".uno:SelectAll")
+ with self.ui_test.execute_dialog_through_command(".uno:FontDialog"):
+ pass
+ self.assertEqual(writer_doc.Text.String[0:5], "Lorem")
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests6/tdf124586.py b/sw/qa/uitest/writer_tests6/tdf124586.py
new file mode 100644
index 000000000..27d7867e9
--- /dev/null
+++ b/sw/qa/uitest/writer_tests6/tdf124586.py
@@ -0,0 +1,30 @@
+# -*- 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_by_text
+from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
+
+#Bug 124586 - Crash if switch from user outline numbering to chapter numbering with same paragraph style
+
+class tdf124586(UITestCase):
+ def test_tdf124586_crash_switch_outline_numbering(self):
+ with self.ui_test.load_file(get_url_for_data_file("tdf124586.odt")) as writer_doc:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ #Goto Tools > Chapter Numbering.
+ with self.ui_test.execute_dialog_through_command(".uno:ChapterNumberingDialog") as xDialog:
+ xstyle = xDialog.getChild("style")
+ select_by_text(xstyle, "MyHeading")
+
+ self.assertEqual(writer_doc.Text.String[0:8], "Schritte")
+
+ with self.ui_test.execute_dialog_through_command(".uno:ChapterNumberingDialog") as xDialog:
+ xstyle = xDialog.getChild("style")
+ self.assertEqual(get_state_as_dict(xstyle)["SelectEntryText"], "MyHeading")
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests6/tdf124675.py b/sw/qa/uitest/writer_tests6/tdf124675.py
new file mode 100644
index 000000000..40eb2987e
--- /dev/null
+++ b/sw/qa/uitest/writer_tests6/tdf124675.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 libreoffice.uno.propertyvalue import mkPropertyValues
+from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
+
+#Bug 124675 - CRASH: after moving the content down and undoing
+
+class tdf124675(UITestCase):
+ def test_tdf124675_crash_moving_SwTextFrame_previous_page(self):
+ with self.ui_test.load_file(get_url_for_data_file("tdf124675.docx")) as writer_doc:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+
+ self.assertEqual(writer_doc.CurrentController.PageCount, 2)
+ self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "1")
+
+ for i in range(52):
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
+
+ self.assertEqual(writer_doc.CurrentController.PageCount, 4)
+ self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2")
+
+ for i in range(52):
+ self.xUITest.executeCommand(".uno:Undo")
+
+ self.assertEqual(writer_doc.CurrentController.PageCount, 2)
+ self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "1")
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests6/tdf125104.py b/sw/qa/uitest/writer_tests6/tdf125104.py
new file mode 100644
index 000000000..63dbda6a2
--- /dev/null
+++ b/sw/qa/uitest/writer_tests6/tdf125104.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 uitest.uihelper.common import select_pos, get_state_as_dict
+from uitest.uihelper.common import select_by_text
+from libreoffice.uno.propertyvalue import mkPropertyValues
+
+class tdf125104(UITestCase):
+
+ def set_combo_layout_format(self, dialog, format):
+ tabcontrol = dialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "1")
+ comboLayoutFormat = dialog.getChild("comboLayoutFormat")
+ select_by_text(comboLayoutFormat, format)
+
+ def test_tdf125104_pageFormat_numbering(self):
+ with self.ui_test.create_doc_in_start_center("writer") as document:
+
+ # insert page numbers on multiple pages
+ self.xUITest.executeCommand(".uno:InsertPageNumberField")
+ self.xUITest.executeCommand(".uno:InsertPagebreak")
+ self.xUITest.executeCommand(".uno:InsertPageNumberField")
+ text = document.Text.String.replace('\r\n', '\n')
+ self.assertEqual(text[0:1], "1")
+ self.assertEqual(text[2:3], "2")
+
+ # Bug 125104 - Changing page numbering to "1st, 2nd, 3rd,..." causes crashes when trying to change Page settings later
+ with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as xDialog:
+ self.set_combo_layout_format(xDialog, "1st, 2nd, 3rd, ...")
+
+ text = document.Text.String.replace('\r\n', '\n')
+ self.assertEqual(text[0:3], "1st")
+ self.assertEqual(text[4:7], "2nd")
+
+ with self.ui_test.execute_dialog_through_command(".uno:PageDialog", close_button="cancel") as xDialog:
+ comboLayoutFormat = xDialog.getChild("comboLayoutFormat")
+ self.assertEqual(get_state_as_dict(comboLayoutFormat)["SelectEntryText"], "1st, 2nd, 3rd, ...")
+
+ # change to devanagari alphabet format
+ with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as xDialog:
+ self.set_combo_layout_format(xDialog, "क, ख, ग, ...")
+
+ text = document.Text.String.replace('\r\n', '\n')
+ self.assertEqual(text[0:1], "क")
+ self.assertEqual(text[2:3], "ख")
+
+ # change to devanagari number format
+ with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as xDialog:
+ self.set_combo_layout_format(xDialog, "१, २, ३, ...")
+
+ text = document.Text.String.replace('\r\n', '\n')
+ self.assertEqual(text[0:1], "१")
+ self.assertEqual(text[2:3], "२")
+
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests6/tdf126017.py b/sw/qa/uitest/writer_tests6/tdf126017.py
new file mode 100644
index 000000000..a57a25305
--- /dev/null
+++ b/sw/qa/uitest/writer_tests6/tdf126017.py
@@ -0,0 +1,42 @@
+# -*- 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_url_for_data_file
+
+#Bug 126017 - Crash swlo!SwNode::EndOfSectionIndex
+
+class tdf126017(UITestCase):
+ def test_tdf126017_crash_after_undo(self):
+ with self.ui_test.load_file(get_url_for_data_file("tdf126017.odt")) as writer_doc:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+
+ #go to TOC
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button="close") as xDialog:
+ searchterm = xDialog.getChild("searchterm")
+ searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"aasasas"}))
+ xsearch = xDialog.getChild("search")
+ xsearch.executeAction("CLICK", tuple())
+ #edit index
+ with self.ui_test.execute_dialog_through_command(".uno:EditCurIndex") as xDiagIndex:
+ title = xDiagIndex.getChild("title")
+ title.executeAction("TYPE", mkPropertyValues({"TEXT":"aaaa"}))
+
+ self.xUITest.executeCommand(".uno:Undo")
+
+ with self.ui_test.execute_dialog_through_command(".uno:EditCurIndex") as xDiagIndex:
+ title = xDiagIndex.getChild("title")
+ title.executeAction("TYPE", mkPropertyValues({"TEXT":"aaaa"}))
+
+ self.xUITest.executeCommand(".uno:Undo")
+ self.xUITest.executeCommand(".uno:Undo")
+
+ self.assertEqual(writer_doc.Text.String.replace('\r\n', '\n')[1:7], "CRASHY")
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests6/tdf126168.py b/sw/qa/uitest/writer_tests6/tdf126168.py
new file mode 100644
index 000000000..2415351db
--- /dev/null
+++ b/sw/qa/uitest/writer_tests6/tdf126168.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
+#Bug 126168 - Crash in: rtl_uString_acquire: frame style undo redo
+
+class tdf126168(UITestCase):
+
+ def test_tdf126168_frame_undo_redo_crash(self):
+ with self.ui_test.create_doc_in_start_center("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+
+ #2) Menu > Insert > Frame > Frame
+ #3) Press OK in Frame dialog
+ with self.ui_test.execute_dialog_through_command(".uno:InsertFrame"):
+ pass
+ self.assertEqual(document.TextFrames.getCount(), 1)
+ #New Style from Selection [uno:StyleNewByExample]
+ with self.ui_test.execute_dialog_through_command(".uno:StyleNewByExample") as xDialog:
+ #5) Enter a name in the Create Style dialog and press OK
+ stylename = xDialog.getChild("stylename")
+ stylename.executeAction("TYPE", mkPropertyValues({"TEXT":"a"}))
+ #6) ctrl+z 3 times
+ self.xUITest.executeCommand(".uno:Undo")
+ self.xUITest.executeCommand(".uno:Undo")
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(document.TextFrames.getCount(), 0)
+ #7) shift+ctrl+z 3 times
+ self.xUITest.executeCommand(".uno:Redo")
+ self.xUITest.executeCommand(".uno:Redo")
+ self.xUITest.executeCommand(".uno:Redo")
+
+ #Results: crash
+ self.assertEqual(document.CurrentController.PageCount, 1)
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests6/tdf126226.py b/sw/qa/uitest/writer_tests6/tdf126226.py
new file mode 100644
index 000000000..65da8b6d6
--- /dev/null
+++ b/sw/qa/uitest/writer_tests6/tdf126226.py
@@ -0,0 +1,28 @@
+# -*- 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, get_url_for_data_file
+
+class Tdf126226(UITestCase):
+
+ def test_tdf126226(self):
+ with self.ui_test.load_file(get_url_for_data_file("tdf126226.odt")) as writer_doc:
+
+ self.xUITest.executeCommand(".uno:SelectAll")
+
+ # Without the fix in place, this test would have crashed here
+ with self.ui_test.execute_dialog_through_command(".uno:CommentChangeTracking") as xDialog:
+
+
+ self.assertEqual("Hello\n", get_state_as_dict(xDialog.getChild("edit"))["Text"])
+ self.assertEqual("Autor desconocido, 07/04/2019 13:43:52",
+ get_state_as_dict(xDialog.getChild("lastedit"))["Text"])
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests6/tdf128431.py b/sw/qa/uitest/writer_tests6/tdf128431.py
new file mode 100644
index 000000000..ee8941d4b
--- /dev/null
+++ b/sw/qa/uitest/writer_tests6/tdf128431.py
@@ -0,0 +1,41 @@
+# -*- 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 uitest.uihelper.common import change_measurement_unit
+#Bug 128431 - Synchronize padding in header borders it is not working
+
+class tdf128431(UITestCase):
+
+ def test_tdf128431_pageFormat_sync_padding(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:PageDialog") as xDialog:
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "6") #borders
+
+ sync = xDialog.getChild("sync")
+ bottomft = xDialog.getChild("bottommf")
+ topft = xDialog.getChild("topmf")
+ rightft = xDialog.getChild("rightmf")
+ leftft = xDialog.getChild("leftmf")
+
+ self.assertEqual(get_state_as_dict(sync)["Selected"], "true")
+ bottomft.executeAction("UP", tuple())
+ self.assertEqual(get_state_as_dict(bottomft)["Text"], "0.10 cm")
+ self.assertEqual(get_state_as_dict(topft)["Text"], "0.10 cm")
+ self.assertEqual(get_state_as_dict(rightft)["Text"], "0.10 cm")
+ self.assertEqual(get_state_as_dict(leftft)["Text"], "0.10 cm")
+
+
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests6/tdf131041.py b/sw/qa/uitest/writer_tests6/tdf131041.py
new file mode 100644
index 000000000..1de344888
--- /dev/null
+++ b/sw/qa/uitest/writer_tests6/tdf131041.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 uitest.uihelper.common import select_pos, get_state_as_dict
+
+class tdf131041(UITestCase):
+
+ def test_run(self):
+ with self.ui_test.create_doc_in_start_center("writer"):
+
+ with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as xDialog:
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "4") #header
+
+ xHeaderOn = xDialog.getChild("checkHeaderOn")
+ xMoreBtn = xDialog.getChild("buttonMore")
+
+ self.assertEqual(get_state_as_dict(xHeaderOn)["Selected"], "false")
+ self.assertEqual(get_state_as_dict(xMoreBtn)["Enabled"], "false")
+
+ xHeaderOn.executeAction("CLICK", tuple())
+
+ self.assertEqual(get_state_as_dict(xHeaderOn)["Selected"], "true")
+ self.assertEqual(get_state_as_dict(xMoreBtn)["Enabled"], "true")
+
+ with self.ui_test.execute_dialog_through_action(xMoreBtn, "CLICK") as xBorderDlg:
+
+
+ #modify any property
+ bottomft = xBorderDlg.getChild("bottommf")
+ bottomft.executeAction("UP", tuple())
+
+ #it would crash here
+
+
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests6/tdf141957.py b/sw/qa/uitest/writer_tests6/tdf141957.py
new file mode 100644
index 000000000..66795099f
--- /dev/null
+++ b/sw/qa/uitest/writer_tests6/tdf141957.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 get_state_as_dict, get_url_for_data_file
+
+class tdf141957(UITestCase):
+
+ def test_tdf_141957(self):
+ with self.ui_test.load_file(get_url_for_data_file("tdf141957.odt")):
+ with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as xDialog:
+ tabcontrol = xDialog.getChild("tabcontrol")
+
+ xLandscape = xDialog.getChild('radiobuttonLandscape')
+ self.assertEqual("true", get_state_as_dict(xLandscape)['Checked'])
+
+ xTextDirectionList = xDialog.getChild("comboTextFlowBox")
+ self.assertEqual("Right-to-left (vertical)", get_state_as_dict(xTextDirectionList)['SelectEntryText'])
+
+ xHeaderOn = xDialog.getChild("checkHeaderOn")
+ self.assertEqual(get_state_as_dict(xHeaderOn)["Selected"], "true")
+
+ xCharsPerLine = xDialog.getChild("spinNF_CHARSPERLINE")
+ xLinesPerLine = xDialog.getChild("spinNF_LINESPERPAGE")
+
+ # Without the fix in place, this test would have failed with
+ # AssertionError: '21' != '24'
+ self.assertEqual("21", get_state_as_dict(xCharsPerLine)['Text'])
+ self.assertEqual("20", get_state_as_dict(xLinesPerLine)['Text'])
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests6/tdf144691.py b/sw/qa/uitest/writer_tests6/tdf144691.py
new file mode 100644
index 000000000..f2f980a59
--- /dev/null
+++ b/sw/qa/uitest/writer_tests6/tdf144691.py
@@ -0,0 +1,46 @@
+# -*- 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 select_by_text
+
+class tdf144691(UITestCase):
+
+ def test_tdf144691(self):
+
+ with self.ui_test.create_doc_in_start_center("writer"):
+
+ with self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") as xDialog:
+ xPages = xDialog.getChild("pages")
+ xLanguageEntry = xPages.getChild('2')
+ xLanguageEntry.executeAction("EXPAND", tuple())
+ xxLanguageEntryGeneralEntry = xLanguageEntry.getChild('0')
+ xxLanguageEntryGeneralEntry.executeAction("SELECT", tuple())
+
+ xWesternLanguage = xDialog.getChild("westernlanguage")
+
+ defaultLanguage = get_state_as_dict(xWesternLanguage)['SelectEntryText']
+
+ # Select another language
+ select_by_text(xWesternLanguage, "Tajik")
+ self.assertEqual("Tajik", get_state_as_dict(xWesternLanguage)['SelectEntryText'])
+
+ xApply = xDialog.getChild("apply")
+ xApply.executeAction("CLICK", tuple())
+
+ # Without the fix in place, this test would have failed with
+ # AssertionError: 'Tajik' != 'English (USA)'
+ self.assertEqual("Tajik", get_state_as_dict(xWesternLanguage)['SelectEntryText'])
+
+ # Select the default language
+ select_by_text(xWesternLanguage, defaultLanguage)
+ self.assertEqual(defaultLanguage, get_state_as_dict(xWesternLanguage)['SelectEntryText'])
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests6/tdf89383.py b/sw/qa/uitest/writer_tests6/tdf89383.py
new file mode 100644
index 000000000..40a7e74c5
--- /dev/null
+++ b/sw/qa/uitest/writer_tests6/tdf89383.py
@@ -0,0 +1,30 @@
+# -*- 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 libreoffice.uno.propertyvalue import mkPropertyValues
+
+#Bug 89383 - Read-only passwords on OOXML files are not working
+
+class tdf89383(UITestCase):
+ def test_tdf89383_DOCX(self):
+ with self.ui_test.load_file(get_url_for_data_file("writeprotection.docx")):
+ document = self.ui_test.get_component()
+
+ # Without the fix in place, this test would have failed with
+ # AssertionError: False is not true
+ self.assertTrue(document.isReadonly())
+
+ with self.ui_test.execute_dialog_through_command(".uno:EditDoc") as xDialog:
+ xPassword = xDialog.getChild("newpassEntry")
+ xPassword.executeAction("TYPE", mkPropertyValues({"TEXT": "a"}))
+
+ self.assertFalse(document.isReadonly())
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests7/apply_line_cap.py b/sw/qa/uitest/writer_tests7/apply_line_cap.py
new file mode 100644
index 000000000..cd4fc8222
--- /dev/null
+++ b/sw/qa/uitest/writer_tests7/apply_line_cap.py
@@ -0,0 +1,93 @@
+# -*- 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, get_url_for_data_file
+from uitest.uihelper.common import select_pos
+
+class apply_line_cap(UITestCase):
+
+ def test_apply_line_cap(self):
+ with self.ui_test.load_file(get_url_for_data_file("tdf127166_prstDash_Word97.docx")) as writer_doc:
+
+ # check FLAT -> ROUND cap style change by selecting the new 'Rounded' preset line styles
+
+ # select second line shape (dashDot)
+ writer_doc.getCurrentController().select(writer_doc.getDrawPage()[1])
+
+ # wait for available line style setting
+ self.ui_test.wait_until_child_is_available('metricfield')
+
+ # line setting dialog window
+ with self.ui_test.execute_dialog_through_command(".uno:FormatLine") as xFormatLineDlg:
+
+ # get cap style combo box
+ xCapStyle = xFormatLineDlg.getChild("LB_CAP_STYLE")
+ cap_style = get_state_as_dict(xCapStyle)['SelectEntryText']
+
+ # get line style combo box
+ xLineStyle = xFormatLineDlg.getChild("LB_LINE_STYLE")
+
+ # select 'Dot (Rounded)', but store the previous value
+ style = get_state_as_dict(xLineStyle)['SelectEntryText']
+ select_pos(xLineStyle, "3")
+
+
+ self.assertEqual(cap_style, 'Flat')
+ self.assertEqual(style, 'Long Dash Dot')
+
+ # check round cap setting, opening the line style dialog again
+ writer_doc.getCurrentController().select(writer_doc.getDrawPage()[1])
+
+ # wait for available line style setting
+ self.ui_test.wait_until_child_is_available('metricfield')
+
+ # line setting dialog window
+ with self.ui_test.execute_dialog_through_command(".uno:FormatLine") as xFormatLineDlg:
+
+ # get cap style combo box
+ xCapStyle = xFormatLineDlg.getChild("LB_CAP_STYLE")
+ cap_style = get_state_as_dict(xCapStyle)['SelectEntryText']
+
+ # get line style combo box
+ xLineStyle = xFormatLineDlg.getChild("LB_LINE_STYLE")
+
+ # select 'Dot', but store the previous value
+ style = get_state_as_dict(xLineStyle)['SelectEntryText']
+ select_pos(xLineStyle, "2")
+
+
+ # This was 'Flat' (set only dash style of the line style before)
+ self.assertEqual(cap_style, 'Round')
+ self.assertEqual(style, 'Dot (Rounded)')
+
+ # 2. check ROUND -> FLAT cap style change
+ writer_doc.getCurrentController().select(writer_doc.getDrawPage()[1])
+
+ # wait for available line style setting
+ self.ui_test.wait_until_child_is_available('metricfield')
+
+ # line setting dialog window
+ with self.ui_test.execute_dialog_through_command(".uno:FormatLine") as xFormatLineDlg:
+
+ # get cap style combo box
+ xCapStyle = xFormatLineDlg.getChild("LB_CAP_STYLE")
+ cap_style = get_state_as_dict(xCapStyle)['SelectEntryText']
+
+ # get line style combo box
+ xLineStyle = xFormatLineDlg.getChild("LB_LINE_STYLE")
+
+ style = get_state_as_dict(xLineStyle)['SelectEntryText']
+
+
+ # This was 'Flat' (set only dash style of the line style before)
+ self.assertEqual(cap_style, 'Flat')
+ self.assertEqual(style, 'Dot')
+
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests7/forms.py b/sw/qa/uitest/writer_tests7/forms.py
new file mode 100644
index 000000000..2e44dbea6
--- /dev/null
+++ b/sw/qa/uitest/writer_tests7/forms.py
@@ -0,0 +1,205 @@
+# -*- 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, get_url_for_data_file
+from uitest.uihelper.common import change_measurement_unit
+from uitest.uihelper.common import select_by_text
+from libreoffice.uno.propertyvalue import mkPropertyValues
+
+class Forms(UITestCase):
+
+ def test_tdf140486(self):
+
+ with self.ui_test.load_file(get_url_for_data_file("tdf140486.odt")):
+
+ self.xUITest.executeCommand(".uno:JumpToNextFrame")
+
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:ControlProperties", close_button=""):
+ xChild = self.ui_test.wait_until_child_is_available('listbox-Empty string is NULL')
+
+ # Without the fix in place, this test would have failed with
+ # AssertionError: 'Yes' != 'No'
+ self.assertEqual("Yes", get_state_as_dict(xChild)['SelectEntryText'])
+
+ def test_tdf140198(self):
+
+ with self.ui_test.load_file(get_url_for_data_file("tdf140198.odt")):
+
+ self.xUITest.executeCommand(".uno:JumpToNextFrame")
+
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:ControlProperties", close_button=""):
+ xChild = self.ui_test.wait_until_child_is_available('listbox-Text type')
+
+ # Without the fix in place, this test would have failed with
+ # AssertionError: 'Multi-line' != 'Single-line'
+ self.assertEqual("Multi-line", get_state_as_dict(xChild)['SelectEntryText'])
+
+ def test_tdf141084(self):
+
+ # Reuse document from tdf#140239
+ with self.ui_test.load_file(get_url_for_data_file("tdf140239.odt")):
+
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:FormProperties", close_button=""):
+ xURL = self.ui_test.wait_until_child_is_available('urlcontrol-URL')
+
+ xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "1"}))
+ xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "2"}))
+ xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "3"}))
+ xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "4"}))
+ xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "5"}))
+
+ # Without the fix in place, this test would have failed with
+ # AssertionError: '12345' != 'file:///tmp/tmp/5file:///tmp/tmp/4file://[40 chars]mp/1'
+ self.assertEqual("12345", get_state_as_dict(xURL)['Text'])
+
+ def test_tdf140239(self):
+
+ with self.ui_test.load_file(get_url_for_data_file("tdf140239.odt")):
+
+ self.xUITest.executeCommand(".uno:JumpToNextFrame")
+
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:ControlProperties", close_button=""):
+ xAction = self.ui_test.wait_until_child_is_available('listbox-Action')
+ xURL = self.ui_test.wait_until_child_is_available('urlcontrol-URL')
+ xEntry = self.ui_test.wait_until_child_is_available('entry')
+
+ self.assertEqual("None", get_state_as_dict(xAction)['SelectEntryText'])
+ self.assertEqual("false", get_state_as_dict(xURL)['Enabled'])
+
+ select_by_text(xAction, "Open document/web page")
+
+ self.assertEqual("Open document/web page", get_state_as_dict(xAction)['SelectEntryText'])
+
+ self.ui_test.wait_until_property_is_updated(xURL, "Enabled", "true")
+ self.assertEqual("true", get_state_as_dict(xURL)['Enabled'])
+
+ xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "1"}))
+ xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "2"}))
+ xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "3"}))
+ xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "4"}))
+ xURL.executeAction("TYPE", mkPropertyValues({"TEXT": "5"}))
+
+ # Without the fix in place, this test would have failed with
+ # AssertionError: '12345' != '54321'
+ self.assertEqual("12345", get_state_as_dict(xURL)['Text'])
+
+ xEntry.executeAction("FOCUS", tuple())
+ self.assertEqual("Push Button", get_state_as_dict(xEntry)['Text'])
+
+ xEntry.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xEntry.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xEntry.executeAction("TYPE", mkPropertyValues({"TEXT": "Push"}))
+
+ # Move the focus to another element so the changes done before will take effect
+ xAction.executeAction("FOCUS", tuple())
+
+ # tdf#131522: Without the fix in place, this test would have failed with
+ # AssertionError: 'Push' != 'Push Button'
+ self.assertEqual("Push", get_state_as_dict(xEntry)['Text'])
+
+ def test_tdf138701(self):
+
+ # Reuse file from another test
+ with self.ui_test.load_file(get_url_for_data_file("tdf140198.odt")):
+
+ self.xUITest.executeCommand(".uno:JumpToNextFrame")
+
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:ControlProperties", close_button=""):
+ xChild = self.ui_test.wait_until_child_is_available('combobox-Data field')
+
+ xChild.executeAction("TYPE", mkPropertyValues({"TEXT": "1"}))
+ xChild.executeAction("TYPE", mkPropertyValues({"TEXT": "2"}))
+ xChild.executeAction("TYPE", mkPropertyValues({"TEXT": "3"}))
+ xChild.executeAction("TYPE", mkPropertyValues({"TEXT": "4"}))
+ xChild.executeAction("TYPE", mkPropertyValues({"TEXT": "5"}))
+
+ # Without the fix in place, this test would have failed with
+ # AssertionError: '12345' != '54321'
+ self.assertEqual("12345", get_state_as_dict(xChild)['Text'])
+
+ def test_tdf139486(self):
+
+ # Reuse file from another test
+ with self.ui_test.load_file(get_url_for_data_file("tdf140198.odt")) as document:
+
+ change_measurement_unit(self, "Centimeter")
+
+ self.xUITest.executeCommand(".uno:JumpToNextFrame")
+
+ drawPage = document.getDrawPages().getByIndex(0)
+ shape = drawPage.getByIndex(0)
+ self.assertEqual(13996, shape.getSize().Width)
+ self.assertEqual(2408, shape.getSize().Height)
+
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:ControlProperties", close_button=""):
+ xWidth = self.ui_test.wait_until_child_is_available('numericfield-Width')
+ xHeight = self.ui_test.wait_until_child_is_available('numericfield-Height')
+
+ self.assertEqual("14.00 cm", get_state_as_dict(xWidth)['Text'])
+ self.assertEqual("2.41 cm", get_state_as_dict(xHeight)['Text'])
+
+ xWidth.executeAction("FOCUS", tuple())
+ xWidth.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xWidth.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xWidth.executeAction("TYPE", mkPropertyValues({"TEXT":"20 cm"}))
+
+ self.assertEqual("20 cm", get_state_as_dict(xWidth)['Text'])
+
+ xHeight.executeAction("FOCUS", tuple())
+ xHeight.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xHeight.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xHeight.executeAction("TYPE", mkPropertyValues({"TEXT":"5 cm"}))
+
+ self.assertEqual("5 cm", get_state_as_dict(xHeight)['Text'])
+
+ # Move the focus to another element so the changes done before take effect on the document
+ xDialog = self.xUITest.getTopFocusWindow()
+ xDialog.getChild('numericfield-PositionY').executeAction("FOCUS", tuple())
+
+ xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit')
+ xToolkit.processEventsToIdle()
+
+ # Without the fix in place, the size of the form wouldn't have changed
+ self.assertEqual(20001, shape.getSize().Width)
+ self.assertEqual(5001, shape.getSize().Height)
+
+ def test_tdf138271(self):
+
+ with self.ui_test.load_file(get_url_for_data_file("tdf138271.odt")):
+
+ self.xUITest.executeCommand(".uno:JumpToNextFrame")
+
+ aOldValue = ["-1000000.00", "1000000.00"]
+ aNewValue = ["-100.00", "100.00"]
+
+ for i, name in enumerate(['formattedcontrol-Value min.', 'formattedcontrol-Value max.']):
+
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:ControlProperties", close_button=""):
+ xChild = self.ui_test.wait_until_child_is_available(name)
+
+ self.assertEqual(aOldValue[i], get_state_as_dict(xChild)['Text'])
+
+ xChild.executeAction("FOCUS", tuple())
+ xChild.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xChild.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xChild.executeAction("TYPE", mkPropertyValues({"TEXT": aNewValue[i]}))
+
+ #Close the dialog and open it again
+ self.xUITest.executeCommand(".uno:ControlProperties")
+
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:ControlProperties", close_button=""):
+ xChild = self.ui_test.wait_until_child_is_available(name)
+
+ # Without the fix in place, this test would have failed here because
+ # the values wouldn't have changed
+ self.assertEqual(aNewValue[i], get_state_as_dict(xChild)['Text'])
+
+ self.xUITest.executeCommand(".uno:ControlProperties")
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests7/tdf104795.py b/sw/qa/uitest/writer_tests7/tdf104795.py
new file mode 100644
index 000000000..98be1cf36
--- /dev/null
+++ b/sw/qa/uitest/writer_tests7/tdf104795.py
@@ -0,0 +1,26 @@
+# -*- 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, get_url_for_data_file
+
+class tdf104795(UITestCase):
+
+ def test_tdf104795(self):
+ with self.ui_test.load_file(get_url_for_data_file("tdf104795.odt")) as writer_doc:
+ with self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties") as xDialog:
+
+ sShowSignedText = get_state_as_dict(xDialog.getChild('showsigned'))['Text']
+
+
+ # Without the fix in place, this test would have failed with
+ # AssertionError: '12/19/2016, 23:06:31, timur.davletshin' != '12/19/2016, 00:00:00, !!br0ken!!'
+ self.assertEqual("12/19/2016, 23:06:31, timur.davletshin", sShowSignedText.split('@')[0])
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests7/tdf115853.py b/sw/qa/uitest/writer_tests7/tdf115853.py
new file mode 100644
index 000000000..a1e9d2a7d
--- /dev/null
+++ b/sw/qa/uitest/writer_tests7/tdf115853.py
@@ -0,0 +1,40 @@
+# -*- 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
+
+class tdf115853(UITestCase):
+
+ def test_tdf115853(self):
+ with self.ui_test.create_doc_in_start_center("writer"):
+ with self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties") as xDialog:
+
+ xTabs = xDialog.getChild("tabcontrol")
+
+ select_pos(xTabs, "2")
+
+ xAddBtn = xDialog.getChild("add")
+ xAddBtn.executeAction("CLICK", tuple())
+
+ xNameBox1 = xDialog.getChild("namebox1")
+ xNameBox1.executeAction("TYPE", mkPropertyValues({"TEXT":"Text"}))
+
+ xAddBtn = xDialog.getChild("add")
+ xAddBtn.executeAction("CLICK", tuple())
+
+ # Without the fix in place, this test would have failed with
+ # AssertionError: 'Text' != ''
+ self.assertEqual("Text", get_state_as_dict(xNameBox1)['Text'])
+
+
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests7/tdf119661.py b/sw/qa/uitest/writer_tests7/tdf119661.py
new file mode 100644
index 000000000..689410f64
--- /dev/null
+++ b/sw/qa/uitest/writer_tests7/tdf119661.py
@@ -0,0 +1,81 @@
+# -*- 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
+from org.libreoffice.unotest import systemPathToFileUrl
+from tempfile import TemporaryDirectory
+import os.path
+
+class tdf119661(UITestCase):
+
+ def test_tdf119661(self):
+ with TemporaryDirectory() as tempdir:
+ xFilePath = os.path.join(tempdir, "tdf119661-tmp.odt")
+
+ with self.ui_test.create_doc_in_start_center("writer"):
+
+ with self.ui_test.execute_dialog_through_command(".uno:InsertGraphic", close_button="") as xOpenDialog:
+ xFileName = xOpenDialog.getChild("file_name")
+ xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": get_url_for_data_file("LibreOffice.jpg")}))
+
+ xLink = xOpenDialog.getChild("link")
+ self.assertEqual("false", get_state_as_dict(xLink)['Selected'])
+
+ xLink.executeAction("CLICK", tuple())
+
+ xOpenBtn = xOpenDialog.getChild("open")
+
+ #Confirmation dialog is displayed
+ with self.ui_test.execute_dialog_through_action(xOpenBtn, 'CLICK'):
+ pass
+
+ with self.ui_test.execute_dialog_through_command(".uno:LinkDialog", close_button="close") as xDialog:
+
+
+ sLinks = "TB_LINKS"
+ xLinks = xDialog.getChild(sLinks)
+ self.assertEqual(1, len(xLinks.getChildren()))
+
+ sFileName = "FULL_FILE_NAME"
+ xFileName = xDialog.getChild(sFileName)
+ self.assertTrue(get_state_as_dict(xFileName)["Text"].endswith("/LibreOffice.jpg"))
+
+ sBreakLink = "BREAK_LINK"
+ xBreakLink = xDialog.getChild(sBreakLink)
+
+ with self.ui_test.execute_blocking_action(xBreakLink.executeAction,
+ args=("CLICK", tuple()), close_button="yes"):
+ pass
+
+
+
+ # Save Copy as
+ with self.ui_test.execute_dialog_through_command(".uno:SaveAs", close_button="open") as xDialog:
+
+ xFileName = xDialog.getChild("file_name")
+ xFileName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xFileName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+ xFileName.executeAction("TYPE", mkPropertyValues({"TEXT": xFilePath}))
+
+ self.ui_test.wait_until_file_is_available(xFilePath)
+
+ with self.ui_test.load_file(systemPathToFileUrl(xFilePath)):
+
+ self.xUITest.executeCommand(".uno:LinkDialog")
+
+ # Since the image is no longer linked, the link dialog is not open.
+ # Without the fix in place, this dialog would have been opened
+ xMainWin = self.xUITest.getTopFocusWindow()
+ self.assertTrue(sLinks not in xMainWin.getChildren())
+ self.assertTrue(sFileName not in xMainWin.getChildren())
+ self.assertTrue(sBreakLink not in xMainWin.getChildren())
+ self.assertTrue("writer_edit" in xMainWin.getChildren())
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests7/tdf122780.py b/sw/qa/uitest/writer_tests7/tdf122780.py
new file mode 100644
index 000000000..957ef31df
--- /dev/null
+++ b/sw/qa/uitest/writer_tests7/tdf122780.py
@@ -0,0 +1,23 @@
+# -*- 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, get_url_for_data_file
+
+class tdf122780(UITestCase):
+
+ def test_tdf122780(self):
+ with self.ui_test.load_file(get_url_for_data_file("tdf122780.docx")) as writer_doc:
+ with self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties") as xDialog:
+
+ # Without the fix in place, this test would have hung here
+ self.assertEqual("Normal_x005F", get_state_as_dict(xDialog.getChild('showtemplate'))['Text'][:12])
+ self.assertEqual(32767, len(get_state_as_dict(xDialog.getChild('showtemplate'))['Text']))
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests7/tdf128744.py b/sw/qa/uitest/writer_tests7/tdf128744.py
new file mode 100644
index 000000000..34201e858
--- /dev/null
+++ b/sw/qa/uitest/writer_tests7/tdf128744.py
@@ -0,0 +1,71 @@
+# -*- 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
+from uitest.uihelper.common import get_url_for_data_file
+
+class tdf128744(UITestCase):
+
+ def test_tdf128744(self):
+ # load the sample file
+ with self.ui_test.load_file(get_url_for_data_file("tdf128744.docx")):
+
+ # first try to unprotect Record Changes with an invalid password
+
+ with self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties") as xDialog:
+ xRecordChangesCheckbox = xDialog.getChild("recordchanges")
+ self.assertEqual(get_state_as_dict(xRecordChangesCheckbox)["Selected"], "true")
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "3") #tab Security
+ xProtectBtn = xDialog.getChild("protect")
+
+ # No close_button: click on the "Ok" inside to check the "Invalid password" infobox
+ with self.ui_test.execute_blocking_action(xProtectBtn.executeAction, args=('CLICK', ()), close_button="") as xPasswordDialog:
+ self.assertEqual(get_state_as_dict(xPasswordDialog)["DisplayText"], "Enter Password")
+ xPassword = xPasswordDialog.getChild("pass1ed")
+ xPassword.executeAction("TYPE", mkPropertyValues({"TEXT": "bad password"}))
+ print(xPasswordDialog.getChildren())
+ xOkBtn = xPasswordDialog.getChild("ok")
+ with self.ui_test.execute_blocking_action(xOkBtn.executeAction, args=('CLICK', ())) as xInfoBox:
+ # "Invalid password" infobox
+ self.assertEqual(get_state_as_dict(xInfoBox)["DisplayText"], 'Information')
+
+ # now open the dialog again and read the properties, Record Changes checkbox is still enabled
+ with self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties", close_button="cancel") as xDialog:
+ xRecordChangesCheckbox = xDialog.getChild("recordchanges")
+ self.assertEqual(get_state_as_dict(xRecordChangesCheckbox)["Selected"], "true")
+ xResetBtn = xDialog.getChild("reset")
+ xResetBtn.executeAction("CLICK", tuple())
+
+ # unprotect Record Changes with the valid password "test"
+
+ with self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties") as xDialog:
+ xRecordChangesCheckbox = xDialog.getChild("recordchanges")
+ self.assertEqual(get_state_as_dict(xRecordChangesCheckbox)["Selected"], "true")
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "3") #tab Security
+ xProtectBtn = xDialog.getChild("protect")
+
+ with self.ui_test.execute_blocking_action(xProtectBtn.executeAction, args=('CLICK', ())) as xPasswordDialog:
+ self.assertEqual(get_state_as_dict(xPasswordDialog)["DisplayText"], "Enter Password")
+ xPassword = xPasswordDialog.getChild("pass1ed")
+ # give the correct password
+ xPassword.executeAction("TYPE", mkPropertyValues({"TEXT": "test"}))
+
+ # now open the dialog again and read the properties, Record Changes checkbox is disabled now
+ with self.ui_test.execute_dialog_through_command(".uno:SetDocumentProperties", close_button="cancel") as xDialog:
+ xRecordChangesCheckbox = xDialog.getChild("recordchanges")
+ self.assertEqual(get_state_as_dict(xRecordChangesCheckbox)["Selected"], "false")
+ xResetBtn = xDialog.getChild("reset")
+ xResetBtn.executeAction("CLICK", tuple())
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests7/tdf131936.py b/sw/qa/uitest/writer_tests7/tdf131936.py
new file mode 100644
index 000000000..c7403bf2c
--- /dev/null
+++ b/sw/qa/uitest/writer_tests7/tdf131936.py
@@ -0,0 +1,24 @@
+# -*- 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, get_url_for_data_file
+
+class tdf131936(UITestCase):
+
+ def test_tdf131936_saveas_docx_version(self):
+ with self.ui_test.load_file(get_url_for_data_file("tdf131936.docx")):
+
+ with self.ui_test.execute_dialog_through_command(".uno:SaveAs", close_button="cancel") as xDialog:
+ xFileTypeCombo = xDialog.getChild("file_type")
+ state = get_state_as_dict(xFileTypeCombo)
+ self.assertEqual(state["SelectEntryText"], "Office Open XML Text (Transitional) (.docx)")
+
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests7/tdf132169.py b/sw/qa/uitest/writer_tests7/tdf132169.py
new file mode 100644
index 000000000..b2704b341
--- /dev/null
+++ b/sw/qa/uitest/writer_tests7/tdf132169.py
@@ -0,0 +1,43 @@
+# -*- 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, get_url_for_data_file, type_text
+from uitest.uihelper.common import change_measurement_unit
+
+class tdf132169(UITestCase):
+ def test_tdf132169(self):
+
+ with self.ui_test.load_file(get_url_for_data_file("shape.odt")) as writer_doc:
+
+ #set measurement to points
+ change_measurement_unit(self, "Point")
+
+ self.xUITest.executeCommand(".uno:JumpToNextFrame")
+
+ #wait until the toolbar is available
+ xLineMetric = self.ui_test.wait_until_child_is_available('metricfield')
+ self.assertEqual(get_state_as_dict(xLineMetric)["Text"], "0.0 pt")
+
+ #Check changing value from dialog also works
+ with self.ui_test.execute_dialog_through_command(".uno:FormatLine") as xFormatLineDlg:
+ xWidth = xFormatLineDlg.getChild('MTR_FLD_LINE_WIDTH')
+ type_text(xWidth, "4.0")
+
+ self.ui_test.wait_until_property_is_updated(xLineMetric, "Text", "4.0 pt")
+ self.assertEqual(get_state_as_dict(xLineMetric)["Text"], "4.0 pt")
+
+ xLineMetric.executeAction("UP", tuple())
+
+ drawPage = writer_doc.getDrawPages().getByIndex(0)
+ shape = drawPage.getByIndex(0)
+
+ #Without the fix in place, it would have been 310
+ self.assertEqual(shape.LineWidth, 176)
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests7/tdf132714.py b/sw/qa/uitest/writer_tests7/tdf132714.py
new file mode 100644
index 000000000..971db5f97
--- /dev/null
+++ b/sw/qa/uitest/writer_tests7/tdf132714.py
@@ -0,0 +1,23 @@
+# -*- 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
+
+class tdf132714(UITestCase):
+ def test_tdf132714(self):
+ with self.ui_test.load_file(get_url_for_data_file("tdf132714.odt")) as document:
+
+ # delete second row (first data row) in the associated text table of the chart
+ self.xUITest.executeCommand(".uno:GoDown")
+ self.xUITest.executeCommand(".uno:GoDown")
+ self.xUITest.executeCommand(".uno:GoDown")
+ # Without the fix in place, at this point crash occurs.
+ self.xUITest.executeCommand(".uno:DeleteRows")
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests7/tdf133348.py b/sw/qa/uitest/writer_tests7/tdf133348.py
new file mode 100644
index 000000000..8f8ff94cf
--- /dev/null
+++ b/sw/qa/uitest/writer_tests7/tdf133348.py
@@ -0,0 +1,58 @@
+# -*- 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 tdf133348(UITestCase):
+ def test_tdf133348(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:SelectAll")
+ xArgs = mkPropertyValues({"Text": "C1"})
+ self.xUITest.executeCommandWithParameters(".uno:InsertAnnotation", xArgs)
+
+ with self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") as xDialogOpt:
+ xPages = xDialogOpt.getChild("pages")
+ xEntry = xPages.getChild('0')
+ xEntry.executeAction("EXPAND", tuple())
+ xGeneralEntry = xEntry.getChild('0')
+ xGeneralEntry.executeAction("SELECT", tuple())
+ xFirstName = xDialogOpt.getChild("firstname")
+ props = {"TEXT": "Known Author"}
+ actionProps = mkPropertyValues(props)
+ xFirstName.executeAction("TYPE", actionProps)
+
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xArgs = mkPropertyValues({"Text": "C2"})
+ self.xUITest.executeCommandWithParameters(".uno:ReplyComment", xArgs)
+
+ # Wait for async events to be processed
+ xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit')
+ xToolkit.processEventsToIdle()
+
+ xEnum = document.TextFields.createEnumeration()
+ self.assertEqual(xEnum.nextElement().Author.strip(), 'Unknown Author')
+ self.assertEqual(xEnum.nextElement().Author.strip(), 'Known Author')
+
+ self.xUITest.executeCommand(".uno:Undo")
+ self.xUITest.executeCommand(".uno:Undo")
+
+ # Without the fix in place, it would have crashed here
+ self.xUITest.executeCommand(".uno:Undo")
+ self.xUITest.executeCommand(".uno:Undo")
+
+ # all comments have been deleted
+ self.assertFalse(document.TextFields.createEnumeration().hasMoreElements())
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests7/tdf134243.py b/sw/qa/uitest/writer_tests7/tdf134243.py
new file mode 100644
index 000000000..9200a4ba8
--- /dev/null
+++ b/sw/qa/uitest/writer_tests7/tdf134243.py
@@ -0,0 +1,21 @@
+# -*- 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
+
+class tdf134243(UITestCase):
+
+ def test_tdf134243(self):
+ with self.ui_test.load_file(get_url_for_data_file("tdf134243.odt")) as writer_doc:
+
+ # Without the fix in place, it would hung launching the mailmerge wizard
+ with self.ui_test.execute_dialog_through_command(".uno:MailMergeWizard", close_button="cancel"):
+ pass
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests7/tdf134452.py b/sw/qa/uitest/writer_tests7/tdf134452.py
new file mode 100644
index 000000000..28dbc6f12
--- /dev/null
+++ b/sw/qa/uitest/writer_tests7/tdf134452.py
@@ -0,0 +1,51 @@
+# -*- 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 libreoffice.uno.propertyvalue import mkPropertyValues
+from uitest.uihelper.common import select_pos
+
+# Bug 134452 - Applying a table style caused the loss of break/pagedesc props of the table
+
+
+class tdf134452(UITestCase):
+ def test_tdf134452(self):
+ with self.ui_test.create_doc_in_start_center("writer"):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
+ with self.ui_test.execute_dialog_through_command(".uno:InsertTable") as xDialog:
+ formatlbinstable = xDialog.getChild("formatlbinstable")
+ entry = formatlbinstable.getChild("1")
+ entry.executeAction("SELECT", tuple())
+ #setting the break and pageDesc properties
+ with self.ui_test.execute_dialog_through_command(".uno:TableDialog") as xDialog:
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "1")
+ xbreak = xDialog.getChild("break")
+ xbreak.executeAction("CLICK", tuple())
+ self.assertEqual("true", get_state_as_dict(xbreak)["Selected"])
+ xpagestyle = xDialog.getChild("pagestyle")
+ xpagestyle.executeAction("CLICK", tuple())
+ self.assertEqual("true", get_state_as_dict(xpagestyle)["Selected"])
+
+ #applying table style on the table
+ #without the fix, break and pageDesc properties would be overridden and lost
+ document = self.ui_test.get_component()
+ tables = document.getTextTables()
+ tables[0].setPropertyValue("TableTemplateName", "Box List Red")
+
+ with self.ui_test.execute_dialog_through_command(".uno:TableDialog") as xDialog:
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "1")
+ xbreak = xDialog.getChild("break")
+ self.assertEqual("true", get_state_as_dict(xbreak)["Selected"])
+ xpagestyle = xDialog.getChild("pagestyle")
+ self.assertEqual("true", get_state_as_dict(xpagestyle)["Selected"])
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests7/tdf135413.py b/sw/qa/uitest/writer_tests7/tdf135413.py
new file mode 100644
index 000000000..22c088eb2
--- /dev/null
+++ b/sw/qa/uitest/writer_tests7/tdf135413.py
@@ -0,0 +1,25 @@
+# -*- 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, get_url_for_data_file
+
+class tdf135413(UITestCase):
+
+ def test_tdf135413(self):
+
+ # Without the fix in place, this test would have crashed opening the document
+ # It seems the issue is only reproducible when the UI is displayed,
+ # thus, test it with a UItest
+ with self.ui_test.load_file(get_url_for_data_file("tdf135413.docx")):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+ self.assertEqual("16", get_state_as_dict(xWriterEdit)["Pages"])
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests7/tdf135938.py b/sw/qa/uitest/writer_tests7/tdf135938.py
new file mode 100755
index 000000000..00a72bec2
--- /dev/null
+++ b/sw/qa/uitest/writer_tests7/tdf135938.py
@@ -0,0 +1,51 @@
+# -*- 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 libreoffice.uno.propertyvalue import mkPropertyValues
+
+class tdf135938(UITestCase):
+
+ def test_tdf135938_cross_reference_update(self):
+ with self.ui_test.create_doc_in_start_center("writer"):
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:InsertReferenceField", close_button="cancel") as xDialog:
+ # Select set reference type
+ xTreelistType = xDialog.getChild("type-ref")
+ xTreeEntry = xTreelistType.getChild('0')
+ self.assertEqual(get_state_as_dict(xTreeEntry)["Text"], "Set Reference")
+ xTreeEntry.executeAction("SELECT", tuple())
+
+ # Insert cross references
+ xName = xDialog.getChild("name-ref")
+ xName.executeAction("TYPE", mkPropertyValues({"TEXT": "ABC"}))
+ xInsert = xDialog.getChild("ok")
+ xInsert.executeAction("CLICK", tuple())
+ xName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+ xName.executeAction("TYPE", mkPropertyValues({"TEXT": "DEF"}))
+ xInsert.executeAction("CLICK", tuple())
+
+ # Search for insert reference type
+ xFilter = None
+ for childIx in range(len(xTreelistType.getChildren())):
+ xTreeEntry = xTreelistType.getChild(childIx)
+ if get_state_as_dict(xTreeEntry)["Text"] == "Insert Reference":
+ xTreeEntry.executeAction("SELECT", tuple())
+ # Filter the cross references
+ xFilter = xDialog.getChild("filter")
+ xFilter.executeAction("TYPE", mkPropertyValues({"TEXT": "A"}))
+ # Without the fix in place, this test would have failed with
+ # AssertionError: 'ABC' != 'DEF', i.e., the text of the name field did not change
+ self.assertEqual(get_state_as_dict(xName)["Text"], "ABC")
+ break
+
+ # Check if insert reference entry was found
+ self.assertFalse(xFilter is None)
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests7/tdf137802.py b/sw/qa/uitest/writer_tests7/tdf137802.py
new file mode 100644
index 000000000..8616e5255
--- /dev/null
+++ b/sw/qa/uitest/writer_tests7/tdf137802.py
@@ -0,0 +1,77 @@
+# -*- 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 libreoffice.uno.propertyvalue import mkPropertyValues
+from com.sun.star.text.TextContentAnchorType import AT_PAGE, AT_PARAGRAPH
+
+class tdf137802(UITestCase):
+
+ def test_tdf137802(self):
+
+ with self.ui_test.load_file(get_url_for_data_file("tdf137802.odt")) as document:
+
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+
+ self.assertEqual(document.DrawPage.getCount(), 2)
+ self.assertEqual(AT_PARAGRAPH, document.DrawPage.getByIndex(0).AnchorType)
+
+ self.xUITest.executeCommand(".uno:JumpToNextFrame")
+
+ self.ui_test.wait_until_child_is_available('metricfield')
+
+ with self.ui_test.execute_dialog_through_command(".uno:TransformDialog") as xDialog:
+
+
+ xDialog.getChild('topage').executeAction("CLICK", tuple())
+
+
+ self.assertEqual(AT_PAGE, document.DrawPage.getByIndex(0).AnchorType)
+
+ self.assertEqual(document.DrawPage.getCount(), 2)
+
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+
+ # When shape 1 is selected, esc key doesn't put the focus back to the document
+ # because the shape has a textbox. Move the focus to another shape with tab key
+ # and then use escape
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ESC"}))
+
+ # Wait until the shape is deselected and the cursor is on the document
+ self.ui_test.wait_until_child_is_available('FontNameBox')
+
+ # Delete the second paragraph. Shape 2 is anchored to this paragraph
+ # so it should be deleted
+ # tdf#137587 fly is no longer deleted by backspace so explicitly select
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "SHIFT+LEFT"}))
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"}))
+
+ self.assertEqual(document.DrawPage.getCount(), 1)
+
+ self.xUITest.executeCommand(".uno:JumpToNextFrame")
+ self.xUITest.executeCommand(".uno:Delete")
+
+ self.assertEqual(document.DrawPage.getCount(), 0)
+
+ self.xUITest.executeCommand(".uno:Undo")
+
+ self.assertEqual(document.DrawPage.getCount(), 1)
+
+ self.xUITest.executeCommand(".uno:Undo")
+
+ self.assertEqual(document.DrawPage.getCount(), 2)
+
+ self.xUITest.executeCommand(".uno:Undo")
+
+ self.assertEqual(AT_PARAGRAPH, document.DrawPage.getByIndex(0).AnchorType)
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests7/tdf137803.py b/sw/qa/uitest/writer_tests7/tdf137803.py
new file mode 100644
index 000000000..3954caca1
--- /dev/null
+++ b/sw/qa/uitest/writer_tests7/tdf137803.py
@@ -0,0 +1,49 @@
+# -*- 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
+
+
+class tdf137803(UITestCase):
+ def test_tdf137803(self):
+ # load the sample file
+ with self.ui_test.load_file(get_url_for_data_file("tdf137803.odt")) as document:
+
+ # select the shape
+ self.xUITest.executeCommand(".uno:JumpToNextFrame")
+ self.ui_test.wait_until_child_is_available('metricfield')
+
+ # open textattrs dialog
+ with self.ui_test.execute_dialog_through_command(".uno:TextAttributes") as TextDialog:
+
+ # check autosize on
+ TSB_AUTOGROW_SIZE = TextDialog.getChild('TSB_AUTOGROW_SIZE')
+ TSB_AUTOGROW_SIZE.executeAction("CLICK",tuple())
+
+ # get the shape
+ drawPage = document.getDrawPages().getByIndex(0)
+ shape = drawPage.getByIndex(0)
+
+ # and the textbox
+ frame = shape.getText()
+
+ # get the positions
+ shapeYPos = shape.getPropertyValue("VertOrientPosition")
+ frameYPos = frame.getPropertyValue("VertOrientPosition")
+ shpsize = shape.getSize().Height
+
+ xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit')
+ xToolkit.processEventsToIdle()
+
+ # without the fix, at this point the textbox falls apart so this won't be passed
+ self.assertLess(frameYPos, shapeYPos + shpsize)
+
+ # close the doc
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests7/tdf139301.py b/sw/qa/uitest/writer_tests7/tdf139301.py
new file mode 100644
index 000000000..242d638e6
--- /dev/null
+++ b/sw/qa/uitest/writer_tests7/tdf139301.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 uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
+
+class tdf139301(UITestCase):
+
+ styles = ('Long Dash', 'Long Dash Dot', 'Long Dot', 'Double Dash', 'Double Dash Dot', 'Double Dash Dot Dot', 'Dash', 'Dash Dot', 'Dash Dot Dot', 'Dot')
+
+ def test_tdf139301(self):
+ with self.ui_test.load_file(get_url_for_data_file("tdf127166_prstDash_Word97.docx")) as writer_doc:
+
+ for i in range(len(self.styles)):
+ # select next line shape
+ writer_doc.getCurrentController().select(writer_doc.getDrawPage()[i])
+
+ # wait for available line style setting
+ self.ui_test.wait_until_child_is_available('metricfield')
+
+ # line setting dialog window
+ with self.ui_test.execute_dialog_through_command(".uno:FormatLine") as xFormatLineDlg:
+ # get line style combo box
+ xLineStyle = xFormatLineDlg.getChild("LB_LINE_STYLE")
+
+ # check preset line style
+ style = get_state_as_dict(xLineStyle)['SelectEntryText']
+
+
+ self.assertEqual(style, self.styles[i])
+
+ def test_round_cap(self):
+ with self.ui_test.load_file(get_url_for_data_file("tdf127166_prstDash_round_cap.docx")) as writer_doc:
+
+ style_name_extension = ' (Rounded)'
+
+ for i in range(len(self.styles)):
+ # select next line shape
+ writer_doc.getCurrentController().select(writer_doc.getDrawPage()[i])
+
+ # wait for available line style setting
+ self.ui_test.wait_until_child_is_available('metricfield')
+
+ # line setting dialog window
+ with self.ui_test.execute_dialog_through_command(".uno:FormatLine") as xFormatLineDlg:
+ # get line style combo box
+ xLineStyle = xFormatLineDlg.getChild("LB_LINE_STYLE")
+
+ # check preset line style
+ style = get_state_as_dict(xLineStyle)['SelectEntryText']
+
+
+ self.assertEqual(style, self.styles[i] + style_name_extension)
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests7/tdf140117.py b/sw/qa/uitest/writer_tests7/tdf140117.py
new file mode 100644
index 000000000..42b8b04fa
--- /dev/null
+++ b/sw/qa/uitest/writer_tests7/tdf140117.py
@@ -0,0 +1,59 @@
+# -*- 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_pos
+from uitest.uihelper.common import type_text
+from uitest.uihelper.common import get_url_for_data_file
+
+class tdf140117(UITestCase):
+ def test_tdf140117(self):
+ # load the sample file
+ with self.ui_test.load_file(get_url_for_data_file("tdf140117.fodt")) as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+
+ for i in range(3):
+ xWriterEdit.executeAction("GOTO", mkPropertyValues({"PAGE": "2"}))
+
+ self.xUITest.executeCommand(".uno:JumpToHeader")
+
+ xPageSytle = document.getStyleFamilies().getByIndex(2)
+ xHeaderText = xPageSytle.getByIndex(0).HeaderText.String
+ xHeaderFirstText = xPageSytle.getByIndex(0).HeaderTextFirst.String
+ xHeaderLeftText = xPageSytle.getByIndex(0).HeaderTextLeft.String
+ xHeaderRightText = xPageSytle.getByIndex(0).HeaderTextRight.String
+
+ # Option "same content on left and right pages" is false,
+ # insert text "XXXX" before actual header text "left" on page 2
+ if i == 0:
+ type_text(xWriterEdit, "XXXX")
+
+ # Option "same content on left and right pages" is true,
+ # header of page 2 contains the same text as page 1
+ elif i == 1:
+ self.assertEqual("right", xHeaderText)
+ self.assertEqual("right", xHeaderRightText)
+
+ # Option "same content on left and right pages" is false again.
+ # This was "right" instead of keeping the header content disabled
+ # temporarily for the second interaction of the loop.
+ elif i == 2:
+ self.assertEqual("XXXXleft", xHeaderLeftText)
+
+ with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as PageDialog:
+
+ xTabs = PageDialog.getChild("tabcontrol")
+ select_pos(xTabs, "4")
+
+ # Change option "same content on left and right pages" for the next iteration
+ Button = xTabs.getChild('checkSameLR')
+ Button.executeAction("CLICK", tuple())
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests7/tdf140863.py b/sw/qa/uitest/writer_tests7/tdf140863.py
new file mode 100644
index 000000000..edac0e451
--- /dev/null
+++ b/sw/qa/uitest/writer_tests7/tdf140863.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
+
+class tdf140863(UITestCase):
+
+ def test_tdf140863(self):
+
+ with self.ui_test.create_doc_in_start_center("writer") as document:
+
+ # Insert one section
+ with self.ui_test.execute_dialog_through_command(".uno:InsertSection"):
+ pass
+
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+
+ # Insert a page break in the section
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"}))
+ self.xUITest.executeCommand(".uno:InsertPagebreak")
+ self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2")
+
+ self.assertEqual(1, len(document.TextSections))
+ self.assertTrue(document.TextSections.Section1.IsVisible)
+
+
+ with self.ui_test.execute_dialog_through_command(".uno:EditRegion") as xDialog:
+ xHide = xDialog.getChild('hide')
+ self.assertEqual('false', get_state_as_dict(xHide)['Selected'])
+
+ xHide.executeAction('CLICK', tuple())
+
+
+ self.assertEqual(1, len(document.TextSections))
+ self.assertFalse(document.TextSections.Section1.IsVisible)
+ self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "1")
+
+ with self.ui_test.execute_dialog_through_command(".uno:EditRegion") as xDialog:
+ xHide = xDialog.getChild('hide')
+ self.assertEqual('true', get_state_as_dict(xHide)['Selected'])
+
+ xHide.executeAction('CLICK', tuple())
+
+ self.assertEqual(1, len(document.TextSections))
+ self.assertTrue(document.TextSections.Section1.IsVisible)
+
+ # Without the fix in place, this test would have failed with
+ # AssertionError: '1' != '2'
+ self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2")
+
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests7/tdf141158.py b/sw/qa/uitest/writer_tests7/tdf141158.py
new file mode 100644
index 000000000..6cdf178da
--- /dev/null
+++ b/sw/qa/uitest/writer_tests7/tdf141158.py
@@ -0,0 +1,41 @@
+# -*- 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
+from uitest.uihelper.common import get_url_for_data_file
+
+class TestTdf141158(UITestCase):
+ def test_tdf141158(self):
+ # load the desired bugdoc
+ with self.ui_test.load_file(get_url_for_data_file("TestHiddenHeadersFooters.docx")) as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+ # open the page styles dialog and select the headers tab
+ with self.ui_test.execute_dialog_through_command(".uno:PageStyleName") as xDialog:
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "4")
+ # make the same left right page header state to off and apply the setting
+ checkSameLR = xDialog.getChild("checkSameLR")
+ checkSameLR.executeAction("CLICK",tuple())
+
+ # go to the left header
+ xWriterEdit.executeAction("GOTO", mkPropertyValues({"PAGE": "2"}))
+ self.xUITest.executeCommand(".uno:JumpToHeader")
+ # get the text of the header
+ xPageSytle = document.getStyleFamilies().getByIndex(2)
+ xHeaderText = xPageSytle.getByIndex(0).HeaderText.String
+ xHeaderLeftText = xPageSytle.getByIndex(0).HeaderTextLeft.String
+ # without the fix in place it was "Right Header" (lost hidden left header),
+ # with the fix it should pass...
+ self.assertEqual("Left Header", xHeaderLeftText)
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests7/tdf141557.py b/sw/qa/uitest/writer_tests7/tdf141557.py
new file mode 100644
index 000000000..355a9f366
--- /dev/null
+++ b/sw/qa/uitest/writer_tests7/tdf141557.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 com.sun.star.text.TextContentAnchorType import AS_CHARACTER, AT_PARAGRAPH
+import org.libreoffice.unotest
+from uitest.uihelper.common import get_url_for_data_file
+
+class tdf141557(UITestCase):
+ def test_tdf141557(self):
+ # load the sample file
+ with self.ui_test.load_file(get_url_for_data_file("tdf141557.docx")):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+ document = self.ui_test.get_component()
+
+ self.assertEqual(AS_CHARACTER, document.DrawPage.getByIndex(0).AnchorType)
+
+ self.xUITest.executeCommand(".uno:JumpToNextFrame")
+
+ self.ui_test.wait_until_child_is_available('metricfield')
+
+ with self.ui_test.execute_dialog_through_command(".uno:TransformDialog") as xDialog:
+
+
+ xDialog.getChild('topara').executeAction("CLICK", tuple())
+
+
+ # Without the fix in place, at this point crash occurs.
+ self.assertEqual(AT_PARAGRAPH, document.DrawPage.getByIndex(0).AnchorType)
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests7/tdf143574.py b/sw/qa/uitest/writer_tests7/tdf143574.py
new file mode 100644
index 000000000..0fc5dc66d
--- /dev/null
+++ b/sw/qa/uitest/writer_tests7/tdf143574.py
@@ -0,0 +1,40 @@
+# -*- 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 org.libreoffice.unotest
+from uitest.uihelper.common import get_url_for_data_file
+from libreoffice.uno.propertyvalue import mkPropertyValues
+
+class tdf143574(UITestCase):
+ def test_tdf143574(self):
+ # load the sample file
+ with self.ui_test.load_file(get_url_for_data_file("tdf143574.odt")):
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+ document = self.ui_test.get_component()
+
+ # check the shape type.
+ self.assertEqual("com.sun.star.drawing.GroupShape", document.DrawPage.getByIndex(0).ShapeType)
+
+ # select the shape.
+ self.xUITest.executeCommand(".uno:JumpToNextFrame")
+ self.ui_test.wait_until_child_is_available('metricfield')
+
+ # go inside the group
+ self.xUITest.executeCommand(".uno:EnterGroup");
+
+ # select a shape in the group
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "TAB"}))
+
+ # At this point the Writer crashed here before the fix.
+ self.xUITest.executeCommand(".uno:AddTextBox");
+
+ self.assertEqual(True, document.DrawPage.getByIndex(0).getByIndex(2).TextBox)
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests7/tdf143785.py b/sw/qa/uitest/writer_tests7/tdf143785.py
new file mode 100644
index 000000000..0e069b558
--- /dev/null
+++ b/sw/qa/uitest/writer_tests7/tdf143785.py
@@ -0,0 +1,43 @@
+# -*- 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 libreoffice.uno.propertyvalue import mkPropertyValues
+from com.sun.star.text.TextContentAnchorType import AT_PAGE, AT_PARAGRAPH
+
+class tdf143785(UITestCase):
+
+ def test_tdf143785(self):
+
+ with self.ui_test.load_file(get_url_for_data_file("tdf137802.odt")) as document:
+
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+
+ self.xUITest.executeCommand(".uno:JumpToNextFrame")
+
+ self.ui_test.wait_until_child_is_available('metricfield')
+
+ self.assertEqual(False, document.isModified())
+
+ with self.ui_test.execute_dialog_through_command(".uno:TransformDialog", close_button="cancel") as xDialog:
+ pass
+
+ # Without the fix in place, this test would have failed with
+ # AssertionError: False != True
+ self.assertEqual(False, document.isModified())
+
+ with self.ui_test.execute_dialog_through_command(".uno:FormatArea", close_button="cancel") as xDialog:
+ pass
+
+ # tdf#143778: Without the fix in place, this test would have failed with
+ # AssertionError: False != True
+ self.assertEqual(False, document.isModified())
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests7/tdf144439.py b/sw/qa/uitest/writer_tests7/tdf144439.py
new file mode 100644
index 000000000..34911ee4c
--- /dev/null
+++ b/sw/qa/uitest/writer_tests7/tdf144439.py
@@ -0,0 +1,94 @@
+# -*- 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, select_by_text, select_pos, get_state_as_dict
+
+class tdf144439(UITestCase):
+
+ def test_tdf144439_list(self):
+ with self.ui_test.create_doc_in_start_center("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+ # Enter some text
+ type_text(xWriterEdit, "List item")
+ # Apply numbering
+ self.xUITest.executeCommand(".uno:DefaultNumbering")
+ # Increase level up to 2
+ self.xUITest.executeCommand(".uno:IncrementIndent")
+
+ with self.ui_test.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") as xDialog:
+ # Select custom tab
+ xTabs = xDialog.getChild("tabcontrol")
+ select_pos(xTabs, "5")
+
+ # Select numbering
+ xNumFmt = xDialog.getChild("numfmtlb")
+ select_by_text(xNumFmt, "1, 2, 3, ...")
+
+ # Increase number of sublevels to show
+ xSubLevels = xDialog.getChild("sublevels")
+ xSubLevels.executeAction("UP", tuple())
+
+ Paragraphs = document.Text.createEnumeration()
+ Para1 = Paragraphs.nextElement()
+ self.assertEqual(Para1.String, "List item")
+ self.assertEqual(Para1.getPropertyValue("ListLabelString"), "1.1.")
+
+ def test_tdf144439_outline(self):
+ with self.ui_test.create_doc_in_start_center("writer") as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+ # Enter some text
+ type_text(xWriterEdit, "Outline2")
+ # Apply outline level 2 (as a style)
+ self.xUITest.executeCommand(".uno:StyleApply?Style:string=Heading%202&FamilyName:string=ParagraphStyles")
+
+ with self.ui_test.execute_dialog_through_command(".uno:ChapterNumberingDialog") as xDialog:
+ # Select level "2"
+ xLevel = xDialog.getChild("level")
+ xLevel2 = xLevel.getChild("1")
+ xLevel2.executeAction("SELECT", tuple())
+ self.assertEqual("2", get_state_as_dict(xLevel)['SelectEntryText'])
+
+ # Select custom tab
+ xTab = xDialog.getChild("tabcontrol")
+ select_pos(xTab, "0")
+
+ # Select numbering
+ xNumFmt = xDialog.getChild("numbering")
+ select_by_text(xNumFmt, "1, 2, 3, ...")
+
+ # Increase number of sublevels to show
+ xSubLevels = xDialog.getChild("sublevelsnf")
+ xSubLevels.executeAction("UP", tuple())
+
+ Paragraphs = document.Text.createEnumeration()
+ Para1 = Paragraphs.nextElement()
+ self.assertEqual(Para1.String, "Outline2")
+ self.assertEqual(Para1.getPropertyValue("ListLabelString"), "1")
+
+ with self.ui_test.execute_dialog_through_command(".uno:ChapterNumberingDialog") as xDialog:
+ # Select level "1"
+ xLevel = xDialog.getChild("level")
+ xLevel2 = xLevel.getChild("0")
+ xLevel2.executeAction("SELECT", tuple())
+ self.assertEqual("1", get_state_as_dict(xLevel)['SelectEntryText'])
+
+ # Select custom tab
+ xTab = xDialog.getChild("tabcontrol")
+ select_pos(xTab, "0")
+
+ # Select numbering
+ xNumFmt = xDialog.getChild("numbering")
+ select_by_text(xNumFmt, "1, 2, 3, ...")
+
+ self.assertEqual(Para1.String, "Outline2")
+ self.assertEqual(Para1.getPropertyValue("ListLabelString"), "1.1")
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests7/tdf144578.py b/sw/qa/uitest/writer_tests7/tdf144578.py
new file mode 100644
index 000000000..f92034edc
--- /dev/null
+++ b/sw/qa/uitest/writer_tests7/tdf144578.py
@@ -0,0 +1,68 @@
+# -*- 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, get_url_for_data_file
+
+import time
+
+class tdf144578(UITestCase):
+
+ def test_tdf144578(self):
+ with self.ui_test.load_file(get_url_for_data_file("tdf144578.odt")) as writer_doc:
+ with self.ui_test.execute_dialog_through_command(".uno:ChapterNumberingDialog") as xDialog:
+ # Select level "1"
+ xLevelsTree = xDialog.getChild("level")
+ xLevel = xLevelsTree.getChild("0")
+ xLevel.executeAction("SELECT", tuple())
+ # Check value for show upper levels
+ xSubLevels = xDialog.getChild("sublevelsnf")
+ self.assertEqual(get_state_as_dict(xSubLevels)["Text"], "1")
+
+ # Select level "2"
+ xLevel = xLevelsTree.getChild("1")
+ xLevel.executeAction("SELECT", tuple())
+ # Check value for show upper levels
+ xSubLevels = xDialog.getChild("sublevelsnf")
+ self.assertEqual(get_state_as_dict(xSubLevels)["Text"], "2")
+
+ # Select level "3"
+ xLevel = xLevelsTree.getChild("2")
+ xLevel.executeAction("SELECT", tuple())
+ # Check value for show upper levels
+ xSubLevels = xDialog.getChild("sublevelsnf")
+ self.assertEqual(get_state_as_dict(xSubLevels)["Text"], "3")
+
+ # Select level "3"
+ xLevel = xLevelsTree.getChild("3")
+ xLevel.executeAction("SELECT", tuple())
+ # Check value for show upper levels
+ xSubLevels = xDialog.getChild("sublevelsnf")
+ self.assertEqual(get_state_as_dict(xSubLevels)["Text"], "1")
+
+ # And also verify label strings in outlines
+ Paragraphs = []
+ ParagraphEnum = writer_doc.Text.createEnumeration()
+ while ParagraphEnum.hasMoreElements():
+ Para = ParagraphEnum.nextElement()
+ Paragraphs.append(Para)
+
+ self.assertEqual(Paragraphs[0].getPropertyValue("ListLabelString"), "I.")
+ self.assertEqual(Paragraphs[2].getPropertyValue("ListLabelString"), "II.")
+ self.assertEqual(Paragraphs[4].getPropertyValue("ListLabelString"), "II.A.")
+ self.assertEqual(Paragraphs[6].getPropertyValue("ListLabelString"), "II.B.")
+ self.assertEqual(Paragraphs[8].getPropertyValue("ListLabelString"), "III.")
+ self.assertEqual(Paragraphs[10].getPropertyValue("ListLabelString"), "III.A.")
+ self.assertEqual(Paragraphs[11].getPropertyValue("ListLabelString"), "III.A.1.")
+ self.assertEqual(Paragraphs[13].getPropertyValue("ListLabelString"), "III.A.2.")
+ self.assertEqual(Paragraphs[15].getPropertyValue("ListLabelString"), "III.B.")
+ self.assertEqual(Paragraphs[17].getPropertyValue("ListLabelString"), "III.C.")
+ self.assertEqual(Paragraphs[19].getPropertyValue("ListLabelString"), "III.C.1.")
+ self.assertEqual(Paragraphs[21].getPropertyValue("ListLabelString"), "III.C.2.")
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests7/tdf145093.py b/sw/qa/uitest/writer_tests7/tdf145093.py
new file mode 100644
index 000000000..b02fa4cbb
--- /dev/null
+++ b/sw/qa/uitest/writer_tests7/tdf145093.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 libreoffice.uno.propertyvalue import mkPropertyValues
+from uitest.uihelper.common import select_pos
+from uitest.uihelper.common import type_text
+from uitest.uihelper.common import get_url_for_data_file
+
+class tdf145093(UITestCase):
+ def test_tdf145093(self):
+ # load the sample file
+ with self.ui_test.load_file(get_url_for_data_file("tdf39721.fodt")) as document:
+
+ # redlining should be on
+ self.xUITest.executeCommand(".uno:TrackChanges")
+
+ # Move Up/Down a list item over a tracked paragraph insertion resulted a crash
+ # (Note: not only at the end of the document, but check the original
+ # bug report temporarily, where the problem is triggered by an other problem).
+
+ self.xUITest.executeCommand(".uno:MoveDown")
+ self.xUITest.executeCommand(".uno:MoveDown")
+ # Note: Move list item from the end of the document creates an extra insertion.
+ # TODO: fix this other problem, and improve the test with an extra paragraph insertion
+ self.xUITest.executeCommand(".uno:MoveUp")
+
+ # This was a crash (using invalid pointer) both in Show Changes and Hide Changes modes
+ self.xUITest.executeCommand(".uno:MoveDown")
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests7/tdf145158.py b/sw/qa/uitest/writer_tests7/tdf145158.py
new file mode 100644
index 000000000..50ef8575d
--- /dev/null
+++ b/sw/qa/uitest/writer_tests7/tdf145158.py
@@ -0,0 +1,38 @@
+# -*- 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_by_text
+
+class tdf145158(UITestCase):
+
+ def test_tdf145158(self):
+
+ with self.ui_test.create_doc_in_start_center("writer"):
+
+ xMainWindow = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xMainWindow.getChild("writer_edit")
+
+ xFontsize = xMainWindow.getChild("fontsizecombobox")
+
+ self.assertEqual("12 pt", get_state_as_dict(xFontsize)['Text'])
+
+ select_by_text(xFontsize, "10.5 pt")
+
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "Test"}))
+
+ with self.ui_test.execute_dialog_through_command(".uno:FontDialog") as xDialog:
+ xSizeFont = xDialog.getChild("cbWestSize")
+
+ # Without the fix in place, this test would have failed with
+ # AssertionError: '10.5 pt' != '11 pt'
+ self.assertEqual("10.5 pt", get_state_as_dict(xSizeFont)['Text'])
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests7/tdf145178.py b/sw/qa/uitest/writer_tests7/tdf145178.py
new file mode 100644
index 000000000..f535fad2a
--- /dev/null
+++ b/sw/qa/uitest/writer_tests7/tdf145178.py
@@ -0,0 +1,79 @@
+# -*- 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_pos
+from uitest.uihelper.common import get_url_for_data_file
+
+class tdf145178(UITestCase):
+
+ def test_tdf145178(self):
+
+ with self.ui_test.load_file(get_url_for_data_file('tdf145178.fodt')):
+
+ with self.ui_test.execute_dialog_through_command(".uno:EditRegion") as xDialog:
+ xTree = xDialog.getChild("tree")
+ self.assertEqual("1", get_state_as_dict(xTree)['Children'])
+ self.assertEqual("Section1", get_state_as_dict(xTree.getChild('0'))['Text'])
+ self.assertEqual("Section1", get_state_as_dict(xDialog.getChild('curname'))['Text'])
+
+ xOptions = xDialog.getChild("options")
+ with self.ui_test.execute_blocking_action(
+ xOptions.executeAction, args=('CLICK', ())) as xOptDialog:
+ xTabs = xOptDialog.getChild("tabcontrol")
+ select_pos(xTabs, "3")
+
+ xFtnExt = xOptDialog.getChild("ftnntattextend")
+ xFtnNum = xOptDialog.getChild("ftnntnum")
+ xFtnFrm = xOptDialog.getChild("ftnntnumfmt")
+ xFtnPre = xOptDialog.getChild("ftnprefix")
+ xFtnSuf = xOptDialog.getChild("ftnsuffix")
+ xFtnView = xOptDialog.getChild("ftnnumviewbox")
+ xFtnOffset = xOptDialog.getChild("ftnoffset")
+
+ self.assertEqual("true", get_state_as_dict(xFtnExt)["Enabled"])
+ self.assertEqual("true", get_state_as_dict(xFtnNum)["Enabled"])
+ self.assertEqual("true", get_state_as_dict(xFtnFrm)["Enabled"])
+ self.assertEqual("true", get_state_as_dict(xFtnPre)["Enabled"])
+ self.assertEqual("true", get_state_as_dict(xFtnSuf)["Enabled"])
+ self.assertEqual("true", get_state_as_dict(xFtnView)["Enabled"])
+ self.assertEqual("true", get_state_as_dict(xFtnOffset)["Enabled"])
+
+ self.assertEqual("1, 2, 3, ...", get_state_as_dict(xFtnView)["DisplayText"])
+ self.assertEqual("(", get_state_as_dict(xFtnPre)["Text"])
+
+ # Without the fix in place, this test would have failed with
+ # AssertionError: ')' != ''
+ self.assertEqual(")", get_state_as_dict(xFtnSuf)["Text"])
+
+ self.assertEqual("3", get_state_as_dict(xFtnOffset)["Text"])
+
+ xEndExt = xOptDialog.getChild("endntattextend")
+ xEndNum = xOptDialog.getChild("endntnum")
+ xEndFrm = xOptDialog.getChild("endntnumfmt")
+ xEndPre = xOptDialog.getChild("endprefix")
+ xEndSuf = xOptDialog.getChild("endsuffix")
+ xEndView = xOptDialog.getChild("endnumviewbox")
+ xEndOffset = xOptDialog.getChild("endoffset")
+
+ self.assertEqual("true", get_state_as_dict(xEndExt)["Enabled"])
+ self.assertEqual("true", get_state_as_dict(xEndNum)["Enabled"])
+ self.assertEqual("true", get_state_as_dict(xEndFrm)["Enabled"])
+ self.assertEqual("true", get_state_as_dict(xEndPre)["Enabled"])
+ self.assertEqual("true", get_state_as_dict(xEndSuf)["Enabled"])
+ self.assertEqual("true", get_state_as_dict(xEndView)["Enabled"])
+ self.assertEqual("true", get_state_as_dict(xEndOffset)["Enabled"])
+
+ self.assertEqual("i, ii, iii, ...", get_state_as_dict(xEndView)["DisplayText"])
+ self.assertEqual("[", get_state_as_dict(xEndPre)["Text"])
+ self.assertEqual("]", get_state_as_dict(xEndSuf)["Text"])
+
+ self.assertEqual("2", get_state_as_dict(xEndOffset)["Text"])
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests7/tdf146605.py b/sw/qa/uitest/writer_tests7/tdf146605.py
new file mode 100644
index 000000000..c63ae0bc9
--- /dev/null
+++ b/sw/qa/uitest/writer_tests7/tdf146605.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
+from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
+from uitest.uihelper.common import select_pos
+
+class tdf146605(UITestCase):
+
+ def test_tdf146605(self):
+
+ with self.ui_test.load_file(get_url_for_data_file("tdf146605.odt")) as document:
+
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+
+ self.assertEqual(1, len(document.TextSections))
+ self.assertTrue(document.TextSections.Section1.IsVisible)
+ self.assertFalse(document.TextSections.Section1.FootnoteIsCollectAtTextEnd)
+ self.assertFalse(document.TextSections.Section1.EndnoteIsCollectAtTextEnd)
+ self.assertEqual("2", get_state_as_dict(xWriterEdit)["Pages"])
+
+ with self.ui_test.execute_dialog_through_command(".uno:EditRegion") as xDialog:
+ xTree = xDialog.getChild("tree")
+ self.assertEqual("1", get_state_as_dict(xTree)['Children'])
+ self.assertEqual("Section1", get_state_as_dict(xTree.getChild('0'))['Text'])
+ self.assertEqual("Section1", get_state_as_dict(xDialog.getChild('curname'))['Text'])
+
+ xOptions = xDialog.getChild("options")
+ with self.ui_test.execute_blocking_action(
+ xOptions.executeAction, args=('CLICK', ())) as xOptDialog:
+ xTabs = xOptDialog.getChild("tabcontrol")
+ select_pos(xTabs, "3")
+
+ xTextEnd = xOptDialog.getChild("endntattextend")
+ xNum = xOptDialog.getChild("endntnum")
+
+ self.assertEqual("true", get_state_as_dict(xTextEnd)['Enabled'])
+ self.assertEqual("false", get_state_as_dict(xTextEnd)['Selected'])
+ self.assertEqual("false", get_state_as_dict(xNum)['Enabled'])
+
+ xTextEnd.executeAction('CLICK', tuple())
+
+ self.assertEqual("true", get_state_as_dict(xTextEnd)['Enabled'])
+ self.assertEqual("true", get_state_as_dict(xTextEnd)['Selected'])
+ self.assertEqual("true", get_state_as_dict(xNum)['Enabled'])
+
+ self.assertEqual(1, len(document.TextSections))
+ self.assertTrue(document.TextSections.Section1.IsVisible)
+ self.assertFalse(document.TextSections.Section1.FootnoteIsCollectAtTextEnd)
+ self.assertTrue(document.TextSections.Section1.EndnoteIsCollectAtTextEnd)
+
+ # Without the fix in place, this test would have failed with
+ # AssertionError: '1' != '2'
+ self.assertEqual("1", get_state_as_dict(xWriterEdit)["Pages"])
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests7/tdf150443.py b/sw/qa/uitest/writer_tests7/tdf150443.py
new file mode 100644
index 000000000..8cca7c78e
--- /dev/null
+++ b/sw/qa/uitest/writer_tests7/tdf150443.py
@@ -0,0 +1,46 @@
+# -*- 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, get_url_for_data_file
+from libreoffice.uno.propertyvalue import mkPropertyValues
+
+class tdf150443(UITestCase):
+
+ def test_tdf150443(self):
+ with self.ui_test.load_file(get_url_for_data_file("tdf150443.docx")) as document:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+ xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit')
+
+ # search term "Jump here!"
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button="close") as xDialog:
+ searchterm = xDialog.getChild("searchterm")
+ searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"Jump here!"}))
+ xsearch = xDialog.getChild("search")
+ xsearch.executeAction("CLICK", tuple()) #first search
+ xToolkit.processEventsToIdle()
+ self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "4")
+
+ # reject the tracked table row in Manage Changes dialog window
+ with self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges", close_button="close") as xTrackDlg:
+ changesList = xTrackDlg.getChild("writerchanges")
+
+ items = len(changesList.getChildren())
+
+ # select tree parent of the actual tracked row deletion in tree list
+ changesList.executeAction("TYPE", mkPropertyValues({"KEYCODE": "LEFT"}))
+ xToolkit.processEventsToIdle()
+
+ # Without the fix in place, it would have crashed here
+ xAccBtn = xTrackDlg.getChild("reject")
+ xAccBtn.executeAction("CLICK", tuple())
+ self.assertEqual(items - 1, len(changesList.getChildren()))
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests7/tdf152964.py b/sw/qa/uitest/writer_tests7/tdf152964.py
new file mode 100644
index 000000000..abbf25434
--- /dev/null
+++ b/sw/qa/uitest/writer_tests7/tdf152964.py
@@ -0,0 +1,50 @@
+# -*- 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 libreoffice.uno.propertyvalue import mkPropertyValues
+from uitest.uihelper.common import select_pos
+
+# Bug 152964 - Undo of tracked deletion of an empty table row crashed Writer
+
+
+class tdf152964(UITestCase):
+ def test_tdf152964(self):
+ with self.ui_test.create_doc_in_start_center("writer"):
+
+ # redlining should be on
+ self.xUITest.executeCommand(".uno:TrackChanges")
+ # hide changes
+ self.xUITest.executeCommand(".uno:ShowTrackedChanges")
+
+ # insert a table
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+ xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
+ with self.ui_test.execute_dialog_through_command(".uno:InsertTable") as xDialog:
+ formatlbinstable = xDialog.getChild("formatlbinstable")
+ entry = formatlbinstable.getChild("1")
+ entry.executeAction("SELECT", tuple())
+
+ # delete its second and first rows
+ self.xUITest.executeCommand(".uno:GoDown")
+ self.xUITest.executeCommand(".uno:DeleteRows")
+ self.xUITest.executeCommand(".uno:DeleteRows")
+
+ # This crashed Writer
+ self.xUITest.executeCommand(".uno:Undo")
+
+ # test other Undos and Redos
+ self.xUITest.executeCommand(".uno:Undo")
+ self.xUITest.executeCommand(".uno:Undo")
+ self.xUITest.executeCommand(".uno:Redo")
+ self.xUITest.executeCommand(".uno:Redo")
+ self.xUITest.executeCommand(".uno:Redo")
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests7/tdf46561.py b/sw/qa/uitest/writer_tests7/tdf46561.py
new file mode 100644
index 000000000..575053a4f
--- /dev/null
+++ b/sw/qa/uitest/writer_tests7/tdf46561.py
@@ -0,0 +1,97 @@
+# -*- 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_pos
+from uitest.uihelper.common import type_text
+from uitest.uihelper.common import get_url_for_data_file
+
+class tdf46561(UITestCase):
+ def check_header_texts(self, master="", first="", left="", right=""):
+ # Get the current header style and its text contents
+ xPageStyle = self.document.getStyleFamilies().getByIndex(2)
+ xHeaderText = xPageStyle.getByIndex(0).HeaderText.String
+ xHeaderTextFirst = xPageStyle.getByIndex(0).HeaderTextFirst.String
+ xHeaderTextLeft = xPageStyle.getByIndex(0).HeaderTextLeft.String
+ xHeaderTextRight = xPageStyle.getByIndex(0).HeaderTextRight.String
+
+ # Check the current values
+ self.assertEqual(master, xHeaderText)
+ self.assertEqual(first, xHeaderTextFirst)
+ self.assertEqual(left, xHeaderTextLeft)
+ self.assertEqual(right, xHeaderTextRight)
+
+ def test_tdf46561(self):
+ with self.ui_test.load_file(get_url_for_data_file("tdf46561.odt")):
+ self.document = self.ui_test.get_component()
+ self.check_header_texts(master="right", first="1st", left="left", right="right")
+
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild("writer_edit")
+ xWriterEdit.executeAction("GOTO", mkPropertyValues({"PAGE": "2"}))
+ self.xUITest.executeCommand(".uno:JumpToHeader")
+
+ # Switch "same left and right page headers" on and off a few times
+ for _ in range(4):
+ with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as PageDialog:
+
+ xTabs = PageDialog.getChild("tabcontrol")
+ select_pos(xTabs, "4")
+
+ Button = xTabs.getChild('checkSameLR')
+ Button.executeAction("CLICK",tuple())
+
+ # We should be back to the starting state after 2*k on/off changes
+ self.check_header_texts(master="right", first="1st", left="left", right="right")
+
+ # Enter some additional text in the left page header
+ type_text(xWriterEdit, "XXXX")
+ self.check_header_texts(master="right", first="1st", left="XXXXleft", right="right")
+
+ # Now go back one change (before entering "XXXX")
+ self.xUITest.executeCommand(".uno:Undo")
+ self.check_header_texts(master="right", first="1st", left="left", right="right")
+
+ # Undo the fourth change
+ self.xUITest.executeCommand(".uno:Undo")
+ self.check_header_texts(master="right", first="1st", left="right", right="right")
+
+ # Undo the third change
+ self.xUITest.executeCommand(".uno:Undo")
+ self.check_header_texts(master="right", first="1st", left="left", right="right")
+
+ # Undo the second change
+ self.xUITest.executeCommand(".uno:Undo")
+ self.check_header_texts(master="right", first="1st", left="right", right="right")
+
+ # Undo the first change
+ self.xUITest.executeCommand(".uno:Undo")
+ self.check_header_texts(master="right", first="1st", left="left", right="right")
+
+ # Redo the first change
+ self.xUITest.executeCommand(".uno:Redo")
+ self.check_header_texts(master="right", first="1st", left="right", right="right")
+
+ # Redo the second change
+ self.xUITest.executeCommand(".uno:Redo")
+ self.check_header_texts(master="right", first="1st", left="left", right="right")
+
+ # Redo the third change
+ self.xUITest.executeCommand(".uno:Redo")
+ self.check_header_texts(master="right", first="1st", left="right", right="right")
+
+ # Redo the fourth change
+ self.xUITest.executeCommand(".uno:Redo")
+ self.check_header_texts(master="right", first="1st", left="left", right="right")
+
+ # Redo the final change
+ self.xUITest.executeCommand(".uno:Redo")
+ self.check_header_texts(master="right", first="1st", left="XXXXleft", right="right")
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests7/tdf90401.py b/sw/qa/uitest/writer_tests7/tdf90401.py
new file mode 100644
index 000000000..b08c1f882
--- /dev/null
+++ b/sw/qa/uitest/writer_tests7/tdf90401.py
@@ -0,0 +1,165 @@
+# -*- 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
+from uitest.uihelper.common import get_state_as_dict
+from uitest.uihelper.common import get_url_for_data_file
+from uitest.uihelper.common import select_pos
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from org.libreoffice.unotest import systemPathToFileUrl
+from tempfile import TemporaryDirectory
+import os.path
+#Bug 90401 - remove personal info on redlines and annotations
+
+class tdf90401(UITestCase):
+
+ def test_tdf90401_remove_personal_info(self):
+
+ # load a test document with a tracked change, and add a comment
+
+ with TemporaryDirectory() as tempdir:
+ xFilePath = os.path.join(tempdir, 'tdf90401-tmp.fodt')
+
+ with self.ui_test.load_file(get_url_for_data_file('redline-autocorrect.fodt')) as writer_doc:
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild('writer_edit')
+
+ self.xUITest.executeCommand('.uno:SelectAll')
+ self.xUITest.executeCommand('.uno:InsertAnnotation')
+
+ # enable remove personal info security option
+
+ with self.ui_test.execute_dialog_through_command('.uno:OptionsTreeDialog') as xDialog:
+ xPages = xDialog.getChild('pages')
+ xGenEntry = xPages.getChild('0')
+ xSecurityPage = xGenEntry.getChild('6')
+ xSecurityPage.executeAction('SELECT', tuple())
+ # Click Button Options...
+ xOptions = xDialog.getChild('options')
+
+ with self.ui_test.execute_blocking_action(xOptions.executeAction, args=('CLICK', ()), close_button="") as dialog:
+ xRemovePersonal = dialog.getChild('removepersonal')
+ if get_state_as_dict(xRemovePersonal)['Selected'] == "false":
+ xRemovePersonal.executeAction('CLICK', tuple())
+ self.ui_test.wait_until_property_is_updated(xRemovePersonal, "Selected", "true")
+ self.assertEqual(get_state_as_dict(xRemovePersonal)["Selected"], "true")
+
+ xOkBtn = dialog.getChild('ok')
+ # FIXME: we can't use close_dialog_through_button here, the dialog doesn't emit the
+ # event DialogClosed after closing
+ xOkBtn.executeAction('CLICK', tuple())
+
+ # Save Copy as
+ with self.ui_test.execute_dialog_through_command('.uno:SaveAs', close_button="open") as xDialog:
+ xFileName = xDialog.getChild('file_name')
+ xFileName.executeAction('TYPE', mkPropertyValues({'KEYCODE':'CTRL+A'}))
+ xFileName.executeAction('TYPE', mkPropertyValues({'KEYCODE':'BACKSPACE'}))
+ xFileName.executeAction('TYPE', mkPropertyValues({'TEXT': xFilePath}))
+
+ self.ui_test.wait_until_file_is_available(xFilePath)
+
+ with self.ui_test.load_file(systemPathToFileUrl(xFilePath)) as writer_doc2:
+
+ # check removed personal info on comments
+
+ textfields = writer_doc2.getTextFields()
+ author = ""
+ year = -1
+ for textfield in textfields:
+ if textfield.supportsService("com.sun.star.text.TextField.Annotation"):
+ author = textfield.Author
+ year = textfield.Date.Year
+ # This was 'Unknown Author'
+ self.assertEqual(author, 'Author2')
+ # This was 2021
+ self.assertEqual(year, 0)
+
+ # check removed personal info on tracked changes
+ with self.ui_test.execute_modeless_dialog_through_command('.uno:AcceptTrackedChanges', close_button="close") as xTrackDlg:
+ xTreeList = xTrackDlg.getChild('writerchanges')
+ state = get_state_as_dict(xTreeList)
+ # This was 'NL\t11/03/2020 19:19:05\t', containing personal info
+ self.assertEqual(state['SelectEntryText'], 'Author1\t01/01/1970 00:00:00\t')
+
+ def test_tdf142902_remove_personal_info_in_DOCX(self):
+
+ # load a test document with a tracked change, and add a comment
+ with TemporaryDirectory() as tempdir:
+ xFilePath = os.path.join(tempdir, 'redline-para-join-tmp.docx')
+
+ with self.ui_test.load_file(get_url_for_data_file('redline-para-join.docx')) as writer_doc:
+
+ xWriterDoc = self.xUITest.getTopFocusWindow()
+ xWriterEdit = xWriterDoc.getChild('writer_edit')
+
+ self.xUITest.executeCommand('.uno:SelectAll')
+ self.xUITest.executeCommand('.uno:InsertAnnotation')
+
+ # enable remove personal info security option
+
+ with self.ui_test.execute_dialog_through_command('.uno:OptionsTreeDialog') as xDialog:
+ xPages = xDialog.getChild('pages')
+ xGenEntry = xPages.getChild('0')
+ xSecurityPage = xGenEntry.getChild('6')
+ xSecurityPage.executeAction('SELECT', tuple())
+ # Click Button Options...
+ xOptions = xDialog.getChild('options')
+
+ with self.ui_test.execute_blocking_action(xOptions.executeAction, args=('CLICK', ()), close_button="") as dialog:
+ xRemovePersonal = dialog.getChild('removepersonal')
+ if get_state_as_dict(xRemovePersonal)['Selected'] == "false":
+ xRemovePersonal.executeAction('CLICK', tuple())
+ self.ui_test.wait_until_property_is_updated(xRemovePersonal, "Selected", "true")
+ self.assertEqual(get_state_as_dict(xRemovePersonal)["Selected"], "true")
+
+ xOkBtn = dialog.getChild('ok')
+ # FIXME: we can't use close_dialog_through_button here, the dialog doesn't emit the
+ # event DialogClosed after closing
+ xOkBtn.executeAction('CLICK', tuple())
+
+ # Save Copy as
+ with self.ui_test.execute_dialog_through_command('.uno:SaveAs', close_button="") as xDialog:
+ xFileName = xDialog.getChild('file_name')
+ xFileName.executeAction('TYPE', mkPropertyValues({'KEYCODE':'CTRL+A'}))
+ xFileName.executeAction('TYPE', mkPropertyValues({'KEYCODE':'BACKSPACE'}))
+ xFileName.executeAction('TYPE', mkPropertyValues({'TEXT': xFilePath}))
+
+ xOpen = xDialog.getChild("open")
+ # DOCX confirmation dialog is displayed
+ with self.ui_test.execute_dialog_through_action(xOpen, "CLICK", close_button="save"):
+ pass
+
+ self.ui_test.wait_until_file_is_available(xFilePath)
+
+ with self.ui_test.load_file(systemPathToFileUrl(xFilePath)) as writer_doc2:
+
+ # check removed personal info on comments
+
+ textfields = writer_doc2.getTextFields()
+ author = ""
+ year = -1
+ for textfield in textfields:
+ if textfield.supportsService("com.sun.star.text.TextField.Annotation"):
+ author = textfield.Author
+ year = textfield.Date.Year
+ # This was 'Unknown Author'
+ self.assertEqual(author, 'Author2')
+ # This was 2021
+ self.assertEqual(year, 0)
+
+ # check removed personal info on tracked changes
+
+ with self.ui_test.execute_modeless_dialog_through_command('.uno:AcceptTrackedChanges', close_button="close") as xTrackDlg:
+ xTreeList = xTrackDlg.getChild('writerchanges')
+ state = get_state_as_dict(xTreeList)
+ # This was 'NL\t11/03/2020 19:19:05\t', containing personal info
+ self.assertEqual(state['SelectEntryText'], 'Author1\t01/01/1970 00:00:00\t')
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab: