Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / sw / qa / uitest / writer_tests2 / formatCharacter.py
blob86efd640dbb4c9bf7a82ac2afb8755b7e2adae98
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 get_state_as_dict
13 from libreoffice.uno.propertyvalue import mkPropertyValues
14 from uitest.uihelper.common import select_pos
15 from uitest.uihelper.common import select_by_text
17 class formatCharacter(UITestCase):
19 def test_format_character_tab_font(self):
20 with self.ui_test.create_doc_in_start_center("writer"):
22 with self.ui_test.execute_dialog_through_command(".uno:FontDialog") as xDialog:
23 xTabs = xDialog.getChild("tabcontrol")
24 select_pos(xTabs, "0")
26 # xNoteBook = xDialog.getChild("nbWestern") //western notebook is always active
27 xSizeFont = xDialog.getChild("cbWestSize")
28 xLangFont = xDialog.getChild("cbWestLanguage")
29 xSizeFont.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
30 xSizeFont.executeAction("TYPE", mkPropertyValues({"TEXT":"18"}))
31 #set font size 18
32 select_pos(xLangFont, "0")
34 xNoteBook = xDialog.getChild("nbCJKCTL")
35 select_pos(xNoteBook, "0")
36 xSizeFontEast = xDialog.getChild("cbCJKSize")
37 xLangFontEast = xDialog.getChild("cbCJKLanguage")
38 xSizeFontEast.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
39 xSizeFontEast.executeAction("TYPE", mkPropertyValues({"TEXT":"18"})) #set font size 18
40 select_pos(xLangFontEast, "0")
42 select_pos(xNoteBook, "1")
43 xSizeFontCTL = xDialog.getChild("cbCTLSize")
44 xLangFontCTL = xDialog.getChild("cbCTLLanguage")
45 xSizeFontCTL.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
46 xSizeFontCTL.executeAction("TYPE", mkPropertyValues({"TEXT":"18"})) #set font size 18
47 select_pos(xLangFontCTL, "0")
49 with self.ui_test.execute_dialog_through_command(".uno:FontDialog", close_button="cancel") as xDialog:
50 xSizeFont = xDialog.getChild("cbWestSize")
51 self.assertEqual(get_state_as_dict(xSizeFont)["Text"], "18 pt")
52 xLangFont = xDialog.getChild("cbWestLanguage")
53 self.assertEqual(get_state_as_dict(xLangFont)["Text"], "[None]")
55 xNoteBook = xDialog.getChild("nbCJKCTL")
56 select_pos(xNoteBook, "0")
57 xSizeFontEast = xDialog.getChild("cbCJKSize")
58 self.assertEqual(get_state_as_dict(xSizeFontEast)["Text"], "18 pt")
59 xLangFontEast = xDialog.getChild("cbCJKLanguage")
60 self.assertEqual(get_state_as_dict(xLangFontEast)["Text"], "[None]")
62 select_pos(xNoteBook, "1")
63 xSizeFontCTL = xDialog.getChild("cbCTLSize")
64 self.assertEqual(get_state_as_dict(xSizeFontCTL)["Text"], "18 pt")
65 xLangFontCTL = xDialog.getChild("cbCTLLanguage")
66 self.assertEqual(get_state_as_dict(xLangFontCTL)["Text"], "[None]")
70 def test_format_character_tab_font_effects(self):
71 with self.ui_test.create_doc_in_start_center("writer"):
73 with self.ui_test.execute_dialog_through_command(".uno:FontDialog") as xDialog:
74 xTabs = xDialog.getChild("tabcontrol")
75 select_pos(xTabs, "1")
77 xEffects = xDialog.getChild("effectslb")
78 xRelief = xDialog.getChild("relieflb")
79 xHidden = xDialog.getChild("hiddencb")
80 xOverline = xDialog.getChild("overlinelb")
81 xStrikeout = xDialog.getChild("strikeoutlb")
82 xUnderline = xDialog.getChild("underlinelb")
83 xEmphasis = xDialog.getChild("emphasislb")
84 xPosition = xDialog.getChild("positionlb")
86 select_pos(xEffects, "1")
87 select_pos(xRelief, "1")
88 xHidden.executeAction("CLICK", tuple())
89 select_pos(xOverline, "1")
90 select_pos(xStrikeout, "1")
91 select_pos(xUnderline, "1")
92 select_pos(xEmphasis, "1")
93 select_pos(xPosition, "1")
96 with self.ui_test.execute_dialog_through_command(".uno:FontDialog", close_button="cancel") as xDialog:
97 xTabs = xDialog.getChild("tabcontrol")
98 select_pos(xTabs, "1")
100 xEffects = xDialog.getChild("effectslb")
101 xRelief = xDialog.getChild("relieflb")
102 xHidden = xDialog.getChild("hiddencb")
103 xOverline = xDialog.getChild("overlinelb")
104 xStrikeout = xDialog.getChild("strikeoutlb")
105 xUnderline = xDialog.getChild("underlinelb")
106 xEmphasis = xDialog.getChild("emphasislb")
107 xPosition = xDialog.getChild("positionlb")
109 self.assertEqual(get_state_as_dict(xEffects)["SelectEntryText"], "UPPERCASE")
110 self.assertEqual(get_state_as_dict(xRelief)["SelectEntryText"], "Embossed")
111 self.assertEqual(get_state_as_dict(xHidden)["Selected"], "true")
112 self.assertEqual(get_state_as_dict(xOverline)["SelectEntryText"], "Single")
113 self.assertEqual(get_state_as_dict(xStrikeout)["SelectEntryText"], "Single")
114 self.assertEqual(get_state_as_dict(xUnderline)["SelectEntryText"], "Single")
115 self.assertEqual(get_state_as_dict(xEmphasis)["SelectEntryText"], "Dot")
116 self.assertEqual(get_state_as_dict(xPosition)["SelectEntryText"], "Below text")
120 def test_format_character_tab_hyperlink(self):
121 with self.ui_test.create_doc_in_start_center("writer") as document:
123 with self.ui_test.execute_dialog_through_command(".uno:FontDialog") as xDialog:
124 xTabs = xDialog.getChild("tabcontrol")
125 select_pos(xTabs, "4")
127 xURL = xDialog.getChild("urled")
128 xURL.executeAction("TYPE", mkPropertyValues({"TEXT":"libreoffice.org"}))
129 xTexted = xDialog.getChild("texted")
130 xTexted.executeAction("TYPE", mkPropertyValues({"TEXT":"LibreOffice"}))
131 xName = xDialog.getChild("nameed")
132 xName.executeAction("TYPE", mkPropertyValues({"TEXT":"hyperlink"}))
134 xVisited = xDialog.getChild("visitedlb")
135 select_by_text(xVisited, "Bullets")
136 xUnVisited = xDialog.getChild("unvisitedlb")
137 select_by_text(xUnVisited, "Bullets")
140 self.xUITest.executeCommand(".uno:GoLeft")
141 self.assertEqual(document.Text.String[0:11], "LibreOffice")
143 with self.ui_test.execute_dialog_through_command(".uno:FontDialog", close_button="cancel") as xDialog:
144 xTabs = xDialog.getChild("tabcontrol")
145 select_pos(xTabs, "4")
146 xURL = xDialog.getChild("urled")
147 xTexted = xDialog.getChild("texted")
148 xName = xDialog.getChild("nameed")
149 xVisited = xDialog.getChild("visitedlb")
150 xUnVisited = xDialog.getChild("unvisitedlb")
152 self.assertEqual(get_state_as_dict(xURL)["Text"], "http://libreoffice.org/")
153 self.assertEqual(get_state_as_dict(xTexted)["Text"], "LibreOffice")
154 self.assertEqual(get_state_as_dict(xName)["Text"], "hyperlink")
155 self.assertEqual(get_state_as_dict(xVisited)["SelectEntryText"], "Bullets")
156 self.assertEqual(get_state_as_dict(xUnVisited)["SelectEntryText"], "Bullets")
159 def test_format_character_tab_asian_layout(self):
160 with self.ui_test.create_doc_in_start_center("writer"):
162 with self.ui_test.execute_dialog_through_command(".uno:FontDialog") as xDialog:
163 xTabs = xDialog.getChild("tabcontrol")
164 select_pos(xTabs, "3")
166 xTwolines = xDialog.getChild("twolines")
167 xTwolines.executeAction("CLICK", tuple())
170 with self.ui_test.execute_dialog_through_command(".uno:FontDialog", close_button="cancel") as xDialog:
171 xTabs = xDialog.getChild("tabcontrol")
172 select_pos(xTabs, "3")
173 xTwolines = xDialog.getChild("twolines")
175 self.assertEqual(get_state_as_dict(xTwolines)["Selected"], "true")
177 def test_format_character_tab_position(self):
178 with self.ui_test.create_doc_in_start_center("writer"):
180 with self.ui_test.execute_dialog_through_command(".uno:FontDialog") as xDialog:
181 xTabs = xDialog.getChild("tabcontrol")
182 select_pos(xTabs, "2")
184 xSuperscript = xDialog.getChild("superscript")
185 xRelFontSize = xDialog.getChild("fontsizesb")
186 x90deg = xDialog.getChild("90deg")
187 xScalewidth = xDialog.getChild("scalewidthsb")
188 xKerning = xDialog.getChild("kerningsb")
189 xPairKerning = xDialog.getChild("pairkerning")
190 xFitToLine = xDialog.getChild("fittoline")
192 xSuperscript.executeAction("CLICK", tuple())
193 xRelFontSize.executeAction("UP", tuple())
194 x90deg.executeAction("CLICK", tuple())
195 xScalewidth.executeAction("UP", tuple())
196 xKerning.executeAction("UP", tuple())
197 xPairKerning.executeAction("CLICK", tuple())
198 xFitToLine.executeAction("CLICK", tuple())
201 with self.ui_test.execute_dialog_through_command(".uno:FontDialog", close_button="cancel") as xDialog:
202 xTabs = xDialog.getChild("tabcontrol")
203 select_pos(xTabs, "2")
204 xSuperscript = xDialog.getChild("superscript")
205 xRelFontSize = xDialog.getChild("fontsizesb")
206 x90deg = xDialog.getChild("90deg")
207 xScalewidth = xDialog.getChild("scalewidthsb")
208 xKerning = xDialog.getChild("kerningsb")
209 xPairKerning = xDialog.getChild("pairkerning")
210 xFitToLine = xDialog.getChild("fittoline")
212 self.assertEqual(get_state_as_dict(xSuperscript)["Checked"], "true")
213 self.assertEqual(get_state_as_dict(x90deg)["Checked"], "true")
214 self.assertEqual(get_state_as_dict(xScalewidth)["Text"], "100%")
215 self.assertEqual(get_state_as_dict(xKerning)["Text"], "0.1 pt")
216 self.assertEqual(get_state_as_dict(xPairKerning)["Selected"], "false")
217 self.assertEqual(get_state_as_dict(xFitToLine)["Selected"], "true")
221 def test_format_character_tab_position_scalewidthsb(self):
222 with self.ui_test.create_doc_in_start_center("writer"):
224 with self.ui_test.execute_dialog_through_command(".uno:FontDialog") as xDialog:
225 xTabs = xDialog.getChild("tabcontrol")
226 select_pos(xTabs, "2")
228 xScalewidth = xDialog.getChild("scalewidthsb")
229 xScalewidth.executeAction("UP", tuple())
232 with self.ui_test.execute_dialog_through_command(".uno:FontDialog", close_button="cancel") as xDialog:
233 xTabs = xDialog.getChild("tabcontrol")
234 select_pos(xTabs, "2")
235 xScalewidth = xDialog.getChild("scalewidthsb")
236 self.assertEqual(get_state_as_dict(xScalewidth)["Text"], "101%")
240 # vim: set shiftwidth=4 softtabstop=4 expandtab: