Avoid potential negative array index access to cached text.
[LibreOffice.git] / sc / qa / uitest / autofilter2 / tdf48025.py
blobe87b7c31b5e2baf7899714631e83bb889730776e
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.calc import enter_text_to_cell
11 from libreoffice.uno.propertyvalue import mkPropertyValues
13 #Bug 48025 - EDITING AUTOFILTER: Autofilter settings stay with the column number when deleting columns
15 class tdf48025(UITestCase):
16 def test_tdf48025_deleted_columns(self):
17 with self.ui_test.create_doc_in_start_center("calc"):
18 calcDoc = self.xUITest.getTopFocusWindow()
19 gridwin = calcDoc.getChild("grid_window")
21 enter_text_to_cell(gridwin, "A1", "A")
22 enter_text_to_cell(gridwin, "A2", "1")
23 enter_text_to_cell(gridwin, "A3", "2")
24 enter_text_to_cell(gridwin, "A4", "3")
26 enter_text_to_cell(gridwin, "B1", "B")
27 enter_text_to_cell(gridwin, "B2", "4")
28 enter_text_to_cell(gridwin, "B3", "5")
29 enter_text_to_cell(gridwin, "B4", "6")
31 enter_text_to_cell(gridwin, "C1", "C")
32 enter_text_to_cell(gridwin, "C2", "7")
33 enter_text_to_cell(gridwin, "C3", "8")
34 enter_text_to_cell(gridwin, "C4", "9")
36 gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C4"}))
38 self.xUITest.executeCommand(".uno:DataFilterAutoFilter")
40 gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"}))
41 xFloatWindow = self.xUITest.getFloatWindow()
42 xCheckListMenu = xFloatWindow.getChild("FilterDropDown")
43 xList = xCheckListMenu.getChild("check_list_box")
44 xEntry = xList.getChild("1")
45 xEntry.executeAction("CLICK", tuple())
47 xOkButton = xFloatWindow.getChild("ok")
48 xOkButton.executeAction("CLICK", tuple())
50 gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
52 self.xUITest.executeCommand(".uno:DeleteColumns")
54 gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
55 xFloatWindow = self.xUITest.getFloatWindow()
56 xCheckListMenu = xFloatWindow.getChild("FilterDropDown")
57 xList = xCheckListMenu.getChild("check_list_box")
58 self.assertEqual(3, len(xList.getChildren()))
59 xCloseBtn = xFloatWindow.getChild("cancel")
60 xCloseBtn.executeAction("CLICK", tuple())
62 gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"}))
63 xFloatWindow = self.xUITest.getFloatWindow()
64 xCheckListMenu = xFloatWindow.getChild("FilterDropDown")
65 xList = xCheckListMenu.getChild("check_list_box")
66 # since tdf#117267, we are showing the hidden filter rows as inactive elements (2 active + 1 inactive)
67 self.assertEqual(3, len(xList.getChildren()))
68 xCloseBtn = xFloatWindow.getChild("cancel")
69 xCloseBtn.executeAction("CLICK", tuple())
72 # vim: set shiftwidth=4 softtabstop=4 expandtab: