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
, get_url_for_data_file
, select_by_text
12 from libreoffice
.uno
.propertyvalue
import mkPropertyValues
13 from libreoffice
.calc
.document
import is_row_hidden
14 from uitest
.uihelper
.calc
import enter_text_to_cell
16 class AutofilterTest(UITestCase
):
18 def test_tdf106214(self
):
19 with self
.ui_test
.load_file(get_url_for_data_file("autofilter.ods")) as doc
:
21 xGridWin
= self
.xUITest
.getTopFocusWindow().getChild("grid_window")
22 xGridWin
.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
24 xFloatWindow
= self
.xUITest
.getFloatWindow()
25 xCheckListMenu
= xFloatWindow
.getChild("FilterDropDown")
27 xTreeList
= xCheckListMenu
.getChild("check_tree_box")
28 xFirstEntry
= xTreeList
.getChild("0")
30 xFirstEntry
.executeAction("CLICK", tuple())
32 xOkBtn
= xFloatWindow
.getChild("ok")
33 xOkBtn
.executeAction("CLICK", tuple())
35 self
.assertFalse(is_row_hidden(doc
, 0))
36 self
.assertFalse(is_row_hidden(doc
, 1))
37 self
.assertFalse(is_row_hidden(doc
, 2))
38 self
.assertTrue(is_row_hidden(doc
, 3))
39 self
.assertFalse(is_row_hidden(doc
, 4))
41 def test_filter_multiple_rows(self
):
42 with self
.ui_test
.load_file(get_url_for_data_file("autofilter.ods")) as doc
:
44 xGridWin
= self
.xUITest
.getTopFocusWindow().getChild("grid_window")
45 xGridWin
.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "2", "ROW": "0"}))
46 xFloatWindow
= self
.xUITest
.getFloatWindow()
47 xCheckListMenu
= xFloatWindow
.getChild("FilterDropDown")
49 xTreeList
= xCheckListMenu
.getChild("check_list_box")
50 xFirstEntry
= xTreeList
.getChild("1")
52 xFirstEntry
.executeAction("CLICK", tuple())
54 xOkBtn
= xFloatWindow
.getChild("ok")
55 xOkBtn
.executeAction("CLICK", tuple())
57 self
.assertFalse(is_row_hidden(doc
, 0))
58 self
.assertFalse(is_row_hidden(doc
, 1))
59 self
.assertTrue(is_row_hidden(doc
, 2))
60 self
.assertTrue(is_row_hidden(doc
, 3))
61 self
.assertFalse(is_row_hidden(doc
, 4))
63 def test_tdf133160(self
):
64 with self
.ui_test
.load_file(get_url_for_data_file("tdf133160.ods")):
66 xGridWin
= self
.xUITest
.getTopFocusWindow().getChild("grid_window")
67 xGridWin
.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "3"}))
68 xFloatWindow
= self
.xUITest
.getFloatWindow()
69 xCheckListMenu
= xFloatWindow
.getChild("FilterDropDown")
70 xTreeList
= xCheckListMenu
.getChild("check_list_box")
71 size1
= int(get_state_as_dict(xTreeList
)["Size"].split('x')[0])
72 xOkBtn
= xFloatWindow
.getChild("cancel")
73 xOkBtn
.executeAction("CLICK", tuple())
75 xGridWin
.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "2", "ROW": "3"}))
76 xFloatWindow
= self
.xUITest
.getFloatWindow()
77 xCheckListMenu
= xFloatWindow
.getChild("FilterDropDown")
78 xTreeList
= xCheckListMenu
.getChild("check_list_box")
79 size2
= int(get_state_as_dict(xTreeList
)["Size"].split('x')[0])
80 xOkBtn
= xFloatWindow
.getChild("cancel")
81 xOkBtn
.executeAction("CLICK", tuple())
83 xGridWin
.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "3", "ROW": "3"}))
84 xFloatWindow
= self
.xUITest
.getFloatWindow()
85 xCheckListMenu
= xFloatWindow
.getChild("FilterDropDown")
86 xTreeList
= xCheckListMenu
.getChild("check_list_box")
87 size3
= int(get_state_as_dict(xTreeList
)["Size"].split('x')[0])
88 xOkBtn
= xFloatWindow
.getChild("cancel")
89 xOkBtn
.executeAction("CLICK", tuple())
91 xGridWin
.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "4", "ROW": "3"}))
92 xFloatWindow
= self
.xUITest
.getFloatWindow()
93 xCheckListMenu
= xFloatWindow
.getChild("FilterDropDown")
94 xTreeList
= xCheckListMenu
.getChild("check_list_box")
95 size4
= int(get_state_as_dict(xTreeList
)["Size"].split('x')[0])
97 xOkBtn
= xFloatWindow
.getChild("cancel")
98 xOkBtn
.executeAction("CLICK", tuple())
100 self
.assertTrue(size1
< size2
) # for me they were size1=176 size2=212 size3=459 size4=1012
101 self
.assertTrue(size2
< size3
) # size1 is the minimum window width, size2 based on its column width
102 self
.assertTrue(size3
< size4
) # size3 is a long text width
103 self
.assertTrue(size4
< 1500) # size4 is the maximum window width with a really long text
105 def test_tdf134351(self
):
106 with self
.ui_test
.load_file(get_url_for_data_file("autofilter.ods")) as doc
:
108 xGridWin
= self
.xUITest
.getTopFocusWindow().getChild("grid_window")
109 xGridWin
.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
111 xFloatWindow
= self
.xUITest
.getFloatWindow()
112 xCheckListMenu
= xFloatWindow
.getChild("FilterDropDown")
114 xTreeList
= xCheckListMenu
.getChild("check_tree_box")
116 self
.assertEqual(2, len(xTreeList
.getChildren()))
117 self
.assertTrue(get_state_as_dict(xTreeList
.getChild('0'))['IsSelected'])
118 self
.assertTrue(get_state_as_dict(xTreeList
.getChild('1'))['IsSelected'])
120 xOkBtn
= xFloatWindow
.getChild("ok")
121 xOkBtn
.executeAction("CLICK", tuple())
123 self
.assertFalse(is_row_hidden(doc
, 0))
124 # Without the fix in place, this test would have failed here
125 self
.assertFalse(is_row_hidden(doc
, 1))
126 self
.assertFalse(is_row_hidden(doc
, 2))
127 self
.assertFalse(is_row_hidden(doc
, 3))
128 self
.assertFalse(is_row_hidden(doc
, 4))
130 def test_differentSearches(self
):
131 with self
.ui_test
.create_doc_in_start_center("calc") as document
:
132 calcDoc
= self
.xUITest
.getTopFocusWindow()
134 xGridWindow
= calcDoc
.getChild("grid_window")
135 enter_text_to_cell(xGridWindow
, "A1", "X")
136 enter_text_to_cell(xGridWindow
, "A2", "11")
137 enter_text_to_cell(xGridWindow
, "A3", "22")
138 xGridWindow
.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A3"}))
140 self
.xUITest
.executeCommand(".uno:DataFilterAutoFilter")
142 xGridWindow
.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
144 xFloatWindow
= self
.xUITest
.getFloatWindow()
146 xCheckListMenu
= xFloatWindow
.getChild("FilterDropDown")
148 xList
= xCheckListMenu
.getChild("check_list_box")
150 self
.assertEqual(2, len(xList
.getChildren()))
151 self
.assertEqual("11", get_state_as_dict(xList
.getChild('0'))['Text'])
152 self
.assertEqual("22", get_state_as_dict(xList
.getChild('1'))['Text'])
154 xSearchEdit
= xFloatWindow
.getChild("search_edit")
155 xSearchEdit
.executeAction("TYPE", mkPropertyValues({"TEXT" : "11"}))
157 self
.ui_test
.wait_until_property_is_updated(xList
, "Children", str(1))
158 self
.assertEqual(1, len(xList
.getChildren()))
159 self
.assertEqual("11", get_state_as_dict(xList
.getChild('0'))['Text'])
161 xOkBtn
= xFloatWindow
.getChild("ok")
162 xOkBtn
.executeAction("CLICK", tuple())
164 self
.assertFalse(is_row_hidden(document
, 0))
165 self
.assertFalse(is_row_hidden(document
, 1))
166 self
.assertTrue(is_row_hidden(document
, 2))
168 xGridWindow
.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
170 xFloatWindow
= self
.xUITest
.getFloatWindow()
172 xCheckListMenu
= xFloatWindow
.getChild("FilterDropDown")
174 xList
= xCheckListMenu
.getChild("check_list_box")
176 self
.assertEqual(2, len(xList
.getChildren()))
177 self
.assertEqual("11", get_state_as_dict(xList
.getChild('0'))['Text'])
178 self
.assertEqual("22", get_state_as_dict(xList
.getChild('1'))['Text'])
180 xSearchEdit
= xFloatWindow
.getChild("search_edit")
181 xSearchEdit
.executeAction("TYPE", mkPropertyValues({"TEXT" : "22"}))
183 self
.ui_test
.wait_until_property_is_updated(xList
, "Children", str(1))
184 self
.assertEqual(1, len(xList
.getChildren()))
185 self
.assertEqual("22", get_state_as_dict(xList
.getChild('0'))['Text'])
187 xOkBtn
= xFloatWindow
.getChild("ok")
188 xOkBtn
.executeAction("CLICK", tuple())
191 self
.assertFalse(is_row_hidden(document
, 0))
192 self
.assertTrue(is_row_hidden(document
, 1))
193 self
.assertFalse(is_row_hidden(document
, 2))
196 def test_tdf89244(self
):
197 with self
.ui_test
.create_doc_in_start_center("calc"):
198 xCalcDoc
= self
.xUITest
.getTopFocusWindow()
199 gridwin
= xCalcDoc
.getChild("grid_window")
201 enter_text_to_cell(gridwin
, "A1", "AAA")
202 enter_text_to_cell(gridwin
, "A3", "BBB")
203 gridwin
.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A2"}))
205 self
.xUITest
.executeCommand(".uno:MergeCells")
207 self
.xUITest
.executeCommand(".uno:DataFilterAutoFilter")
209 gridwin
.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
211 xFloatWindow
= self
.xUITest
.getFloatWindow()
213 xCheckListMenu
= xFloatWindow
.getChild("FilterDropDown")
215 xList
= xCheckListMenu
.getChild("check_list_box")
217 self
.assertEqual(2, len(xList
.getChildren()))
218 self
.assertEqual("(empty)", get_state_as_dict(xList
.getChild('0'))['Text'])
219 self
.assertEqual("BBB", get_state_as_dict(xList
.getChild('1'))['Text'])
221 xOkBtn
= xFloatWindow
.getChild("ok")
222 xOkBtn
.executeAction("CLICK", tuple())
225 def test_tdf116818(self
):
226 with self
.ui_test
.load_file(get_url_for_data_file("tdf116818.xlsx")):
228 xGridWin
= self
.xUITest
.getTopFocusWindow().getChild("grid_window")
230 xGridWin
.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
231 xFloatWindow
= self
.xUITest
.getFloatWindow()
232 xCheckListMenu
= xFloatWindow
.getChild("FilterDropDown")
233 xTreeList
= xCheckListMenu
.getChild("check_tree_box")
234 self
.assertEqual(3, len(xTreeList
.getChildren()))
235 xOkBtn
= xFloatWindow
.getChild("cancel")
236 xOkBtn
.executeAction("CLICK", tuple())
238 xGridWin
.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"}))
239 xFloatWindow
= self
.xUITest
.getFloatWindow()
240 xCheckListMenu
= xFloatWindow
.getChild("FilterDropDown")
241 xTreeList
= xCheckListMenu
.getChild("check_list_box")
242 # since tdf#117267, we are showing the hidden filter rows as inactive elements (5 active + 3 inactive)
243 self
.assertEqual(8, len(xTreeList
.getChildren()))
244 xOkBtn
= xFloatWindow
.getChild("cancel")
245 xOkBtn
.executeAction("CLICK", tuple())
247 xGridWin
.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "2", "ROW": "0"}))
248 xFloatWindow
= self
.xUITest
.getFloatWindow()
249 xCheckListMenu
= xFloatWindow
.getChild("FilterDropDown")
250 xTreeList
= xCheckListMenu
.getChild("check_list_box")
251 # since tdf#117267, we are showing the hidden filter rows as inactive elements (3 active + 9 inactive)
252 self
.assertEqual(12, len(xTreeList
.getChildren()))
253 xOkBtn
= xFloatWindow
.getChild("cancel")
254 xOkBtn
.executeAction("CLICK", tuple())
256 def test_tdf140469(self
):
257 with self
.ui_test
.load_file(get_url_for_data_file("tdf140469.xlsx")):
259 xGridWin
= self
.xUITest
.getTopFocusWindow().getChild("grid_window")
261 xGridWin
.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"}))
262 xFloatWindow
= self
.xUITest
.getFloatWindow()
263 xCheckListMenu
= xFloatWindow
.getChild("FilterDropDown")
264 xTreeList
= xCheckListMenu
.getChild("check_list_box")
265 # since tdf#117267, we are showing the hidden filter rows as inactive elements (9 active + 3 inactive)
266 self
.assertEqual(12, len(xTreeList
.getChildren()))
267 xOkBtn
= xFloatWindow
.getChild("cancel")
268 xOkBtn
.executeAction("CLICK", tuple())
270 def test_tdf140462(self
):
271 with self
.ui_test
.load_file(get_url_for_data_file("tdf140462.ods")):
273 xGridWin
= self
.xUITest
.getTopFocusWindow().getChild("grid_window")
275 xGridWin
.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
276 xFloatWindow
= self
.xUITest
.getFloatWindow()
277 xCheckListMenu
= xFloatWindow
.getChild("FilterDropDown")
278 xTreeList
= xCheckListMenu
.getChild("check_tree_box")
279 self
.assertEqual(3, len(xTreeList
.getChildren()))
280 xOkBtn
= xFloatWindow
.getChild("cancel")
281 xOkBtn
.executeAction("CLICK", tuple())
283 xGridWin
.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"}))
284 xFloatWindow
= self
.xUITest
.getFloatWindow()
285 xCheckListMenu
= xFloatWindow
.getChild("FilterDropDown")
286 xTreeList
= xCheckListMenu
.getChild("check_list_box")
287 # since tdf#117267, we are showing the hidden filter rows as inactive elements (3 active + 5 inactive)
288 self
.assertEqual(8, len(xTreeList
.getChildren()))
289 xOkBtn
= xFloatWindow
.getChild("cancel")
290 xOkBtn
.executeAction("CLICK", tuple())
292 xGridWin
.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "2", "ROW": "0"}))
293 xFloatWindow
= self
.xUITest
.getFloatWindow()
294 xCheckListMenu
= xFloatWindow
.getChild("FilterDropDown")
295 xTreeList
= xCheckListMenu
.getChild("check_list_box")
296 # since tdf#117267, we are showing the hidden filter rows as inactive elements (4 active + 8 inactive)
297 self
.assertEqual(12, len(xTreeList
.getChildren()))
298 xOkBtn
= xFloatWindow
.getChild("cancel")
299 xOkBtn
.executeAction("CLICK", tuple())
301 def test_tdf137626(self
):
302 with self
.ui_test
.load_file(get_url_for_data_file("tdf137626.xlsx")):
304 xGridWin
= self
.xUITest
.getTopFocusWindow().getChild("grid_window")
306 xGridWin
.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"}))
307 xFloatWindow
= self
.xUITest
.getFloatWindow()
308 xCheckListMenu
= xFloatWindow
.getChild("FilterDropDown")
309 xTreeList
= xCheckListMenu
.getChild("check_list_box")
310 # since tdf#117267, we are showing the hidden filter rows as inactive elements (3 active + 1 inactive)
311 self
.assertEqual(4, len(xTreeList
.getChildren()))
312 xOkBtn
= xFloatWindow
.getChild("cancel")
313 xOkBtn
.executeAction("CLICK", tuple())
315 def test_time_value(self
):
316 with self
.ui_test
.load_file(get_url_for_data_file("time_value.xlsx")):
318 xGridWin
= self
.xUITest
.getTopFocusWindow().getChild("grid_window")
320 xGridWin
.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
321 xFloatWindow
= self
.xUITest
.getFloatWindow()
322 xCheckListMenu
= xFloatWindow
.getChild("FilterDropDown")
323 xTreeList
= xCheckListMenu
.getChild("check_list_box")
324 self
.assertEqual(5, len(xTreeList
.getChildren()))
325 self
.assertEqual('true', get_state_as_dict(xTreeList
.getChild('0'))['IsChecked'])
326 self
.assertEqual('false', get_state_as_dict(xTreeList
.getChild('1'))['IsChecked'])
327 self
.assertEqual('true', get_state_as_dict(xTreeList
.getChild('2'))['IsChecked'])
328 self
.assertEqual('false', get_state_as_dict(xTreeList
.getChild('3'))['IsChecked'])
329 self
.assertEqual('true', get_state_as_dict(xTreeList
.getChild('4'))['IsChecked'])
330 xOkBtn
= xFloatWindow
.getChild("cancel")
331 xOkBtn
.executeAction("CLICK", tuple())
333 xGridWin
.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"}))
334 xFloatWindow
= self
.xUITest
.getFloatWindow()
335 xCheckListMenu
= xFloatWindow
.getChild("FilterDropDown")
336 xTreeList
= xCheckListMenu
.getChild("check_list_box")
337 # since tdf#117267, we are showing the hidden filter rows as inactive elements (2 active + 1 inactive)
338 self
.assertEqual(3, len(xTreeList
.getChildren()))
339 xOkBtn
= xFloatWindow
.getChild("cancel")
340 xOkBtn
.executeAction("CLICK", tuple())
342 def test_tdf140968(self
):
343 with self
.ui_test
.load_file(get_url_for_data_file("tdf140968.xlsx")) as doc
:
345 xGridWin
= self
.xUITest
.getTopFocusWindow().getChild("grid_window")
347 xGridWin
.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
348 xFloatWindow
= self
.xUITest
.getFloatWindow()
349 xCheckListMenu
= xFloatWindow
.getChild("FilterDropDown")
350 xTreeList
= xCheckListMenu
.getChild("check_list_box")
351 self
.assertEqual(5, len(xTreeList
.getChildren()))
352 self
.assertEqual("0.000", get_state_as_dict(xTreeList
.getChild('0'))['Text'])
353 self
.assertEqual("0.046", get_state_as_dict(xTreeList
.getChild('1'))['Text'])
354 self
.assertEqual("0.365", get_state_as_dict(xTreeList
.getChild('2'))['Text'])
355 self
.assertEqual("0.500", get_state_as_dict(xTreeList
.getChild('3'))['Text'])
356 self
.assertEqual("0.516", get_state_as_dict(xTreeList
.getChild('4'))['Text'])
358 self
.assertEqual('false', get_state_as_dict(xTreeList
.getChild('0'))['IsChecked'])
359 self
.assertEqual('true', get_state_as_dict(xTreeList
.getChild('1'))['IsChecked'])
360 self
.assertEqual('false', get_state_as_dict(xTreeList
.getChild('2'))['IsChecked'])
361 self
.assertEqual('true', get_state_as_dict(xTreeList
.getChild('3'))['IsChecked'])
362 self
.assertEqual('true', get_state_as_dict(xTreeList
.getChild('4'))['IsChecked'])
364 xFirstEntry
= xTreeList
.getChild("0")
365 xFirstEntry
.executeAction("CLICK", tuple())
366 xFirstEntry
= xTreeList
.getChild("1")
367 xFirstEntry
.executeAction("CLICK", tuple())
369 xOkBtn
= xFloatWindow
.getChild("ok")
370 xOkBtn
.executeAction("CLICK", tuple())
372 self
.assertFalse(is_row_hidden(doc
, 0))
373 self
.assertTrue(is_row_hidden(doc
, 1))
374 self
.assertTrue(is_row_hidden(doc
, 2))
375 self
.assertTrue(is_row_hidden(doc
, 3))
376 self
.assertTrue(is_row_hidden(doc
, 4))
377 self
.assertFalse(is_row_hidden(doc
, 5))
378 self
.assertFalse(is_row_hidden(doc
, 6))
379 self
.assertFalse(is_row_hidden(doc
, 7))
381 def test_tdf36383_row_height(self
):
382 with self
.ui_test
.create_doc_in_start_center("calc") as document
:
383 calcDoc
= self
.xUITest
.getTopFocusWindow()
384 gridwin
= calcDoc
.getChild("grid_window")
386 enter_text_to_cell(gridwin
, "A1", "A")
387 enter_text_to_cell(gridwin
, "A2", "1")
388 enter_text_to_cell(gridwin
, "A3", "2")
389 enter_text_to_cell(gridwin
, "A4", "3")
390 gridwin
.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"}))
392 self
.xUITest
.executeCommand(".uno:DataFilterAutoFilter")
393 gridwin
.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
394 xFloatWindow
= self
.xUITest
.getFloatWindow()
395 xCheckListMenu
= xFloatWindow
.getChild("FilterDropDown")
396 xTreeList
= xCheckListMenu
.getChild("check_list_box")
397 xEntry
= xTreeList
.getChild("1")
398 xEntry
.executeAction("CLICK", tuple())
400 xOkButton
= xFloatWindow
.getChild("ok")
401 xOkButton
.executeAction("CLICK", tuple())
403 self
.assertTrue(is_row_hidden(document
, 2))
406 with self
.ui_test
.execute_dialog_through_command(".uno:RowHeight") as xDialog
:
407 xvalue
= xDialog
.getChild("value")
408 xvalue
.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
409 xvalue
.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
410 xvalue
.executeAction("TYPE", mkPropertyValues({"TEXT":"1 cm"}))
412 self
.assertTrue(is_row_hidden(document
, 2))
415 with self
.ui_test
.execute_dialog_through_command(".uno:SetOptimalRowHeight"):
418 self
.assertTrue(is_row_hidden(document
, 2))
420 def test_tdf142350(self
):
421 with self
.ui_test
.create_doc_in_start_center("calc") as document
:
422 calcDoc
= self
.xUITest
.getTopFocusWindow()
423 gridwin
= calcDoc
.getChild("grid_window")
425 enter_text_to_cell(gridwin
, "A1", "A")
426 enter_text_to_cell(gridwin
, "A2", "0")
427 enter_text_to_cell(gridwin
, "A3", "")
428 enter_text_to_cell(gridwin
, "A4", "1")
430 gridwin
.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"}))
432 self
.xUITest
.executeCommand(".uno:DataFilterAutoFilter")
434 gridwin
.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
435 xFloatWindow
= self
.xUITest
.getFloatWindow()
436 xCheckListMenu
= xFloatWindow
.getChild("FilterDropDown")
437 xList
= xCheckListMenu
.getChild("check_list_box")
439 # tdf140745 show (empty) entry on top of the checkbox list
440 self
.assertEqual(3, len(xList
.getChildren()))
441 self
.assertEqual("(empty)", get_state_as_dict(xList
.getChild('0'))['Text'])
442 self
.assertEqual("0", get_state_as_dict(xList
.getChild('1'))['Text'])
443 self
.assertEqual("1", get_state_as_dict(xList
.getChild('2'))['Text'])
445 xEntry
= xList
.getChild("0")
446 xEntry
.executeAction("CLICK", tuple())
448 xOkButton
= xFloatWindow
.getChild("ok")
449 xOkButton
.executeAction("CLICK", tuple())
451 self
.assertFalse(is_row_hidden(document
, 1))
452 self
.assertTrue(is_row_hidden(document
, 2))
453 self
.assertFalse(is_row_hidden(document
, 3))
455 gridwin
.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
456 xFloatWindow
= self
.xUITest
.getFloatWindow()
457 xCheckListMenu
= xFloatWindow
.getChild("FilterDropDown")
458 xList
= xCheckListMenu
.getChild("check_list_box")
459 self
.assertEqual(3, len(xList
.getChildren()))
460 self
.assertEqual('false', get_state_as_dict(xList
.getChild('0'))['IsChecked'])
461 self
.assertEqual('true', get_state_as_dict(xList
.getChild('1'))['IsChecked'])
462 self
.assertEqual('true', get_state_as_dict(xList
.getChild('2'))['IsChecked'])
463 xCloseButton
= xFloatWindow
.getChild("cancel")
464 xCloseButton
.executeAction("CLICK", tuple())
467 def test_tdf138438(self
):
468 with self
.ui_test
.load_file(get_url_for_data_file("tdf138438.ods")) as doc
:
470 xGridWin
= self
.xUITest
.getTopFocusWindow().getChild("grid_window")
473 xGridWin
.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"}))
474 xFloatWindow
= self
.xUITest
.getFloatWindow()
475 xMenu
= xFloatWindow
.getChild("menu")
476 xMenu
.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
477 xMenu
.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
478 xMenu
.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
479 xMenu
.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
480 xMenu
.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"}))
481 xSubFloatWindow
= self
.xUITest
.getFloatWindow()
482 xSubMenu
= xSubFloatWindow
.getChild("menu")
483 xSubMenu
.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
484 xSubMenu
.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
485 xSubMenu
.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"}))
487 self
.assertFalse(is_row_hidden(doc
, 0))
488 self
.assertTrue(is_row_hidden(doc
, 1))
489 self
.assertTrue(is_row_hidden(doc
, 2))
490 self
.assertFalse(is_row_hidden(doc
, 3))
491 self
.assertFalse(is_row_hidden(doc
, 4))
492 self
.assertFalse(is_row_hidden(doc
, 5))
493 self
.assertFalse(is_row_hidden(doc
, 6))
494 self
.assertTrue(is_row_hidden(doc
, 7))
495 self
.assertFalse(is_row_hidden(doc
, 8))
497 def test_tdf142402(self
):
498 with self
.ui_test
.load_file(get_url_for_data_file("tdf140968.xlsx")) as doc
:
500 xGridWin
= self
.xUITest
.getTopFocusWindow().getChild("grid_window")
502 xGridWin
.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B8"}))
503 with self
.ui_test
.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") as xDialog
:
504 xval1
= xDialog
.getChild("val1")
506 select_by_text(xval1
, "0.365")
509 self
.assertFalse(is_row_hidden(doc
, 0))
510 self
.assertFalse(is_row_hidden(doc
, 1))
511 self
.assertTrue(is_row_hidden(doc
, 2))
512 self
.assertTrue(is_row_hidden(doc
, 3))
513 self
.assertTrue(is_row_hidden(doc
, 4))
514 self
.assertTrue(is_row_hidden(doc
, 5))
515 self
.assertTrue(is_row_hidden(doc
, 6))
517 def test_tdf142910(self
):
518 with self
.ui_test
.load_file(get_url_for_data_file("tdf140968.xlsx")) as doc
:
520 xGridWin
= self
.xUITest
.getTopFocusWindow().getChild("grid_window")
523 xGridWin
.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B8"}))
524 with self
.ui_test
.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") as xDialog
:
526 xfield1
= xDialog
.getChild("field1")
527 xval1
= xDialog
.getChild("val1")
528 xcond1
= xDialog
.getChild("cond1")
530 select_by_text(xfield1
, "Values")
531 select_by_text(xcond1
, "<")
532 select_by_text(xval1
, "0.365")
535 self
.assertFalse(is_row_hidden(doc
, 0))
536 self
.assertTrue(is_row_hidden(doc
, 1))
537 self
.assertFalse(is_row_hidden(doc
, 2))
538 self
.assertFalse(is_row_hidden(doc
, 3))
539 self
.assertFalse(is_row_hidden(doc
, 4))
540 self
.assertFalse(is_row_hidden(doc
, 5))
541 self
.assertTrue(is_row_hidden(doc
, 6))
542 self
.assertTrue(is_row_hidden(doc
, 7))
545 xGridWin
.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B8"}))
546 with self
.ui_test
.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") as xDialog
:
547 xfield1
= xDialog
.getChild("field1")
548 xval1
= xDialog
.getChild("val1")
549 xcond1
= xDialog
.getChild("cond1")
551 select_by_text(xfield1
, "Values")
552 select_by_text(xcond1
, ">=")
553 select_by_text(xval1
, "0.046")
556 self
.assertFalse(is_row_hidden(doc
, 0))
557 self
.assertFalse(is_row_hidden(doc
, 1))
558 self
.assertFalse(is_row_hidden(doc
, 2))
559 self
.assertFalse(is_row_hidden(doc
, 3))
560 self
.assertFalse(is_row_hidden(doc
, 4))
561 self
.assertTrue(is_row_hidden(doc
, 5))
562 self
.assertFalse(is_row_hidden(doc
, 6))
563 self
.assertFalse(is_row_hidden(doc
, 7))
565 def test_tdf144253(self
):
566 with self
.ui_test
.load_file(get_url_for_data_file("tdf144253.ods")) as doc
:
568 xGridWin
= self
.xUITest
.getTopFocusWindow().getChild("grid_window")
570 xGridWin
.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "4", "ROW": "0"}))
571 xFloatWindow
= self
.xUITest
.getFloatWindow()
572 xCheckListMenu
= xFloatWindow
.getChild("FilterDropDown")
573 xTreeList
= xCheckListMenu
.getChild("check_list_box")
574 self
.assertEqual(2, len(xTreeList
.getChildren()))
575 self
.assertEqual("65.43", get_state_as_dict(xTreeList
.getChild('0'))['Text'])
576 self
.assertEqual("83.33", get_state_as_dict(xTreeList
.getChild('1'))['Text'])
578 xFirstEntry
= xTreeList
.getChild("1")
579 xFirstEntry
.executeAction("CLICK", tuple())
581 xOkBtn
= xFloatWindow
.getChild("ok")
582 xOkBtn
.executeAction("CLICK", tuple())
584 self
.assertFalse(is_row_hidden(doc
, 0))
585 self
.assertTrue(is_row_hidden(doc
, 1))
586 self
.assertFalse(is_row_hidden(doc
, 2))
588 # vim: set shiftwidth=4 softtabstop=4 expandtab: