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 uitest
.uihelper
.common
import select_by_text
, get_state_as_dict
12 from libreoffice
.uno
.propertyvalue
import mkPropertyValues
13 from libreoffice
.calc
.document
import get_row
15 #Bug 46184 - [Calc] [AutoFilter] Option "Copy results to ..." remains activated in AutoFilter
17 class tdf46184(UITestCase
):
18 def test_tdf46184_copy_results_to(self
):
19 with self
.ui_test
.create_doc_in_start_center("calc") as document
:
20 calcDoc
= self
.xUITest
.getTopFocusWindow()
21 gridwin
= calcDoc
.getChild("grid_window")
23 enter_text_to_cell(gridwin
, "A1", "A")
24 enter_text_to_cell(gridwin
, "A2", "1")
25 enter_text_to_cell(gridwin
, "A3", "2")
26 enter_text_to_cell(gridwin
, "A4", "3")
28 gridwin
.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"}))
30 self
.xUITest
.executeCommand(".uno:DataFilterAutoFilter")
32 gridwin
.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
33 xFloatWindow
= self
.xUITest
.getFloatWindow()
34 #Choose Standard Filter... button
35 xMenu
= xFloatWindow
.getChild("menu")
36 xMenu
.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
37 xMenu
.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
38 xMenu
.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
39 xMenu
.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
40 xMenu
.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"}))
41 xSubFloatWindow
= self
.xUITest
.getFloatWindow()
42 xSubMenu
= xSubFloatWindow
.getChild("menu")
43 xSubMenu
.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
44 xSubMenu
.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
45 xSubMenu
.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
46 xSubMenu
.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
47 self
.assertEqual("Standard Filter...", get_state_as_dict(xSubMenu
)['SelectEntryText'])
48 xSubMenu
.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"}))
50 xDialog
= self
.xUITest
.getTopFocusWindow()
51 xfield1
= xDialog
.getChild("field1")
52 xcond1
= xDialog
.getChild("cond1")
53 xval1
= xDialog
.getChild("val1")
54 xcopyresult
= xDialog
.getChild("copyresult")
55 xedcopyarea
= xDialog
.getChild("edcopyarea")
56 xdestpers
= xDialog
.getChild("destpers")
58 select_by_text(xfield1
, "A")
59 select_by_text(xcond1
, ">")
60 xval1
.executeAction("TYPE", mkPropertyValues({"TEXT":"1"}))
61 xcopyresult
.executeAction("CLICK", tuple())
62 xedcopyarea
.executeAction("TYPE", mkPropertyValues({"TEXT":"A6"}))
63 if get_state_as_dict(xdestpers
)['Selected'] == 'false':
64 xdestpers
.executeAction("CLICK", tuple())
65 self
.assertEqual('true', get_state_as_dict(xcopyresult
)['Selected'])
66 xOKBtn
= xDialog
.getChild("ok")
67 self
.ui_test
.close_dialog_through_button(xOKBtn
)
70 row1
= get_row(document
, 1)
71 row2
= get_row(document
, 2)
72 row3
= get_row(document
, 3)
73 self
.assertTrue(row1
.getPropertyValue("IsVisible"))
74 self
.assertTrue(row2
.getPropertyValue("IsVisible"))
75 self
.assertTrue(row3
.getPropertyValue("IsVisible"))
77 gridwin
.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
78 xFloatWindow
= self
.xUITest
.getFloatWindow()
79 xCheckListMenu
= xFloatWindow
.getChild("FilterDropDown")
80 xTreeList
= xCheckListMenu
.getChild("check_list_box")
81 xEntry
= xTreeList
.getChild("1")
82 xEntry
.executeAction("CLICK", tuple())
83 xOkBtn
= xFloatWindow
.getChild("ok")
84 xOkBtn
.executeAction("CLICK", tuple())
86 self
.assertTrue(row1
.getPropertyValue("IsVisible"))
87 self
.assertFalse(row2
.getPropertyValue("IsVisible"))
88 self
.assertTrue(row3
.getPropertyValue("IsVisible"))
90 # vim: set shiftwidth=4 softtabstop=4 expandtab: