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 libreoffice
.calc
.document
import get_cell_by_position
11 from libreoffice
.uno
.propertyvalue
import mkPropertyValues
12 from uitest
.uihelper
.common
import get_url_for_data_file
13 from uitest
.uihelper
.common
import get_state_as_dict
15 #Bug 101165 - Crashing on a filter selection, every time
17 class tdf101165(UITestCase
):
18 def test_tdf101165_autofilter(self
):
19 with self
.ui_test
.load_file(get_url_for_data_file("tdf101165.ods")) as calc_doc
:
20 xCalcDoc
= self
.xUITest
.getTopFocusWindow()
21 gridwin
= xCalcDoc
.getChild("grid_window")
23 gridwin
.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"}))
24 xFloatWindow
= self
.xUITest
.getFloatWindow()
25 xAll
= xFloatWindow
.getChild("toggle_all")
26 xAll
.executeAction("CLICK", tuple())
28 xCheckListMenu
= xFloatWindow
.getChild("FilterDropDown")
29 xTreeList
= xCheckListMenu
.getChild("check_tree_box")
30 self
.assertEqual(3, len(xTreeList
.getChildren()))
32 xChild
= xTreeList
.getChild(str(i
))
33 self
.assertEqual("false", get_state_as_dict(xChild
)["IsChecked"])
36 self
.assertEqual(2, len(xChild
.getChildren()))
38 self
.assertEqual("false", get_state_as_dict(xChild
.getChild(str(j
)))["IsChecked"])
40 self
.assertEqual(6, len(xChild
.getChildren()))
42 self
.assertEqual("false", get_state_as_dict(xChild
.getChild(str(j
)))["IsChecked"])
44 self
.assertEqual(0, len(xChild
.getChildren()))
47 self
.assertEqual(get_cell_by_position(calc_doc
, 1, 0, 1).getValue(), 6494)
49 # vim: set shiftwidth=4 softtabstop=4 expandtab: