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/.
9 from uitest
.framework
import UITestCase
10 from uitest
.uihelper
.common
import type_text
, select_by_text
, select_pos
, get_state_as_dict
12 class tdf144439(UITestCase
):
14 def test_tdf144439_list(self
):
15 with self
.ui_test
.create_doc_in_start_center("writer") as document
:
16 xWriterDoc
= self
.xUITest
.getTopFocusWindow()
17 xWriterEdit
= xWriterDoc
.getChild("writer_edit")
19 type_text(xWriterEdit
, "List item")
21 self
.xUITest
.executeCommand(".uno:DefaultNumbering")
22 # Increase level up to 2
23 self
.xUITest
.executeCommand(".uno:IncrementIndent")
25 with self
.ui_test
.execute_dialog_through_command(".uno:BulletsAndNumberingDialog") as xDialog
:
27 xTabs
= xDialog
.getChild("tabcontrol")
28 select_pos(xTabs
, "5")
31 xNumFmt
= xDialog
.getChild("numfmtlb")
32 select_by_text(xNumFmt
, "1, 2, 3, ...")
34 # Increase number of sublevels to show
35 xSubLevels
= xDialog
.getChild("sublevels")
36 xSubLevels
.executeAction("UP", tuple())
38 Paragraphs
= document
.Text
.createEnumeration()
39 Para1
= Paragraphs
.nextElement()
40 self
.assertEqual(Para1
.String
, "List item")
41 self
.assertEqual(Para1
.getPropertyValue("ListLabelString"), "1.1.")
43 def test_tdf144439_outline(self
):
44 with self
.ui_test
.create_doc_in_start_center("writer") as document
:
45 xWriterDoc
= self
.xUITest
.getTopFocusWindow()
46 xWriterEdit
= xWriterDoc
.getChild("writer_edit")
48 type_text(xWriterEdit
, "Outline2")
49 # Apply outline level 2 (as a style)
50 self
.xUITest
.executeCommand(".uno:StyleApply?Style:string=Heading%202&FamilyName:string=ParagraphStyles")
52 with self
.ui_test
.execute_dialog_through_command(".uno:ChapterNumberingDialog") as xDialog
:
54 xLevel
= xDialog
.getChild("level")
55 xLevel2
= xLevel
.getChild("1")
56 xLevel2
.executeAction("SELECT", tuple())
57 self
.assertEqual("2", get_state_as_dict(xLevel
)['SelectEntryText'])
60 xTab
= xDialog
.getChild("tabcontrol")
64 xNumFmt
= xDialog
.getChild("numbering")
65 select_by_text(xNumFmt
, "1, 2, 3, ...")
67 # Increase number of sublevels to show
68 xSubLevels
= xDialog
.getChild("sublevelsnf")
69 xSubLevels
.executeAction("UP", tuple())
71 Paragraphs
= document
.Text
.createEnumeration()
72 Para1
= Paragraphs
.nextElement()
73 self
.assertEqual(Para1
.String
, "Outline2")
74 self
.assertEqual(Para1
.getPropertyValue("ListLabelString"), "1")
76 with self
.ui_test
.execute_dialog_through_command(".uno:ChapterNumberingDialog") as xDialog
:
78 xLevel
= xDialog
.getChild("level")
79 xLevel2
= xLevel
.getChild("0")
80 xLevel2
.executeAction("SELECT", tuple())
81 self
.assertEqual("1", get_state_as_dict(xLevel
)['SelectEntryText'])
84 xTab
= xDialog
.getChild("tabcontrol")
88 xNumFmt
= xDialog
.getChild("numbering")
89 select_by_text(xNumFmt
, "1, 2, 3, ...")
91 self
.assertEqual(Para1
.String
, "Outline2")
92 self
.assertEqual(Para1
.getPropertyValue("ListLabelString"), "1.1")
94 # vim: set shiftwidth=4 softtabstop=4 expandtab: