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 select_by_text
13 from uitest
.uihelper
.common
import get_state_as_dict
14 from uitest
.uihelper
.common
import change_measurement_unit
16 class WriterLineNumbering(UITestCase
):
18 def test_line_numbering_dialog(self
):
19 with self
.ui_test
.create_doc_in_start_center("writer"):
21 with
change_measurement_unit(self
, "Centimeter"):
23 with self
.ui_test
.execute_dialog_through_command(".uno:LineNumberingDialog") as xDialog
:
24 xshownumbering
= xDialog
.getChild("shownumbering")
25 xstyledropdown
= xDialog
.getChild("styledropdown")
26 xformatdropdown
= xDialog
.getChild("formatdropdown")
27 xpositiondropdown
= xDialog
.getChild("positiondropdown")
28 xspacingspin
= xDialog
.getChild("spacingspin")
29 xintervalspin
= xDialog
.getChild("intervalspin")
30 xtextentry
= xDialog
.getChild("textentry")
31 xlinesspin
= xDialog
.getChild("linesspin")
32 xblanklines
= xDialog
.getChild("blanklines")
33 xlinesintextframes
= xDialog
.getChild("linesintextframes")
34 xshowfooterheadernumbering
= xDialog
.getChild("showfooterheadernumbering")
35 xrestarteverynewpage
= xDialog
.getChild("restarteverynewpage")
37 xshownumbering
.executeAction("CLICK", tuple())
38 select_by_text(xstyledropdown
, "Bullets")
39 select_by_text(xformatdropdown
, "A, B, C, ...")
40 select_by_text(xpositiondropdown
, "Right")
41 xspacingspin
.executeAction("UP", tuple())
42 xintervalspin
.executeAction("UP", tuple())
43 xtextentry
.executeAction("TYPE", mkPropertyValues({"TEXT":";"}))
44 xlinesspin
.executeAction("UP", tuple())
45 xblanklines
.executeAction("CLICK", tuple())
46 xlinesintextframes
.executeAction("CLICK", tuple())
47 xshowfooterheadernumbering
.executeAction("CLICK", tuple())
48 xrestarteverynewpage
.executeAction("CLICK", tuple())
50 with self
.ui_test
.execute_dialog_through_command(".uno:LineNumberingDialog", close_button
="cancel") as xDialog
:
51 xshownumbering
= xDialog
.getChild("shownumbering")
52 xstyledropdown
= xDialog
.getChild("styledropdown")
53 xformatdropdown
= xDialog
.getChild("formatdropdown")
54 xpositiondropdown
= xDialog
.getChild("positiondropdown")
55 xspacingspin
= xDialog
.getChild("spacingspin")
56 xintervalspin
= xDialog
.getChild("intervalspin")
57 xtextentry
= xDialog
.getChild("textentry")
58 xlinesspin
= xDialog
.getChild("linesspin")
59 xblanklines
= xDialog
.getChild("blanklines")
60 xlinesintextframes
= xDialog
.getChild("linesintextframes")
61 xshowfooterheadernumbering
= xDialog
.getChild("showfooterheadernumbering")
62 xrestarteverynewpage
= xDialog
.getChild("restarteverynewpage")
64 self
.assertEqual(get_state_as_dict(xshownumbering
)["Selected"], "true")
65 self
.assertEqual(get_state_as_dict(xstyledropdown
)["SelectEntryText"], "Bullets")
66 self
.assertEqual(get_state_as_dict(xformatdropdown
)["SelectEntryText"], "A, B, C, ...")
67 self
.assertEqual(get_state_as_dict(xpositiondropdown
)["SelectEntryText"], "Right")
68 self
.assertEqual(get_state_as_dict(xspacingspin
)["Text"], "0.60 cm")
69 self
.assertEqual(get_state_as_dict(xintervalspin
)["Text"], "6")
70 self
.assertEqual(get_state_as_dict(xtextentry
)["Text"], ";")
71 self
.assertEqual(get_state_as_dict(xlinesspin
)["Text"], "4")
72 self
.assertEqual(get_state_as_dict(xblanklines
)["Selected"], "false")
73 self
.assertEqual(get_state_as_dict(xlinesintextframes
)["Selected"], "true")
74 self
.assertEqual(get_state_as_dict(xshowfooterheadernumbering
)["Selected"], "true")
75 self
.assertEqual(get_state_as_dict(xrestarteverynewpage
)["Selected"], "true")
77 def test_tdf86185(self
):
78 with self
.ui_test
.create_doc_in_start_center("writer"):
80 with self
.ui_test
.execute_dialog_through_command(".uno:LineNumberingDialog", close_button
="cancel") as xDialog
:
81 xshownumbering
= xDialog
.getChild("shownumbering")
82 xformatdropdown
= xDialog
.getChild("formatdropdown")
84 xshownumbering
.executeAction("CLICK", tuple())
85 itemFormat
= ["1, 2, 3, ...", "A, B, C, ...", "a, b, c, ...", "I, II, III, ...", "i, ii, iii, ...", "A, .., AA, .., AAA, ..."]
87 select_by_text(xformatdropdown
, itemFormat
[i
])
88 self
.assertEqual(get_state_as_dict(xformatdropdown
)["SelectEntryText"], itemFormat
[i
])
89 # vim: set shiftwidth=4 softtabstop=4 expandtab: