summaryrefslogtreecommitdiffstats
path: root/sw/qa/uitest
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 09:27:54 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 09:27:54 +0000
commitadb203bc05e3e36173cbd46b9951f79821a81799 (patch)
tree6e6739df9b3f0a567330a0dd7ee0e03ae70876a3 /sw/qa/uitest
parentAdding debian version 4:24.2.0-3. (diff)
downloadlibreoffice-adb203bc05e3e36173cbd46b9951f79821a81799.tar.xz
libreoffice-adb203bc05e3e36173cbd46b9951f79821a81799.zip
Merging upstream version 4:24.2.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sw/qa/uitest')
-rw-r--r--sw/qa/uitest/data/tdf106733.fodt66
-rw-r--r--sw/qa/uitest/data/tdf159102.fodt61
-rw-r--r--sw/qa/uitest/writer_tests8/tdf106733.py112
-rw-r--r--sw/qa/uitest/writer_tests8/tdf159102.py97
4 files changed, 336 insertions, 0 deletions
diff --git a/sw/qa/uitest/data/tdf106733.fodt b/sw/qa/uitest/data/tdf106733.fodt
new file mode 100644
index 0000000000..fa9a024405
--- /dev/null
+++ b/sw/qa/uitest/data/tdf106733.fodt
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<office:document xmlns:css3t="http://www.w3.org/TR/css3-text/" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:rpt="http://openoffice.org/2005/report" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:officeooo="http://openoffice.org/2009/office" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text">
+ <office:font-face-decls>
+ <style:font-face style:name="DejaVu Sans" svg:font-family="&apos;DejaVu Sans&apos;" style:font-family-generic="swiss"/>
+ </office:font-face-decls>
+ <office:styles>
+ <style:default-style style:family="paragraph">
+ <style:paragraph-properties fo:orphans="2" fo:widows="2" fo:hyphenation-ladder-count="no-limit" style:text-autospace="ideograph-alpha" style:punctuation-wrap="hanging" style:line-break="strict" style:tab-stop-distance="35.46pt" style:writing-mode="page"/>
+ <style:text-properties style:use-window-font-color="true" loext:opacity="0%" style:font-name="DejaVu Sans" fo:font-size="12pt" fo:language="hu" fo:country="HU" style:letter-kerning="true" style:font-name-asian="Noto Serif CJK SC" style:font-size-asian="10.5pt" style:language-asian="zh" style:country-asian="CN" style:font-name-complex="Lohit Devanagari1" style:font-size-complex="12pt" style:language-complex="hi" style:country-complex="IN" fo:hyphenate="false" fo:hyphenation-remain-char-count="2" fo:hyphenation-push-char-count="2" loext:hyphenation-no-caps="false" loext:hyphenation-no-last-word="false" loext:hyphenation-word-char-count="5" loext:hyphenation-zone="no-limit"/>
+ </style:default-style>
+ <style:style style:name="Standard" style:family="paragraph" style:class="text"/>
+ <style:style style:name="Text_20_body" style:display-name="Text body" style:family="paragraph" style:parent-style-name="Standard" style:class="text">
+ <style:paragraph-properties fo:margin-top="0pt" fo:margin-bottom="7pt" style:contextual-spacing="false" fo:line-height="115%"/>
+ </style:style>
+ <style:style style:name="Heading_20_3" style:display-name="Heading 3" style:family="paragraph" style:parent-style-name="Heading" style:next-style-name="Text_20_body" style:default-outline-level="3" style:class="text">
+ <style:paragraph-properties fo:margin-top="7pt" fo:margin-bottom="6.01pt" style:contextual-spacing="false"/>
+ <style:text-properties fo:font-size="14pt" fo:font-weight="bold" style:font-size-asian="14pt" style:font-weight-asian="bold" style:font-size-complex="14pt" style:font-weight-complex="bold"/>
+ </style:style>
+ <style:style style:name="Strong_20_Emphasis" style:display-name="Strong Emphasis" style:family="text">
+ <style:text-properties fo:font-weight="bold" fo:hyphenate="false" style:font-weight-asian="bold" style:font-weight-complex="bold"/>
+ </style:style>
+ </office:styles>
+ <office:automatic-styles>
+ <style:style style:name="P1" style:family="paragraph" style:parent-style-name="Text_20_body">
+ <loext:graphic-properties draw:fill="none"/>
+ <style:paragraph-properties fo:margin-left="0pt" fo:margin-right="257.95pt" fo:margin-top="0pt" fo:margin-bottom="7pt" style:contextual-spacing="false" fo:line-height="115%" fo:text-align="justify" style:justify-single-word="false" fo:hyphenation-ladder-count="no-limit" fo:text-indent="0pt" style:auto-text-indent="false" fo:background-color="transparent"/>
+ <style:text-properties fo:language="en" fo:country="US" officeooo:rsid="1d851e57" officeooo:paragraph-rsid="0007570c" style:language-complex="ar" style:country-complex="SA" fo:hyphenate="true" fo:hyphenation-remain-char-count="2" fo:hyphenation-push-char-count="2" loext:hyphenation-no-caps="false" loext:hyphenation-no-last-word="false" loext:hyphenation-word-char-count="no-limit" loext:hyphenation-zone="no-limit"/>
+ </style:style>
+ <style:style style:name="P3" style:family="paragraph" style:parent-style-name="Text_20_body">
+ <loext:graphic-properties draw:fill="none"/>
+ <style:paragraph-properties fo:margin-left="0pt" fo:margin-right="257.95pt" fo:margin-top="0pt" fo:margin-bottom="7pt" style:contextual-spacing="false" fo:line-height="115%" fo:text-align="justify" style:justify-single-word="false" fo:hyphenation-ladder-count="no-limit" fo:text-indent="0pt" style:auto-text-indent="false" fo:background-color="transparent"/>
+ <style:text-properties fo:language="en" fo:country="US" officeooo:paragraph-rsid="0007570c" style:language-complex="ar" style:country-complex="SA" fo:hyphenate="true" fo:hyphenation-remain-char-count="2" fo:hyphenation-push-char-count="2" loext:hyphenation-no-caps="false" loext:hyphenation-no-last-word="false" loext:hyphenation-word-char-count="no-limit" loext:hyphenation-zone="no-limit"/>
+ </style:style>
+ <style:style style:name="P4" style:family="paragraph" style:parent-style-name="Heading_20_3">
+ <style:text-properties officeooo:paragraph-rsid="0007570c"/>
+ </style:style>
+ <style:style style:name="T6" style:family="text">
+ <style:text-properties fo:language="en" fo:country="US" fo:font-style="italic" fo:font-weight="bold" officeooo:rsid="1d851e57" fo:hyphenate="false" style:font-style-asian="italic" style:font-weight-asian="bold" style:language-complex="ar" style:country-complex="SA" style:font-style-complex="italic" style:font-weight-complex="bold"/>
+ </style:style>
+ <style:style style:name="T8" style:family="text">
+ <style:text-properties fo:font-weight="bold" officeooo:rsid="1d851e57" style:font-weight-asian="bold" style:font-weight-complex="bold"/>
+ </style:style>
+ <style:page-layout style:name="pm1">
+ <style:page-layout-properties fo:page-width="595.3pt" fo:page-height="841.89pt" style:num-format="1" style:print-orientation="portrait" fo:margin-top="56.69pt" fo:margin-bottom="56.69pt" fo:margin-left="56.69pt" fo:margin-right="56.69pt" style:writing-mode="lr-tb" style:layout-grid-color="#c0c0c0" style:layout-grid-lines="20" style:layout-grid-base-height="20.01pt" style:layout-grid-ruby-height="10.01pt" style:layout-grid-mode="none" style:layout-grid-ruby-below="false" style:layout-grid-print="false" style:layout-grid-display="false" style:footnote-max-height="0pt" loext:margin-gutter="0pt">
+ <style:footnote-sep style:width="0.51pt" style:distance-before-sep="2.86pt" style:distance-after-sep="2.86pt" style:line-style="solid" style:adjustment="left" style:rel-width="25%" style:color="#000000"/>
+ </style:page-layout-properties>
+ <style:header-style/>
+ <style:footer-style/>
+ </style:page-layout>
+ </office:automatic-styles>
+ <office:master-styles>
+ <style:master-page style:name="Standard" style:page-layout-name="pm1" draw:style-name="dp1"/>
+ </office:master-styles>
+ <office:body>
+ <office:text>
+ <text:h text:style-name="P4" text:outline-level="3">Hyphenate</text:h>
+ <text:p text:style-name="P3">The Earth is no different to any other celestial body out there in space. It merely moves along in space inertially. Even just one inch above the surface of the Earth is space, <text:span text:style-name="T8">except</text:span> that it has an atmosphere.</text:p>
+ <text:h text:style-name="P4" text:outline-level="3">Don’t hyphenate (direct formatting)</text:h>
+ <text:p text:style-name="P3">The Earth is no different to any other celestial body out there in space. It merely moves along in space inertially. Even just one inch above the surface of the Earth is space, <text:span text:style-name="T6">except</text:span> that it has an atmosphere.</text:p>
+ <text:h text:style-name="P4" text:outline-level="3">Don’t hyphenate (character style)</text:h>
+ <text:p text:style-name="P3">The Earth is no different to any other celestial body out there in space. It merely moves along in space inertially. Even just one inch above the surface of the Earth is space, <text:span text:style-name="Strong_20_Emphasis">except</text:span> that it has an atmosphere.</text:p>
+ <text:p text:style-name="P3"/>
+ </office:text>
+ </office:body>
+</office:document>
diff --git a/sw/qa/uitest/data/tdf159102.fodt b/sw/qa/uitest/data/tdf159102.fodt
new file mode 100644
index 0000000000..dfe9fc1887
--- /dev/null
+++ b/sw/qa/uitest/data/tdf159102.fodt
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<office:document xmlns:css3t="http://www.w3.org/TR/css3-text/" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:rpt="http://openoffice.org/2005/report" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:officeooo="http://openoffice.org/2009/office" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.text">
+ <office:settings>
+ <config:config-item-set config:name="ooo:configuration-settings">
+ <config:config-item config:name="JustifyLinesWithShrinking" config:type="boolean">true</config:config-item>
+ <config:config-item config:name="PrinterIndependentLayout" config:type="string">high-resolution</config:config-item>
+ </config:config-item-set>
+ </office:settings>
+ <office:font-face-decls>
+ <style:font-face style:name="Arial" svg:font-family="Arial" style:font-family-generic="swiss"/>
+ <style:font-face style:name="Arial1" svg:font-family="Arial" style:font-family-generic="system" style:font-pitch="variable"/>
+ </office:font-face-decls>
+ <office:styles>
+ <style:default-style style:family="paragraph">
+ <style:paragraph-properties fo:hyphenation-ladder-count="no-limit" style:text-autospace="ideograph-alpha" style:punctuation-wrap="hanging" style:line-break="strict" style:tab-stop-distance="36pt" style:writing-mode="page"/>
+ <style:text-properties style:use-window-font-color="true" loext:opacity="0%" style:font-name="Calibri" fo:font-size="10pt" fo:language="en" fo:country="US" style:letter-kerning="false" style:font-name-asian="MS Mincho" style:font-size-asian="10pt" style:language-asian="en" style:country-asian="US" style:font-name-complex="Calibri1" style:font-size-complex="10pt" style:language-complex="ar" style:country-complex="SA" fo:hyphenate="true" fo:hyphenation-remain-char-count="2" fo:hyphenation-push-char-count="2" loext:hyphenation-no-caps="false" loext:hyphenation-no-last-word="false" loext:hyphenation-word-char-count="5" loext:hyphenation-zone="no-limit"/>
+ </style:default-style>
+ <style:default-style style:family="table">
+ <style:table-properties table:border-model="collapsing"/>
+ </style:default-style>
+ <style:default-style style:family="table-row">
+ <style:table-row-properties fo:keep-together="auto"/>
+ </style:default-style>
+ <style:style style:name="Standard" style:family="paragraph" style:class="text">
+ <style:paragraph-properties fo:margin-top="0pt" fo:margin-bottom="0pt" style:contextual-spacing="false" fo:text-align="start" style:justify-single-word="false" fo:orphans="2" fo:widows="2" style:writing-mode="lr-tb"/>
+ <style:text-properties style:font-name="Arial" fo:font-family="Arial" style:font-family-generic="swiss" fo:font-size="12pt" fo:language="en" fo:country="GB" style:font-name-asian="Times New Roman1" style:font-family-asian="&apos;Times New Roman&apos;" style:font-family-generic-asian="system" style:font-pitch-asian="variable" style:font-size-asian="12pt" style:font-name-complex="Arial1" style:font-family-complex="Arial" style:font-family-generic-complex="system" style:font-pitch-complex="variable" style:font-size-complex="12pt"/>
+ </style:style>
+ </office:styles>
+ <office:automatic-styles>
+ <style:style style:name="P1" style:family="paragraph" style:parent-style-name="Standard">
+ <style:paragraph-properties fo:text-align="justify" style:justify-single-word="false"/>
+ <style:text-properties officeooo:paragraph-rsid="0018cb95"/>
+ </style:style>
+ <style:style style:name="T1" style:family="text">
+ <style:text-properties fo:font-size="10pt" fo:language="es" fo:country="ES" style:font-size-asian="10pt" style:font-size-complex="10pt"/>
+ </style:style>
+ <style:style style:name="T2" style:family="text">
+ <style:text-properties fo:font-size="10pt" fo:language="es" fo:country="ES" officeooo:rsid="001a9d3d" style:font-size-asian="10pt" style:font-size-complex="10pt"/>
+ </style:style>
+ <style:style style:name="T3" style:family="text">
+ <style:text-properties fo:font-size="10pt" style:font-size-asian="10pt" style:font-size-complex="10pt"/>
+ </style:style>
+ <style:page-layout style:name="pm1">
+ <style:page-layout-properties fo:page-width="419.56pt" fo:page-height="595.3pt" style:num-format="1" style:print-orientation="portrait" fo:margin-top="21.6pt" fo:margin-bottom="14.4pt" fo:margin-left="36pt" fo:margin-right="36pt" style:writing-mode="lr-tb" style:layout-grid-color="#c0c0c0" style:layout-grid-lines="31" style:layout-grid-base-height="18pt" style:layout-grid-ruby-height="0pt" style:layout-grid-mode="none" style:layout-grid-ruby-below="false" style:layout-grid-print="false" style:layout-grid-display="false" style:layout-grid-base-width="10.46pt" style:layout-grid-snap-to="true" style:footnote-max-height="0pt" loext:margin-gutter="0pt">
+ <style:footnote-sep style:width="0.51pt" style:distance-before-sep="2.86pt" style:distance-after-sep="2.86pt" style:line-style="solid" style:adjustment="left" style:rel-width="25%" style:color="#000000"/>
+ </style:page-layout-properties>
+ <style:header-style/>
+ <style:footer-style/>
+ </style:page-layout>
+ </office:automatic-styles>
+ <office:master-styles>
+ <style:master-page style:name="Standard" style:page-layout-name="pm1" draw:style-name="dp1"/>
+ </office:master-styles>
+ <office:body>
+ <office:text>
+ <text:p text:style-name="P1" loext:marker-style-name="T3"><text:span text:style-name="T1">venenatis, quis commodo dolor posuere. Curabitur dignissim sapien quis cursus egestas.</text:span></text:p>
+ <text:p text:style-name="P1" loext:marker-style-name="T3"><text:span text:style-name="T1">venenatis, quis commodo dolor posuere. Curabitur dignissim sapien quis cur</text:span><text:span text:style-name="T1">sus egestas.</text:span></text:p>
+ </office:text>
+ </office:body>
+</office:document>
diff --git a/sw/qa/uitest/writer_tests8/tdf106733.py b/sw/qa/uitest/writer_tests8/tdf106733.py
new file mode 100644
index 0000000000..201bba1c56
--- /dev/null
+++ b/sw/qa/uitest/writer_tests8/tdf106733.py
@@ -0,0 +1,112 @@
+# -*- 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#106733 hyphenation of words disabled by character formatting
+
+class tdf106733(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 hyphenations 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:
+ # add in=ertially and ex=cept to the custom hyphenations
+ inputbox = xEdit.getChild("word")
+ inputbox.executeAction("TYPE", mkPropertyValues({"TEXT": "ex=cept"}))
+ add = xEdit.getChild("newreplace")
+ add.executeAction("CLICK", tuple())
+ inputbox.executeAction("TYPE", mkPropertyValues({"TEXT": "in=ertially"}))
+ add.executeAction("CLICK", tuple())
+
+ def test_tdf106733_disable_hyphenation(self):
+ supported_locale = self.is_supported_locale("en", "US")
+ if not supported_locale:
+ self.skipTest("no hyphenation patterns for en_US available")
+
+ with self.ui_test.load_file(get_url_for_data_file("tdf106733.fodt")) as writer_doc:
+ # we must not depend on the installed hyphenation patterns,
+ # so extend user dictionary temporarily with the requested hyphenations
+ self.set_custom_hyphenation()
+
+ # delete the text of the first line
+ for i in range(5):
+ 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()
+ # check default "ex=cept" hyphenation
+ self.assertEqual(True, para1.String.startswith("cept"))
+
+ # check disabled hyphenations (by direct character formatting)
+ for i in range(6):
+ 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()
+ # This was False (the line started with "cept", because of the enabled hyphenation)
+ self.assertEqual(True, para1.String.startswith(" except"))
+
+ # check disabled hyphenations (by character style)
+ for i in range(6):
+ 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()
+ # This was False (the line started with "cept", because of the enabled hyphenation)
+ self.assertEqual(True, para1.String.startswith(" except"))
+
diff --git a/sw/qa/uitest/writer_tests8/tdf159102.py b/sw/qa/uitest/writer_tests8/tdf159102.py
new file mode 100644
index 0000000000..b1daffabfe
--- /dev/null
+++ b/sw/qa/uitest/writer_tests8/tdf159102.py
@@ -0,0 +1,97 @@
+# -*- 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("sus 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("sus egestas.", para1.String)