diff options
-rw-r--r-- | editeng/source/misc/swafopt.cxx | 2 | ||||
-rw-r--r-- | officecfg/registry/schema/org/openoffice/Office/Writer.xcs | 2 | ||||
-rw-r--r-- | sw/qa/uitest/data/tdf156165.odt | bin | 0 -> 10462 bytes | |||
-rw-r--r-- | sw/qa/uitest/writer_tests/tdf156165.py | 80 |
4 files changed, 82 insertions, 2 deletions
diff --git a/editeng/source/misc/swafopt.cxx b/editeng/source/misc/swafopt.cxx index f6de4098d2e4..f5f79a45be97 100644 --- a/editeng/source/misc/swafopt.cxx +++ b/editeng/source/misc/swafopt.cxx @@ -27,7 +27,6 @@ SvxSwAutoFormatFlags::SvxSwAutoFormatFlags() bAutoCorrect = bCapitalStartSentence = bCapitalStartWord = - bChgUserColl = bChgEnumNum = bAddNonBrkSpace = bChgOrdinalNumber = @@ -42,6 +41,7 @@ SvxSwAutoFormatFlags::SvxSwAutoFormatFlags() bAFormatByInpDelSpacesAtSttEnd = bAFormatByInpDelSpacesBetweenLines = true; + bChgUserColl = bReplaceStyles = bDelEmptyNode = bWithRedlining = diff --git a/officecfg/registry/schema/org/openoffice/Office/Writer.xcs b/officecfg/registry/schema/org/openoffice/Office/Writer.xcs index 5ac39808f1d0..ad2f1497a561 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Writer.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Writer.xcs @@ -4235,7 +4235,7 @@ <desc>Specifies whether user-defined styles applied in the document are replaced by predefined text document styles.</desc> <label>Replace user-defined styles</label> </info> - <value>true</value> + <value>false</value> </prop> <prop oor:name="CombineParagraphs" oor:type="xs:boolean" oor:nillable="false"> <!-- UIHints: Tools AutoCorrect/AutoFormat Options Combine single line paragraphs if length greater --> diff --git a/sw/qa/uitest/data/tdf156165.odt b/sw/qa/uitest/data/tdf156165.odt Binary files differnew file mode 100644 index 000000000000..aabcfef91499 --- /dev/null +++ b/sw/qa/uitest/data/tdf156165.odt diff --git a/sw/qa/uitest/writer_tests/tdf156165.py b/sw/qa/uitest/writer_tests/tdf156165.py new file mode 100644 index 000000000000..69d1928bb8ce --- /dev/null +++ b/sw/qa/uitest/writer_tests/tdf156165.py @@ -0,0 +1,80 @@ +# -*- 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_pos +from libreoffice.uno.propertyvalue import mkPropertyValues +from time import sleep + +class tdf156165(UITestCase): + + def test_tdf156165(self): + with self.ui_test.load_file(get_url_for_data_file("tdf156165.odt")): + xMainWindow = self.xUITest.getTopFocusWindow() + writer_edit = xMainWindow.getChild("writer_edit") + style=xMainWindow.getChild('applystyle') + + with self.ui_test.execute_dialog_through_command(".uno:AutoCorrectDlg") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "2") + options=xDialog.getChild('list') + checkbox=options.getChild("16") + self.assertEqual("Replace Custom Styles", get_state_as_dict(checkbox)["Text"]) + + # Replace Custom Styles is default to be false + self.assertEqual("false", get_state_as_dict(checkbox)["IsChecked"]) + + # Replace Custom Styles when applying manully with it disabled, should not change style + writer_edit.executeAction("SELECT", mkPropertyValues({"END_POS": "0", "START_POS": "12"})) + self.xUITest.executeCommand(".uno:AutoFormatApply") + sleep(1) + self.assertEqual(get_state_as_dict(style)["Text"], "eSelah") + + # Replace Custom Styles when typing with it disabled, should not change style + writer_edit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + writer_edit.executeAction("SELECT", mkPropertyValues({"END_POS": "12", "START_POS": "12"})) + writer_edit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + sleep(1) + self.assertEqual(get_state_as_dict(style)["Text"], "eSelah") # new line + writer_edit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + writer_edit.executeAction("SELECT", mkPropertyValues({"END_POS": "0", "START_POS": "12"})) + self.assertEqual(get_state_as_dict(style)["Text"], "eSelah") # original line + + with self.ui_test.execute_dialog_through_command(".uno:AutoCorrectDlg") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "2") + options=xDialog.getChild('list') + checkbox=options.getChild("16") + self.assertEqual("Replace Custom Styles", get_state_as_dict(checkbox)["Text"]) + + # set Replace Custom Styles to True + checkbox.executeAction("CLICK", tuple()) + self.assertEqual("true", get_state_as_dict(checkbox)["IsChecked"]) + + # Replace Custom Styles when applying manully with it enabled, should change style + writer_edit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + writer_edit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + writer_edit.executeAction("SELECT", mkPropertyValues({"END_POS": "0", "START_POS": "12"})) + self.xUITest.executeCommand(".uno:AutoFormatApply") + sleep(1) + self.assertEqual(get_state_as_dict(style)["Text"], "Body Text") + + # Replace Custom Styles when typing with it enabled, should not change style + writer_edit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + writer_edit.executeAction("SELECT", mkPropertyValues({"END_POS": "12", "START_POS": "12"})) + writer_edit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + sleep(1) + self.assertEqual(get_state_as_dict(style)["Text"], "eSelah") # new line + writer_edit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + writer_edit.executeAction("SELECT", mkPropertyValues({"END_POS": "0", "START_POS": "12"})) + self.assertEqual(get_state_as_dict(style)["Text"], "eSelah") # original line + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: |