nss: upgrade to release 3.73
[LibreOffice.git] / sc / qa / uitest / autofilter / autofilterBugs.py
blobe1d0cd19d524ad0ea9c523adaf74e6ddc00fd078
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 libreoffice.uno.propertyvalue import mkPropertyValues
9 from uitest.uihelper.common import get_state_as_dict
10 from uitest.uihelper.calc import enter_text_to_cell
12 import org.libreoffice.unotest
13 import pathlib
15 def get_url_for_data_file(file_name):
16 return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri()
18 class autofilter(UITestCase):
20 def test_tdf115046(self):
21 calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf115046.ods"))
22 document = self.ui_test.get_component()
23 #autofilter exist
24 self.assertEqual(document.getPropertyValue("UnnamedDatabaseRanges").getByTable(0).AutoFilter, True)
26 self.ui_test.execute_dialog_through_command(".uno:DataSort")
27 xDialog = self.xUITest.getTopFocusWindow()
29 xcancBtn = xDialog.getChild("cancel")
30 self.ui_test.close_dialog_through_button(xcancBtn)
31 #autofilter still exist
32 self.assertEqual(document.getPropertyValue("UnnamedDatabaseRanges").getByTable(0).AutoFilter, True)
34 self.ui_test.close_doc()
36 def test_tdf94055(self):
37 self.ui_test.create_doc_in_start_center("calc")
38 document = self.ui_test.get_component()
39 calcDoc = self.xUITest.getTopFocusWindow()
40 xGridWindow = calcDoc.getChild("grid_window")
41 enter_text_to_cell(xGridWindow, "A1", "X")
42 enter_text_to_cell(xGridWindow, "B1", "Y")
43 enter_text_to_cell(xGridWindow, "A2", "a")
44 enter_text_to_cell(xGridWindow, "B2", "b")
45 enter_text_to_cell(xGridWindow, "A3", "c")
46 enter_text_to_cell(xGridWindow, "B3", "d")
47 xGridWindow.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B1"}))
49 self.ui_test.execute_dialog_through_command(".uno:DataFilterAutoFilter")
50 xDialog = self.xUITest.getTopFocusWindow()
51 xYesBtn = xDialog.getChild("yes")
52 self.ui_test.close_dialog_through_button(xYesBtn)
54 xGridWindow.executeAction("SELECT", mkPropertyValues({"RANGE": "A2:A3"}))
55 self.xUITest.executeCommand(".uno:SelectRow") #select two rows
57 self.ui_test.execute_dialog_through_command(".uno:DataSort")
58 xDialog = self.xUITest.getTopFocusWindow()
59 xOKBtn = xDialog.getChild("ok")
60 self.ui_test.close_dialog_through_button(xOKBtn)
61 #autofilter still exist
62 self.assertEqual(document.getPropertyValue("UnnamedDatabaseRanges").getByTable(0).AutoFilter, True)
64 self.ui_test.close_doc()
66 #tdf77479.ods
67 def test_tdf77479(self):
68 calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf77479.ods"))
69 document = self.ui_test.get_component()
70 calcDoc = self.xUITest.getTopFocusWindow()
71 xGridWindow = calcDoc.getChild("grid_window")
72 #autofilter exist
73 self.assertEqual(document.getPropertyValue("UnnamedDatabaseRanges").getByTable(0).AutoFilter, True)
75 xGridWindow.executeAction("SELECT", mkPropertyValues({"RANGE": "A2:E6"}))
77 self.ui_test.execute_dialog_through_command(".uno:DataSort")
78 xDialog = self.xUITest.getTopFocusWindow()
79 xOKBtn = xDialog.getChild("ok")
80 self.ui_test.close_dialog_through_button(xOKBtn)
81 #autofilter still exist
82 self.assertEqual(document.getPropertyValue("UnnamedDatabaseRanges").getByTable(0).AutoFilter, True)
84 self.ui_test.close_doc()
86 #112656
87 def test_tdf112656(self):
88 calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf112656.ods"))
89 document = self.ui_test.get_component()
90 calcDoc = self.xUITest.getTopFocusWindow()
91 xGridWindow = calcDoc.getChild("grid_window")
93 xGridWindow.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "2", "ROW": "0"}))
94 xFloatWindow = self.xUITest.getFloatWindow()
95 xTreeList = xFloatWindow.getChild("check_list_box")
96 xFirstEntry = xTreeList.getChild("0")
97 xSecondEntry = xTreeList.getChild("1")
98 self.assertEqual(get_state_as_dict(xFirstEntry)["Text"], "Fruit")
99 self.assertEqual(get_state_as_dict(xSecondEntry)["Text"], "Vegetables")
101 self.ui_test.close_doc()
103 #tdf81124
104 def test_tdf81124(self):
105 calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf81124.ods"))
106 document = self.ui_test.get_component()
107 calcDoc = self.xUITest.getTopFocusWindow()
108 xGridWindow = calcDoc.getChild("grid_window")
110 xGridWindow.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
111 xFloatWindow = self.xUITest.getFloatWindow()
113 xUnselect = xFloatWindow.getChild("unselect_current")
114 xUnselect.executeAction("CLICK", tuple())
115 xokBtn = xFloatWindow.getChild("ok")
116 self.assertEqual(get_state_as_dict(xokBtn)["Enabled"], "false")
118 xSelect = xFloatWindow.getChild("select_current")
119 xSelect.executeAction("CLICK", tuple())
120 xokBtn = xFloatWindow.getChild("ok")
121 self.assertEqual(get_state_as_dict(xokBtn)["Enabled"], "true")
123 xCancel = xFloatWindow.getChild("cancel")
124 xCancel.executeAction("CLICK", tuple())
126 self.ui_test.close_doc()
128 #tdf73565
129 def test_tdf73565(self):
130 calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf73565.ods"))
131 document = self.ui_test.get_component()
132 calcDoc = self.xUITest.getTopFocusWindow()
133 xGridWindow = calcDoc.getChild("grid_window")
135 xGridWindow.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
136 xFloatWindow = self.xUITest.getFloatWindow()
137 xTreeList = xFloatWindow.getChild("check_tree_box")
138 xFirstEntry = xTreeList.getChild("0")
139 self.assertEqual(get_state_as_dict(xFirstEntry)["Text"], "2014")
141 xCancel = xFloatWindow.getChild("cancel")
142 xCancel.executeAction("CLICK", tuple())
144 self.ui_test.close_doc()
146 #tdf65505
147 def test_tdf65505(self):
148 calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf81124.ods"))
149 document = self.ui_test.get_component()
150 calcDoc = self.xUITest.getTopFocusWindow()
151 xGridWindow = calcDoc.getChild("grid_window")
153 xGridWindow.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
154 xFloatWindow = self.xUITest.getFloatWindow()
155 xTreeList = xFloatWindow.getChild("check_list_box")
156 xFirstEntry = xTreeList.getChild("0")
157 self.assertEqual(get_state_as_dict(xFirstEntry)["Text"], "(empty)")
159 xCancel = xFloatWindow.getChild("cancel")
160 xCancel.executeAction("CLICK", tuple())
162 self.ui_test.close_doc()
164 #tdf74857
165 def test_tdf74857(self):
166 calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf74857.ods"))
167 document = self.ui_test.get_component()
168 calcDoc = self.xUITest.getTopFocusWindow()
169 xGridWindow = calcDoc.getChild("grid_window")
171 xGridWindow.executeAction("TYPE", mkPropertyValues({"KEYCODE":"SHIFT+CTRL+DOWN"}))
172 # Assert that the correct range has been selected
173 gridWinState = get_state_as_dict(xGridWindow)
174 self.assertEqual(gridWinState["MarkedArea"], "Sheet1.A1:Sheet1.A25")
176 self.ui_test.close_doc()
178 #tdf35294
179 def test_tdf35294(self):
180 calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf35294.ods"))
181 document = self.ui_test.get_component()
182 calcDoc = self.xUITest.getTopFocusWindow()
183 xGridWindow = calcDoc.getChild("grid_window")
185 xGridWindow.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
186 xFloatWindow = self.xUITest.getFloatWindow()
187 xTreeList = xFloatWindow.getChild("check_list_box")
188 x1Entry = xTreeList.getChild("0")
189 x2Entry = xTreeList.getChild("1")
190 x3Entry = xTreeList.getChild("2")
191 x4Entry = xTreeList.getChild("3")
192 x5Entry = xTreeList.getChild("4")
193 x6Entry = xTreeList.getChild("5")
194 x7Entry = xTreeList.getChild("6")
196 self.assertEqual(get_state_as_dict(x1Entry)["Text"], "a")
197 self.assertEqual(get_state_as_dict(x2Entry)["Text"], "á")
198 self.assertEqual(get_state_as_dict(x3Entry)["Text"], "b")
199 self.assertEqual(get_state_as_dict(x4Entry)["Text"], "č")
200 self.assertEqual(get_state_as_dict(x5Entry)["Text"], "é")
201 self.assertEqual(get_state_as_dict(x6Entry)["Text"], "ř")
202 self.assertEqual(get_state_as_dict(x7Entry)["Text"], "ž")
204 xCancel = xFloatWindow.getChild("cancel")
205 xCancel.executeAction("CLICK", tuple())
207 self.ui_test.close_doc()
209 #tdf55712
210 def test_tdf55712(self):
211 calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf55712.ods"))
212 document = self.ui_test.get_component()
213 calcDoc = self.xUITest.getTopFocusWindow()
214 xGridWindow = calcDoc.getChild("grid_window")
216 xGridWindow.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
217 xFloatWindow = self.xUITest.getFloatWindow()
218 xTreeList = xFloatWindow.getChild("check_list_box")
219 x1Entry = xTreeList.getChild("0")
220 x2Entry = xTreeList.getChild("1")
221 x3Entry = xTreeList.getChild("2")
222 x4Entry = xTreeList.getChild("3")
223 x5Entry = xTreeList.getChild("4")
224 x6Entry = xTreeList.getChild("5")
225 x7Entry = xTreeList.getChild("6")
226 x8Entry = xTreeList.getChild("7")
227 x9Entry = xTreeList.getChild("8")
229 self.assertEqual(get_state_as_dict(x1Entry)["Text"], "0")
230 self.assertEqual(get_state_as_dict(x2Entry)["Text"], "0.1")
231 self.assertEqual(get_state_as_dict(x3Entry)["Text"], "0.2")
232 self.assertEqual(get_state_as_dict(x4Entry)["Text"], "0.3")
233 self.assertEqual(get_state_as_dict(x5Entry)["Text"], "0.5")
234 self.assertEqual(get_state_as_dict(x6Entry)["Text"], "0.8")
235 self.assertEqual(get_state_as_dict(x7Entry)["Text"], "0.9")
236 self.assertEqual(get_state_as_dict(x8Entry)["Text"], "1")
237 self.assertEqual(get_state_as_dict(x9Entry)["Text"], "(empty)")
238 self.assertEqual(get_state_as_dict(xTreeList)["Children"], "9")
240 xCancel = xFloatWindow.getChild("cancel")
241 xCancel.executeAction("CLICK", tuple())
243 self.ui_test.close_doc()
245 # vim: set shiftwidth=4 softtabstop=4 expandtab: