Version 6.4.0.3, tag libreoffice-6.4.0.3
[LibreOffice.git] / sc / qa / uitest / calc_tests4 / tdf89958.py
blobd08148fbd6479da27eee3704775ffdab126d260b
1 # -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
3 # This Source Code Form is subject to the terms of the Mozilla Public
4 # License, v. 2.0. If a copy of the MPL was not distributed with this
5 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 from uitest.framework import UITestCase
8 from uitest.uihelper.common import get_state_as_dict
9 from uitest.uihelper.common import select_pos
10 from uitest.uihelper.calc import enter_text_to_cell
11 from libreoffice.calc.document import get_cell_by_position
12 from libreoffice.uno.propertyvalue import mkPropertyValues
13 import org.libreoffice.unotest
14 import pathlib
15 #Bug 89958 - Data->Filter->Standard Filter, condition "does not end with" does filter too much
16 def get_url_for_data_file(file_name):
17 return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri()
19 class tdf89958(UITestCase):
20 def test_td89958_standard_filter(self):
21 calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf89958.ods"))
22 xCalcDoc = self.xUITest.getTopFocusWindow()
23 gridwin = xCalcDoc.getChild("grid_window")
24 document = self.ui_test.get_component()
25 #select A1-> Column .uno:SelectColumn
26 gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
27 self.xUITest.executeCommand(".uno:SelectColumn")
29 #Menu: Data->Filter->Standard Filter ...
30 #Field Name "Column A", Condition "Does not end with", Value: "CTORS"
31 self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter")
32 xDialog = self.xUITest.getTopFocusWindow()
33 xfield1 = xDialog.getChild("field1")
34 xval1 = xDialog.getChild("val1")
35 xcond1 = xDialog.getChild("cond1")
37 props = {"TEXT": "Column A"}
38 actionProps = mkPropertyValues(props)
39 xfield1.executeAction("SELECT", actionProps)
40 props2 = {"TEXT": "Does not end with"}
41 actionProps2 = mkPropertyValues(props2)
42 xcond1.executeAction("SELECT", actionProps2)
43 xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"CTORS"}))
44 xOKBtn = xDialog.getChild("ok")
45 self.ui_test.close_dialog_through_button(xOKBtn)
47 #Expected behaviours: A2 is not filtered as it does not end with "CTORS".
48 gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
49 gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"}))
50 gridWinState = get_state_as_dict(gridwin)
51 self.assertEqual(gridWinState["CurrentRow"], "1")
52 gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"}))
53 gridWinState = get_state_as_dict(gridwin)
54 self.assertEqual(gridWinState["CurrentRow"], "3")
55 # #reopen filter and verify - doesn't works
56 # gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"}))
57 # gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"}))
58 # self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter")
59 # xDialog = self.xUITest.getTopFocusWindow()
60 # xfield1 = xDialog.getChild("field1")
61 # xval1 = xDialog.getChild("val1")
62 # xcond1 = xDialog.getChild("cond1")
63 # self.assertEqual(get_state_as_dict(xfield1)["SelectEntryText"], "Column A")
64 # self.assertEqual(get_state_as_dict(xval1)["Text"], "CTORS")
65 # self.assertEqual(get_state_as_dict(xcond1)["SelectEntryText"], "Does not end with")
66 # xCancelBtn = xDialog.getChild("cancel")
67 # self.ui_test.close_dialog_through_button(xCancelBtn)
69 self.ui_test.close_doc()
71 # vim: set shiftwidth=4 softtabstop=4 expandtab: