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 xSeparatedBy
= xDialog
.getChild("toseparatedby")
30 xSeparatedBy
.executeAction("CLICK", tuple())
32 xother
= xDialog
.getChild("other")
33 xinputother
= xDialog
.getChild("inputother")
35 if (get_state_as_dict(xother
)["Selected"]) == "false":
36 xother
.executeAction("CLICK", tuple())
37 xinputother
.executeAction("TYPE", mkPropertyValues({"TEXT":"."}))
39 xOK
= xDialog
.getChild("ok")
40 with self
.ui_test
.execute_blocking_action(xOK
.executeAction
, args
=('CLICK', ()), close_button
="yes"):
44 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 0, 0).getValue(), 1)
45 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 0, 1).getValue(), 2)
46 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 0, 2).getValue(), 3)
47 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 0, 3).getValue(), 4)
48 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 0, 4).getValue(), 5)
49 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 1, 0).getValue(), 2)
50 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 1, 1).getValue(), 2)
51 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 1, 2).getValue(), 2)
52 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 1, 3).getValue(), 2)
53 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 1, 4).getValue(), 2)
54 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 2, 0).getValue(), 3)
55 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 2, 1).getValue(), 3)
56 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 2, 2).getValue(), 3)
57 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 2, 3).getValue(), 3)
58 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 2, 4).getValue(), 3)
59 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 3, 0).getValue(), 4)
60 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 3, 1).getValue(), 4)
61 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 3, 2).getValue(), 4)
62 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 3, 3).getValue(), 4)
63 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 3, 4).getValue(), 4)
64 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 4, 0).getValue(), 5)
65 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 4, 1).getValue(), 5)
66 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 4, 2).getValue(), 5)
67 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 4, 3).getValue(), 5)
68 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 4, 4).getValue(), 5)
69 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 5, 0).getValue(), 6)
70 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 5, 1).getValue(), 6)
71 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 5, 2).getValue(), 6)
72 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 5, 3).getValue(), 6)
73 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 5, 4).getValue(), 6)
74 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 6, 0).getString(), "random content")
75 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 6, 1).getValue(), 0)
76 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 6, 2).getValue(), 0)
77 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 6, 3).getValue(), 0)
78 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 6, 4).getString(), "random content")
80 def test_text_to_columns_comma(self
):
82 with self
.ui_test
.load_file(get_url_for_data_file("text_to_columns_comma.ods")) as calc_doc
:
83 xCalcDoc
= self
.xUITest
.getTopFocusWindow()
84 gridwin
= xCalcDoc
.getChild("grid_window")
87 gridwin
.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A5"}))
88 # Data - Text to Columns
89 with self
.ui_test
.execute_dialog_through_command(".uno:TextToColumns", close_button
="") as xDialog
:
90 # Untag Tab as separator and tag comma.
91 xSeparatedBy
= xDialog
.getChild("toseparatedby")
92 xSeparatedBy
.executeAction("CLICK", tuple())
94 xComma
= xDialog
.getChild("comma")
95 if (get_state_as_dict(xComma
)["Selected"]) == "false":
96 xComma
.executeAction("CLICK", tuple())
99 xOK
= xDialog
.getChild("ok")
100 with self
.ui_test
.execute_blocking_action(xOK
.executeAction
, args
=('CLICK', ()), close_button
="yes"):
104 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 0, 0).getValue(), 1)
105 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 0, 1).getValue(), 2)
106 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 0, 2).getValue(), 3)
107 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 0, 3).getValue(), 4)
108 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 0, 4).getValue(), 5)
109 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 1, 0).getValue(), 2)
110 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 1, 1).getValue(), 2)
111 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 1, 2).getValue(), 2)
112 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 1, 3).getValue(), 2)
113 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 1, 4).getValue(), 2)
114 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 2, 0).getValue(), 3)
115 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 2, 1).getValue(), 3)
116 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 2, 2).getValue(), 3)
117 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 2, 3).getValue(), 3)
118 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 2, 4).getValue(), 3)
119 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 3, 0).getValue(), 4)
120 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 3, 1).getValue(), 4)
121 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 3, 2).getValue(), 4)
122 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 3, 3).getValue(), 4)
123 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 3, 4).getValue(), 4)
124 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 4, 0).getValue(), 5)
125 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 4, 1).getValue(), 5)
126 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 4, 2).getValue(), 5)
127 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 4, 3).getValue(), 5)
128 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 4, 4).getValue(), 5)
129 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 5, 0).getValue(), 6)
130 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 5, 1).getValue(), 6)
131 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 5, 2).getValue(), 6)
132 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 5, 3).getValue(), 6)
133 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 5, 4).getValue(), 6)
134 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 6, 0).getString(), "random content")
135 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 6, 1).getValue(), 0)
136 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 6, 2).getValue(), 0)
137 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 6, 3).getValue(), 0)
138 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 6, 4).getString(), "random content")
140 def test_text_to_columns_semicolon(self
):
141 #Semicolon as Separator
142 with self
.ui_test
.load_file(get_url_for_data_file("text_to_columns_semicolon.ods")) as calc_doc
:
143 xCalcDoc
= self
.xUITest
.getTopFocusWindow()
144 gridwin
= xCalcDoc
.getChild("grid_window")
146 # Select A1:A5 on Sheet
147 gridwin
.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A5"}))
148 # Data - Text to Columns
149 with self
.ui_test
.execute_dialog_through_command(".uno:TextToColumns", close_button
="") as xDialog
:
150 # Untag comma as separator and tag Semicolon
151 xSeparatedBy
= xDialog
.getChild("toseparatedby")
152 xSeparatedBy
.executeAction("CLICK", tuple())
154 xSemicolon
= xDialog
.getChild("semicolon")
155 if (get_state_as_dict(xSemicolon
)["Selected"]) == "false":
156 xSemicolon
.executeAction("CLICK", tuple())
159 xOK
= xDialog
.getChild("ok")
160 with self
.ui_test
.execute_blocking_action(xOK
.executeAction
, args
=('CLICK', ()), close_button
="yes"):
164 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 0, 0).getValue(), 1)
165 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 0, 1).getValue(), 2)
166 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 0, 2).getValue(), 3)
167 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 0, 3).getValue(), 4)
168 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 0, 4).getValue(), 5)
169 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 1, 0).getValue(), 2)
170 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 1, 1).getValue(), 2)
171 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 1, 2).getValue(), 2)
172 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 1, 3).getValue(), 2)
173 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 1, 4).getValue(), 2)
174 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 2, 0).getValue(), 3)
175 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 2, 1).getValue(), 3)
176 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 2, 2).getValue(), 3)
177 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 2, 3).getValue(), 3)
178 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 2, 4).getValue(), 3)
179 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 3, 0).getValue(), 4)
180 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 3, 1).getValue(), 4)
181 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 3, 2).getValue(), 4)
182 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 3, 3).getValue(), 4)
183 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 3, 4).getValue(), 4)
184 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 4, 0).getValue(), 5)
185 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 4, 1).getValue(), 5)
186 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 4, 2).getValue(), 5)
187 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 4, 3).getValue(), 5)
188 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 4, 4).getValue(), 5)
189 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 5, 0).getValue(), 6)
190 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 5, 1).getValue(), 6)
191 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 5, 2).getValue(), 6)
192 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 5, 3).getValue(), 6)
193 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 5, 4).getValue(), 6)
194 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 6, 0).getString(), "random content")
195 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 6, 1).getValue(), 0)
196 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 6, 2).getValue(), 0)
197 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 6, 3).getValue(), 0)
198 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 6, 4).getString(), "random content")
200 def test_text_to_columns_space(self
):
202 with self
.ui_test
.load_file(get_url_for_data_file("text_to_columns_space.ods")) as calc_doc
:
203 xCalcDoc
= self
.xUITest
.getTopFocusWindow()
204 gridwin
= xCalcDoc
.getChild("grid_window")
206 # Select A1:A5 on Sheet
207 gridwin
.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A5"}))
208 # Data - Text to Columns
209 with self
.ui_test
.execute_dialog_through_command(".uno:TextToColumns", close_button
="") as xDialog
:
210 # Untag comma as separator and tag Semicolon
211 xSeparatedBy
= xDialog
.getChild("toseparatedby")
212 xSeparatedBy
.executeAction("CLICK", tuple())
214 xSpace
= xDialog
.getChild("space")
215 if (get_state_as_dict(xSpace
)["Selected"]) == "false":
216 xSpace
.executeAction("CLICK", tuple())
217 # xspace.executeAction("CLICK", tuple())
220 xOK
= xDialog
.getChild("ok")
221 with self
.ui_test
.execute_blocking_action(xOK
.executeAction
, args
=('CLICK', ()), close_button
="yes"):
225 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 0, 0).getValue(), 1)
226 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 0, 1).getValue(), 2)
227 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 0, 2).getValue(), 3)
228 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 0, 3).getValue(), 4)
229 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 0, 4).getValue(), 5)
230 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 1, 0).getValue(), 2)
231 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 1, 1).getValue(), 2)
232 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 1, 2).getValue(), 2)
233 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 1, 3).getValue(), 2)
234 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 1, 4).getValue(), 2)
235 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 2, 0).getValue(), 3)
236 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 2, 1).getValue(), 3)
237 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 2, 2).getValue(), 3)
238 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 2, 3).getValue(), 3)
239 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 2, 4).getValue(), 3)
240 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 3, 0).getValue(), 4)
241 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 3, 1).getValue(), 4)
242 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 3, 2).getValue(), 4)
243 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 3, 3).getValue(), 4)
244 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 3, 4).getValue(), 4)
245 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 4, 0).getValue(), 5)
246 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 4, 1).getValue(), 5)
247 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 4, 2).getValue(), 5)
248 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 4, 3).getValue(), 5)
249 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 4, 4).getValue(), 5)
250 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 5, 0).getValue(), 6)
251 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 5, 1).getValue(), 6)
252 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 5, 2).getValue(), 6)
253 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 5, 3).getValue(), 6)
254 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 5, 4).getValue(), 6)
255 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 6, 0).getString(), "random content")
256 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 6, 1).getValue(), 0)
257 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 6, 2).getValue(), 0)
258 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 6, 3).getValue(), 0)
259 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 6, 4).getString(), "random content")
261 def test_text_to_columns_pipe(self
):
263 with self
.ui_test
.load_file(get_url_for_data_file("text_to_columns_pipe.ods")) as calc_doc
:
264 xCalcDoc
= self
.xUITest
.getTopFocusWindow()
265 gridwin
= xCalcDoc
.getChild("grid_window")
267 # Select A1:A5 on Sheet
268 gridwin
.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A5"}))
269 # Data - Text to Columns
270 with self
.ui_test
.execute_dialog_through_command(".uno:TextToColumns", close_button
="") as xDialog
:
271 # Untag comma as separator and tag Semicolon
272 xSeparatedBy
= xDialog
.getChild("toseparatedby")
273 xSeparatedBy
.executeAction("CLICK", tuple())
275 xother
= xDialog
.getChild("other")
276 xinputother
= xDialog
.getChild("inputother")
277 if (get_state_as_dict(xother
)["Selected"]) == "false":
278 xother
.executeAction("CLICK", tuple())
279 xinputother
.executeAction("TYPE", mkPropertyValues({"TEXT":"|"}))
282 xOK
= xDialog
.getChild("ok")
283 with self
.ui_test
.execute_blocking_action(xOK
.executeAction
, args
=('CLICK', ()), close_button
="yes"):
287 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 0, 0).getValue(), 1)
288 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 0, 1).getValue(), 2)
289 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 0, 2).getValue(), 3)
290 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 0, 3).getValue(), 4)
291 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 0, 4).getValue(), 5)
292 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 1, 0).getValue(), 2)
293 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 1, 1).getValue(), 2)
294 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 1, 2).getValue(), 2)
295 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 1, 3).getValue(), 2)
296 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 1, 4).getValue(), 2)
297 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 2, 0).getValue(), 3)
298 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 2, 1).getValue(), 3)
299 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 2, 2).getValue(), 3)
300 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 2, 3).getValue(), 3)
301 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 2, 4).getValue(), 3)
302 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 3, 0).getValue(), 4)
303 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 3, 1).getValue(), 4)
304 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 3, 2).getValue(), 4)
305 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 3, 3).getValue(), 4)
306 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 3, 4).getValue(), 4)
307 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 4, 0).getValue(), 5)
308 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 4, 1).getValue(), 5)
309 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 4, 2).getValue(), 5)
310 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 4, 3).getValue(), 5)
311 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 4, 4).getValue(), 5)
312 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 5, 0).getValue(), 6)
313 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 5, 1).getValue(), 6)
314 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 5, 2).getValue(), 6)
315 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 5, 3).getValue(), 6)
316 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 5, 4).getValue(), 6)
317 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 6, 0).getString(), "random content")
318 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 6, 1).getValue(), 0)
319 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 6, 2).getValue(), 0)
320 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 6, 3).getValue(), 0)
321 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 6, 4).getString(), "random content")
323 def test_text_to_columns_pipespace(self
):
325 with self
.ui_test
.load_file(get_url_for_data_file("text_to_columns_pipe_space.ods")) as calc_doc
:
326 xCalcDoc
= self
.xUITest
.getTopFocusWindow()
327 gridwin
= xCalcDoc
.getChild("grid_window")
329 # Select A1:A5 on Sheet
330 gridwin
.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A5"}))
331 # Data - Text to Columns
332 with self
.ui_test
.execute_dialog_through_command(".uno:TextToColumns", close_button
="") as xDialog
:
333 xSeparatedBy
= xDialog
.getChild("toseparatedby")
334 xSeparatedBy
.executeAction("CLICK", tuple())
336 xspace
= xDialog
.getChild("space")
337 xother
= xDialog
.getChild("other")
338 xinputother
= xDialog
.getChild("inputother")
339 if (get_state_as_dict(xspace
)["Selected"]) == "false":
340 xspace
.executeAction("CLICK", tuple())
341 if (get_state_as_dict(xother
)["Selected"]) == "false":
342 xother
.executeAction("CLICK", tuple())
343 xinputother
.executeAction("TYPE", mkPropertyValues({"TEXT":"|"}))
346 xOK
= xDialog
.getChild("ok")
347 with self
.ui_test
.execute_blocking_action(xOK
.executeAction
, args
=('CLICK', ()), close_button
="yes"):
351 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 0, 0).getValue(), 1)
352 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 0, 1).getValue(), 2)
353 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 0, 2).getValue(), 3)
354 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 0, 3).getValue(), 4)
355 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 0, 4).getValue(), 5)
356 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 1, 0).getValue(), 2)
357 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 1, 1).getValue(), 2)
358 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 1, 2).getValue(), 2)
359 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 1, 3).getValue(), 2)
360 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 1, 4).getValue(), 2)
361 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 2, 0).getValue(), 3)
362 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 2, 1).getValue(), 3)
363 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 2, 2).getValue(), 3)
364 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 2, 3).getValue(), 3)
365 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 2, 4).getValue(), 3)
366 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 3, 0).getValue(), 4)
367 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 3, 1).getValue(), 4)
368 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 3, 2).getValue(), 4)
369 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 3, 3).getValue(), 4)
370 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 3, 4).getValue(), 4)
371 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 4, 0).getValue(), 5)
372 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 4, 1).getValue(), 5)
373 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 4, 2).getValue(), 5)
374 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 4, 3).getValue(), 5)
375 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 4, 4).getValue(), 5)
376 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 5, 0).getValue(), 6)
377 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 5, 1).getValue(), 6)
378 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 5, 2).getValue(), 6)
379 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 5, 3).getValue(), 6)
380 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 5, 4).getValue(), 6)
381 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 6, 0).getString(), "random content")
382 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 6, 1).getValue(), 0)
383 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 6, 2).getValue(), 0)
384 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 6, 3).getValue(), 0)
385 self
.assertEqual(get_cell_by_position(calc_doc
, 0, 6, 4).getString(), "random content")
387 # vim: set shiftwidth=4 softtabstop=4 expandtab: