merge duplicate part of branches
[LibreOffice.git] / sw / qa / uitest / writer_tests5 / tdf123446.py
blob53f8208f83340d8b562e331121c4340d2bb03e96
1 # -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
3 # This file is part of the LibreOffice project.
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 from uitest.framework import UITestCase
11 from uitest.uihelper.common import type_text
12 #Bug 123446 - Writer crashes after undoing + redoing ToC insertion in middle of word
14 class tdf123446(UITestCase):
16 def test_tdf123446_undo_redo_ToC_crash(self):
17 with self.ui_test.create_doc_in_start_center("writer") as document:
18 xWriterDoc = self.xUITest.getTopFocusWindow()
19 xWriterEdit = xWriterDoc.getChild("writer_edit")
20 #- Add a word to an empty document.
21 type_text(xWriterEdit, "LibreOffice")
22 #- Change its style to Heading 2.
23 self.xUITest.executeCommand(".uno:StyleApply?Style:string=Heading%202&FamilyName:string=ParagraphStyles")
24 #- Position cursor somewhere in the middle of the word, and add Table of Contents
25 #(no need to change anything in the dialog).
26 self.xUITest.executeCommand(".uno:GoLeft")
27 self.xUITest.executeCommand(".uno:GoLeft")
28 self.xUITest.executeCommand(".uno:GoLeft")
29 self.xUITest.executeCommand(".uno:GoLeft")
31 with self.ui_test.execute_dialog_through_command(".uno:InsertMultiIndex"):
32 pass
33 #- Undo the ToC insertion.
34 self.xUITest.executeCommand(".uno:Undo")
35 #- Redo the ToC insertion.
36 self.xUITest.executeCommand(".uno:Redo")
37 #=> Crash. Now we verify the text
38 # This second undo crash in Clang build https://bugs.documentfoundation.org/show_bug.cgi?id=123313#c9
39 self.xUITest.executeCommand(".uno:Undo")
40 self.assertEqual(document.Text.String[0:7], "LibreOf")
42 # vim: set shiftwidth=4 softtabstop=4 expandtab: