sw/qa/uitest/writer_tests7/tdf150443.py |   48 -----------
 sw/qa/uitest/writer_tests7/tdf156783.py |   63 --------------
 sw/qa/uitest/writer_tests7/tdf156784.py |   38 --------
 sw/qa/uitest/writer_tests7/tdf156900.py |   46 ----------
 sw/qa/uitest/writer_tests7/tdf46561.py  |   97 ----------------------
 sw/qa/uitest/writer_tests7/tdf90401.py  |  139 --------------------------------
 sw/qa/uitest/writer_tests8/tdf159102.py |   97 ----------------------
 7 files changed, 528 deletions(-)

New commits:
commit bff92c0c289b3dfe4d05e92b928c7c371307d0f2
Author:     Thorsten Behrens <thorsten.behr...@allotropia.de>
AuthorDate: Tue May 7 23:39:36 2024 +0200
Commit:     Thorsten Behrens <thorsten.behr...@allotropia.de>
CommitDate: Wed May 8 15:58:55 2024 +0200

    Remove known-problematic tests
    
    Trying to address similar issues as on 7-6, via
    https://gerrit.libreoffice.org/c/core/+/164714.
    
    Change-Id: I43a3680c12d5e2d69e61854af6496fac24530524
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167297
    Tested-by: allotropia jenkins <jenk...@allotropia.de>
    Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de>

diff --git a/sw/qa/uitest/writer_tests7/tdf150443.py 
b/sw/qa/uitest/writer_tests7/tdf150443.py
deleted file mode 100644
index 91937551a4b3..000000000000
--- a/sw/qa/uitest/writer_tests7/tdf150443.py
+++ /dev/null
@@ -1,48 +0,0 @@
-# -*- 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 libreoffice.uno.propertyvalue import mkPropertyValues
-
-class tdf150443(UITestCase):
-
-    def test_tdf150443(self):
-        with self.ui_test.load_file(get_url_for_data_file("tdf150443.docx")):
-            xWriterDoc = self.xUITest.getTopFocusWindow()
-            xWriterEdit = xWriterDoc.getChild("writer_edit")
-            xToolkit = 
self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit')
-
-            # search term "Jump here!"
-            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":"Jump here!"}))
-                xsearch = xDialog.getChild("search")
-                xsearch.executeAction("CLICK", tuple())  #first search
-                xToolkit.processEventsToIdle()
-                page = get_state_as_dict(xWriterEdit)["CurrentPage"]
-                # page may depend on font subsitution, just check it moved
-                self.assertTrue(page == "4" or page == "5")
-
-            # reject the tracked table row in Manage Changes dialog window
-            with 
self.ui_test.execute_modeless_dialog_through_command(".uno:AcceptTrackedChanges",
 close_button="close") as xTrackDlg:
