diff options
Diffstat (limited to 'sw/qa/uitest/writer_tests6')
-rw-r--r-- | sw/qa/uitest/writer_tests6/edit_file_properties_before_saving.py | 106 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests6/infobar.py | 61 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests6/save_readonly_with_password.py | 105 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests6/tdf107847.py | 34 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests6/tdf118883.py | 34 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests6/tdf120731.py | 23 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests6/tdf124586.py | 30 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests6/tdf124675.py | 36 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests6/tdf125104.py | 63 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests6/tdf126017.py | 42 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests6/tdf126168.py | 44 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests6/tdf126226.py | 28 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests6/tdf128431.py | 41 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests6/tdf131041.py | 44 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests6/tdf141957.py | 37 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests6/tdf144691.py | 46 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests6/tdf89383.py | 30 |
17 files changed, 804 insertions, 0 deletions
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: |