diff options
author | Hossein <hossein@libreoffice.org> | 2022-08-24 23:03:09 +0200 |
---|---|---|
committer | Hossein <hossein@libreoffice.org> | 2022-08-27 00:53:55 +0200 |
commit | d05c176cc022f1b771f7c064f6ce74e9f8c27a1b (patch) | |
tree | 2ce277326b80778d76b31e4bbf55f7590a93c25b /sw/qa | |
parent | 903b8f8524b8c84eced3ccbf7cfec9c5b9015f4b (diff) |
tdf#150457 Fix crash on hovering removed footnote reference
The regression was caused by 402f36efb215338ad545caa65d39fb8a39685ea1.
Before that, 0aa0fda64057647219954480ac1bab86b0f0e433 changed the cursor
jumping behavior to fix tdf#81226. The goal was to make LibreOffice
behave as described in the description of the issue:
"When your cursor is on the last line but not at the end of it, simply
press the down arrow to go at the end of the file (end of that line)."
The same behavior was achieved for pressing down on the last line.
The above patches allowed removing the footnotes and their numbers
(except the first number) while the reference were still present. Then,
on hovering a removed footnote reference, a crash was happening. It
should be noted that even with this patch, removing the first reference
number was not possible.
This fix limits this behavior to anywhere other than inside a footnote.
In this way, it prevents crashing.
With this fix, the behavior of the cursor goes back to what it was
before 0aa0fda64057647219954480ac1bab86b0f0e433. The user will not be
able to select all the footnotes at once. Also, removing footnote number
will not be possible.
It is worth noting that not being able to select all the footnotes at
once prevents the user from changing the characteristics of the
footnotes all at the same time. Also, not being able to remove the
footnote numbers, prevents the user from having footnotes with custom
numbers written manually. Both of these actions are possible in MS Word.
The other difference is that by going up, one can go out of the footnote
section in MS Word, but this is not the case for LibreOffice.
A UI test is added to make sure the crash will not happen again. The
test can be run by:
cd sw && make -srj1 UITest_writer_tests2 \
UITEST_TEST_NAME="deleteFootnotes.tdf150457.test_delete_footnotes" \
SAL_USE_VCLPLUGIN=gen
Change-Id: I1ce7d2189355f6763b6f31219e00516ff7a8164e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138562
Tested-by: Jenkins
Reviewed-by: Hossein <hossein@libreoffice.org>
Diffstat (limited to 'sw/qa')
-rw-r--r-- | sw/qa/uitest/writer_tests2/deleteFootnotes.py | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/sw/qa/uitest/writer_tests2/deleteFootnotes.py b/sw/qa/uitest/writer_tests2/deleteFootnotes.py new file mode 100644 index 000000000000..162cc7d3e1b2 --- /dev/null +++ b/sw/qa/uitest/writer_tests2/deleteFootnotes.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 uitest.uihelper.common import type_text +from libreoffice.uno.propertyvalue import mkPropertyValues +import time + + +class tdf150457(UITestCase): + + def test_delete_footnotes(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, "a") + self.xUITest.executeCommand(".uno:InsertFootnote") + type_text(xWriterEdit, "abc") + self.assertEqual(document.Footnotes[0].String, "abc") + self.assertEqual(document.Footnotes.getCount(), 1) + + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "PAGEUP"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"})) + type_text(xWriterEdit, "d") + + self.xUITest.executeCommand(".uno:InsertFootnote") + type_text(xWriterEdit, "def") + self.assertEqual(document.Footnotes[1].String, "def") + self.assertEqual(document.Footnotes.getCount(), 2) + + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "HOME"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "SHIFT+DOWN"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DELETE"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "PAGEUP"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "CTRL+A"})) + xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DELETE"})) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: |