-                changesList = xTrackDlg.getChild("writerchanges")
-
-                items = len(changesList.getChildren())
-
-                # select tree parent of the actual tracked row deletion in 
tree list
-                changesList.executeAction("TYPE", mkPropertyValues({"KEYCODE": 
"LEFT"}))
-                xToolkit.processEventsToIdle()
-
-                # Without the fix in place, it would have crashed here
-                xAccBtn = xTrackDlg.getChild("reject")
-                xAccBtn.executeAction("CLICK", tuple())
-                self.assertEqual(items - 1, len(changesList.getChildren()))
-
-# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests7/tdf156783.py 
b/sw/qa/uitest/writer_tests7/tdf156783.py
deleted file mode 100644
index 2ccdb7dcf6e1..000000000000
--- a/sw/qa/uitest/writer_tests7/tdf156783.py
+++ /dev/null
@@ -1,63 +0,0 @@
-# -*- 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 libreoffice.uno.propertyvalue import mkPropertyValues
-from uitest.uihelper.common import select_pos
-from uitest.uihelper.common import get_url_for_data_file
-
-# Bug 156783 - crash fix: setting table border on a table without correct 
table cursor
-
-class tdf156783(UITestCase):
-    def test_tdf156783(self):
-        with 
self.ui_test.load_file(get_url_for_data_file("TC-table-del-add.docx")) as 
self.document:
-
-            xToolkit = 
self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit')
-
-            # accept all tracked changes
-            self.xUITest.executeCommand(".uno:AcceptAllTrackedChanges")
-
-            # select all tables
-            self.xUITest.executeCommand(".uno:SelectAll")
-            self.xUITest.executeCommand(".uno:SelectAll")
-            self.xUITest.executeCommand(".uno:SelectAll")
-
-            # dialog Table Properties - Borders
-            with 
self.ui_test.execute_dialog_through_command(".uno:TableDialog", 
close_button="ok") as xDialog:
-                tabcontrol = xDialog.getChild("tabcontrol")
-                select_pos(tabcontrol, "3")
-
-                sync = xDialog.getChild("sync")
-                rightmf = xDialog.getChild("rightmf")
-                leftmf = xDialog.getChild("leftmf")
-                topmf = xDialog.getChild("topmf")
-                bottommf = xDialog.getChild("bottommf")
-                sync.executeAction("CLICK", tuple())
-
-                rightmf.executeAction("TYPE", 
mkPropertyValues({"KEYCODE":"CTRL+A"}))
-                rightmf.executeAction("TYPE", 
mkPropertyValues({"KEYCODE":"BACKSPACE"}))
-                rightmf.executeAction("TYPE", 
mkPropertyValues({"TEXT":"72pt"}))
-                leftmf.executeAction("TYPE", 
mkPropertyValues({"KEYCODE":"CTRL+A"}))
-                leftmf.executeAction("TYPE", 
mkPropertyValues({"KEYCODE":"BACKSPACE"}))
-                leftmf.executeAction("TYPE", mkPropertyValues({"TEXT":"72pt"}))
-                topmf.executeAction("TYPE", 
mkPropertyValues({"KEYCODE":"CTRL+A"}))
-                topmf.executeAction("TYPE", 
mkPropertyValues({"KEYCODE":"BACKSPACE"}))
-                topmf.executeAction("TYPE", mkPropertyValues({"TEXT":"72pt"}))
-                bottommf.executeAction("TYPE", 
mkPropertyValues({"KEYCODE":"CTRL+A"}))
-                bottommf.executeAction("TYPE", 
mkPropertyValues({"KEYCODE":"BACKSPACE"}))
-                bottommf.executeAction("TYPE", 
mkPropertyValues({"TEXT":"72pt"}))
-
-                self.assertEqual(get_state_as_dict(rightmf)["Text"], u"72pt")
-                self.assertEqual(get_state_as_dict(leftmf)["Text"], u"72pt")
-                self.assertEqual(get_state_as_dict(topmf)["Text"], u"72pt")
-                self.assertEqual(get_state_as_dict(bottommf)["Text"], u"72pt")
-
-            # Without the fix in place, this test would have crashed here
-
-# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests7/tdf156784.py 
b/sw/qa/uitest/writer_tests7/tdf156784.py
deleted file mode 100644
index 5cac8fc628db..000000000000
--- a/sw/qa/uitest/writer_tests7/tdf156784.py
+++ /dev/null
@@ -1,38 +0,0 @@
-# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
-#
-# This file is part of the LibreOffice project.
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#
-from uitest.framework import UITestCase
-from uitest.uihelper.common import get_url_for_data_file
-
-# Bug 156784 - crash fix: Select All in section starting table with hidden 
first column
-
-class tdf156784(UITestCase):
-    def test_tdf156784(self):
-        with 
self.ui_test.load_file(get_url_for_data_file("TC-table-del-add.docx")) as 
self.document:
-
-            xToolkit = 
self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit')
-
-            # accept all tracked changes
-            self.xUITest.executeCommand(".uno:AcceptAllTrackedChanges")
-
-            # delete first column
-            self.xUITest.executeCommand(".uno:DeleteColumns")
-
-            # hide changes
-            self.xUITest.executeCommand(".uno:ShowTrackedChanges")
-
-            # select cell content
-            self.xUITest.executeCommand(".uno:SelectAll")
-
-            # This resulted crashing (select section starting table with 
hidden first column)
-            self.xUITest.executeCommand(".uno:SelectAll")
-
-            # show changes
-            self.xUITest.executeCommand(".uno:ShowTrackedChanges")
-
-# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests7/tdf156900.py 
b/sw/qa/uitest/writer_tests7/tdf156900.py
deleted file mode 100644
index 545be94242f4..000000000000
--- a/sw/qa/uitest/writer_tests7/tdf156900.py
+++ /dev/null
@@ -1,46 +0,0 @@
-# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
-#
-# This file is part of the LibreOffice project.
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#
-from uitest.framework import UITestCase
-from uitest.uihelper.common import get_url_for_data_file
-
-# Bug 156900 - no row deletion when there is a hidden last column
-
-class tdf156900(UITestCase):
-    def test_tdf156900(self):
-        with 
self.ui_test.load_file(get_url_for_data_file("TC-table-del-add.docx")) as 
self.document:
-
-            xToolkit = 
self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit')
-
-            # accept all tracked changes
-            self.xUITest.executeCommand(".uno:AcceptAllTrackedChanges")
-
-            # delete last column
-            self.xUITest.executeCommand(".uno:GoRight")
-            self.xUITest.executeCommand(".uno:GoRight")
-            self.xUITest.executeCommand(".uno:GoRight")
-            self.xUITest.executeCommand(".uno:GoRight")
-            self.xUITest.executeCommand(".uno:DeleteColumns")
-
-            # hide changes
-            self.xUITest.executeCommand(".uno:ShowTrackedChanges")
-
-            # delete first row
-            self.xUITest.executeCommand(".uno:DeleteRows")
-
-            # accept all changes
-            self.xUITest.executeCommand(".uno:AcceptAllTrackedChanges")
-
-            tables = self.document.getTextTables()
-            # This was 3 (not deleted row)
-            self.assertEqual(len(tables[0].getRows()), 2)
-
-            # show changes
-            self.xUITest.executeCommand(".uno:ShowTrackedChanges")
-
-# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests7/tdf46561.py 
b/sw/qa/uitest/writer_tests7/tdf46561.py
deleted file mode 100644
index 575053a4f2af..000000000000
--- a/sw/qa/uitest/writer_tests7/tdf46561.py
+++ /dev/null
@@ -1,97 +0,0 @@
-# -*- 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
-from uitest.uihelper.common import type_text
-from uitest.uihelper.common import get_url_for_data_file
-
-class tdf46561(UITestCase):
-    def check_header_texts(self, master="", first="", left="", right=""):
-        # Get the current header style and its text contents
-        xPageStyle = self.document.getStyleFamilies().getByIndex(2)
-        xHeaderText = xPageStyle.getByIndex(0).HeaderText.String
-        xHeaderTextFirst = xPageStyle.getByIndex(0).HeaderTextFirst.String
-        xHeaderTextLeft = xPageStyle.getByIndex(0).HeaderTextLeft.String
-        xHeaderTextRight = xPageStyle.getByIndex(0).HeaderTextRight.String
-
-        # Check the current values
-        self.assertEqual(master, xHeaderText)
-        self.assertEqual(first, xHeaderTextFirst)
-        self.assertEqual(left, xHeaderTextLeft)
-        self.assertEqual(right, xHeaderTextRight)
-
-    def test_tdf46561(self):
-        with self.ui_test.load_file(get_url_for_data_file("tdf46561.odt")):
-            self.document = self.ui_test.get_component()
-            self.check_header_texts(master="right", first="1st", left="left", 
right="right")
-
-            xWriterDoc = self.xUITest.getTopFocusWindow()
-            xWriterEdit = xWriterDoc.getChild("writer_edit")
-            xWriterEdit.executeAction("GOTO", mkPropertyValues({"PAGE": "2"}))
-            self.xUITest.executeCommand(".uno:JumpToHeader")
-
-            # Switch "same left and right page headers" on and off a few times
-            for _ in range(4):
-                with 
self.ui_test.execute_dialog_through_command(".uno:PageDialog") as PageDialog:
-
-                    xTabs = PageDialog.getChild("tabcontrol")
-                    select_pos(xTabs, "4")
-
-                    Button = xTabs.getChild('checkSameLR')
-                    Button.executeAction("CLICK",tuple())
-
-            # We should be back to the starting state after 2*k on/off changes
-            self.check_header_texts(master="right", first="1st", left="left", 
right="right")
-
-            # Enter some additional text in the left page header
-            type_text(xWriterEdit, "XXXX")
-            self.check_header_texts(master="right", first="1st", 
left="XXXXleft", right="right")
-
-            # Now go back one change (before entering "XXXX")
-            self.xUITest.executeCommand(".uno:Undo")
-            self.check_header_texts(master="right", first="1st", left="left", 
right="right")
-
-            # Undo the fourth change
-            self.xUITest.executeCommand(".uno:Undo")
-            self.check_header_texts(master="right", first="1st", left="right", 
right="right")
-
-            # Undo the third change
-            self.xUITest.executeCommand(".uno:Undo")
-            self.check_header_texts(master="right", first="1st", left="left", 
right="right")
-
-            # Undo the second change
-            self.xUITest.executeCommand(".uno:Undo")
-            self.check_header_texts(master="right", first="1st", left="right", 
right="right")
-
-            # Undo the first change
-            self.xUITest.executeCommand(".uno:Undo")
-            self.check_header_texts(master="right", first="1st", left="left", 
right="right")
-
-            # Redo the first change
-            self.xUITest.executeCommand(".uno:Redo")
-            self.check_header_texts(master="right", first="1st", left="right", 
right="right")
-
-            # Redo the second change
-            self.xUITest.executeCommand(".uno:Redo")
-            self.check_header_texts(master="right", first="1st", left="left", 
right="right")
-
-            # Redo the third change
-            self.xUITest.executeCommand(".uno:Redo")
-            self.check_header_texts(master="right", first="1st", left="right", 
right="right")
-
-            # Redo the fourth change
-            self.xUITest.executeCommand(".uno:Redo")
-            self.check_header_texts(master="right", first="1st", left="left", 
right="right")
-
-            # Redo the final change
-            self.xUITest.executeCommand(".uno:Redo")
-            self.check_header_texts(master="right", first="1st", 
left="XXXXleft", right="right")
-
-# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests7/tdf90401.py 
b/sw/qa/uitest/writer_tests7/tdf90401.py
deleted file mode 100644
index 95cc966e1dc7..000000000000
--- a/sw/qa/uitest/writer_tests7/tdf90401.py
+++ /dev/null
@@ -1,139 +0,0 @@
-# -*- 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 type_text
-from uitest.uihelper.common import get_state_as_dict
-from uitest.uihelper.common import get_url_for_data_file
-from libreoffice.uno.propertyvalue import mkPropertyValues
-from org.libreoffice.unotest import systemPathToFileUrl
-from tempfile import TemporaryDirectory
-import os.path
-#Bug 90401 - remove personal info on redlines and annotations
-
-class tdf90401(UITestCase):
-
-    def change_security_option(self, enabled):
-        with 
self.ui_test.execute_dialog_through_command('.uno:OptionsTreeDialog') as 
xDialog:
-            xPages = xDialog.getChild('pages')
-            xGenEntry = xPages.getChild('0')
-            xSecurityPage = xGenEntry.getChild('6')
-            xSecurityPage.executeAction('SELECT', tuple())
-            # Click Button Options...
-            xOptions = xDialog.getChild('options')
-
-            with self.ui_test.execute_blocking_action(xOptions.executeAction, 
args=('CLICK', ()), close_button="") as dialog:
-                xRemovePersonal = dialog.getChild('removepersonal')
-                if get_state_as_dict(xRemovePersonal)['Selected'] != enabled:
-                    xRemovePersonal.executeAction('CLICK', tuple())
-                self.ui_test.wait_until_property_is_updated(xRemovePersonal, 
"Selected", enabled)
-                
self.assertEqual(get_state_as_dict(xRemovePersonal)["Selected"], enabled)
-
-                xOkBtn = dialog.getChild('ok')
-                # FIXME: we can't use close_dialog_through_button here, the 
dialog doesn't emit the
-                # event DialogClosed after closing
-                xOkBtn.executeAction('CLICK', tuple())
-
-    def test_tdf90401_remove_personal_info(self):
-        # load a test document with a tracked change, and add a comment
-
-        with TemporaryDirectory() as tempdir:
-            try:
-                self.change_security_option("true")
-
-                xFilePath = os.path.join(tempdir, 'tdf90401-tmp.fodt')
-
-                with 
self.ui_test.load_file(get_url_for_data_file('redline-autocorrect.fodt')):
-                    self.xUITest.executeCommand('.uno:SelectAll')
-                    self.xUITest.executeCommand('.uno:InsertAnnotation')
-
-                    # Save Copy as
-                    with 
self.ui_test.execute_dialog_through_command('.uno:SaveAs', close_button="open") 
as xDialog:
-                        xFileName = xDialog.getChild('file_name')
-                        xFileName.executeAction('TYPE', 
mkPropertyValues({'KEYCODE':'CTRL+A'}))
-                        xFileName.executeAction('TYPE', 
mkPropertyValues({'KEYCODE':'BACKSPACE'}))
-                        xFileName.executeAction('TYPE', 
mkPropertyValues({'TEXT': xFilePath}))
-
-                with self.ui_test.load_file(systemPathToFileUrl(xFilePath)) as 
writer_doc2:
-
-                    # check removed personal info on comments
-
-                    textfields = writer_doc2.getTextFields()
-                    author = ""
-                    year = -1
-                    for textfield in textfields:
-                        if 
textfield.supportsService("com.sun.star.text.TextField.Annotation"):
-                            author = textfield.Author
-                            year = textfield.Date.Year
-                    # This was 'Unknown Author'
-                    self.assertEqual(author, 'Author2')
-                    # This was 2021
-                    self.assertEqual(year, 0)
-
-                    # check removed personal info on tracked changes
-                    with 
self.ui_test.execute_modeless_dialog_through_command('.uno:AcceptTrackedChanges',
 close_button="close") as xTrackDlg:
-                        xTreeList = xTrackDlg.getChild('writerchanges')
-                        state = get_state_as_dict(xTreeList)
-                        # This was 'NL 11/03/2020 19:19:05     ', containing 
personal info
-                        self.assertEqual(state['SelectEntryText'], 'Author1    
01/01/1970 00:00:00     ')
-            finally:
-                self.change_security_option("false")
-
-    def test_tdf142902_remove_personal_info_in_DOCX(self):
-        # load a test document with a tracked change, and add a comment
-        with TemporaryDirectory() as tempdir:
-            try:
-                self.change_security_option("true")
-
-                xFilePath = os.path.join(tempdir, 'redline-para-join-tmp.docx')
-
-                with 
self.ui_test.load_file(get_url_for_data_file('redline-para-join.docx')):
-
-                    self.xUITest.executeCommand('.uno:SelectAll')
-                    self.xUITest.executeCommand('.uno:InsertAnnotation')
-
-                    # Save Copy as
-                    with 
self.ui_test.execute_dialog_through_command('.uno:SaveAs', close_button="") as 
xDialog:
-                        xFileName = xDialog.getChild('file_name')
-                        xFileName.executeAction('TYPE', 
mkPropertyValues({'KEYCODE':'CTRL+A'}))
-                        xFileName.executeAction('TYPE', 
mkPropertyValues({'KEYCODE':'BACKSPACE'}))
-                        xFileName.executeAction('TYPE', 
mkPropertyValues({'TEXT': xFilePath}))
-
-                        xOpen = xDialog.getChild("open")
-                        # DOCX confirmation dialog is displayed
-                        with self.ui_test.execute_dialog_through_action(xOpen, 
"CLICK", close_button="save"):
-                            pass
-
-                with self.ui_test.load_file(systemPathToFileUrl(xFilePath)) as 
writer_doc2:
-
-                    # check removed personal info on comments
-
-                    textfields = writer_doc2.getTextFields()
-                    author = ""
-                    year = -1
-                    for textfield in textfields:
-                        if 
textfield.supportsService("com.sun.star.text.TextField.Annotation"):
-                            author = textfield.Author
-                            year = textfield.Date.Year
-                    # This was 'Unknown Author'
-                    self.assertEqual(author, 'Author2')
-                    # This was 2021
-                    self.assertEqual(year, 0)
-
-                    # check removed personal info on tracked changes
-
-                    with 
self.ui_test.execute_modeless_dialog_through_command('.uno:AcceptTrackedChanges',
 close_button="close") as xTrackDlg:
-                        xTreeList = xTrackDlg.getChild('writerchanges')
-                        state = get_state_as_dict(xTreeList)
-                        # This was 'NL 11/03/2020 19:19:05     ', containing 
personal info
-                        self.assertEqual(state['SelectEntryText'], 'Author1    
01/01/1970 00:00:00     ')
-            finally:
-                self.change_security_option("false")
-
-# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sw/qa/uitest/writer_tests8/tdf159102.py 
b/sw/qa/uitest/writer_tests8/tdf159102.py
deleted file mode 100644
index b8cf82cd6547..000000000000
--- a/sw/qa/uitest/writer_tests8/tdf159102.py
+++ /dev/null
@@ -1,97 +0,0 @@
-# -*- 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 libreoffice.uno.propertyvalue import mkPropertyValues
-from libreoffice.linguistic.linguservice import get_lingu_service_manager
-from com.sun.star.lang import Locale
-
-# handle tdf#119908 smart justify with automatic hyphenation
-
-class tdf159102(UITestCase):
-    def is_supported_locale(self, language, country):
-        xLinguServiceManager = 
get_lingu_service_manager(self.ui_test._xContext)
-        xHyphenator = xLinguServiceManager.getHyphenator()
-        locales = xHyphenator.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
-
-    def set_custom_hyphenation(self):
-        with 
self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") as 
xDialog:
-
-            xPages = xDialog.getChild("pages")
-            xLanguageEntry = xPages.getChild('2')                 # Language 
Settings
-            xLanguageEntry.executeAction("EXPAND", tuple())
-            xxLanguageEntryWritingAidsEntry = xLanguageEntry.getChild('1')
-            xxLanguageEntryWritingAidsEntry.executeAction("SELECT", tuple())   
       # Writing Aids
-
-            # add hyphenation "cur=sus" and "ege=stas" to the custom dictionary
-            # to solve the non-accessible hyphenation patterns for the test
-
-            # Select an editable dictionary (list of Ignored words)
-            dictionaries = xDialog.getChild("lingudicts")
-            hasEditableDictionary = False
-            for i in dictionaries.getChildren():
-                entry = dictionaries.getChild(i)
-                entry_label = get_state_as_dict(entry)["Text"]
-                if entry_label == "List of Ignored Words [All]":
-                    hasEditableDictionary = True
-                    entry.executeAction("SELECT", tuple())          # an 
editable user dictionary
-                    break
-
-            self.assertEqual(True, hasEditableDictionary)
-
-            # open Edit dialog window
-            edit = xDialog.getChild("lingudictsedit")
-            with self.ui_test.execute_blocking_action(edit.executeAction, 
args=('CLICK', ()), close_button="close") as xEdit:
-                # write cur=sus into the input box
-                inputbox = xEdit.getChild("word")
-                inputbox.executeAction("TYPE", mkPropertyValues({"TEXT": 
"cur=sus"}))
-                add = xEdit.getChild("newreplace")
-                add.executeAction("CLICK", tuple())
-                inputbox.executeAction("TYPE", mkPropertyValues({"TEXT": 
"ege=stas"}))
-                add.executeAction("CLICK", tuple())
-
-    def test_tdf159102_smart_justify_with_automatic_hyphenation(self):
-        supported_locale = self.is_supported_locale("en", "US")
-        if not supported_locale:
-            self.skipTest("no hyphenation patterns for en_US available")
-
-        xToolkit = 
self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit')
-        with self.ui_test.load_file(get_url_for_data_file("tdf159102.fodt")) 
as writer_doc:
-            # we must not depend on the installed hyphenation patterns,
-            # so extend user dictionary temporarily with the hyphenation 
cur=sus and ege=stas
-            self.set_custom_hyphenation()
-            xToolkit.processEventsToIdle()
-            # delete the text of the first line
-            self.xUITest.executeCommand(".uno:GoToEndOfLine")
-            self.xUITest.executeCommand('.uno:StartOfDocumentSel')
-            self.xUITest.executeCommand('.uno:Delete')
-            paragraphs = writer_doc.Text.createEnumeration()
-            para1 = paragraphs.nextElement()
-            # This was "stas.", i.e. too much shrinking
-            self.assertEqual(" cursus egestas.", para1.String)
-
-            # check next paragraph (containing different text portions)
-            self.xUITest.executeCommand(".uno:GoDown")
-            self.xUITest.executeCommand(".uno:GoToEndOfLine")
-            self.xUITest.executeCommand('.uno:StartOfDocumentSel')
-            self.xUITest.executeCommand('.uno:Delete')
-            paragraphs = writer_doc.Text.createEnumeration()
-            para1 = paragraphs.nextElement()
-            self.assertEqual(" cursus egestas.", para1.String)

Reply via email to