1 # -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
3 # This Source Code Form is subject to the terms of the Mozilla Public
4 # License, v. 2.0. If a copy of the MPL was not distributed with this
5 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 from uitest
.framework
import UITestCase
8 from uitest
.uihelper
.common
import get_state_as_dict
9 from uitest
.uihelper
.common
import select_pos
10 from uitest
.uihelper
.calc
import enter_text_to_cell
11 from libreoffice
.calc
.document
import get_cell_by_position
12 from libreoffice
.uno
.propertyvalue
import mkPropertyValues
13 from uitest
.uihelper
.common
import get_state_as_dict
, type_text
14 from uitest
.debug
import sleep
15 import org
.libreoffice
.unotest
17 def get_url_for_data_file(file_name
):
18 return pathlib
.Path(org
.libreoffice
.unotest
.makeCopyFromTDOC(file_name
)).as_uri()
20 #Bug 124586 - Crash if switch from user outline numbering to chapter numbering with same paragraph style
22 class tdf124586(UITestCase
):
23 def test_tdf124586_crash_switch_outline_numbering(self
):
24 writer_doc
= self
.ui_test
.load_file(get_url_for_data_file("tdf124586.odt"))
25 document
= self
.ui_test
.get_component()
26 xWriterDoc
= self
.xUITest
.getTopFocusWindow()
28 #Goto Tools > Chapter Numbering.
29 self
.ui_test
.execute_dialog_through_command(".uno:ChapterNumberingDialog")
30 xDialog
= self
.xUITest
.getTopFocusWindow()
31 xstyle
= xDialog
.getChild("style")
32 props
= {"TEXT": "MyHeading"}
33 actionProps
= mkPropertyValues(props
)
34 xstyle
.executeAction("SELECT", actionProps
)
35 xOK
= xDialog
.getChild("ok")
36 xOK
.executeAction("CLICK", tuple())
38 self
.assertEqual(document
.Text
.String
[0:8], "Schritte")
40 self
.ui_test
.execute_dialog_through_command(".uno:ChapterNumberingDialog")
41 xDialog
= self
.xUITest
.getTopFocusWindow()
42 xstyle
= xDialog
.getChild("style")
43 self
.assertEqual(get_state_as_dict(xstyle
)["SelectEntryText"], "MyHeading")
44 xOK
= xDialog
.getChild("ok")
45 xOK
.executeAction("CLICK", tuple())
46 self
.ui_test
.close_doc()
47 # vim: set shiftwidth=4 softtabstop=4 expandtab: