tdf#157992: add test to make sure footnotes don't get deleted

This tests calls the SpellDialog with a paragraph containing a
footnote. Prior to the fix of tdf#157992 the footnote had been deleted
when the spelling error has been manually fixed.

Change-Id: Ib57d49d8fad153c96daa1b1f6554abebd272a7f2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163351
Tested-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
diff --git a/sw/qa/uitest/data/tdf157992.odt b/sw/qa/uitest/data/tdf157992.odt
new file mode 100755
index 0000000..4a26682
--- /dev/null
+++ b/sw/qa/uitest/data/tdf157992.odt
Binary files differ
diff --git a/sw/qa/uitest/writer_tests4/spellDialog.py b/sw/qa/uitest/writer_tests4/spellDialog.py
index 5fbffe9..801141b 100644
--- a/sw/qa/uitest/writer_tests4/spellDialog.py
+++ b/sw/qa/uitest/writer_tests4/spellDialog.py
@@ -13,6 +13,7 @@ from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
from uitest.uihelper.common import type_text

from libreoffice.linguistic.linguservice import get_spellchecker
from libreoffice.uno.propertyvalue import mkPropertyValues
from com.sun.star.lang import Locale

class SpellingAndGrammarDialog(UITestCase):
@@ -181,4 +182,23 @@ frog, dogg, catt"""
            # This was False (lost comment)
            self.assertEqual(True, has_comment)

    def test_tdf157992(self):
        supported_locale = self.is_supported_locale("en", "US")
        if not supported_locale:
            self.skipTest("no dictionary support for en_US available")

        with self.ui_test.load_file(get_url_for_data_file("tdf157992.odt")) as document:
            with self.ui_test.execute_modeless_dialog_through_command(".uno:SpellingAndGrammarDialog", close_button="") as xDialog:
                sentence = xDialog.getChild('sentence')
                sentence.executeAction('TYPE', mkPropertyValues({'KEYCODE':'KEY_RIGHT'}))
                sentence.executeAction('TYPE', mkPropertyValues({'KEYCODE':'DELETE'}))
                sentence.executeAction('TYPE', mkPropertyValues({'KEYCODE':'DELETE'}))
                sentence.executeAction('TYPE', mkPropertyValues({'TEXT':'oo'}))
                change = xDialog.getChild('change')
                with self.ui_test.execute_blocking_action(
                        change.executeAction, args=('CLICK', ()), close_button="ok"):
                    footnotes = document.getFootnotes()
                    self.assertTrue(len(footnotes) == 1)


# vim: set shiftwidth=4 softtabstop=4 expandtab: