diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 05:54:39 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 05:54:39 +0000 |
commit | 267c6f2ac71f92999e969232431ba04678e7437e (patch) | |
tree | 358c9467650e1d0a1d7227a21dac2e3d08b622b2 /sw/qa/uitest/writer_tests6 | |
parent | Initial commit. (diff) | |
download | libreoffice-267c6f2ac71f92999e969232431ba04678e7437e.tar.xz libreoffice-267c6f2ac71f92999e969232431ba04678e7437e.zip |
Adding upstream version 4:24.2.0.upstream/4%24.2.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sw/qa/uitest/writer_tests6')
-rw-r--r-- | sw/qa/uitest/writer_tests6/edit_file_properties_before_saving.py | 101 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests6/infobar.py | 61 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests6/tdf107847.py | 33 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests6/tdf118883.py | 34 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests6/tdf120731.py | 22 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests6/tdf124586.py | 29 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests6/tdf124675.py | 36 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests6/tdf125104.py | 62 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests6/tdf126017.py | 41 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests6/tdf126168.py | 42 | ||||
-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 | 36 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests6/tdf144691.py | 47 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests6/tdf150331.py | 60 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests6/tdf89383.py | 30 |
17 files changed, 747 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 0000000000..38d5ec818a --- /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 new file mode 100644 index 0000000000..cb525fc9bf --- /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/tdf107847.py b/sw/qa/uitest/writer_tests6/tdf107847.py new file mode 100644 index 0000000000..5905cd6d7d --- /dev/null +++ b/sw/qa/uitest/writer_tests6/tdf107847.py @@ -0,0 +1,33 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from uitest.uihelper.common import 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: + + 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 0000000000..20e58c32d4 --- /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 0000000000..69546e6249 --- /dev/null +++ b/sw/qa/uitest/writer_tests6/tdf120731.py @@ -0,0 +1,22 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +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: + + 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 0000000000..b98237bf26 --- /dev/null +++ b/sw/qa/uitest/writer_tests6/tdf124586.py @@ -0,0 +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_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: + + #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 0000000000..83bddd42b1 --- /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"], "3") + + 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 0000000000..6e87c2da12 --- /dev/null +++ b/sw/qa/uitest/writer_tests6/tdf125104.py @@ -0,0 +1,62 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from uitest.uihelper.common import select_pos, get_state_as_dict +from uitest.uihelper.common import select_by_text + +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 0000000000..ce19925d48 --- /dev/null +++ b/sw/qa/uitest/writer_tests6/tdf126017.py @@ -0,0 +1,41 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_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: + + #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 0000000000..16e5fc6fbc --- /dev/null +++ b/sw/qa/uitest/writer_tests6/tdf126168.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 +#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: + + #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 0000000000..823b0b1377 --- /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/tdf128431.py b/sw/qa/uitest/writer_tests6/tdf128431.py new file mode 100644 index 0000000000..aae1290f44 --- /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"): + + with 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 0000000000..1de344888a --- /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 0000000000..fc1605aa24 --- /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 0000000000..14e8a62a4b --- /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 0000000000..eb6e058bbd --- /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/tdf89383.py b/sw/qa/uitest/writer_tests6/tdf89383.py new file mode 100644 index 0000000000..40a7e74c53 --- /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: |