2 # This Source Code Form is subject to the terms of the Mozilla Public
3 # License, v. 2.0. If a copy of the MPL was not distributed with this
4 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 from uitest
.framework
import UITestCase
9 from uitest
.uihelper
.common
import get_state_as_dict
, type_text
11 class tdf79236(UITestCase
):
13 def test_paragraph(self
):
15 self
.ui_test
.create_doc_in_start_center("writer")
17 xWriterDoc
= self
.xUITest
.getTopFocusWindow()
18 xWriterEdit
= xWriterDoc
.getChild("writer_edit")
20 type_text(xWriterEdit
, "Test for tdf79236")
22 document
= self
.ui_test
.get_component()
24 selection
= self
.xUITest
.executeCommand(".uno:SelectAll")
26 self
.assertEqual(document
.CurrentSelection
.getByIndex(0).ParaLeftMargin
, 0)
27 self
.assertEqual(document
.CurrentSelection
.getByIndex(0).ParaRightMargin
, 0)
28 self
.assertEqual(document
.CurrentSelection
.getByIndex(0).ParaTopMargin
, 0)
29 self
.assertEqual(document
.CurrentSelection
.getByIndex(0).ParaBottomMargin
, 0)
30 self
.assertEqual(document
.CurrentSelection
.getByIndex(0).ParaFirstLineIndent
, 0)
32 self
.assertEqual(document
.CurrentSelection
.getByIndex(0).String
, "Test for tdf79236")
34 self
.ui_test
.execute_dialog_through_command(".uno:ParagraphDialog")
36 xParagraphDlg
= self
.xUITest
.getTopFocusWindow()
39 xLeftSpnBtn
= xParagraphDlg
.getChild("spinED_LEFTINDENT")
41 xLeftSpnBtn
.executeAction("UP", tuple())
43 xRightSpnBtn
= xParagraphDlg
.getChild("spinED_RIGHTINDENT")
45 xRightSpnBtn
.executeAction("UP", tuple())
48 xLineSpnBtn
= xParagraphDlg
.getChild("spinED_FLINEINDENT")
50 xLineSpnBtn
.executeAction("UP", tuple())
53 xBottomSpnBtn
= xParagraphDlg
.getChild("spinED_BOTTOMDIST")
55 xBottomSpnBtn
.executeAction("UP", tuple())
57 xTopSpnBtn
= xParagraphDlg
.getChild("spinED_TOPDIST")
59 xTopSpnBtn
.executeAction("UP", tuple())
61 xOkBtn
= xParagraphDlg
.getChild("ok")
62 xOkBtn
.executeAction("CLICK", tuple())
64 self
.assertEqual(document
.CurrentSelection
.getByIndex(0).ParaLeftMargin
, 3704)
65 self
.assertEqual(document
.CurrentSelection
.getByIndex(0).ParaRightMargin
, 3704)
66 self
.assertEqual(document
.CurrentSelection
.getByIndex(0).ParaTopMargin
, 5503)
67 self
.assertEqual(document
.CurrentSelection
.getByIndex(0).ParaBottomMargin
, 5503)
68 self
.assertEqual(document
.CurrentSelection
.getByIndex(0).ParaFirstLineIndent
, 3704)
70 self
.ui_test
.execute_dialog_through_command(".uno:ParagraphDialog")
72 xParagraphDlg
= self
.xUITest
.getTopFocusWindow()
74 xLeftSpnBtn
= xParagraphDlg
.getChild("spinED_LEFTINDENT")
76 xLeftSpnBtn
.executeAction("DOWN", tuple())
78 xRightSpnBtn
= xParagraphDlg
.getChild("spinED_RIGHTINDENT")
80 xRightSpnBtn
.executeAction("DOWN", tuple())
83 xLineSpnBtn
= xParagraphDlg
.getChild("spinED_FLINEINDENT")
85 xLineSpnBtn
.executeAction("DOWN", tuple())
87 xBottomSpnBtn
= xParagraphDlg
.getChild("spinED_BOTTOMDIST")
89 xBottomSpnBtn
.executeAction("DOWN", tuple())
91 xTopSpnBtn
= xParagraphDlg
.getChild("spinED_TOPDIST")
93 xTopSpnBtn
.executeAction("DOWN", tuple())
95 xOkBtn
= xParagraphDlg
.getChild("ok")
96 self
.ui_test
.close_dialog_through_button(xOkBtn
)
98 self
.assertEqual(document
.CurrentSelection
.getByIndex(0).ParaLeftMargin
, 0)
99 self
.assertEqual(document
.CurrentSelection
.getByIndex(0).ParaRightMargin
, 0)
100 self
.assertEqual(document
.CurrentSelection
.getByIndex(0).ParaTopMargin
, 0)
101 self
.assertEqual(document
.CurrentSelection
.getByIndex(0).ParaBottomMargin
, 0)
102 self
.assertEqual(document
.CurrentSelection
.getByIndex(0).ParaFirstLineIndent
, 0)
104 self
.xUITest
.executeCommand(".uno:Undo")
106 self
.assertEqual(document
.CurrentSelection
.getByIndex(0).ParaLeftMargin
, 3704)
107 self
.assertEqual(document
.CurrentSelection
.getByIndex(0).ParaRightMargin
, 3704)
108 self
.assertEqual(document
.CurrentSelection
.getByIndex(0).ParaTopMargin
, 5503)
109 self
.assertEqual(document
.CurrentSelection
.getByIndex(0).ParaBottomMargin
, 5503)
110 self
.assertEqual(document
.CurrentSelection
.getByIndex(0).ParaFirstLineIndent
, 3704)
112 self
.xUITest
.executeCommand(".uno:Undo")
114 self
.assertEqual(document
.CurrentSelection
.getByIndex(0).ParaLeftMargin
, 0)
115 self
.assertEqual(document
.CurrentSelection
.getByIndex(0).ParaRightMargin
, 0)
116 self
.assertEqual(document
.CurrentSelection
.getByIndex(0).ParaTopMargin
, 0)
117 self
.assertEqual(document
.CurrentSelection
.getByIndex(0).ParaBottomMargin
, 0)
118 self
.assertEqual(document
.CurrentSelection
.getByIndex(0).ParaFirstLineIndent
, 0)
120 self
.assertEqual(document
.CurrentSelection
.getByIndex(0).String
, "Test for tdf79236")
122 self
.ui_test
.close_doc()
124 # vim: set shiftwidth=4 softtabstop=4 expandtab: