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/.
8 from uitest
.framework
import UITestCase
9 from uitest
.debug
import sleep
10 from uitest
.path
import get_srcdir_url
11 from libreoffice
.uno
.propertyvalue
import mkPropertyValues
12 from uitest
.uihelper
.common
import get_state_as_dict
, type_text
13 from uitest
.uihelper
.common
import select_pos
15 class WriterLineNumbering(UITestCase
):
17 def test_line_numbering_dialog(self
):
18 self
.ui_test
.create_doc_in_start_center("writer")
19 document
= self
.ui_test
.get_component()
21 self
.ui_test
.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog
22 xDialog
= self
.xUITest
.getTopFocusWindow()
23 xPages
= xDialog
.getChild("pages")
24 xWriterEntry
= xPages
.getChild('3') # Writer
25 xWriterEntry
.executeAction("EXPAND", tuple())
26 xWriterGeneralEntry
= xWriterEntry
.getChild('0')
27 xWriterGeneralEntry
.executeAction("SELECT", tuple()) #General - set centimeters
28 xMetric
= xDialog
.getChild("metric")
29 props
= {"TEXT": "Centimeter"}
30 actionProps
= mkPropertyValues(props
)
31 xMetric
.executeAction("SELECT", actionProps
)
32 xOKBtn
= xDialog
.getChild("ok")
33 self
.ui_test
.close_dialog_through_button(xOKBtn
)
35 self
.ui_test
.execute_dialog_through_command(".uno:LineNumberingDialog")
36 xDialog
= self
.xUITest
.getTopFocusWindow()
37 xshownumbering
= xDialog
.getChild("shownumbering")
38 xstyledropdown
= xDialog
.getChild("styledropdown")
39 xformatdropdown
= xDialog
.getChild("formatdropdown")
40 xpositiondropdown
= xDialog
.getChild("positiondropdown")
41 xspacingspin
= xDialog
.getChild("spacingspin")
42 xintervalspin
= xDialog
.getChild("intervalspin")
43 xtextentry
= xDialog
.getChild("textentry")
44 xlinesspin
= xDialog
.getChild("linesspin")
45 xblanklines
= xDialog
.getChild("blanklines")
46 xlinesintextframes
= xDialog
.getChild("linesintextframes")
47 xshowfooterheadernumbering
= xDialog
.getChild("showfooterheadernumbering")
48 xrestarteverynewpage
= xDialog
.getChild("restarteverynewpage")
50 xshownumbering
.executeAction("CLICK", tuple())
51 props
= {"TEXT": "Bullets"}
52 actionProps
= mkPropertyValues(props
)
53 xstyledropdown
.executeAction("SELECT", actionProps
)
54 props2
= {"TEXT": "A, B, C, ..."}
55 actionProps2
= mkPropertyValues(props2
)
56 xformatdropdown
.executeAction("SELECT", actionProps2
)
57 props3
= {"TEXT": "Right"}
58 actionProps3
= mkPropertyValues(props3
)
59 xpositiondropdown
.executeAction("SELECT", actionProps3
)
60 xspacingspin
.executeAction("UP", tuple())
61 xintervalspin
.executeAction("UP", tuple())
62 xtextentry
.executeAction("TYPE", mkPropertyValues({"TEXT":";"}))
63 xlinesspin
.executeAction("UP", tuple())
64 xblanklines
.executeAction("CLICK", tuple())
65 xlinesintextframes
.executeAction("CLICK", tuple())
66 xshowfooterheadernumbering
.executeAction("CLICK", tuple())
67 xrestarteverynewpage
.executeAction("CLICK", tuple())
68 xOKBtn
= xDialog
.getChild("ok")
69 self
.ui_test
.close_dialog_through_button(xOKBtn
)
71 self
.ui_test
.execute_dialog_through_command(".uno:LineNumberingDialog")
72 xDialog
= self
.xUITest
.getTopFocusWindow()
73 xshownumbering
= xDialog
.getChild("shownumbering")
74 xstyledropdown
= xDialog
.getChild("styledropdown")
75 xformatdropdown
= xDialog
.getChild("formatdropdown")
76 xpositiondropdown
= xDialog
.getChild("positiondropdown")
77 xspacingspin
= xDialog
.getChild("spacingspin")
78 xintervalspin
= xDialog
.getChild("intervalspin")
79 xtextentry
= xDialog
.getChild("textentry")
80 xlinesspin
= xDialog
.getChild("linesspin")
81 xblanklines
= xDialog
.getChild("blanklines")
82 xlinesintextframes
= xDialog
.getChild("linesintextframes")
83 xshowfooterheadernumbering
= xDialog
.getChild("showfooterheadernumbering")
84 xrestarteverynewpage
= xDialog
.getChild("restarteverynewpage")
86 self
.assertEqual(get_state_as_dict(xshownumbering
)["Selected"], "true")
87 self
.assertEqual(get_state_as_dict(xstyledropdown
)["SelectEntryText"], "Bullets")
88 self
.assertEqual(get_state_as_dict(xformatdropdown
)["SelectEntryText"], "A, B, C, ...")
89 self
.assertEqual(get_state_as_dict(xpositiondropdown
)["SelectEntryText"], "Right")
90 self
.assertEqual(get_state_as_dict(xspacingspin
)["Text"], "0.60 cm")
91 self
.assertEqual(get_state_as_dict(xintervalspin
)["Text"], "6")
92 self
.assertEqual(get_state_as_dict(xtextentry
)["Text"], ";")
93 self
.assertEqual(get_state_as_dict(xlinesspin
)["Text"], "4")
94 self
.assertEqual(get_state_as_dict(xblanklines
)["Selected"], "false")
95 self
.assertEqual(get_state_as_dict(xlinesintextframes
)["Selected"], "true")
96 self
.assertEqual(get_state_as_dict(xshowfooterheadernumbering
)["Selected"], "true")
97 self
.assertEqual(get_state_as_dict(xrestarteverynewpage
)["Selected"], "true")
98 xCancelBtn
= xDialog
.getChild("cancel")
99 self
.ui_test
.close_dialog_through_button(xCancelBtn
)
100 self
.ui_test
.close_doc()
102 def test_tdf86185(self
):
103 self
.ui_test
.create_doc_in_start_center("writer")
104 document
= self
.ui_test
.get_component()
106 self
.ui_test
.execute_dialog_through_command(".uno:LineNumberingDialog")
107 xDialog
= self
.xUITest
.getTopFocusWindow()
108 xshownumbering
= xDialog
.getChild("shownumbering")
109 xformatdropdown
= xDialog
.getChild("formatdropdown")
111 xshownumbering
.executeAction("CLICK", tuple())
112 itemFormat
= ["1, 2, 3, ...", "A, B, C, ...", "a, b, c, ...", "I, II, III, ...", "i, ii, iii, ...", "A, .., AA, .., AAA, ..."]
114 props2
= {"TEXT": itemFormat
[i
]}
115 actionProps2
= mkPropertyValues(props2
)
116 xformatdropdown
.executeAction("SELECT", actionProps2
)
117 self
.assertEqual(get_state_as_dict(xformatdropdown
)["SelectEntryText"], itemFormat
[i
])
118 xCancelBtn
= xDialog
.getChild("cancel")
119 self
.ui_test
.close_dialog_through_button(xCancelBtn
)
120 self
.ui_test
.close_doc()
121 # vim: set shiftwidth=4 softtabstop=4 expandtab: