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/.
9 from uitest
.framework
import UITestCase
10 from uitest
.uihelper
.common
import get_state_as_dict
, get_url_for_data_file
11 from libreoffice
.calc
.document
import get_cell_by_position
12 from libreoffice
.uno
.propertyvalue
import mkPropertyValues
14 #text to column testcase
16 class CalcTextToColumns(UITestCase
):
18 def test_text_to_columns_dot(self
):
20 with self
.ui_test
.load_file(get_url_for_data_file("text_to_columns_dot.ods")) as calc_doc
:
21 xCalcDoc
= self
.xUITest
.getTopFocusWindow()
22 gridwin
= xCalcDoc
.getChild("grid_window")
24 #Select A1:A5 on Sheet 'Dot_as_Separator'
25 gridwin
.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A5"}))
26 #Data - Text to Columns
27 with self
.ui_test
.execute_dialog_through_command(".uno:TextToColumns", close_button
="") as xDialog
:
28 #Untag Tab as separator and tag other. Put a dot into the input field next to the other checkbox
29 xother
= xDialog
.getChild("other")
30 xinputother
= xDialog
.getChild("inputother")
32 if (get_state_as_dict(xother
)["Selected"]) == "false":
33 xother
.executeAction("CLICK", tuple())
34 xinputother
.executeAction("TYPE", mkPropertyValues({"TEXT":"."}))
36 xOK
= xDialog
.getChild("ok")
37 with self
.ui_test
.execute_blocking_action(xOK
.executeAction
, args
=('CLICK', ()), close_button
="yes"):
41 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 0, 0).getValue(), 1)
42 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 0, 1).getValue(), 2)
43 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 0, 2).getValue(), 3)
44 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 0, 3).getValue(), 4)
45 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 0, 4).getValue(), 5)
46 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 1, 0).getValue(), 2)
47 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 1, 1).getValue(), 2)
48 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 1, 2).getValue(), 2)
49 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 1, 3).getValue(), 2)
50 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 1, 4).getValue(), 2)
51 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 2, 0).getValue(), 3)
52 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 2, 1).getValue(), 3)
53 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 2, 2).getValue(), 3)
54 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 2, 3).getValue(), 3)
55 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 2, 4).getValue(), 3)
56 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 3, 0).getValue(), 4)
57 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 3, 1).getValue(), 4)
58 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 3, 2).getValue(), 4)
59 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 3, 3).getValue(), 4)
60 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 3, 4).getValue(), 4)
61 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 4, 0).getValue(), 5)
62 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 4, 1).getValue(), 5)
63 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 4, 2).getValue(), 5)
64 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 4, 3).getValue(), 5)
65 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 4, 4).getValue(), 5)
66 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 5, 0).getValue(), 6)
67 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 5, 1).getValue(), 6)
68 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 5, 2).getValue(), 6)
69 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 5, 3).getValue(), 6)
70 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 5, 4).getValue(), 6)
71 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 6, 0).getString(), "random content")
72 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 6, 1).getValue(), 0)
73 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 6, 2).getValue(), 0)
74 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 6, 3).getValue(), 0)
75 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 6, 4).getString(), "random content")
77 def test_text_to_columns_comma(self
):
79 with self
.ui_test
.load_file(get_url_for_data_file("text_to_columns_comma.ods")) as calc_doc
:
80 xCalcDoc
= self
.xUITest
.getTopFocusWindow()
81 gridwin
= xCalcDoc
.getChild("grid_window")
84 gridwin
.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A5"}))
85 # Data - Text to Columns
86 with self
.ui_test
.execute_dialog_through_command(".uno:TextToColumns", close_button
="") as xDialog
:
87 # Untag Tab as separator and tag comma.
88 xComma
= xDialog
.getChild("comma")
89 if (get_state_as_dict(xComma
)["Selected"]) == "false":
90 xComma
.executeAction("CLICK", tuple())
93 xOK
= xDialog
.getChild("ok")
94 with self
.ui_test
.execute_blocking_action(xOK
.executeAction
, args
=('CLICK', ()), close_button
="yes"):
98 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 0, 0).getValue(), 1)
99 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 0, 1).getValue(), 2)
100 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 0, 2).getValue(), 3)
101 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 0, 3).getValue(), 4)
102 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 0, 4).getValue(), 5)
103 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 1, 0).getValue(), 2)
104 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 1, 1).getValue(), 2)
105 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 1, 2).getValue(), 2)
106 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 1, 3).getValue(), 2)
107 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 1, 4).getValue(), 2)
108 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 2, 0).getValue(), 3)
109 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 2, 1).getValue(), 3)
110 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 2, 2).getValue(), 3)
111 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 2, 3).getValue(), 3)
112 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 2, 4).getValue(), 3)
113 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 3, 0).getValue(), 4)
114 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 3, 1).getValue(), 4)
115 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 3, 2).getValue(), 4)
116 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 3, 3).getValue(), 4)
117 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 3, 4).getValue(), 4)
118 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 4, 0).getValue(), 5)
119 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 4, 1).getValue(), 5)
120 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 4, 2).getValue(), 5)
121 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 4, 3).getValue(), 5)
122 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 4, 4).getValue(), 5)
123 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 5, 0).getValue(), 6)
124 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 5, 1).getValue(), 6)
125 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 5, 2).getValue(), 6)
126 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 5, 3).getValue(), 6)
127 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 5, 4).getValue(), 6)
128 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 6, 0).getString(), "random content")
129 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 6, 1).getValue(), 0)
130 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 6, 2).getValue(), 0)
131 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 6, 3).getValue(), 0)
132 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 6, 4).getString(), "random content")
134 def test_text_to_columns_semicolon(self
):
135 #Semicolon as Separator
136 with self
.ui_test
.load_file(get_url_for_data_file("text_to_columns_semicolon.ods")) as calc_doc
:
137 xCalcDoc
= self
.xUITest
.getTopFocusWindow()
138 gridwin
= xCalcDoc
.getChild("grid_window")
140 # Select A1:A5 on Sheet
141 gridwin
.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A5"}))
142 # Data - Text to Columns
143 with self
.ui_test
.execute_dialog_through_command(".uno:TextToColumns", close_button
="") as xDialog
:
144 # Untag comma as separator and tag Semicolon
145 xSemicolon
= xDialog
.getChild("semicolon")
146 if (get_state_as_dict(xSemicolon
)["Selected"]) == "false":
147 xSemicolon
.executeAction("CLICK", tuple())
150 xOK
= xDialog
.getChild("ok")
151 with self
.ui_test
.execute_blocking_action(xOK
.executeAction
, args
=('CLICK', ()), close_button
="yes"):
155 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 0, 0).getValue(), 1)
156 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 0, 1).getValue(), 2)
157 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 0, 2).getValue(), 3)
158 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 0, 3).getValue(), 4)
159 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 0, 4).getValue(), 5)
160 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 1, 0).getValue(), 2)
161 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 1, 1).getValue(), 2)
162 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 1, 2).getValue(), 2)
163 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 1, 3).getValue(), 2)
164 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 1, 4).getValue(), 2)
165 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 2, 0).getValue(), 3)
166 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 2, 1).getValue(), 3)
167 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 2, 2).getValue(), 3)
168 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 2, 3).getValue(), 3)
169 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 2, 4).getValue(), 3)
170 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 3, 0).getValue(), 4)
171 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 3, 1).getValue(), 4)
172 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 3, 2).getValue(), 4)
173 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 3, 3).getValue(), 4)
174 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 3, 4).getValue(), 4)
175 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 4, 0).getValue(), 5)
176 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 4, 1).getValue(), 5)
177 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 4, 2).getValue(), 5)
178 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 4, 3).getValue(), 5)
179 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 4, 4).getValue(), 5)
180 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 5, 0).getValue(), 6)
181 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 5, 1).getValue(), 6)
182 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 5, 2).getValue(), 6)
183 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 5, 3).getValue(), 6)
184 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 5, 4).getValue(), 6)
185 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 6, 0).getString(), "random content")
186 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 6, 1).getValue(), 0)
187 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 6, 2).getValue(), 0)
188 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 6, 3).getValue(), 0)
189 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 6, 4).getString(), "random content")
191 def test_text_to_columns_space(self
):
193 with self
.ui_test
.load_file(get_url_for_data_file("text_to_columns_space.ods")) as calc_doc
:
194 xCalcDoc
= self
.xUITest
.getTopFocusWindow()
195 gridwin
= xCalcDoc
.getChild("grid_window")
197 # Select A1:A5 on Sheet
198 gridwin
.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A5"}))
199 # Data - Text to Columns
200 with self
.ui_test
.execute_dialog_through_command(".uno:TextToColumns", close_button
="") as xDialog
:
201 # Untag comma as separator and tag Semicolon
202 xSpace
= xDialog
.getChild("space")
203 if (get_state_as_dict(xSpace
)["Selected"]) == "false":
204 xSpace
.executeAction("CLICK", tuple())
205 # xspace.executeAction("CLICK", tuple())
208 xOK
= xDialog
.getChild("ok")
209 with self
.ui_test
.execute_blocking_action(xOK
.executeAction
, args
=('CLICK', ()), close_button
="yes"):
213 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 0, 0).getValue(), 1)
214 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 0, 1).getValue(), 2)
215 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 0, 2).getValue(), 3)
216 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 0, 3).getValue(), 4)
217 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 0, 4).getValue(), 5)
218 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 1, 0).getValue(), 2)
219 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 1, 1).getValue(), 2)
220 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 1, 2).getValue(), 2)
221 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 1, 3).getValue(), 2)
222 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 1, 4).getValue(), 2)
223 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 2, 0).getValue(), 3)
224 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 2, 1).getValue(), 3)
225 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 2, 2).getValue(), 3)
226 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 2, 3).getValue(), 3)
227 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 2, 4).getValue(), 3)
228 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 3, 0).getValue(), 4)
229 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 3, 1).getValue(), 4)
230 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 3, 2).getValue(), 4)
231 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 3, 3).getValue(), 4)
232 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 3, 4).getValue(), 4)
233 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 4, 0).getValue(), 5)
234 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 4, 1).getValue(), 5)
235 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 4, 2).getValue(), 5)
236 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 4, 3).getValue(), 5)
237 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 4, 4).getValue(), 5)
238 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 5, 0).getValue(), 6)
239 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 5, 1).getValue(), 6)
240 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 5, 2).getValue(), 6)
241 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 5, 3).getValue(), 6)
242 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 5, 4).getValue(), 6)
243 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 6, 0).getString(), "random content")
244 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 6, 1).getValue(), 0)
245 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 6, 2).getValue(), 0)
246 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 6, 3).getValue(), 0)
247 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 6, 4).getString(), "random content")
249 def test_text_to_columns_pipe(self
):
251 with self
.ui_test
.load_file(get_url_for_data_file("text_to_columns_pipe.ods")) as calc_doc
:
252 xCalcDoc
= self
.xUITest
.getTopFocusWindow()
253 gridwin
= xCalcDoc
.getChild("grid_window")
255 # Select A1:A5 on Sheet
256 gridwin
.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A5"}))
257 # Data - Text to Columns
258 with self
.ui_test
.execute_dialog_through_command(".uno:TextToColumns", close_button
="") as xDialog
:
259 # Untag comma as separator and tag Semicolon
260 xother
= xDialog
.getChild("other")
261 xinputother
= xDialog
.getChild("inputother")
262 if (get_state_as_dict(xother
)["Selected"]) == "false":
263 xother
.executeAction("CLICK", tuple())
264 xinputother
.executeAction("TYPE", mkPropertyValues({"TEXT":"|"}))
267 xOK
= xDialog
.getChild("ok")
268 with self
.ui_test
.execute_blocking_action(xOK
.executeAction
, args
=('CLICK', ()), close_button
="yes"):
272 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 0, 0).getValue(), 1)
273 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 0, 1).getValue(), 2)
274 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 0, 2).getValue(), 3)
275 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 0, 3).getValue(), 4)
276 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 0, 4).getValue(), 5)
277 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 1, 0).getValue(), 2)
278 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 1, 1).getValue(), 2)
279 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 1, 2).getValue(), 2)
280 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 1, 3).getValue(), 2)
281 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 1, 4).getValue(), 2)
282 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 2, 0).getValue(), 3)
283 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 2, 1).getValue(), 3)
284 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 2, 2).getValue(), 3)
285 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 2, 3).getValue(), 3)
286 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 2, 4).getValue(), 3)
287 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 3, 0).getValue(), 4)
288 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 3, 1).getValue(), 4)
289 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 3, 2).getValue(), 4)
290 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 3, 3).getValue(), 4)
291 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 3, 4).getValue(), 4)
292 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 4, 0).getValue(), 5)
293 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 4, 1).getValue(), 5)
294 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 4, 2).getValue(), 5)
295 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 4, 3).getValue(), 5)
296 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 4, 4).getValue(), 5)
297 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 5, 0).getValue(), 6)
298 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 5, 1).getValue(), 6)
299 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 5, 2).getValue(), 6)
300 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 5, 3).getValue(), 6)
301 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 5, 4).getValue(), 6)
302 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 6, 0).getString(), "random content")
303 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 6, 1).getValue(), 0)
304 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 6, 2).getValue(), 0)
305 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 6, 3).getValue(), 0)
306 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 6, 4).getString(), "random content")
308 def test_text_to_columns_pipespace(self
):
310 with self
.ui_test
.load_file(get_url_for_data_file("text_to_columns_pipe_space.ods")) as calc_doc
:
311 xCalcDoc
= self
.xUITest
.getTopFocusWindow()
312 gridwin
= xCalcDoc
.getChild("grid_window")
314 # Select A1:A5 on Sheet
315 gridwin
.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A5"}))
316 # Data - Text to Columns
317 with self
.ui_test
.execute_dialog_through_command(".uno:TextToColumns", close_button
="") as xDialog
:
318 xspace
= xDialog
.getChild("space")
319 xother
= xDialog
.getChild("other")
320 xinputother
= xDialog
.getChild("inputother")
321 if (get_state_as_dict(xspace
)["Selected"]) == "false":
322 xspace
.executeAction("CLICK", tuple())
323 if (get_state_as_dict(xother
)["Selected"]) == "false":
324 xother
.executeAction("CLICK", tuple())
325 xinputother
.executeAction("TYPE", mkPropertyValues({"TEXT":"|"}))
328 xOK
= xDialog
.getChild("ok")
329 with self
.ui_test
.execute_blocking_action(xOK
.executeAction
, args
=('CLICK', ()), close_button
="yes"):
333 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 0, 0).getValue(), 1)
334 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 0, 1).getValue(), 2)
335 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 0, 2).getValue(), 3)
336 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 0, 3).getValue(), 4)
337 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 0, 4).getValue(), 5)
338 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 1, 0).getValue(), 2)
339 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 1, 1).getValue(), 2)
340 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 1, 2).getValue(), 2)
341 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 1, 3).getValue(), 2)
342 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 1, 4).getValue(), 2)
343 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 2, 0).getValue(), 3)
344 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 2, 1).getValue(), 3)
345 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 2, 2).getValue(), 3)
346 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 2, 3).getValue(), 3)
347 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 2, 4).getValue(), 3)
348 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 3, 0).getValue(), 4)
349 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 3, 1).getValue(), 4)
350 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 3, 2).getValue(), 4)
351 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 3, 3).getValue(), 4)
352 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 3, 4).getValue(), 4)
353 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 4, 0).getValue(), 5)
354 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 4, 1).getValue(), 5)
355 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 4, 2).getValue(), 5)
356 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 4, 3).getValue(), 5)
357 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 4, 4).getValue(), 5)
358 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 5, 0).getValue(), 6)
359 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 5, 1).getValue(), 6)
360 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 5, 2).getValue(), 6)
361 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 5, 3).getValue(), 6)
362 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 5, 4).getValue(), 6)
363 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 6, 0).getString(), "random content")
364 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 6, 1).getValue(), 0)
365 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 6, 2).getValue(), 0)
366 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 6, 3).getValue(), 0)
367 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 6, 4).getString(), "random content")
369 # vim: set shiftwidth=4 softtabstop=4 expandtab: