summaryrefslogtreecommitdiffstats
path: root/sw/qa/uitest/writer_tests4
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--sw/qa/uitest/writer_tests4/exportToPDF.py75
-rw-r--r--sw/qa/uitest/writer_tests4/insertBreakDialog.py69
-rw-r--r--sw/qa/uitest/writer_tests4/spellDialog.py184
-rw-r--r--sw/qa/uitest/writer_tests4/start.py49
-rw-r--r--sw/qa/uitest/writer_tests4/tdf113252.py37
-rw-r--r--sw/qa/uitest/writer_tests4/tdf113284.py40
-rw-r--r--sw/qa/uitest/writer_tests4/tdf122449.py43
-rw-r--r--sw/qa/uitest/writer_tests4/tdf128192.py72
-rw-r--r--sw/qa/uitest/writer_tests4/tdf134439.py53
-rw-r--r--sw/qa/uitest/writer_tests4/tdf135636.py40
-rw-r--r--sw/qa/uitest/writer_tests4/tdf136578.py31
-rw-r--r--sw/qa/uitest/writer_tests4/tdf138546.py37
-rw-r--r--sw/qa/uitest/writer_tests4/tdf148395.py46
-rw-r--r--sw/qa/uitest/writer_tests4/tdf92611.py23
14 files changed, 799 insertions, 0 deletions
diff --git a/sw/qa/uitest/writer_tests4/exportToPDF.py b/sw/qa/uitest/writer_tests4/exportToPDF.py
new file mode 100644
index 0000000000..ef628d4eea
--- /dev/null
+++ b/sw/qa/uitest/writer_tests4/exportToPDF.py
@@ -0,0 +1,75 @@
+# -*- 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 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', 'tagged']
+
+ 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',
+ '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', 'outline', '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', 'pageonly', '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}))
+
+ 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 0000000000..4d968f723c
--- /dev/null
+++ b/sw/qa/uitest/writer_tests4/insertBreakDialog.py
@@ -0,0 +1,69 @@
+# -*- 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
+
+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/spellDialog.py b/sw/qa/uitest/writer_tests4/spellDialog.py
new file mode 100644
index 0000000000..5fbffe93b1
--- /dev/null
+++ b/sw/qa/uitest/writer_tests4/spellDialog.py
@@ -0,0 +1,184 @@
+# -*- 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 uitest.uihelper.common import type_text
+
+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')
+
+ def test_tdf65535(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("tdf65535.fodt")) 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", "")
+
+ xMainWindow = self.xUITest.getTopFocusWindow()
+ xEdit = xMainWindow.getChild("writer_edit")
+
+ # type a bad word after the word with comment
+ cursor.goRight(5, False)
+ type_text(xEdit, " baad")
+ cursor.goLeft(10, False)
+
+ # fix the first word using the spelling dialog
+ 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')
+
+ change = xDialog.getChild('change')
+ change.executeAction("CLICK", ())
+
+ # FIXME: disabled for the sake of testing on lo-upsan build
+ # output_text = document.Text.getString()
+ # self.assertEqual(fixed_word, output_text)
+
+ # check the original comment
+ has_comment = False
+ textfields = document.getTextFields()
+ for textfield in textfields:
+ if textfield.supportsService("com.sun.star.text.TextField.Annotation"):
+ has_comment = True
+
+ # This was False (lost comment)
+ self.assertEqual(True, has_comment)
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests4/start.py b/sw/qa/uitest/writer_tests4/start.py
new file mode 100644
index 0000000000..64d41ff026
--- /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 0000000000..4278d2536e
--- /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 0000000000..3f04b3ff64
--- /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 0000000000..dad65e29a7
--- /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")):
+ 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/tdf128192.py b/sw/qa/uitest/writer_tests4/tdf128192.py
new file mode 100644
index 0000000000..3c5f72c3be
--- /dev/null
+++ b/sw/qa/uitest/writer_tests4/tdf128192.py
@@ -0,0 +1,72 @@
+# -*- 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 128192 - Fix Tools/AutoCorrect/Apply to apply for all styles
+
+class tdf128192(UITestCase):
+
+ def test_tdf128192(self):
+ with self.ui_test.load_file(get_url_for_data_file("tdf128192.odt")):
+ MainWindow = self.xUITest.getTopFocusWindow()
+ writer_edit = MainWindow.getChild("writer_edit")
+
+ # perform Tools/AutoCorrect/Apply on the whole document
+ self.xUITest.executeCommand(".uno:SelectAll")
+ self.xUITest.executeCommand(".uno:AutoFormatApply")
+
+ # test for each style whether "Replace dashes" works in AutoCorrect
+ writer_edit.executeAction("SELECT", mkPropertyValues({"END_POS": "9", "START_POS": "14"}))
+ self.assertEqual(get_state_as_dict(writer_edit)["SelectedText"], "A – B")
+
+ self.xUITest.executeCommand(".uno:GoUp")
+ writer_edit.executeAction("SELECT", mkPropertyValues({"END_POS": "19", "START_POS": "24"}))
+ self.assertEqual(get_state_as_dict(writer_edit)["SelectedText"], "A – B")
+
+ self.xUITest.executeCommand(".uno:GoUp")
+ writer_edit.executeAction("SELECT", mkPropertyValues({"END_POS": "12", "START_POS": "17"}))
+ self.assertEqual(get_state_as_dict(writer_edit)["SelectedText"], "A – B")
+
+ self.xUITest.executeCommand(".uno:GoUp")
+ writer_edit.executeAction("SELECT", mkPropertyValues({"END_POS": "11", "START_POS": "16"}))
+ self.assertEqual(get_state_as_dict(writer_edit)["SelectedText"], "A – B")
+
+ self.xUITest.executeCommand(".uno:GoUp")
+ writer_edit.executeAction("SELECT", mkPropertyValues({"END_POS": "11", "START_POS": "16"}))
+ self.assertEqual(get_state_as_dict(writer_edit)["SelectedText"], "A – B")
+
+ self.xUITest.executeCommand(".uno:GoUp")
+ writer_edit.executeAction("SELECT", mkPropertyValues({"END_POS": "11", "START_POS": "16"}))
+ self.assertEqual(get_state_as_dict(writer_edit)["SelectedText"], "A – B")
+
+ self.xUITest.executeCommand(".uno:GoUp")
+ writer_edit.executeAction("SELECT", mkPropertyValues({"END_POS": "11", "START_POS": "16"}))
+ self.assertEqual(get_state_as_dict(writer_edit)["SelectedText"], "A – B")
+
+ self.xUITest.executeCommand(".uno:GoUp")
+ writer_edit.executeAction("SELECT", mkPropertyValues({"END_POS": "16", "START_POS": "11"}))
+ self.assertEqual(get_state_as_dict(writer_edit)["SelectedText"], "A – B")
+
+ self.xUITest.executeCommand(".uno:GoUp")
+ writer_edit.executeAction("SELECT", mkPropertyValues({"END_POS": "25", "START_POS": "30"}))
+ self.assertEqual(get_state_as_dict(writer_edit)["SelectedText"], "A – B")
+
+ self.xUITest.executeCommand(".uno:GoUp")
+ writer_edit.executeAction("SELECT", mkPropertyValues({"END_POS": "10", "START_POS": "15"}))
+ self.assertEqual(get_state_as_dict(writer_edit)["SelectedText"], "A – B")
+
+ self.xUITest.executeCommand(".uno:GoUp")
+ writer_edit.executeAction("SELECT", mkPropertyValues({"END_POS": "7", "START_POS": "12"}))
+ self.assertEqual(get_state_as_dict(writer_edit)["SelectedText"], "A – B")
+
+
+# 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 0000000000..d34c365dc5
--- /dev/null
+++ b/sw/qa/uitest/writer_tests4/tdf134439.py
@@ -0,0 +1,53 @@
+# -*- 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
+
+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 0000000000..0fd3aec664
--- /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 0000000000..13dc063a3f
--- /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 0000000000..11305bf823
--- /dev/null
+++ b/sw/qa/uitest/writer_tests4/tdf138546.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 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")):
+
+ with 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 0000000000..233b4f2363
--- /dev/null
+++ b/sw/qa/uitest/writer_tests4/tdf148395.py
@@ -0,0 +1,46 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+from uitest.framework import UITestCase
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from uitest.uihelper.common import get_state_as_dict
+
+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 0000000000..a0feb2f6b8
--- /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: