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 141946 - EDITING Inserting column before autofiltered column empties autofilter
15 class tdf141946(UITestCase
):
16 def test_tdf141946_inserted_column(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 gridwin
.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B4"}))
33 self
.xUITest
.executeCommand(".uno:DataFilterAutoFilter")
35 gridwin
.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"}))
36 xFloatWindow
= self
.xUITest
.getFloatWindow()
37 xCheckListMenu
= xFloatWindow
.getChild("FilterDropDown")
38 xList
= xCheckListMenu
.getChild("check_list_box")
39 xEntry
= xList
.getChild("1")
40 xEntry
.executeAction("CLICK", tuple())
42 xOkButton
= xFloatWindow
.getChild("ok")
43 xOkButton
.executeAction("CLICK", tuple())
45 gridwin
.executeAction("SELECT", mkPropertyValues({"CELL": "B1"}))
47 self
.xUITest
.executeCommand(".uno:InsertColumnsBefore")
49 gridwin
.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
50 xFloatWindow
= self
.xUITest
.getFloatWindow()
51 xCheckListMenu
= xFloatWindow
.getChild("FilterDropDown")
52 xList
= xCheckListMenu
.getChild("check_list_box")
53 # since tdf#117267, we are showing the hidden filter rows as inactive elements (2 active + 1 inactive)
54 self
.assertEqual(3, len(xList
.getChildren()))
55 xCloseBtn
= xFloatWindow
.getChild("cancel")
56 xCloseBtn
.executeAction("CLICK", tuple())
58 gridwin
.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"}))
59 xFloatWindow
= self
.xUITest
.getFloatWindow()
60 xCheckListMenu
= xFloatWindow
.getChild("FilterDropDown")
61 xList
= xCheckListMenu
.getChild("check_list_box")
62 self
.assertEqual(1, len(xList
.getChildren()))
63 xCloseBtn
= xFloatWindow
.getChild("cancel")
64 xCloseBtn
.executeAction("CLICK", tuple())
66 gridwin
.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "2", "ROW": "0"}))
67 xFloatWindow
= self
.xUITest
.getFloatWindow()
68 xCheckListMenu
= xFloatWindow
.getChild("FilterDropDown")
69 xList
= xCheckListMenu
.getChild("check_list_box")
70 self
.assertEqual(3, len(xList
.getChildren()))
71 xCloseBtn
= xFloatWindow
.getChild("cancel")
72 xCloseBtn
.executeAction("CLICK", tuple())
75 # vim: set shiftwidth=4 softtabstop=4 expandtab: