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 uitest
.uihelper
.common
import type_text
13 class tdf79236(UITestCase
):
15 def test_paragraph(self
):
17 with self
.ui_test
.create_doc_in_start_center("writer") as document
:
19 xWriterDoc
= self
.xUITest
.getTopFocusWindow()
20 xWriterEdit
= xWriterDoc
.getChild("writer_edit")
22 type_text(xWriterEdit
, "Test for tdf79236")
25 self
.xUITest
.executeCommand(".uno:SelectAll")
27 self
.assertEqual(document
.CurrentSelection
[0].ParaLeftMargin
, 0)
28 self
.assertEqual(document
.CurrentSelection
[0].ParaRightMargin
, 0)
29 self
.assertEqual(document
.CurrentSelection
[0].ParaTopMargin
, 0)
30 self
.assertEqual(document
.CurrentSelection
[0].ParaBottomMargin
, 0)
31 self
.assertEqual(document
.CurrentSelection
[0].ParaFirstLineIndent
, 0)
33 self
.assertEqual(document
.CurrentSelection
[0].String
, "Test for tdf79236")
35 with self
.ui_test
.execute_dialog_through_command(".uno:ParagraphDialog") as xParagraphDlg
:
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())
62 self
.assertEqual(document
.CurrentSelection
[0].ParaLeftMargin
, 1016)
63 self
.assertEqual(document
.CurrentSelection
[0].ParaRightMargin
, 1016)
64 self
.assertEqual(document
.CurrentSelection
[0].ParaTopMargin
, 1016)
65 self
.assertEqual(document
.CurrentSelection
[0].ParaBottomMargin
, 1016)
66 self
.assertEqual(document
.CurrentSelection
[0].ParaFirstLineIndent
, 1016)
68 with self
.ui_test
.execute_dialog_through_command(".uno:ParagraphDialog") as xParagraphDlg
:
71 xLeftSpnBtn
= xParagraphDlg
.getChild("spinED_LEFTINDENT")
73 xLeftSpnBtn
.executeAction("DOWN", tuple())
75 xRightSpnBtn
= xParagraphDlg
.getChild("spinED_RIGHTINDENT")
77 xRightSpnBtn
.executeAction("DOWN", tuple())
80 xLineSpnBtn
= xParagraphDlg
.getChild("spinED_FLINEINDENT")
82 xLineSpnBtn
.executeAction("DOWN", tuple())
84 xBottomSpnBtn
= xParagraphDlg
.getChild("spinED_BOTTOMDIST")
86 xBottomSpnBtn
.executeAction("DOWN", tuple())
88 xTopSpnBtn
= xParagraphDlg
.getChild("spinED_TOPDIST")
90 xTopSpnBtn
.executeAction("DOWN", tuple())
93 self
.assertEqual(document
.CurrentSelection
[0].ParaLeftMargin
, 0)
94 self
.assertEqual(document
.CurrentSelection
[0].ParaRightMargin
, 0)
95 self
.assertEqual(document
.CurrentSelection
[0].ParaTopMargin
, 0)
96 self
.assertEqual(document
.CurrentSelection
[0].ParaBottomMargin
, 0)
97 self
.assertEqual(document
.CurrentSelection
[0].ParaFirstLineIndent
, 0)
99 self
.xUITest
.executeCommand(".uno:Undo")
101 self
.assertEqual(document
.CurrentSelection
[0].ParaLeftMargin
, 1016)
102 self
.assertEqual(document
.CurrentSelection
[0].ParaRightMargin
, 1016)
103 self
.assertEqual(document
.CurrentSelection
[0].ParaTopMargin
, 1016)
104 self
.assertEqual(document
.CurrentSelection
[0].ParaBottomMargin
, 1016)
105 self
.assertEqual(document
.CurrentSelection
[0].ParaFirstLineIndent
, 1016)
107 self
.xUITest
.executeCommand(".uno:Undo")
109 self
.assertEqual(document
.CurrentSelection
[0].ParaLeftMargin
, 0)
110 self
.assertEqual(document
.CurrentSelection
[0].ParaRightMargin
, 0)
111 self
.assertEqual(document
.CurrentSelection
[0].ParaTopMargin
, 0)
112 self
.assertEqual(document
.CurrentSelection
[0].ParaBottomMargin
, 0)
113 self
.assertEqual(document
.CurrentSelection
[0].ParaFirstLineIndent
, 0)
115 self
.assertEqual(document
.CurrentSelection
[0].String
, "Test for tdf79236")
118 # vim: set shiftwidth=4 softtabstop=4 expandtab: