diff options
author | Matt K <mattkse@gmail.com> | 2023-11-23 21:47:34 -0600 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2023-11-25 12:41:49 +0100 |
commit | b6e273aaaf597b60f78c1dd3db8676eea958a9f5 (patch) | |
tree | a072da464e72d969865e7d26658dd9bdac938110 /sw/qa/uitest/writer_tests8 | |
parent | 8b50a615cbf6c09ed9cf6af6336e388cd32db28e (diff) |
tdf#156243 Fix off-by-one bug for autocorrect
This change removes the "-1" from the code
that applies the autocorrection so that the entire
string to be autocorrected is replaced, instead
of leaving off the last character. Also,
the starting character of the string is
preserved (i.e. non-bold if changing to bold)
by adding 1 to the start position; this is
for the case when the user cancels the
autocorrect dialog.
Change-Id: Ibe500a1ba0ca5b12ec9c918b51353074b8dd12ec
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154685
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sw/qa/uitest/writer_tests8')
-rw-r--r-- | sw/qa/uitest/writer_tests8/tdf156243.py | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/sw/qa/uitest/writer_tests8/tdf156243.py b/sw/qa/uitest/writer_tests8/tdf156243.py new file mode 100644 index 000000000000..fc4eecffdb7c --- /dev/null +++ b/sw/qa/uitest/writer_tests8/tdf156243.py @@ -0,0 +1,39 @@ +# -*- 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 +from uitest.uihelper.common import type_text +from libreoffice.uno.propertyvalue import mkPropertyValues + +class tdf156243(UITestCase): + + def test_tdf156243_Autocorrect_dialog(self): + with self.ui_test.create_doc_in_start_center("writer") as document: + xWriterDoc = self.xUITest.getTopFocusWindow() + xWriterEdit = xWriterDoc.getChild("writer_edit") + type_text(xWriterEdit, "*ab*") + with self.ui_test.execute_dialog_through_command(".uno:AutoFormatRedlineApply", close_button="close") as xAutoFmt: + xAcceptAll = xAutoFmt.getChild("acceptall") + xAcceptAll.executeAction("CLICK", tuple()) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"SHIFT+LEFT"})) + with self.ui_test.execute_dialog_through_command(".uno:FontDialog", close_button="cancel") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + xweststylelbcjk = xDialog.getChild("cbWestStyle") + self.assertEqual(get_state_as_dict(xweststylelbcjk)["Text"], "Bold") + self.xUITest.executeCommand(".uno:GoLeft") + with self.ui_test.execute_dialog_through_command(".uno:FontDialog", close_button="cancel") as xDialog: + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "0") + xweststylelbcjk = xDialog.getChild("cbWestStyle") + self.assertEqual(get_state_as_dict(xweststylelbcjk)["Text"], "Bold") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: |