From ed5640d8b587fbcfed7dd7967f3de04b37a76f26 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 11:06:44 +0200 Subject: Adding upstream version 4:7.4.7. Signed-off-by: Daniel Baumann --- sw/qa/uitest/writer_tests4/exportToPDF.py | 76 +++++++++++++ sw/qa/uitest/writer_tests4/insertBreakDialog.py | 70 ++++++++++++ sw/qa/uitest/writer_tests4/insertPageHeader.py | 78 +++++++++++++ sw/qa/uitest/writer_tests4/spellDialog.py | 141 ++++++++++++++++++++++++ sw/qa/uitest/writer_tests4/start.py | 49 ++++++++ sw/qa/uitest/writer_tests4/tdf113252.py | 37 +++++++ sw/qa/uitest/writer_tests4/tdf113284.py | 40 +++++++ sw/qa/uitest/writer_tests4/tdf122449.py | 43 ++++++++ sw/qa/uitest/writer_tests4/tdf134439.py | 54 +++++++++ sw/qa/uitest/writer_tests4/tdf135636.py | 40 +++++++ sw/qa/uitest/writer_tests4/tdf136578.py | 31 ++++++ sw/qa/uitest/writer_tests4/tdf138546.py | 38 +++++++ sw/qa/uitest/writer_tests4/tdf148395.py | 47 ++++++++ sw/qa/uitest/writer_tests4/tdf92611.py | 23 ++++ 14 files changed, 767 insertions(+) create mode 100644 sw/qa/uitest/writer_tests4/exportToPDF.py create mode 100644 sw/qa/uitest/writer_tests4/insertBreakDialog.py create mode 100644 sw/qa/uitest/writer_tests4/insertPageHeader.py create mode 100644 sw/qa/uitest/writer_tests4/spellDialog.py create mode 100644 sw/qa/uitest/writer_tests4/start.py create mode 100644 sw/qa/uitest/writer_tests4/tdf113252.py create mode 100644 sw/qa/uitest/writer_tests4/tdf113284.py create mode 100644 sw/qa/uitest/writer_tests4/tdf122449.py create mode 100644 sw/qa/uitest/writer_tests4/tdf134439.py create mode 100644 sw/qa/uitest/writer_tests4/tdf135636.py create mode 100644 sw/qa/uitest/writer_tests4/tdf136578.py create mode 100644 sw/qa/uitest/writer_tests4/tdf138546.py create mode 100644 sw/qa/uitest/writer_tests4/tdf148395.py create mode 100644 sw/qa/uitest/writer_tests4/tdf92611.py (limited to 'sw/qa/uitest/writer_tests4') diff --git a/sw/qa/uitest/writer_tests4/exportToPDF.py b/sw/qa/uitest/writer_tests4/exportToPDF.py new file mode 100644 index 000000000..e88255948 --- /dev/null +++ b/sw/qa/uitest/writer_tests4/exportToPDF.py @@ -0,0 +1,76 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file +from uitest.uihelper.common import type_text +from libreoffice.uno.propertyvalue import mkPropertyValues +from org.libreoffice.unotest import systemPathToFileUrl +from tempfile import TemporaryDirectory +import os.path + +class exportToPDF(UITestCase): + + def test_checkDefaultValues(self): + + with TemporaryDirectory() as tempdir: + xFilePath = os.path.join(tempdir, 'exportToPDFFromWriter-tmp.pdf') + + with self.ui_test.create_doc_in_start_center("writer"): + + xMainWindow = self.xUITest.getTopFocusWindow() + xEdit = xMainWindow.getChild("writer_edit") + + type_text(xEdit, "Hello World") + + # Export as PDF + with self.ui_test.execute_dialog_through_command('.uno:ExportToPDF', close_button="") as xDialog: + + selectedChildren = ['bookmarks', 'display', 'effects', 'enablea11y', 'enablecopy', 'exporturl', 'forms', 'reduceresolution'] + + for child in selectedChildren: + self.assertEqual("true", get_state_as_dict(xDialog.getChild(child))['Selected']) + + nonSelectedChildren = ['allowdups', 'center', 'comments', 'convert', 'embed', 'emptypages', 'export', 'exportplaceholders', + 'firstonleft', 'hiddenpages', 'menubar', 'notes', 'onlynotes', 'open', 'pdfa', 'pdfua', 'resize', 'singlepagesheets', + 'tagged', 'toolbar', 'usereferencexobject', 'viewpdf', 'watermark', 'window'] + + for child in nonSelectedChildren: + self.assertEqual("false", get_state_as_dict(xDialog.getChild(child))['Selected']) + + checkedChildren = ['all', 'allbookmarks', 'changeany', 'default', 'defaultlayout', 'fitdefault', 'jpegcompress', 'pageonly', 'printhigh'] + + for child in checkedChildren: + self.assertEqual("true", get_state_as_dict(xDialog.getChild(child))['Checked']) + + nonCheckedChildren = ['changecomment', 'changeform', 'changeinsdel', 'changenone', 'contfacinglayout', 'contlayout', 'fitvis', + 'fitwidth', 'fitwin', 'fitzoom', 'losslesscompress', 'openinternet', 'openpdf', 'outline', 'printlow', 'printnone', 'range', + 'selection', 'singlelayout', 'thumbs', 'visiblebookmark'] + + for child in nonCheckedChildren: + self.assertEqual("false", get_state_as_dict(xDialog.getChild(child))['Checked']) + + self.assertEqual("300 DPI", get_state_as_dict(xDialog.getChild("resolution"))['Text']) + self.assertEqual("90", get_state_as_dict(xDialog.getChild("quality"))['Value']) + self.assertEqual("FDF", get_state_as_dict(xDialog.getChild("format"))['DisplayText']) + + xOk = xDialog.getChild("ok") + with self.ui_test.execute_dialog_through_action(xOk, "CLICK", close_button="open") as xSaveDialog: + xFileName = xSaveDialog.getChild('file_name') + xFileName.executeAction('TYPE', mkPropertyValues({'KEYCODE':'CTRL+A'})) + xFileName.executeAction('TYPE', mkPropertyValues({'KEYCODE':'BACKSPACE'})) + xFileName.executeAction('TYPE', mkPropertyValues({'TEXT': xFilePath})) + + self.ui_test.wait_until_file_is_available(xFilePath) + + with self.ui_test.load_file(systemPathToFileUrl(xFilePath)) as document: + + self.assertEqual("Hello World", document.DrawPages[0].getByIndex(0).String) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests4/insertBreakDialog.py b/sw/qa/uitest/writer_tests4/insertBreakDialog.py new file mode 100644 index 000000000..9299d46aa --- /dev/null +++ b/sw/qa/uitest/writer_tests4/insertBreakDialog.py @@ -0,0 +1,70 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import select_pos + +class WriterInsertBreakDialog(UITestCase): + + def getPages(self, total): + document = self.ui_test.get_component() + + self.assertEqual(document.CurrentController.PageCount, total) + + def test_insert_line_break(self): + + with self.ui_test.create_doc_in_start_center("writer"): + + with self.ui_test.execute_dialog_through_command(".uno:InsertBreak") as xDialog: + xOption = xDialog.getChild("linerb") + xOption.executeAction("CLICK", tuple()) + + self.getPages(1) + + + def test_insert_column_break(self): + + with self.ui_test.create_doc_in_start_center("writer"): + + with self.ui_test.execute_dialog_through_command(".uno:InsertBreak") as xDialog: + xOption = xDialog.getChild("columnrb") + xOption.executeAction("CLICK", tuple()) + + self.getPages(1) + + + def test_insert_page_break(self): + + with self.ui_test.create_doc_in_start_center("writer"): + + for i in range(9): + with self.subTest(i=i): + with self.ui_test.execute_dialog_through_command(".uno:InsertBreak") as xDialog: + + xOption = xDialog.getChild("pagerb") + xOption.executeAction("CLICK", tuple()) + + xStyleList = xDialog.getChild("stylelb") + select_pos(xStyleList, str(i)) + + self.getPages(i + 2) + + + def test_cancel_button_insert_line_break_dialog(self): + + with self.ui_test.create_doc_in_start_center("writer"): + + with self.ui_test.execute_dialog_through_command(".uno:InsertBreak", close_button="cancel"): + pass + + self.getPages(1) + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests4/insertPageHeader.py b/sw/qa/uitest/writer_tests4/insertPageHeader.py new file mode 100644 index 000000000..9da58db9a --- /dev/null +++ b/sw/qa/uitest/writer_tests4/insertPageHeader.py @@ -0,0 +1,78 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from uitest.uihelper.common import get_url_for_data_file + +class WriterInsertPageHeader(UITestCase): + + def insert_header(self): + document = self.ui_test.get_component() + + self.assertEqual( + document.StyleFamilies.PageStyles.Standard.HeaderIsOn, False) + + self.xUITest.executeCommand( + ".uno:InsertPageHeader?PageStyle:string=Default%20Page%20Style&On:bool=true") + + self.assertEqual( + document.StyleFamilies.PageStyles.Standard.HeaderIsOn, True) + + def delete_header(self): + document = self.ui_test.get_component() + + self.assertEqual( + document.StyleFamilies.PageStyles.Standard.HeaderIsOn, True) + + with self.ui_test.execute_dialog_through_command( + ".uno:InsertPageHeader?PageStyle:string=Default%20Page%20Style&On:bool=false", close_button="yes"): + pass + + self.assertEqual( + document.StyleFamilies.PageStyles.Standard.HeaderIsOn, False) + + def test_header(self): + with self.ui_test.create_doc_in_start_center("writer") as document: + + self.insert_header() + + self.delete_header() + + + def test_tdf107427(self): + with self.ui_test.create_doc_in_start_center("writer") as document: + + self.insert_header() + + with self.ui_test.execute_dialog_through_command(".uno:InsertTable"): + pass + + + tables = document.getTextTables() + self.assertEqual(len(tables[0].getRows()), 2) + self.assertEqual(len(tables[0].getColumns()), 2) + + self.xUITest.executeCommand(".uno:SelectAll") + + self.delete_header() + + def test_tdf146248(self): + with self.ui_test.load_file(get_url_for_data_file("tdf146248.docx")): + + self.delete_header() + + # crashed before + self.xUITest.executeCommand(".uno:Undo") + + document = self.ui_test.get_component() + self.assertEqual( + document.StyleFamilies.PageStyles.Standard.HeaderIsOn, True) + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests4/spellDialog.py b/sw/qa/uitest/writer_tests4/spellDialog.py new file mode 100644 index 000000000..4d2b4b622 --- /dev/null +++ b/sw/qa/uitest/writer_tests4/spellDialog.py @@ -0,0 +1,141 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +import re +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file + +from libreoffice.linguistic.linguservice import get_spellchecker +from com.sun.star.lang import Locale + +class SpellingAndGrammarDialog(UITestCase): + + def is_supported_locale(self, language, country): + xSpellChecker = get_spellchecker(self.ui_test._xContext) + locales = xSpellChecker.getLocales() + for locale in locales: + if language != None: + if locale.Language != language: + continue + + if country != None: + if locale.Country != country: + continue + + # we found the correct combination + return True + + TDF46852_INPUT = """\ +dogg +dogg +catt dogg +frogg frogg +frogg catt dogg +dogg catt +frog, dogg, catt""" + + TDF46852_REGEX = """\ +([a-z]+) +\\1 +([a-z]+) \\1 +([a-z]+) \\3 +\\3 \\2 \\1 +\\1 \\2 +\\3, \\1, \\2""" + + def test_tdf46852(self): + supported_locale = self.is_supported_locale("en", "US") + if not supported_locale: + self.skipTest("no dictionary support for en_US available") + # This automates the steps described in the bug report tdf#46852 + + # Step 1: Create a document with repetitious misspelled words + with self.ui_test.create_doc_in_start_center("writer") as document: + cursor = document.getCurrentController().getViewCursor() + # Inserted text must be en_US, so make sure to set language in current location + cursor.CharLocale = Locale("en", "US", "") + input_text = self.TDF46852_INPUT.replace('\n', '\r') # \r = para break + document.Text.insertString(cursor, input_text, False) + + # Step 2: Place cursor on 4th line after second "frogg" + cursor.goUp(2, False) + cursor.goLeft(1, False) + + # Step 3: Initiate spellchecking, and make sure "Check grammar" is + # unchecked + with self.ui_test.execute_modeless_dialog_through_command(".uno:SpellingAndGrammarDialog", close_button="") as xDialog: + checkgrammar = xDialog.getChild('checkgrammar') + if get_state_as_dict(checkgrammar)['Selected'] == 'true': + checkgrammar.executeAction('CLICK', ()) + self.assertTrue(get_state_as_dict(checkgrammar)['Selected'] == 'false') + + # Step 4: Repetitively click on "Correct all" for each misspelling + # prompt until end of document is reached. + changeall = xDialog.getChild('changeall') + changeall.executeAction("CLICK", ()) + changeall.executeAction("CLICK", ()) + # The third time we click on changeall, the click action is going to + # block while two message boxes are shown, so we need to do this third + # click specially + # Use empty close_button to open consecutive dialogs + with self.ui_test.execute_blocking_action( + changeall.executeAction, args=('CLICK', ()), close_button="") as dialog: + # Step 5: Confirm to "Continue check at beginning of document" + xYesBtn = dialog.getChild("yes") + + with self.ui_test.execute_blocking_action( + xYesBtn.executeAction, args=('CLICK', ())): + pass + + output_text = document.Text.getString().replace('\r\n', '\n') + self.assertTrue(re.match(self.TDF46852_REGEX, output_text)) + + def test_tdf136855(self): + supported_locale = self.is_supported_locale("en", "US") + if not supported_locale: + self.skipTest("no dictionary support for en_US available") + + with self.ui_test.load_file(get_url_for_data_file("tdf136855.odt")) as writer_doc: + + with self.ui_test.execute_modeless_dialog_through_command(".uno:SpellingAndGrammarDialog", close_button="close") as xDialog: + + xChangeBtn = xDialog.getChild('change') + for i in range(6): + # Without the fix in place, this test would have crashed here + xChangeBtn.executeAction("CLICK", ()) + + output_text = writer_doc.Text.getString().replace('\n', '').replace('\r', '') + self.assertTrue(output_text.startswith("xx xx xx xxxxxxxxxxix xxxxxxxxxxxxxxviii")) + + def test_tdf66043(self): + supported_locale = self.is_supported_locale("en", "US") + if not supported_locale: + self.skipTest("no dictionary support for en_US available") + with self.ui_test.load_file(get_url_for_data_file("tdf66043.fodt")) as writer_doc: + # Step 1: Initiate spellchecking, and make sure "Check grammar" is + # unchecked + with self.ui_test.execute_modeless_dialog_through_command(".uno:SpellingAndGrammarDialog", close_button="close") as xDialog: + checkgrammar = xDialog.getChild('checkgrammar') + if get_state_as_dict(checkgrammar)['Selected'] == 'true': + checkgrammar.executeAction('CLICK', ()) + self.assertTrue(get_state_as_dict(checkgrammar)['Selected'] == 'false') + + # Step 2: Click on "Correct all" for each misspelling + # prompt until end of document is reached. + changeall = xDialog.getChild('changeall') + changeall.executeAction("CLICK", ()) + + output_text = writer_doc.Text.getString().replace('\r\n', '\n') + # This was "gooodgood baaad eeend" ("goood" is a deletion, + # "good" is an insertion by fixing the first misspelling), + # but now "goood" is not a misspelling because it is accepted + # correctly without the redline containing a deleted "o" + self.assertEqual(output_text, 'goood baaadbaaed eeend') + +# vim: set shiftwidth=4 softtabstop=4 expandtab: \ No newline at end of file diff --git a/sw/qa/uitest/writer_tests4/start.py b/sw/qa/uitest/writer_tests4/start.py new file mode 100644 index 000000000..64d41ff02 --- /dev/null +++ b/sw/qa/uitest/writer_tests4/start.py @@ -0,0 +1,49 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from libreoffice.uno.propertyvalue import mkPropertyValues + +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict + +class SimpleWriterTest(UITestCase): + + def test_start_writer(self): + + with self.ui_test.create_doc_in_start_center("writer"): + + xWriterDoc = self.xUITest.getTopFocusWindow() + + xWriterEdit = xWriterDoc.getChild("writer_edit") + + xWriterEdit.executeAction("SET", mkPropertyValues({"ZOOM": "200"})) + + self.assertEqual(get_state_as_dict(xWriterEdit)["Zoom"], "200") + + + def test_goto_first_page(self): + + with self.ui_test.create_doc_in_start_center("writer"): + + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + state = get_state_as_dict(xWriterEdit) + while state["CurrentPage"] == "1": + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + state = get_state_as_dict(xWriterEdit) + + self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2") + + xWriterEdit.executeAction("GOTO", mkPropertyValues({"PAGE": "1"})) + + self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "1") + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests4/tdf113252.py b/sw/qa/uitest/writer_tests4/tdf113252.py new file mode 100644 index 000000000..4278d2536 --- /dev/null +++ b/sw/qa/uitest/writer_tests4/tdf113252.py @@ -0,0 +1,37 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import select_pos +#Bug 113252 - Basic Library Organizer is broken and closing dialogs crashes + +class tdf113252(UITestCase): + + def test_tdf113252_macro_dialog(self): + with self.ui_test.create_doc_in_start_center("writer"): + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + #Start LibreOffice. Go to Tools > Macros > Organize Macros > Basic + with self.ui_test.execute_dialog_through_command(".uno:MacroDialog", close_button="close") as xDialog: + + #Click Button Organizer + xorganize = xDialog.getChild("organize") + with self.ui_test.execute_blocking_action(xorganize.executeAction, args=('CLICK', ()), close_button="close") as dialog: + xTabs = dialog.getChild("tabcontrol") + select_pos(xTabs, "0") + select_pos(xTabs, "1") + select_pos(xTabs, "2") + #Click button Close in the next dialog -> crash. + + + self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "1") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests4/tdf113284.py b/sw/qa/uitest/writer_tests4/tdf113284.py new file mode 100644 index 000000000..3f04b3ff6 --- /dev/null +++ b/sw/qa/uitest/writer_tests4/tdf113284.py @@ -0,0 +1,40 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file + +class tdf113284(UITestCase): + + def test_tdf113284(self): + with self.ui_test.load_file(get_url_for_data_file("tdf113284.odt")) as writer_doc: + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + + xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit') + xToolkit.processEventsToIdle() + + xPageCount = writer_doc.CurrentController.PageCount + with self.ui_test.execute_dialog_through_command(".uno:GotoPage") as xDialog: + xPageText = xDialog.getChild("page") + xPageText.executeAction("TYPE", mkPropertyValues({"TEXT":str(xPageCount)})) # goto last page + + xToolkit.processEventsToIdle() + + self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], str(xPageCount)) + with self.ui_test.execute_dialog_through_command(".uno:EditCurIndex", close_button="cancel"): + pass + + #page count is not constant + #self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "66") #page 66 start of the Index + #pagecount unchanged + self.assertEqual(writer_doc.CurrentController.PageCount, xPageCount) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests4/tdf122449.py b/sw/qa/uitest/writer_tests4/tdf122449.py new file mode 100644 index 000000000..4c4f91e75 --- /dev/null +++ b/sw/qa/uitest/writer_tests4/tdf122449.py @@ -0,0 +1,43 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file + +#Bug 122449 - Crash in: mergedlo.dll when closing "Edit Index Entry" dialog (gen/gtk) + +class tdf122449(UITestCase): + + def test_tdf122449_crash_edit_index_entry(self): + with self.ui_test.load_file(get_url_for_data_file("tdf122449.odt")) as writer_doc: + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + #search word Autocorrect (second find) .uno:SearchDialog + with self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button="close") as xDialog: + + searchterm = xDialog.getChild("searchterm") + searchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"Autocorrection"})) + xsearch = xDialog.getChild("search") + xsearch.executeAction("CLICK", tuple()) #first search + xsearch.executeAction("CLICK", tuple()) #2nd search + self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "6") + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "HOME"})) + # invoke Index dialog Index entry .uno:IndexEntryDialog + with self.ui_test.execute_dialog_through_command(".uno:IndexEntryDialog", close_button="close"): + pass + # close + # Go to page 2 + with self.ui_test.execute_dialog_through_command(".uno:GotoPage") as xDialog: + xPageText = xDialog.getChild("page") + xPageText.executeAction("TYPE", mkPropertyValues({"TEXT":"2"})) + # verify + self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "2") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests4/tdf134439.py b/sw/qa/uitest/writer_tests4/tdf134439.py new file mode 100644 index 000000000..7348049d1 --- /dev/null +++ b/sw/qa/uitest/writer_tests4/tdf134439.py @@ -0,0 +1,54 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file +from uitest.uihelper.common import select_by_text +from libreoffice.uno.propertyvalue import mkPropertyValues + +class tdf134439(UITestCase): + + def test_tdf134439(self): + + with self.ui_test.load_file(get_url_for_data_file("tdf134439.odt")) as document: + + self.assertEqual(document.CurrentController.PageCount, 3) + + xCursor = document.CurrentController.ViewCursor + self.assertEqual("Chap 1", xCursor.PageStyleName) + + xPageBreak = self.ui_test.wait_until_child_is_available('PageBreak') + with self.ui_test.execute_dialog_through_action(xPageBreak, "EDIT") as xDialog: + + + self.assertEqual("Page", get_state_as_dict(xDialog.getChild("comboBreakType"))["SelectEntryText"]) + self.assertEqual("Before", get_state_as_dict(xDialog.getChild("comboBreakPosition"))["SelectEntryText"]) + + xPageStyle = xDialog.getChild("comboPageStyle") + self.assertEqual("Chap 2", get_state_as_dict(xPageStyle)["SelectEntryText"]) + + select_by_text(xPageStyle, "Chap 3") + + self.assertEqual("Chap 3", get_state_as_dict(xPageStyle)["SelectEntryText"]) + + # tdf#116070: Without the fix in place, this test would have crashed here + + # Without the fix in place, this test would have failed with + # AssertionError: 'Chap 1' != 'Chap 3' + self.assertEqual("Chap 1", xCursor.PageStyleName) + + self.assertEqual(document.CurrentController.PageCount, 3) + + xCursor.jumpToNextPage() + self.assertEqual("Chap 3", xCursor.PageStyleName) + + self.xUITest.executeCommand(".uno:Undo") + + self.assertEqual("Chap 2", xCursor.PageStyleName) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests4/tdf135636.py b/sw/qa/uitest/writer_tests4/tdf135636.py new file mode 100644 index 000000000..0fd3aec66 --- /dev/null +++ b/sw/qa/uitest/writer_tests4/tdf135636.py @@ -0,0 +1,40 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file + +class tdf135636(UITestCase): + + def test_tdf135636(self): + + with self.ui_test.load_file(get_url_for_data_file("tdf135636.odt")) as document: + + self.assertEqual(document.CurrentController.PageCount, 2) + + xPageBreak = self.ui_test.wait_until_child_is_available('PageBreak') + with self.ui_test.execute_dialog_through_action(xPageBreak, "EDIT") as xDialog: + + + xBreak = xDialog.getChild("break") + self.assertEqual("true", get_state_as_dict(xBreak)["Selected"]) + + xBreak.executeAction("CLICK", tuple()) + + self.assertEqual("false", get_state_as_dict(xBreak)["Selected"]) + + + # Without the fix in place, this test would have failed with + # AssertionError: 2 != 1 + self.assertEqual(document.CurrentController.PageCount, 1) + + self.xUITest.executeCommand(".uno:Undo") + + self.assertEqual(document.CurrentController.PageCount, 2) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests4/tdf136578.py b/sw/qa/uitest/writer_tests4/tdf136578.py new file mode 100644 index 000000000..13dc063a3 --- /dev/null +++ b/sw/qa/uitest/writer_tests4/tdf136578.py @@ -0,0 +1,31 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import get_url_for_data_file + +class tdf136578(UITestCase): + + def test_tdf136578(self): + + with self.ui_test.load_file(get_url_for_data_file("tdf136578.odt")) as document: + + self.assertEqual(document.CurrentController.PageCount, 2) + + xPageBreak = self.ui_test.wait_until_child_is_available('PageBreak') + xPageBreak.executeAction("DELETE", tuple()) + + # Without the fix in place, this test would have failed with + # AssertionError: 1 != 2 + self.assertEqual(document.CurrentController.PageCount, 1) + + self.xUITest.executeCommand(".uno:Undo") + + self.assertEqual(document.CurrentController.PageCount, 2) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests4/tdf138546.py b/sw/qa/uitest/writer_tests4/tdf138546.py new file mode 100644 index 000000000..89abcf7da --- /dev/null +++ b/sw/qa/uitest/writer_tests4/tdf138546.py @@ -0,0 +1,38 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from uitest.uihelper.common import change_measurement_unit +from uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import select_pos +from uitest.uihelper.common import get_url_for_data_file + +class tdf138546(UITestCase): + def test_tdf138546(self): + with self.ui_test.load_file(get_url_for_data_file("tdf138546.odt")): + xWriterDoc = self.xUITest.getTopFocusWindow() + + change_measurement_unit(self, "Centimeter") + + #dialog Columns + with self.ui_test.execute_dialog_through_command(".uno:FormatColumns", close_button="cancel") as xDialog: + + colsnf = xDialog.getChild("colsnf") + width1mf = xDialog.getChild("width1mf") + self.assertEqual(get_state_as_dict(colsnf)["Text"], "2") + self.assertEqual((get_state_as_dict(width1mf)["Text"])[0:3], "2.0") #2.00 cm + + with self.ui_test.execute_dialog_through_command(".uno:PageDialog", close_button="cancel") as xDialog: + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "7") #Columns + colsnf = xDialog.getChild("colsnf") + width1mf = xDialog.getChild("width1mf") + self.assertEqual(get_state_as_dict(colsnf)["Text"], "2") + self.assertEqual((get_state_as_dict(width1mf)["Text"])[0:3], "2.0") #2.00 cm + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests4/tdf148395.py b/sw/qa/uitest/writer_tests4/tdf148395.py new file mode 100644 index 000000000..312733525 --- /dev/null +++ b/sw/qa/uitest/writer_tests4/tdf148395.py @@ -0,0 +1,47 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict +from uitest.uihelper.common import select_pos + +class Tdf148395(UITestCase): + + def test_tdf148395(self): + + with self.ui_test.create_doc_in_start_center("writer") as document: + + with self.ui_test.execute_dialog_through_command(".uno:InsertObject") as xDialog: + xTypes = xDialog.getChild("types") + xCreateNew = xDialog.getChild("createnew") + + self.assertEqual('true', get_state_as_dict(xCreateNew)['Checked']) + + xSelectedEntry = get_state_as_dict(xTypes)['SelectEntryText'] + self.assertTrue('Spreadsheet' in xSelectedEntry ) + + for i in range(10): + xTypes.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + xSelectedEntry = get_state_as_dict(xTypes)['SelectEntryText'] + if 'Chart' in xSelectedEntry: + break + + self.assertEqual(1, document.EmbeddedObjects.Count) + self.assertEqual("SwXTextEmbeddedObject", document.CurrentSelection.getImplementationName()) + + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/Page=") + + # Without the fix in place, this test would have crashed here + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramArea"})) as xDialog: + pass + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sw/qa/uitest/writer_tests4/tdf92611.py b/sw/qa/uitest/writer_tests4/tdf92611.py new file mode 100644 index 000000000..a0feb2f6b --- /dev/null +++ b/sw/qa/uitest/writer_tests4/tdf92611.py @@ -0,0 +1,23 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.framework import UITestCase + +class tdf92611(UITestCase): + + def test_launch_and_close_bibliography(self): + + with self.ui_test.create_doc_in_start_center("writer"): + + self.xUITest.executeCommand(".uno:BibliographyComponent") + + self.xUITest.executeCommand(".uno:CloseWin") + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: -- cgit v1.2.3