diff options
Diffstat (limited to 'sw/qa/uitest/writer_tests6')
21 files changed, 642 insertions, 384 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 000000000000..38d5ec818a38 --- /dev/null +++ b/sw/qa/uitest/writer_tests6/edit_file_properties_before_saving.py @@ -0,0 +1,101 @@ +# -*- 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']) + + 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']) + + 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 index 84dfdb3ac887..cb525fc9bf80 100644 --- a/sw/qa/uitest/writer_tests6/infobar.py +++ b/sw/qa/uitest/writer_tests6/infobar.py @@ -1,5 +1,7 @@ # -*- 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/. @@ -16,45 +18,44 @@ from com.sun.star.container import NoSuchElementException class tdf97926(UITestCase): def test_infobar_add(self): - self.ui_test.create_doc_in_start_center("writer") - controller = self.ui_test.get_component().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): + 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) - self.ui_test.close_doc() + + # 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): - self.ui_test.create_doc_in_start_center("writer") - controller = self.ui_test.get_component().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) + 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) + # 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) + # Passing invalid values for InfobarType should throw an exception + with self.assertRaises(IllegalArgumentException): + controller.updateInfobar("my", "", "", 120) def test_infobar_remove(self): - self.ui_test.create_doc_in_start_center("writer") - controller = self.ui_test.get_component().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") + 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) - # Removing an already removed infobar should throw an exception - with self.assertRaises(NoSuchElementException): 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/tdf101313.py b/sw/qa/uitest/writer_tests6/tdf101313.py new file mode 100644 index 000000000000..8918c44f7636 --- /dev/null +++ b/sw/qa/uitest/writer_tests6/tdf101313.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_url_for_data_file +from libreoffice.calc.document import get_cell_by_position + +class Tdf101313(UITestCase): + + def test_tdf101313(self): + with self.ui_test.load_file(get_url_for_data_file("tdf101313.odt")): + + self.xUITest.executeCommand(".uno:SelectTable") + + self.xUITest.executeCommand(".uno:Copy") + + with self.ui_test.load_empty_file("calc") as document: + + self.xUITest.executeCommand(".uno:Paste") + + self.assertEqual("a", get_cell_by_position(document, 0, 0, 0).getString()) + self.assertEqual("e", get_cell_by_position(document, 0, 0, 1).getString()) + self.assertEqual("b", get_cell_by_position(document, 0, 1, 0).getString()) + self.assertEqual("f", get_cell_by_position(document, 0, 1, 1).getString()) + + # Without the fix in place, this test would have failed with + # AssertionError: '' != 'c' + self.assertEqual("", get_cell_by_position(document, 0, 2, 0).getString()) + self.assertEqual("g", get_cell_by_position(document, 0, 2, 1).getString()) + self.assertEqual("c", get_cell_by_position(document, 0, 3, 0).getString()) + self.assertEqual("h", get_cell_by_position(document, 0, 3, 1).getString()) + self.assertEqual("d", get_cell_by_position(document, 0, 4, 0).getString()) + self.assertEqual("i", get_cell_by_position(document, 0, 4, 1).getString()) + +# 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 index d653ddb0adae..41e6433cfca1 100644 --- a/sw/qa/uitest/writer_tests6/tdf107847.py +++ b/sw/qa/uitest/writer_tests6/tdf107847.py @@ -1,40 +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 libreoffice.uno.propertyvalue import mkPropertyValues -from uitest.uihelper.common import get_state_as_dict, type_text from uitest.uihelper.common import select_pos -import time -from uitest.debug import sleep #Bug 107847 - CRASH Opening macro tab of properties dialog (images, frames) causes crash class tdf107847(UITestCase): def test_tdf_107847_macro_tab_crash(self): - self.ui_test.create_doc_in_start_center("writer") - document = self.ui_test.get_component() - xWriterDoc = self.xUITest.getTopFocusWindow() + with self.ui_test.create_doc_in_start_center("writer") as document: - self.ui_test.execute_dialog_through_command(".uno:InsertFrame") # insert frame - xDialog = self.xUITest.getTopFocusWindow() - 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 - xokbtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xokbtn) + 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) - self.ui_test.close_doc() + self.assertEqual(len(document.TextFrames), 1) + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(len(document.TextFrames), 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 000000000000..316120b80065 --- /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, len(writer_document.DrawPage)) + + 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, len(calc_document.DrawPages[0])) + +# 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 index b9d8f6afb9da..69546e6249b5 100644 --- a/sw/qa/uitest/writer_tests6/tdf120731.py +++ b/sw/qa/uitest/writer_tests6/tdf120731.py @@ -1,29 +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 -from uitest.uihelper.common import select_pos -from uitest.uihelper.calc import enter_text_to_cell -from libreoffice.calc.document import get_cell_by_position -from libreoffice.uno.propertyvalue import mkPropertyValues -from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file, type_text +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): - writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf120731.odt")) - document = self.ui_test.get_component() - xWriterDoc = self.xUITest.getTopFocusWindow() + with self.ui_test.load_file(get_url_for_data_file("tdf120731.odt")) as writer_doc: - self.xUITest.executeCommand(".uno:SelectAll") - self.ui_test.execute_dialog_through_command(".uno:FontDialog") - xDialog = self.xUITest.getTopFocusWindow() - xOK = xDialog.getChild("ok") - xOK.executeAction("CLICK", tuple()) - self.assertEqual(document.Text.String[0:5], "Lorem") - self.ui_test.close_doc() + 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 index 8bb4f67e8888..b98237bf2680 100644 --- a/sw/qa/uitest/writer_tests6/tdf124586.py +++ b/sw/qa/uitest/writer_tests6/tdf124586.py @@ -1,41 +1,29 @@ # -*- 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 -from uitest.uihelper.calc import enter_text_to_cell -from libreoffice.calc.document import get_cell_by_position -from libreoffice.uno.propertyvalue import mkPropertyValues -from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file, type_text +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): - writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf124586.odt")) - document = self.ui_test.get_component() - xWriterDoc = self.xUITest.getTopFocusWindow() + with self.ui_test.load_file(get_url_for_data_file("tdf124586.odt")) as writer_doc: - #Goto Tools > Chapter Numbering. - self.ui_test.execute_dialog_through_command(".uno:ChapterNumberingDialog") - xDialog = self.xUITest.getTopFocusWindow() - xstyle = xDialog.getChild("style") - props = {"TEXT": "MyHeading"} - actionProps = mkPropertyValues(props) - xstyle.executeAction("SELECT", actionProps) - xOK = xDialog.getChild("ok") - xOK.executeAction("CLICK", tuple()) + #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(document.Text.String[0:8], "Schritte") + self.assertEqual(writer_doc.Text.String[0:8], "Schritte") - self.ui_test.execute_dialog_through_command(".uno:ChapterNumberingDialog") - xDialog = self.xUITest.getTopFocusWindow() - xstyle = xDialog.getChild("style") - self.assertEqual(get_state_as_dict(xstyle)["SelectEntryText"], "MyHeading") - xOK = xDialog.getChild("ok") - xOK.executeAction("CLICK", tuple()) - self.ui_test.close_doc() + 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 index f124a554dd08..83bddd42b108 100644 --- a/sw/qa/uitest/writer_tests6/tdf124675.py +++ b/sw/qa/uitest/writer_tests6/tdf124675.py @@ -1,40 +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 select_pos -from uitest.uihelper.calc import enter_text_to_cell -from libreoffice.calc.document import get_cell_by_position from libreoffice.uno.propertyvalue import mkPropertyValues -from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file, type_text +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): - writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf124675.docx")) - document = self.ui_test.get_component() - xWriterDoc = self.xUITest.getTopFocusWindow() - xWriterEdit = xWriterDoc.getChild("writer_edit") - - self.assertEqual(document.CurrentController.PageCount, 2) - self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "1") + 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") - for i in range(52): - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + self.assertEqual(writer_doc.CurrentController.PageCount, 2) + self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "1") - self.assertEqual(document.CurrentController.PageCount, 4) - self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2") + for i in range(52): + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) - for i in range(52): - self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(writer_doc.CurrentController.PageCount, 4) + self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "3") - self.assertEqual(document.CurrentController.PageCount, 2) - self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "1") + for i in range(52): + self.xUITest.executeCommand(".uno:Undo") - self.ui_test.close_doc() + 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 index b711b01caefe..6e87c2da12b5 100644 --- a/sw/qa/uitest/writer_tests6/tdf125104.py +++ b/sw/qa/uitest/writer_tests6/tdf125104.py @@ -1,3 +1,6 @@ +# -*- 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 @@ -6,61 +9,54 @@ from uitest.framework import UITestCase from uitest.uihelper.common import select_pos, get_state_as_dict -from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import select_by_text class tdf125104(UITestCase): - def open_page_style_dialog(self): - self.ui_test.execute_dialog_through_command(".uno:PageDialog") - xDialog = self.xUITest.getTopFocusWindow() - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, "1") - return xDialog.getChild("comboLayoutFormat") - def set_combo_layout_format(self, dialog, format): + tabcontrol = dialog.getChild("tabcontrol") + select_pos(tabcontrol, "1") comboLayoutFormat = dialog.getChild("comboLayoutFormat") - props = {"TEXT": format} - actionProps = mkPropertyValues(props) - comboLayoutFormat.executeAction("SELECT", actionProps) - okBtn = dialog.getChild("ok") - self.ui_test.close_dialog_through_button(okBtn) + select_by_text(comboLayoutFormat, format) def test_tdf125104_pageFormat_numbering(self): - self.ui_test.create_doc_in_start_center("writer") - document = self.ui_test.get_component() + 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") - # 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") + 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, ...") - # Bug 125104 - Changing page numbering to "1st, 2nd, 3rd,..." causes crashes when trying to change Page settings later - self.set_combo_layout_format(self.open_page_style_dialog(), "1st, 2nd, 3rd, ...") - text = document.Text.String.replace('\r\n', '\n') - self.assertEqual(text[0:3], "1st") - self.assertEqual(text[4:7], "2nd") + # change to devanagari alphabet format + with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as xDialog: + self.set_combo_layout_format(xDialog, "क, ख, ग, ...") - xDialog = self.open_page_style_dialog() - comboLayoutFormat = xDialog.getChild("comboLayoutFormat") - self.assertEqual(get_state_as_dict(comboLayoutFormat)["SelectEntryText"], "1st, 2nd, 3rd, ...") - cancelBtn = xDialog.getChild("cancel") - self.ui_test.close_dialog_through_button(cancelBtn) + text = document.Text.String.replace('\r\n', '\n') + self.assertEqual(text[0:1], "क") + self.assertEqual(text[2:3], "ख") - # change to devanagari alphabet format - self.set_combo_layout_format(self.open_page_style_dialog(), "क, ख, ग, ...") - 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, "१, २, ३, ...") - # change to devanagari number format - self.set_combo_layout_format(self.open_page_style_dialog(), "१, २, ३, ...") - text = document.Text.String.replace('\r\n', '\n') - self.assertEqual(text[0:1], "१") - self.assertEqual(text[2:3], "२") + text = document.Text.String.replace('\r\n', '\n') + self.assertEqual(text[0:1], "१") + self.assertEqual(text[2:3], "२") - self.ui_test.close_doc() # 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 index 3639e9ed1b18..ce19925d488e 100644 --- a/sw/qa/uitest/writer_tests6/tdf126017.py +++ b/sw/qa/uitest/writer_tests6/tdf126017.py @@ -1,54 +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 -from uitest.uihelper.calc import enter_text_to_cell -from libreoffice.calc.document import get_cell_by_position from libreoffice.uno.propertyvalue import mkPropertyValues -from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file, type_text +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): - writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf126017.odt")) - document = self.ui_test.get_component() - xWriterDoc = self.xUITest.getTopFocusWindow() - - #go to TOC - self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog") - xDialog = self.xUITest.getTopFocusWindow() - searchterm = xDialog.getChild("searchterm") - searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"aasasas"})) - xsearch = xDialog.getChild("search") - xsearch.executeAction("CLICK", tuple()) - xcloseBtn = xDialog.getChild("close") - self.ui_test.close_dialog_through_button(xcloseBtn) - #edit index - self.ui_test.execute_dialog_through_command(".uno:EditCurIndex") #open index dialog - xDiagIndex = self.xUITest.getTopFocusWindow() - xOKBtn = xDiagIndex.getChild("ok") - title = xDiagIndex.getChild("title") - title.executeAction("TYPE", mkPropertyValues({"TEXT":"aaaa"})) - self.ui_test.close_dialog_through_button(xOKBtn) - - self.xUITest.executeCommand(".uno:Undo") - - self.ui_test.execute_dialog_through_command(".uno:EditCurIndex") #open index dialog - xDiagIndex = self.xUITest.getTopFocusWindow() - xOKBtn = xDiagIndex.getChild("ok") - title = xDiagIndex.getChild("title") - title.executeAction("TYPE", mkPropertyValues({"TEXT":"aaaa"})) - self.ui_test.close_dialog_through_button(xOKBtn) - - self.xUITest.executeCommand(".uno:Undo") - self.xUITest.executeCommand(".uno:Undo") - - self.assertEqual(document.Text.String.replace('\r\n', '\n')[1:7], "CRASHY") - - self.ui_test.close_doc() + with self.ui_test.load_file(get_url_for_data_file("tdf126017.odt")) as writer_doc: + + #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 index d25ae711e49d..cea599f0ac21 100644 --- a/sw/qa/uitest/writer_tests6/tdf126168.py +++ b/sw/qa/uitest/writer_tests6/tdf126168.py @@ -1,52 +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_state_as_dict, type_text -from uitest.uihelper.common import select_pos -import time -from uitest.debug import sleep #Bug 126168 - Crash in: rtl_uString_acquire: frame style undo redo class tdf126168(UITestCase): def test_tdf126168_frame_undo_redo_crash(self): - self.ui_test.create_doc_in_start_center("writer") - document = self.ui_test.get_component() - xWriterDoc = self.xUITest.getTopFocusWindow() - xWriterEdit = xWriterDoc.getChild("writer_edit") + with self.ui_test.create_doc_in_start_center("writer") as document: - #2) Menu > Insert > Frame > Frame - #3) Press OK in Frame dialog - self.ui_test.execute_dialog_through_command(".uno:InsertFrame") # insert frame - xDialog = self.xUITest.getTopFocusWindow() - xokbtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xokbtn) - self.assertEqual(document.TextFrames.getCount(), 1) - #New Style from Selection [uno:StyleNewByExample] - self.ui_test.execute_dialog_through_command(".uno:StyleNewByExample") - #5) Enter a name in the Create Style dialog and press OK - xDialog = self.xUITest.getTopFocusWindow() - stylename = xDialog.getChild("stylename") - stylename.executeAction("TYPE", mkPropertyValues({"TEXT":"a"})) - xokbtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(xokbtn) - #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") + #2) Menu > Insert > Frame > Frame + #3) Press OK in Frame dialog + with self.ui_test.execute_dialog_through_command(".uno:InsertFrame"): + pass + self.assertEqual(len(document.TextFrames), 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(len(document.TextFrames), 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) + #Results: crash + self.assertEqual(document.CurrentController.PageCount, 1) - self.ui_test.close_doc() # 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 000000000000..823b0b137721 --- /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")): + + 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/tdf126627.py b/sw/qa/uitest/writer_tests6/tdf126627.py deleted file mode 100644 index 0fa84b347910..000000000000 --- a/sw/qa/uitest/writer_tests6/tdf126627.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- -# -# 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 -from uitest.uihelper.calc import enter_text_to_cell -from libreoffice.calc.document import get_cell_by_position -from libreoffice.uno.propertyvalue import mkPropertyValues -from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file, type_text - -#Bug 126627 - CRASH: undoing redlinehide deletion - -class tdf126627(UITestCase): - def test_tdf126627_crash_undo_deletion(self): - writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf126627.odt")) - document = self.ui_test.get_component() - xWriterDoc = self.xUITest.getTopFocusWindow() - xWriterEdit = xWriterDoc.getChild("writer_edit") - self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog") - xDialog = self.xUITest.getTopFocusWindow() - - searchterm = xDialog.getChild("searchterm") - searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"bar"})) - xsearch = xDialog.getChild("search") - xsearch.executeAction("CLICK", tuple()) - - xcloseBtn = xDialog.getChild("close") - self.ui_test.close_dialog_through_button(xcloseBtn) - #2. Place the cursor before 'bar' - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "LEFT"})) - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "LEFT"})) - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "LEFT"})) - #3. Hit backspace 4 times -> Foo and bar are together - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"})) - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"})) - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"})) - xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"})) - self.assertEqual(document.Text.String[0:6], "foobar") - #4. Undo once-> Crash - self.xUITest.executeCommand(".uno:Undo") - #verify that we have now two words - self.ui_test.execute_modeless_dialog_through_command(".uno:WordCountDialog") - xDialog = self.xUITest.getTopFocusWindow() - xselectwords = xDialog.getChild("selectwords") - self.assertEqual(get_state_as_dict(xselectwords)["Text"], "2") - xCloseBtn = xDialog.getChild("close") - self.ui_test.close_dialog_through_button(xCloseBtn) - - self.ui_test.close_doc() -# 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 index 88b140235725..aae1290f446f 100644 --- a/sw/qa/uitest/writer_tests6/tdf128431.py +++ b/sw/qa/uitest/writer_tests6/tdf128431.py @@ -1,3 +1,6 @@ +# -*- 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 @@ -7,44 +10,32 @@ from uitest.framework import UITestCase from uitest.uihelper.common import select_pos, get_state_as_dict from uitest.uihelper.common import change_measurement_unit -from com.sun.star.uno import RuntimeException -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 - -from libreoffice.uno.propertyvalue import mkPropertyValues #Bug 128431 - Synchronize padding in header borders it is not working class tdf128431(UITestCase): def test_tdf128431_pageFormat_sync_padding(self): - self.ui_test.create_doc_in_start_center("writer") - document = self.ui_test.get_component() + with self.ui_test.create_doc_in_start_center("writer"): - change_measurement_unit(self, "Centimeter") + with change_measurement_unit(self, "Centimeter"): - self.ui_test.execute_dialog_through_command(".uno:PageDialog") - xDialog = self.xUITest.getTopFocusWindow() - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, 6) #borders + 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") + 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") + 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") - okBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(okBtn) - self.ui_test.close_doc() # 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 index 94a6f2b750e7..1de344888a6b 100644 --- a/sw/qa/uitest/writer_tests6/tdf131041.py +++ b/sw/qa/uitest/writer_tests6/tdf131041.py @@ -1,3 +1,6 @@ +# -*- 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 @@ -10,41 +13,32 @@ from uitest.uihelper.common import select_pos, get_state_as_dict class tdf131041(UITestCase): def test_run(self): - self.ui_test.create_doc_in_start_center("writer") - document = self.ui_test.get_component() + with self.ui_test.create_doc_in_start_center("writer"): - self.ui_test.execute_dialog_through_command(".uno:PageDialog") - xDialog = self.xUITest.getTopFocusWindow() - tabcontrol = xDialog.getChild("tabcontrol") - select_pos(tabcontrol, 4) #header + 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") + 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") + self.assertEqual(get_state_as_dict(xHeaderOn)["Selected"], "false") + self.assertEqual(get_state_as_dict(xMoreBtn)["Enabled"], "false") - xHeaderOn.executeAction("CLICK", tuple()) + xHeaderOn.executeAction("CLICK", tuple()) - self.assertEqual(get_state_as_dict(xHeaderOn)["Selected"], "true") - self.assertEqual(get_state_as_dict(xMoreBtn)["Enabled"], "true") + self.assertEqual(get_state_as_dict(xHeaderOn)["Selected"], "true") + self.assertEqual(get_state_as_dict(xMoreBtn)["Enabled"], "true") - self.ui_test.execute_dialog_through_action(xMoreBtn, "CLICK") + with self.ui_test.execute_dialog_through_action(xMoreBtn, "CLICK") as xBorderDlg: - xBorderDlg = self.xUITest.getTopFocusWindow() - #modify any property - bottomft = xBorderDlg.getChild("bottommf") - bottomft.executeAction("UP", tuple()) + #modify any property + bottomft = xBorderDlg.getChild("bottommf") + bottomft.executeAction("UP", tuple()) - #it would crash here - okBtn = xBorderDlg.getChild("ok") - self.ui_test.close_dialog_through_button(okBtn) + #it would crash here - xDialog = self.xUITest.getTopFocusWindow() - okBtn = xDialog.getChild("ok") - self.ui_test.close_dialog_through_button(okBtn) - self.ui_test.close_doc() # 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 000000000000..fc1605aa24ef --- /dev/null +++ b/sw/qa/uitest/writer_tests6/tdf141957.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 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: + + 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 000000000000..14e8a62a4b5a --- /dev/null +++ b/sw/qa/uitest/writer_tests6/tdf144691.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 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'] + + try: + # 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']) + finally: + # 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/tdf150331.py b/sw/qa/uitest/writer_tests6/tdf150331.py new file mode 100644 index 000000000000..eb6e058bbd8b --- /dev/null +++ b/sw/qa/uitest/writer_tests6/tdf150331.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, select_pos, type_text + +class tdf150331(UITestCase): + + def test_tdf150331(self): + with self.ui_test.create_doc_in_start_center("writer") as document: + + with self.ui_test.execute_dialog_through_command(".uno:AutoCorrectDlg") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "4") + + xEnableWordComplete = xDialog.getChild("enablewordcomplete") + xAppendSpace = xDialog.getChild("appendspace") + xShowAsTip = xDialog.getChild("showastip") + xMinWordLen = xDialog.getChild("minwordlen") + xMaxEntries = xDialog.getChild("maxentries") + + xEnableWordComplete.executeAction("CLICK", tuple()) + + self.assertEqual("true", get_state_as_dict(xEnableWordComplete)['Selected']) + self.assertEqual("false", get_state_as_dict(xAppendSpace)['Selected']) + self.assertEqual("true", get_state_as_dict(xShowAsTip)['Selected']) + self.assertEqual("8", get_state_as_dict(xMinWordLen)['Value']) + self.assertEqual("1000", get_state_as_dict(xMaxEntries)['Value']) + + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + type_text(xWriterEdit, "sun") + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + + self.assertEqual("sunday", document.Text.String) + + with self.ui_test.execute_dialog_through_command(".uno:AutoCorrectDlg") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "4") + + xShowAsTip = xDialog.getChild("showastip") + + xShowAsTip.executeAction("CLICK", tuple()) + self.assertEqual("false", get_state_as_dict(xShowAsTip)['Selected']) + + type_text(xWriterEdit, " sunny") + + # Without the fix in place, this test would have failed with + # AssertionError: 'sunday sunny' != 'Sunday sundayny' + self.assertEqual("Sunday sunny", document.Text.String) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests6/tdf157569.py b/sw/qa/uitest/writer_tests6/tdf157569.py new file mode 100644 index 000000000000..9177047cec51 --- /dev/null +++ b/sw/qa/uitest/writer_tests6/tdf157569.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_url_for_data_file +from libreoffice.uno.propertyvalue import mkPropertyValues +import platform + +class tdf157569(UITestCase): + + def test_tdf157569(self): + with self.ui_test.load_file(get_url_for_data_file("tdf157569.docx")) as document: + + xShape = document.getDrawPages()[0][0] + nHeight = xShape.getSize().Height + nWidth = xShape.getSize().Width + + # Without the fix in place, this test would have failed with + # AssertionError: 1663 != 944 + self.assertEqual(1663, nHeight) + if platform.system() == "Windows": + self.assertEqual(2155, nWidth) # no idea why it's different on Windows + else: + self.assertEqual(2118, nWidth) + + xDoc = self.xUITest.getTopFocusWindow() + xEditWin = xDoc.getChild("writer_edit") + + # Select the formula + self.xUITest.executeCommand(".uno:JumpToNextFrame") + xEditWin.executeAction("SELECT", mkPropertyValues({"OBJECT":"Object1"})) + self.assertEqual("SwXTextEmbeddedObject", document.CurrentSelection.getImplementationName()) + + # Go into edit mode + xEditWin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) + + self.assertEqual(nHeight, xShape.getSize().Height) + self.assertEqual(nWidth, xShape.getSize().Width) + + # leave edit mode + xEditWin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"ESC"})) + + self.assertEqual(nHeight, xShape.getSize().Height) + self.assertEqual(nWidth, xShape.getSize().Width) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests6/tdf44837.py b/sw/qa/uitest/writer_tests6/tdf44837.py deleted file mode 100644 index 8354709da8ab..000000000000 --- a/sw/qa/uitest/writer_tests6/tdf44837.py +++ /dev/null @@ -1,46 +0,0 @@ -# -# 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, type_text -from com.sun.star.uno import RuntimeException -from libreoffice.uno.propertyvalue import mkPropertyValues -from uitest.debug import sleep -#Bug 44837 - EDITING 'Replace All' clears current selection - -class tdf44837(UITestCase): - - def test_tdf448373_Replace_All_clears_current_selection(self): - self.ui_test.create_doc_in_start_center("writer") - xWriterDoc = self.xUITest.getTopFocusWindow() - xWriterEdit = xWriterDoc.getChild("writer_edit") - document = self.ui_test.get_component() - - type_text(xWriterEdit, "asd asd") - self.xUITest.executeCommand(".uno:SelectAll") - - self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog") - xDialog = self.xUITest.getTopFocusWindow() - searchterm = xDialog.getChild("searchterm") - searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) - searchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) - searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"a"})) - replaceterm = xDialog.getChild("replaceterm") - replaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"b"})) #replace textbox - - selectionOnly = xDialog.getChild("selection") - selectionOnly.executeAction("CLICK", tuple()) - replaceall = xDialog.getChild("replaceall") - replaceall.executeAction("CLICK", tuple()) - xcloseBtn = xDialog.getChild("close") - self.ui_test.close_dialog_through_button(xcloseBtn) - - self.assertEqual(document.Text.String[0:8], "bsd bsd") - self.assertEqual(len(document.CurrentSelection[0].String) > 1, True) - #follow-up bug 125663 - self.ui_test.close_doc() - -# 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 000000000000..40a7e74c5331 --- /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: |