diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 16:51:28 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 16:51:28 +0000 |
commit | 940b4d1848e8c70ab7642901a68594e8016caffc (patch) | |
tree | eb72f344ee6c3d9b80a7ecc079ea79e9fba8676d /sw/qa/uitest/writer_tests6 | |
parent | Initial commit. (diff) | |
download | libreoffice-940b4d1848e8c70ab7642901a68594e8016caffc.tar.xz libreoffice-940b4d1848e8c70ab7642901a68594e8016caffc.zip |
Adding upstream version 1:7.0.4.upstream/1%7.0.4upstream
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/infobar.py | 60 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests6/tdf107847.py | 40 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests6/tdf120731.py | 35 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests6/tdf124586.py | 47 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests6/tdf124675.py | 37 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests6/tdf125104.py | 66 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests6/tdf126017.py | 61 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests6/tdf126168.py | 52 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests6/tdf126627.py | 60 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests6/tdf128431.py | 63 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests6/tdf131041.py | 50 | ||||
-rw-r--r-- | sw/qa/uitest/writer_tests6/tdf44837.py | 46 |
12 files changed, 617 insertions, 0 deletions
diff --git a/sw/qa/uitest/writer_tests6/infobar.py b/sw/qa/uitest/writer_tests6/infobar.py new file mode 100644 index 000000000..84dfdb3ac --- /dev/null +++ b/sw/qa/uitest/writer_tests6/infobar.py @@ -0,0 +1,60 @@ +# -*- 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 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): + 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): + controller.appendInfobar( + "my", "Hello world", "The quick, brown fox jumps over a lazy dog.", InfobarType.INFO, buttons, True) + self.ui_test.close_doc() + + 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) + + # 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): + 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") + + # 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 000000000..d653ddb0a --- /dev/null +++ b/sw/qa/uitest/writer_tests6/tdf107847.py @@ -0,0 +1,40 @@ +# -*- 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 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() + + 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) + + self.assertEqual(document.TextFrames.getCount(), 1) + self.xUITest.executeCommand(".uno:Undo") + self.assertEqual(document.TextFrames.getCount(), 0) + self.ui_test.close_doc() +# 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..b2d722663 --- /dev/null +++ b/sw/qa/uitest/writer_tests6/tdf120731.py @@ -0,0 +1,35 @@ +# -*- 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 get_state_as_dict +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, type_text +from uitest.debug import sleep +import org.libreoffice.unotest +import pathlib +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +#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() + + 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() +# 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..fa71f0551 --- /dev/null +++ b/sw/qa/uitest/writer_tests6/tdf124586.py @@ -0,0 +1,47 @@ +# -*- 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 get_state_as_dict +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, type_text +from uitest.debug import sleep +import org.libreoffice.unotest +import pathlib +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +#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() + + #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()) + + self.assertEqual(document.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() +# 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..2a02e36bc --- /dev/null +++ b/sw/qa/uitest/writer_tests6/tdf124675.py @@ -0,0 +1,37 @@ +# -*- 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 get_state_as_dict +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, type_text +from uitest.debug import sleep +import org.libreoffice.unotest +import pathlib + +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +#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") + + for i in range(52): + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + + self.xUITest.executeCommand(".uno:Undo") + + self.assertEqual(document.CurrentController.PageCount, 15) + self.ui_test.close_doc() +# 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..b711b01ca --- /dev/null +++ b/sw/qa/uitest/writer_tests6/tdf125104.py @@ -0,0 +1,66 @@ +# +# 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 libreoffice.uno.propertyvalue import mkPropertyValues + +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): + 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) + + def test_tdf125104_pageFormat_numbering(self): + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + + # 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 + 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") + + 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) + + # 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 + 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], "२") + + 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 new file mode 100644 index 000000000..99ca14759 --- /dev/null +++ b/sw/qa/uitest/writer_tests6/tdf126017.py @@ -0,0 +1,61 @@ +# -*- 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 get_state_as_dict +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, type_text +from uitest.debug import sleep +import org.libreoffice.unotest +import pathlib + +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +#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() +# 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..d25ae711e --- /dev/null +++ b/sw/qa/uitest/writer_tests6/tdf126168.py @@ -0,0 +1,52 @@ +# -*- 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 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") + + #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") + + #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/tdf126627.py b/sw/qa/uitest/writer_tests6/tdf126627.py new file mode 100644 index 000000000..dcce155b3 --- /dev/null +++ b/sw/qa/uitest/writer_tests6/tdf126627.py @@ -0,0 +1,60 @@ +# -*- 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 get_state_as_dict +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, type_text +from uitest.debug import sleep +import org.libreoffice.unotest +import pathlib +from uitest.path import get_srcdir_url +def get_url_for_data_file(file_name): + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() + +#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 new file mode 100644 index 000000000..17dde483e --- /dev/null +++ b/sw/qa/uitest/writer_tests6/tdf128431.py @@ -0,0 +1,63 @@ +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from uitest.uihelper.common import select_pos, get_state_as_dict +from com.sun.star.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() + + #set cm Tools-options-StarOffice Writer-General + self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog + xDialog = self.xUITest.getTopFocusWindow() + + xPages = xDialog.getChild("pages") + xWriterEntry = xPages.getChild('3') # Writer + xWriterEntry.executeAction("EXPAND", tuple()) + xWriterGeneralEntry = xWriterEntry.getChild('0') + xWriterGeneralEntry.executeAction("SELECT", tuple()) #General + xMetric = xDialog.getChild("metric") + props = {"TEXT": "Centimeter"} + actionProps = mkPropertyValues(props) + xMetric.executeAction("SELECT", actionProps) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.ui_test.execute_dialog_through_command(".uno:PageDialog") + xDialog = self.xUITest.getTopFocusWindow() + 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") + + 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 new file mode 100644 index 000000000..94a6f2b75 --- /dev/null +++ b/sw/qa/uitest/writer_tests6/tdf131041.py @@ -0,0 +1,50 @@ +# +# 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): + self.ui_test.create_doc_in_start_center("writer") + document = self.ui_test.get_component() + + self.ui_test.execute_dialog_through_command(".uno:PageDialog") + xDialog = self.xUITest.getTopFocusWindow() + 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") + + self.ui_test.execute_dialog_through_action(xMoreBtn, "CLICK") + + xBorderDlg = self.xUITest.getTopFocusWindow() + + #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) + + 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/tdf44837.py b/sw/qa/uitest/writer_tests6/tdf44837.py new file mode 100644 index 000000000..8354709da --- /dev/null +++ b/sw/qa/uitest/writer_tests6/tdf44837.py @@ -0,0 +1,46 @@ +# +# 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: |