Version 6.1.0.2, tag libreoffice-6.1.0.2
[LibreOffice.git] / sw / qa / uitest / writer_tests / formatParagraph.py
blob0cdc32ed2ac8b725825826ba23c706ba1e7a1862
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 libreoffice.uno.propertyvalue import mkPropertyValues
9 from uitest.uihelper.common import get_state_as_dict, type_text
11 import time
12 from uitest.debug import sleep
13 from libreoffice.uno.propertyvalue import mkPropertyValues
14 from uitest.uihelper.common import select_pos
16 class formatParagraph(UITestCase):
18 def test_format_paragraph_tab_indents_spacing(self):
19 self.ui_test.create_doc_in_start_center("writer")
20 document = self.ui_test.get_component()
21 xWriterDoc = self.xUITest.getTopFocusWindow()
22 xWriterEdit = xWriterDoc.getChild("writer_edit")
24 self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
25 xDialog = self.xUITest.getTopFocusWindow()
26 xTabs = xDialog.getChild("tabcontrol")
27 select_pos(xTabs, "0")
29 xBeforeText = xDialog.getChild("spinED_LEFTINDENT")
30 xAfterText = xDialog.getChild("spinED_RIGHTINDENT")
31 xFirstLine = xDialog.getChild("spinED_FLINEINDENT")
32 xAutomaticChk = xDialog.getChild("checkCB_AUTO")
33 xAbovePar = xDialog.getChild("spinED_TOPDIST")
34 xBelowPar = xDialog.getChild("spinED_BOTTOMDIST")
35 xChkspace = xDialog.getChild("checkCB_CONTEXTUALSPACING")
36 xLineSpacing = xDialog.getChild("comboLB_LINEDIST")
37 xActivate = xDialog.getChild("checkCB_REGISTER")
39 xBeforeText.executeAction("UP", tuple())
40 xAfterText.executeAction("UP", tuple())
41 xFirstLine.executeAction("UP", tuple())
42 xAutomaticChk.executeAction("CLICK", tuple())
43 xAbovePar.executeAction("UP", tuple())
44 xBelowPar.executeAction("UP", tuple())
45 xChkspace.executeAction("CLICK", tuple())
46 props = {"TEXT": "Double"}
47 actionProps = mkPropertyValues(props)
48 xLineSpacing.executeAction("SELECT", actionProps)
49 xActivate.executeAction("CLICK", tuple())
51 xOK = xDialog.getChild("ok")
52 xOK.executeAction("CLICK", tuple())
54 self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
55 xDialog = self.xUITest.getTopFocusWindow()
56 xTabs = xDialog.getChild("tabcontrol")
57 select_pos(xTabs, "0")
58 xBeforeText = xDialog.getChild("spinED_LEFTINDENT")
59 xAfterText = xDialog.getChild("spinED_RIGHTINDENT")
60 xFirstLine = xDialog.getChild("spinED_FLINEINDENT")
61 xAutomaticChk = xDialog.getChild("checkCB_AUTO")
62 xAbovePar = xDialog.getChild("spinED_TOPDIST")
63 xBelowPar = xDialog.getChild("spinED_BOTTOMDIST")
64 xChkspace = xDialog.getChild("checkCB_CONTEXTUALSPACING")
65 xLineSpacing = xDialog.getChild("comboLB_LINEDIST")
66 xActivate = xDialog.getChild("checkCB_REGISTER")
68 self.assertEqual(get_state_as_dict(xBeforeText)["Text"], "0.50 ch")
69 self.assertEqual(get_state_as_dict(xAfterText)["Text"], "0.50 ch")
70 self.assertEqual(get_state_as_dict(xFirstLine)["Text"], "0.50 ch")
71 self.assertEqual(get_state_as_dict(xAutomaticChk)["Selected"], "true")
72 self.assertEqual(get_state_as_dict(xAbovePar)["Text"], "0.50 line")
73 self.assertEqual(get_state_as_dict(xBelowPar)["Text"], "0.50 line")
74 self.assertEqual(get_state_as_dict(xChkspace)["Selected"], "true")
75 self.assertEqual(get_state_as_dict(xLineSpacing)["SelectEntryText"], "Double")
76 self.assertEqual(get_state_as_dict(xActivate)["Selected"], "true")
78 xCanc = xDialog.getChild("cancel")
79 self.ui_test.close_dialog_through_button(xCanc)
81 self.ui_test.close_doc()
83 def test_format_paragraph_tab_alignment(self):
84 self.ui_test.create_doc_in_start_center("writer")
85 document = self.ui_test.get_component()
86 xWriterDoc = self.xUITest.getTopFocusWindow()
87 xWriterEdit = xWriterDoc.getChild("writer_edit")
89 self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
90 xDialog = self.xUITest.getTopFocusWindow()
91 xTabs = xDialog.getChild("tabcontrol")
92 select_pos(xTabs, "1")
94 xTextDirection = xDialog.getChild("comboLB_TEXTDIRECTION")
95 xAlignment = xDialog.getChild("comboLB_VERTALIGN")
96 xSnapToText = xDialog.getChild("checkCB_SNAP")
97 xJustified = xDialog.getChild("radioBTN_JUSTIFYALIGN")
98 xLastLine = xDialog.getChild("comboLB_LASTLINE")
99 xExpandChk = xDialog.getChild("checkCB_EXPAND")
101 props = {"TEXT": "Left-to-right (LTR)"}
102 actionProps = mkPropertyValues(props)
103 xTextDirection.executeAction("SELECT", actionProps)
104 props2 = {"TEXT": "Top"}
105 actionProps2 = mkPropertyValues(props2)
106 xAlignment.executeAction("SELECT", actionProps2)
107 xSnapToText.executeAction("CLICK", tuple())
108 xJustified.executeAction("CLICK", tuple())
109 props3 = {"TEXT": "Justified"}
110 actionProps3 = mkPropertyValues(props3)
111 xLastLine.executeAction("SELECT", actionProps3)
112 xExpandChk.executeAction("CLICK", tuple())
114 xOK = xDialog.getChild("ok")
115 xOK.executeAction("CLICK", tuple())
117 self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
118 xDialog = self.xUITest.getTopFocusWindow()
119 xTabs = xDialog.getChild("tabcontrol")
120 select_pos(xTabs, "1")
122 xTextDirection = xDialog.getChild("comboLB_TEXTDIRECTION")
123 xAlignment = xDialog.getChild("comboLB_VERTALIGN")
124 xSnapToText = xDialog.getChild("checkCB_SNAP")
125 xJustified = xDialog.getChild("radioBTN_JUSTIFYALIGN")
126 xLastLine = xDialog.getChild("comboLB_LASTLINE")
127 xExpandChk = xDialog.getChild("checkCB_EXPAND")
129 self.assertEqual(get_state_as_dict(xTextDirection)["SelectEntryText"], "Left-to-right (LTR)")
130 self.assertEqual(get_state_as_dict(xAlignment)["SelectEntryText"], "Top")
131 self.assertEqual(get_state_as_dict(xSnapToText)["Selected"], "false")
132 self.assertEqual(get_state_as_dict(xJustified)["Checked"], "true")
133 self.assertEqual(get_state_as_dict(xLastLine)["SelectEntryText"], "Justified")
134 self.assertEqual(get_state_as_dict(xExpandChk)["Selected"], "true")
136 xCanc = xDialog.getChild("cancel")
137 self.ui_test.close_dialog_through_button(xCanc)
139 self.ui_test.close_doc()
141 def test_format_paragraph_tab_text_flow(self):
142 self.ui_test.create_doc_in_start_center("writer")
143 document = self.ui_test.get_component()
144 xWriterDoc = self.xUITest.getTopFocusWindow()
145 xWriterEdit = xWriterDoc.getChild("writer_edit")
147 self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
148 xDialog = self.xUITest.getTopFocusWindow()
149 xTabs = xDialog.getChild("tabcontrol")
150 select_pos(xTabs, "2")
152 xAutomaticaly = xDialog.getChild("checkAuto")
153 xEnd = xDialog.getChild("spinLineEnd")
154 xBegin = xDialog.getChild("spinLineBegin")
155 xMax = xDialog.getChild("spinMaxNum")
156 xIns = xDialog.getChild("checkInsert")
157 xType = xDialog.getChild("comboBreakType")
158 xPosition = xDialog.getChild("comboBreakPosition")
159 xspinOrphan = xDialog.getChild("spinOrphan")
160 xspinWidow = xDialog.getChild("spinWidow")
161 xcheckWidow = xDialog.getChild("checkWidow")
162 xcheckOrphan = xDialog.getChild("checkOrphan")
163 xcheckSplitPara = xDialog.getChild("checkSplitPara")
164 xcheckKeepPara = xDialog.getChild("checkKeepPara")
166 xAutomaticaly.executeAction("CLICK", tuple())
167 xEnd.executeAction("UP", tuple())
168 xBegin.executeAction("UP", tuple())
169 xMax.executeAction("UP", tuple())
170 xIns.executeAction("CLICK", tuple())
171 props = {"TEXT": "Column"}
172 actionProps = mkPropertyValues(props)
173 xType.executeAction("SELECT", actionProps)
174 props2 = {"TEXT": "After"}
175 actionProps2 = mkPropertyValues(props2)
176 xPosition.executeAction("SELECT", actionProps2)
177 xspinOrphan.executeAction("UP", tuple())
178 xspinWidow.executeAction("UP", tuple())
179 xcheckWidow.executeAction("CLICK", tuple())
180 xcheckOrphan.executeAction("CLICK", tuple())
181 xcheckSplitPara.executeAction("CLICK", tuple())
182 xcheckKeepPara.executeAction("CLICK", tuple())
184 xOK = xDialog.getChild("ok")
185 xOK.executeAction("CLICK", tuple())
187 self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
188 xDialog = self.xUITest.getTopFocusWindow()
189 xTabs = xDialog.getChild("tabcontrol")
190 select_pos(xTabs, "2")
192 xAutomaticaly = xDialog.getChild("checkAuto")
193 xEnd = xDialog.getChild("spinLineEnd")
194 xBegin = xDialog.getChild("spinLineBegin")
195 xMax = xDialog.getChild("spinMaxNum")
196 xIns = xDialog.getChild("checkInsert")
197 xType = xDialog.getChild("comboBreakType")
198 xPosition = xDialog.getChild("comboBreakPosition")
199 xspinOrphan = xDialog.getChild("spinOrphan")
200 xspinWidow = xDialog.getChild("spinWidow")
201 xcheckWidow = xDialog.getChild("checkWidow")
202 xcheckOrphan = xDialog.getChild("checkOrphan")
203 xcheckSplitPara = xDialog.getChild("checkSplitPara")
204 xcheckKeepPara = xDialog.getChild("checkKeepPara")
206 self.assertEqual(get_state_as_dict(xAutomaticaly)["Selected"], "true")
207 self.assertEqual(get_state_as_dict(xEnd)["Text"], "3")
208 self.assertEqual(get_state_as_dict(xBegin)["Text"], "3")
209 self.assertEqual(get_state_as_dict(xMax)["Text"], "1")
210 self.assertEqual(get_state_as_dict(xIns)["Selected"], "true")
211 self.assertEqual(get_state_as_dict(xType)["SelectEntryText"], "Column")
212 self.assertEqual(get_state_as_dict(xPosition)["SelectEntryText"], "After")
213 self.assertEqual(get_state_as_dict(xspinOrphan)["Text"], "2")
214 self.assertEqual(get_state_as_dict(xspinWidow)["Text"], "2")
215 self.assertEqual(get_state_as_dict(xcheckWidow)["Selected"], "false")
216 self.assertEqual(get_state_as_dict(xcheckOrphan)["Selected"], "false")
217 self.assertEqual(get_state_as_dict(xcheckSplitPara)["Selected"], "true")
218 self.assertEqual(get_state_as_dict(xcheckKeepPara)["Selected"], "true")
220 xCanc = xDialog.getChild("cancel")
221 self.ui_test.close_dialog_through_button(xCanc)
223 self.ui_test.close_doc()
225 def test_format_paragraph_tab_asian_typography(self):
226 self.ui_test.create_doc_in_start_center("writer")
227 document = self.ui_test.get_component()
228 xWriterDoc = self.xUITest.getTopFocusWindow()
229 xWriterEdit = xWriterDoc.getChild("writer_edit")
231 self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
232 xDialog = self.xUITest.getTopFocusWindow()
233 xTabs = xDialog.getChild("tabcontrol")
234 select_pos(xTabs, "3")
236 xcheckForbidList = xDialog.getChild("checkForbidList")
237 xcheckHangPunct = xDialog.getChild("checkHangPunct")
238 xcheckApplySpacing = xDialog.getChild("checkApplySpacing")
240 xcheckForbidList.executeAction("CLICK", tuple())
241 xcheckHangPunct.executeAction("CLICK", tuple())
242 xcheckApplySpacing.executeAction("CLICK", tuple())
244 xOK = xDialog.getChild("ok")
245 xOK.executeAction("CLICK", tuple())
247 self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
248 xDialog = self.xUITest.getTopFocusWindow()
249 xTabs = xDialog.getChild("tabcontrol")
250 select_pos(xTabs, "3")
252 xcheckForbidList = xDialog.getChild("checkForbidList")
253 xcheckHangPunct = xDialog.getChild("checkHangPunct")
254 xcheckApplySpacing = xDialog.getChild("checkApplySpacing")
256 self.assertEqual(get_state_as_dict(xcheckForbidList)["Selected"], "false")
257 self.assertEqual(get_state_as_dict(xcheckHangPunct)["Selected"], "false")
258 self.assertEqual(get_state_as_dict(xcheckApplySpacing)["Selected"], "false")
260 xCanc = xDialog.getChild("cancel")
261 self.ui_test.close_dialog_through_button(xCanc)
263 self.ui_test.close_doc()
265 def test_format_paragraph_tab_outline_numbering(self):
266 self.ui_test.create_doc_in_start_center("writer")
267 document = self.ui_test.get_component()
268 xWriterDoc = self.xUITest.getTopFocusWindow()
269 xWriterEdit = xWriterDoc.getChild("writer_edit")
271 self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
272 xDialog = self.xUITest.getTopFocusWindow()
273 xTabs = xDialog.getChild("tabcontrol")
274 select_pos(xTabs, "4")
276 xOutline = xDialog.getChild("comboLB_OUTLINE_LEVEL")
277 xNumbering = xDialog.getChild("comboLB_NUMBER_STYLE")
278 xPara = xDialog.getChild("checkCB_RESTART_PARACOUNT")
279 xParaSpin = xDialog.getChild("spinNF_RESTART_PARA")
281 props = {"TEXT": "Level 1"}
282 actionProps = mkPropertyValues(props)
283 xOutline.executeAction("SELECT", actionProps)
284 props2 = {"TEXT": "List 1"}
285 actionProps2 = mkPropertyValues(props2)
286 xNumbering.executeAction("SELECT", actionProps2)
287 xPara.executeAction("CLICK", tuple())
288 xParaSpin.executeAction("UP", tuple())
290 xOK = xDialog.getChild("ok")
291 xOK.executeAction("CLICK", tuple())
293 self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
294 xDialog = self.xUITest.getTopFocusWindow()
295 xTabs = xDialog.getChild("tabcontrol")
296 select_pos(xTabs, "4")
298 xOutline = xDialog.getChild("comboLB_OUTLINE_LEVEL")
299 xNumbering = xDialog.getChild("comboLB_NUMBER_STYLE")
300 xPara = xDialog.getChild("checkCB_RESTART_PARACOUNT")
301 xParaSpin = xDialog.getChild("spinNF_RESTART_PARA")
303 self.assertEqual(get_state_as_dict(xOutline)["SelectEntryText"], "Level 1")
304 self.assertEqual(get_state_as_dict(xNumbering)["SelectEntryText"], "List 1")
305 self.assertEqual(get_state_as_dict(xPara)["Selected"], "true")
306 self.assertEqual(get_state_as_dict(xParaSpin)["Text"], "2")
308 xCanc = xDialog.getChild("cancel")
309 self.ui_test.close_dialog_through_button(xCanc)
311 self.ui_test.close_doc()
313 def test_format_paragraph_tab_tabs(self):
314 self.ui_test.create_doc_in_start_center("writer")
315 document = self.ui_test.get_component()
316 xWriterDoc = self.xUITest.getTopFocusWindow()
317 xWriterEdit = xWriterDoc.getChild("writer_edit")
319 self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog
320 xDialog = self.xUITest.getTopFocusWindow()
321 xPages = xDialog.getChild("pages")
322 xWriterEntry = xPages.getChild('3') # Writer
323 xWriterEntry.executeAction("EXPAND", tuple())
324 xWriterGeneralEntry = xWriterEntry.getChild('0')
325 xWriterGeneralEntry.executeAction("SELECT", tuple()) #General
326 xMetric = xDialog.getChild("metric")
327 props = {"TEXT": "Centimeter"}
328 actionProps = mkPropertyValues(props)
329 xMetric.executeAction("SELECT", actionProps)
330 xOKBtn = xDialog.getChild("ok")
331 self.ui_test.close_dialog_through_button(xOKBtn)
333 self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
334 xDialog = self.xUITest.getTopFocusWindow()
335 xTabs = xDialog.getChild("tabcontrol")
336 select_pos(xTabs, "5")
338 xDecimal = xDialog.getChild("radiobuttonBTN_TABTYPE_DECIMAL")
339 xDecimalTxt = xDialog.getChild("entryED_TABTYPE_DECCHAR")
340 xFill = xDialog.getChild("radiobuttonBTN_FILLCHAR_OTHER")
341 xFillTxt = xDialog.getChild("entryED_FILLCHAR_OTHER")
342 xNewButtn = xDialog.getChild("buttonBTN_NEW")
343 xED_TABPOS = xDialog.getChild("ED_TABPOS")
345 xDecimal.executeAction("CLICK", tuple())
346 xDecimalTxt.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
347 xDecimalTxt.executeAction("BACKSPACE", tuple())
348 xDecimalTxt.executeAction("TYPE", mkPropertyValues({"TEXT":"i"}))
349 xFill.executeAction("CLICK", tuple())
350 xFillTxt.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
351 xFillTxt.executeAction("BACKSPACE", tuple())
352 xFillTxt.executeAction("TYPE", mkPropertyValues({"TEXT":"p"}))
353 xED_TABPOS.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
354 xED_TABPOS.executeAction("BACKSPACE", tuple())
355 xED_TABPOS.executeAction("TYPE", mkPropertyValues({"TEXT":"1"}))
356 xNewButtn.executeAction("CLICK", tuple())
358 xOK = xDialog.getChild("ok")
359 xOK.executeAction("CLICK", tuple())
361 self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
362 xDialog = self.xUITest.getTopFocusWindow()
363 xTabs = xDialog.getChild("tabcontrol")
364 select_pos(xTabs, "5")
366 xDecimal = xDialog.getChild("radiobuttonBTN_TABTYPE_DECIMAL")
367 xDecimalTxt = xDialog.getChild("entryED_TABTYPE_DECCHAR")
368 xFill = xDialog.getChild("radiobuttonBTN_FILLCHAR_OTHER")
369 xFillTxt = xDialog.getChild("entryED_FILLCHAR_OTHER")
370 xNewButtn = xDialog.getChild("buttonBTN_NEW")
371 xED_TABPOS = xDialog.getChild("ED_TABPOS")
373 self.assertEqual(get_state_as_dict(xDecimal)["Checked"], "true")
374 self.assertEqual(get_state_as_dict(xDecimalTxt)["Text"], "i")
375 self.assertEqual(get_state_as_dict(xFill)["Checked"], "true")
376 self.assertEqual(get_state_as_dict(xFillTxt)["Text"], "p")
377 self.assertEqual(get_state_as_dict(xED_TABPOS)["Text"], "1.00 cm")
379 xCanc = xDialog.getChild("cancel")
380 self.ui_test.close_dialog_through_button(xCanc)
382 self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
383 xDialog = self.xUITest.getTopFocusWindow()
384 xTabs = xDialog.getChild("tabcontrol")
385 select_pos(xTabs, "5")
387 xCentered = xDialog.getChild("radiobuttonBTN_TABTYPE_CENTER")
388 xUnderscore = xDialog.getChild("radiobuttonBTN_FILLCHAR_UNDERSCORE")
389 xNewButtn = xDialog.getChild("buttonBTN_NEW")
391 xCentered.executeAction("CLICK", tuple())
392 xUnderscore.executeAction("CLICK", tuple())
393 xNewButtn.executeAction("CLICK", tuple())
394 xOK = xDialog.getChild("ok")
395 xOK.executeAction("CLICK", tuple())
397 self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
398 xDialog = self.xUITest.getTopFocusWindow()
399 xTabs = xDialog.getChild("tabcontrol")
400 select_pos(xTabs, "5")
402 xCentered = xDialog.getChild("radiobuttonBTN_TABTYPE_CENTER")
403 xUnderscore = xDialog.getChild("radiobuttonBTN_FILLCHAR_UNDERSCORE")
404 self.assertEqual(get_state_as_dict(xCentered)["Checked"], "true")
405 self.assertEqual(get_state_as_dict(xUnderscore)["Checked"], "true")
407 xCanc = xDialog.getChild("cancel")
408 self.ui_test.close_dialog_through_button(xCanc)
410 self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
411 xDialog = self.xUITest.getTopFocusWindow()
412 xTabs = xDialog.getChild("tabcontrol")
413 select_pos(xTabs, "5")
415 xRight = xDialog.getChild("radiobuttonST_RIGHTTAB_ASIAN")
416 xDashLine = xDialog.getChild("radiobuttonBTN_FILLCHAR_DASHLINE")
417 xNewButtn = xDialog.getChild("buttonBTN_NEW")
419 xRight.executeAction("CLICK", tuple())
420 xDashLine.executeAction("CLICK", tuple())
421 xNewButtn.executeAction("CLICK", tuple())
422 xOK = xDialog.getChild("ok")
423 xOK.executeAction("CLICK", tuple())
425 self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
426 xDialog = self.xUITest.getTopFocusWindow()
427 xTabs = xDialog.getChild("tabcontrol")
428 select_pos(xTabs, "5")
430 xRight = xDialog.getChild("radiobuttonST_RIGHTTAB_ASIAN")
431 xDashLine = xDialog.getChild("radiobuttonBTN_FILLCHAR_DASHLINE")
432 self.assertEqual(get_state_as_dict(xRight)["Checked"], "true")
433 self.assertEqual(get_state_as_dict(xDashLine)["Checked"], "true")
435 xCanc = xDialog.getChild("cancel")
436 self.ui_test.close_dialog_through_button(xCanc)
438 self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
439 xDialog = self.xUITest.getTopFocusWindow()
440 xTabs = xDialog.getChild("tabcontrol")
441 select_pos(xTabs, "5")
443 xLeft = xDialog.getChild("radiobuttonST_LEFTTAB_ASIAN")
444 xPointsLine = xDialog.getChild("radiobuttonBTN_FILLCHAR_POINTS")
445 xNewButtn = xDialog.getChild("buttonBTN_NEW")
447 xLeft.executeAction("CLICK", tuple())
448 xPointsLine.executeAction("CLICK", tuple())
449 xNewButtn.executeAction("CLICK", tuple())
450 xOK = xDialog.getChild("ok")
451 xOK.executeAction("CLICK", tuple())
453 self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
454 xDialog = self.xUITest.getTopFocusWindow()
455 xTabs = xDialog.getChild("tabcontrol")
456 select_pos(xTabs, "5")
458 xLeft = xDialog.getChild("radiobuttonST_LEFTTAB_ASIAN")
459 xPointsLine = xDialog.getChild("radiobuttonBTN_FILLCHAR_POINTS")
460 self.assertEqual(get_state_as_dict(xLeft)["Checked"], "true")
461 self.assertEqual(get_state_as_dict(xPointsLine)["Checked"], "true")
463 xCanc = xDialog.getChild("cancel")
464 self.ui_test.close_dialog_through_button(xCanc)
466 self.ui_test.close_doc()
468 def test_format_paragraph_tab_drop_caps(self):
469 self.ui_test.create_doc_in_start_center("writer")
470 document = self.ui_test.get_component()
471 xWriterDoc = self.xUITest.getTopFocusWindow()
472 xWriterEdit = xWriterDoc.getChild("writer_edit")
474 self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
475 xDialog = self.xUITest.getTopFocusWindow()
476 xTabs = xDialog.getChild("tabcontrol")
477 select_pos(xTabs, "6")
479 xDisplay = xDialog.getChild("checkCB_SWITCH")
480 xWholeWord = xDialog.getChild("checkCB_WORD")
481 xLines = xDialog.getChild("spinFLD_LINES")
482 xSpaceToText = xDialog.getChild("spinFLD_DISTANCE")
483 xText = xDialog.getChild("entryEDT_TEXT")
484 xCharStyle = xDialog.getChild("comboBOX_TEMPLATE")
486 xDisplay.executeAction("CLICK", tuple())
487 xWholeWord.executeAction("CLICK", tuple())
488 xLines.executeAction("UP", tuple())
489 xSpaceToText.executeAction("UP", tuple())
490 xText.executeAction("TYPE", mkPropertyValues({"TEXT":"A"}))
491 props = {"TEXT": "Definition"}
492 actionProps = mkPropertyValues(props)
493 xCharStyle.executeAction("SELECT", actionProps)
494 xOK = xDialog.getChild("ok")
495 xOK.executeAction("CLICK", tuple())
497 self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
498 xDialog = self.xUITest.getTopFocusWindow()
499 xTabs = xDialog.getChild("tabcontrol")
500 select_pos(xTabs, "6")
502 xDisplay = xDialog.getChild("checkCB_SWITCH")
503 xWholeWord = xDialog.getChild("checkCB_WORD")
504 xLines = xDialog.getChild("spinFLD_LINES")
505 xSpaceToText = xDialog.getChild("spinFLD_DISTANCE")
506 xText = xDialog.getChild("entryEDT_TEXT")
507 xCharStyle = xDialog.getChild("comboBOX_TEMPLATE")
509 self.assertEqual(get_state_as_dict(xDisplay)["Selected"], "true")
510 self.assertEqual(get_state_as_dict(xWholeWord)["Selected"], "true")
511 self.assertEqual(get_state_as_dict(xText)["Text"], "A")
512 self.assertEqual(get_state_as_dict(xCharStyle)["SelectEntryText"], "Definition")
514 xCanc = xDialog.getChild("cancel")
515 self.ui_test.close_dialog_through_button(xCanc)
517 self.ui_test.close_doc()
519 def test_format_paragraph_tab_borders(self):
520 self.ui_test.create_doc_in_start_center("writer")
521 document = self.ui_test.get_component()
522 xWriterDoc = self.xUITest.getTopFocusWindow()
523 xWriterEdit = xWriterDoc.getChild("writer_edit")
525 self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") #optionsdialog
526 xDialog = self.xUITest.getTopFocusWindow()
527 xPages = xDialog.getChild("pages")
528 xWriterEntry = xPages.getChild('3') # Writer
529 xWriterEntry.executeAction("EXPAND", tuple())
530 xWriterGeneralEntry = xWriterEntry.getChild('0')
531 xWriterGeneralEntry.executeAction("SELECT", tuple()) #General - set centimeter
532 xMetric = xDialog.getChild("metric")
533 props = {"TEXT": "Centimeter"}
534 actionProps = mkPropertyValues(props)
535 xMetric.executeAction("SELECT", actionProps)
536 xOKBtn = xDialog.getChild("ok")
537 self.ui_test.close_dialog_through_button(xOKBtn)
539 self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
540 xDialog = self.xUITest.getTopFocusWindow()
541 xTabs = xDialog.getChild("tabcontrol")
542 select_pos(xTabs, "7")
544 xStyle = xDialog.getChild("linestylelb")
545 xwidth = xDialog.getChild("linewidthmf")
546 xSync = xDialog.getChild("sync")
547 xLeft = xDialog.getChild("leftmf")
548 xRight = xDialog.getChild("rightmf")
549 xTop = xDialog.getChild("topmf")
550 xBottom = xDialog.getChild("bottommf")
551 xMerge = xDialog.getChild("mergewithnext")
553 select_pos(xStyle, "1")
554 xwidth.executeAction("UP", tuple())
555 xSync.executeAction("CLICK", tuple())
556 xLeft.executeAction("UP", tuple())
557 xLeft.executeAction("UP", tuple())
558 xRight.executeAction("UP", tuple())
559 xTop.executeAction("UP", tuple())
560 xBottom.executeAction("UP", tuple())
561 xMerge.executeAction("CLICK", tuple())
563 xOK = xDialog.getChild("ok")
564 xOK.executeAction("CLICK", tuple())
566 self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
567 xDialog = self.xUITest.getTopFocusWindow()
568 xTabs = xDialog.getChild("tabcontrol")
569 select_pos(xTabs, "7")
571 xStyle = xDialog.getChild("linestylelb")
572 xwidth = xDialog.getChild("linewidthmf")
573 xSync = xDialog.getChild("sync")
574 xLeft = xDialog.getChild("leftmf")
575 xRight = xDialog.getChild("rightmf")
576 xTop = xDialog.getChild("topmf")
577 xBottom = xDialog.getChild("bottommf")
578 xMerge = xDialog.getChild("mergewithnext")
580 self.assertEqual(get_state_as_dict(xSync)["Selected"], "false")
581 self.assertEqual(get_state_as_dict(xMerge)["Selected"], "false")
582 self.assertEqual(get_state_as_dict(xLeft)["Text"], "0.20 cm")
583 self.assertEqual(get_state_as_dict(xRight)["Text"], "0.10 cm")
584 self.assertEqual(get_state_as_dict(xTop)["Text"], "0.10 cm")
585 self.assertEqual(get_state_as_dict(xBottom)["Text"], "0.10 cm")
587 xCanc = xDialog.getChild("cancel")
588 self.ui_test.close_dialog_through_button(xCanc)
589 self.ui_test.close_doc()
591 def test_format_paragraph_area(self):
592 self.ui_test.create_doc_in_start_center("writer")
593 document = self.ui_test.get_component()
594 xWriterDoc = self.xUITest.getTopFocusWindow()
595 xWriterEdit = xWriterDoc.getChild("writer_edit")
597 self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
598 xDialog = self.xUITest.getTopFocusWindow()
599 xTabs = xDialog.getChild("tabcontrol")
600 select_pos(xTabs, "8")
602 xColor = xDialog.getChild("btncolor")
603 xGradient = xDialog.getChild("btngradient")
604 xBitmap = xDialog.getChild("btnbitmap")
605 xPattern = xDialog.getChild("btnpattern")
606 xHatch = xDialog.getChild("btnhatch")
608 xColor.executeAction("CLICK", tuple())
609 xGradient.executeAction("CLICK", tuple())
610 xBitmap.executeAction("CLICK", tuple())
611 xPattern.executeAction("CLICK", tuple())
612 xHatch.executeAction("CLICK", tuple())
613 xCanc = xDialog.getChild("cancel")
614 self.ui_test.close_dialog_through_button(xCanc)
615 self.ui_test.close_doc()
617 def test_format_paragraph_transparency(self):
618 self.ui_test.create_doc_in_start_center("writer")
619 document = self.ui_test.get_component()
620 xWriterDoc = self.xUITest.getTopFocusWindow()
621 xWriterEdit = xWriterDoc.getChild("writer_edit")
623 self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
624 xDialog = self.xUITest.getTopFocusWindow()
625 xTabs = xDialog.getChild("tabcontrol")
626 select_pos(xTabs, "9")
628 xTran = xDialog.getChild("RBT_TRANS_LINEAR")
629 xTranText = xDialog.getChild("MTR_TRANSPARENT")
631 xTran.executeAction("CLICK", tuple())
632 xTranText.executeAction("UP", tuple())
634 xOK = xDialog.getChild("ok")
635 xOK.executeAction("CLICK", tuple())
637 self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
638 xDialog = self.xUITest.getTopFocusWindow()
639 xTabs = xDialog.getChild("tabcontrol")
640 select_pos(xTabs, "9")
642 xTran = xDialog.getChild("RBT_TRANS_LINEAR")
643 xTranText = xDialog.getChild("MTR_TRANSPARENT")
645 self.assertEqual(get_state_as_dict(xTran)["Checked"], "true")
646 self.assertEqual(get_state_as_dict(xTranText)["Text"], "51%")
648 xCanc = xDialog.getChild("cancel")
649 self.ui_test.close_dialog_through_button(xCanc)
651 self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
652 xDialog = self.xUITest.getTopFocusWindow()
653 xTabs = xDialog.getChild("tabcontrol")
654 select_pos(xTabs, "9")
656 xGradient = xDialog.getChild("RBT_TRANS_GRADIENT")
657 xType = xDialog.getChild("LB_TRGR_GRADIENT_TYPES")
658 xAngle = xDialog.getChild("MTR_TRGR_ANGLE")
659 xBorder = xDialog.getChild("MTR_TRGR_BORDER")
660 xStart = xDialog.getChild("MTR_TRGR_START_VALUE")
661 xEnd = xDialog.getChild("MTR_TRGR_END_VALUE")
663 xGradient.executeAction("CLICK", tuple())
664 props = {"TEXT": "Axial"}
665 actionProps = mkPropertyValues(props)
666 xType.executeAction("SELECT", actionProps)
667 xAngle.executeAction("UP", tuple())
668 xBorder.executeAction("UP", tuple())
669 xStart.executeAction("UP", tuple())
670 xEnd.executeAction("DOWN", tuple())
672 xOK = xDialog.getChild("ok")
673 xOK.executeAction("CLICK", tuple())
675 self.ui_test.execute_dialog_through_command(".uno:ParagraphDialog")
676 xDialog = self.xUITest.getTopFocusWindow()
677 xTabs = xDialog.getChild("tabcontrol")
678 select_pos(xTabs, "9")
680 xGradient = xDialog.getChild("RBT_TRANS_GRADIENT")
681 xType = xDialog.getChild("LB_TRGR_GRADIENT_TYPES")
682 xAngle = xDialog.getChild("MTR_TRGR_ANGLE")
683 xBorder = xDialog.getChild("MTR_TRGR_BORDER")
684 xStart = xDialog.getChild("MTR_TRGR_START_VALUE")
685 xEnd = xDialog.getChild("MTR_TRGR_END_VALUE")
687 self.assertEqual(get_state_as_dict(xGradient)["Checked"], "true")
688 self.assertEqual(get_state_as_dict(xType)["SelectEntryText"], "Axial")
689 self.assertEqual(get_state_as_dict(xAngle)["Text"], "1°")
690 self.assertEqual(get_state_as_dict(xBorder)["Text"], "1%")
691 self.assertEqual(get_state_as_dict(xStart)["Text"], "1%")
692 self.assertEqual(get_state_as_dict(xEnd)["Text"], "99%")
694 xCanc = xDialog.getChild("cancel")
695 self.ui_test.close_dialog_through_button(xCanc)
696 self.ui_test.close_doc()
698 # vim: set shiftwidth=4 softtabstop=4 expandtab: