Get the style color and number just once
[LibreOffice.git] / sw / qa / uitest / writer_tests3 / tdf79236.py
blob45ca76f7b35fa9289d9a73ad9208413c8fa180b2
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")
40 for _ in range(0,20):
41 xLeftSpnBtn.executeAction("UP", tuple())
43 xRightSpnBtn = xParagraphDlg.getChild("spinED_RIGHTINDENT")
44 for _ in range(0,20):
45 xRightSpnBtn.executeAction("UP", tuple())
48 xLineSpnBtn = xParagraphDlg.getChild("spinED_FLINEINDENT")
49 for _ in range(0,20):
50 xLineSpnBtn.executeAction("UP", tuple())
53 xBottomSpnBtn = xParagraphDlg.getChild("spinED_BOTTOMDIST")
54 for _ in range(0,20):
55 xBottomSpnBtn.executeAction("UP", tuple())
57 xTopSpnBtn = xParagraphDlg.getChild("spinED_TOPDIST")
58 for _ in range(0,20):
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")
72 for _ in range(0,20):
73 xLeftSpnBtn.executeAction("DOWN", tuple())
75 xRightSpnBtn = xParagraphDlg.getChild("spinED_RIGHTINDENT")
76 for _ in range(0,20):
77 xRightSpnBtn.executeAction("DOWN", tuple())
80 xLineSpnBtn = xParagraphDlg.getChild("spinED_FLINEINDENT")
81 for _ in range(0,20):
82 xLineSpnBtn.executeAction("DOWN", tuple())
84 xBottomSpnBtn = xParagraphDlg.getChild("spinED_BOTTOMDIST")
85 for _ in range(0,20):
86 xBottomSpnBtn.executeAction("DOWN", tuple())
88 xTopSpnBtn = xParagraphDlg.getChild("spinED_TOPDIST")
89 for _ in range(0,20):
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: