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 libreoffice
.uno
.propertyvalue
import mkPropertyValues
12 from uitest
.uihelper
.common
import get_state_as_dict
13 from uitest
.uihelper
.common
import select_pos
14 from uitest
.uihelper
.common
import select_by_text
15 from uitest
.uihelper
.common
import change_measurement_unit
17 #Outline Numbering is now Chapter Numbering
19 class WriterChapterNumbering(UITestCase
):
21 def test_chapter_numbering_dialog(self
):
22 with self
.ui_test
.create_doc_in_start_center("writer"):
24 with
change_measurement_unit(self
, "Millimeter"):
26 with self
.ui_test
.execute_dialog_through_command(".uno:ChapterNumberingDialog") as xDialog
:
27 xstyle
= xDialog
.getChild("style")
28 xnumbering
= xDialog
.getChild("numbering")
29 xcharstyle
= xDialog
.getChild("charstyle")
30 xprefix
= xDialog
.getChild("prefix")
31 xsuffix
= xDialog
.getChild("suffix")
32 xstartat
= xDialog
.getChild("startat")
33 xtab
= xDialog
.getChild("tabcontrol")
35 xalignedatmf
= xDialog
.getChild("alignedatmf")
36 xnum2alignlb
= xDialog
.getChild("num2alignlb")
37 xnumfollowedbylb
= xDialog
.getChild("numfollowedbylb")
38 xatmf
= xDialog
.getChild("atmf")
39 xindentatmf
= xDialog
.getChild("indentatmf")
40 select_pos(xtab
, "0") #first tab
41 select_by_text(xstyle
, "Heading")
42 select_by_text(xnumbering
, "1, 2, 3, ...")
43 select_by_text(xcharstyle
, "Bullets")
44 xprefix
.executeAction("TYPE", mkPropertyValues({"TEXT":"A"}))
45 xsuffix
.executeAction("TYPE", mkPropertyValues({"TEXT":"B"}))
46 xstartat
.executeAction("UP", tuple())
48 select_pos(xtab
, "1") #second tab Position
49 xalignedatmf
.executeAction("UP", tuple())
50 select_by_text(xnum2alignlb
, "Centered")
51 select_by_text(xnumfollowedbylb
, "Tab stop")
52 xatmf
.executeAction("UP", tuple())
53 xindentatmf
.executeAction("UP", tuple())
56 with self
.ui_test
.execute_dialog_through_command(".uno:ChapterNumberingDialog", close_button
="cancel") as xDialog
:
58 xstyle
= xDialog
.getChild("style")
59 xnumbering
= xDialog
.getChild("numbering")
60 xcharstyle
= xDialog
.getChild("charstyle")
61 xprefix
= xDialog
.getChild("prefix")
62 xsuffix
= xDialog
.getChild("suffix")
63 xstartat
= xDialog
.getChild("startat")
64 xtab
= xDialog
.getChild("tabcontrol")
66 xalignedatmf
= xDialog
.getChild("alignedatmf")
67 xnum2alignlb
= xDialog
.getChild("num2alignlb")
68 xnumfollowedbylb
= xDialog
.getChild("numfollowedbylb")
69 xatmf
= xDialog
.getChild("atmf")
70 xindentatmf
= xDialog
.getChild("indentatmf")
72 self
.assertEqual(get_state_as_dict(xstyle
)["SelectEntryText"], "Heading")
73 self
.assertEqual(get_state_as_dict(xnumbering
)["SelectEntryText"], "1, 2, 3, ...")
74 self
.assertEqual(get_state_as_dict(xcharstyle
)["SelectEntryText"], "Bullets")
75 self
.assertEqual(get_state_as_dict(xprefix
)["Text"], "A")
76 self
.assertEqual(get_state_as_dict(xsuffix
)["Text"], "B")
77 self
.assertEqual(get_state_as_dict(xstartat
)["Text"], "2")
78 select_pos(xtab
, "1") #second tab Position
79 self
.assertEqual(get_state_as_dict(xalignedatmf
)["Text"], "0.1 mm")
80 self
.assertEqual(get_state_as_dict(xnum2alignlb
)["SelectEntryText"], "Centered")
81 self
.assertEqual(get_state_as_dict(xnumfollowedbylb
)["SelectEntryText"], "Tab stop")
82 self
.assertEqual(get_state_as_dict(xatmf
)["Text"], "0.1 mm")
83 self
.assertEqual(get_state_as_dict(xindentatmf
)["Text"], "0.1 mm")
85 # vim: set shiftwidth=4 softtabstop=4 expandtab: