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 libreoffice
.uno
.propertyvalue
import mkPropertyValues
11 from libreoffice
.calc
.document
import is_row_hidden
12 from uitest
.uihelper
.common
import get_url_for_data_file
14 #Bug 130770 - Autofilter not updated on data change (automatically or manually)
16 class tdf130770(UITestCase
):
17 def test_tdf130770_autofilter(self
):
18 with self
.ui_test
.load_file(get_url_for_data_file("tdf130770.ods")) as calc_doc
:
19 xCalcDoc
= self
.xUITest
.getTopFocusWindow()
20 gridwin
= xCalcDoc
.getChild("grid_window")
22 # 1. open attached file and check initial state
23 self
.assertFalse(is_row_hidden(calc_doc
, 0))
24 self
.assertFalse(is_row_hidden(calc_doc
, 1))
25 self
.assertTrue(is_row_hidden(calc_doc
, 2))
26 self
.assertFalse(is_row_hidden(calc_doc
, 3))
27 self
.assertFalse(is_row_hidden(calc_doc
, 4))
29 # 2. open filter of column A and cancel
30 gridwin
.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
31 xFloatWindow
= self
.xUITest
.getFloatWindow()
33 xOkBtn
= xFloatWindow
.getChild("cancel")
34 xOkBtn
.executeAction("CLICK", tuple())
36 self
.assertFalse(is_row_hidden(calc_doc
, 0))
37 self
.assertFalse(is_row_hidden(calc_doc
, 1))
38 self
.assertTrue(is_row_hidden(calc_doc
, 2))
39 self
.assertFalse(is_row_hidden(calc_doc
, 3))
40 self
.assertFalse(is_row_hidden(calc_doc
, 4))
42 # 3. open filter of column A and just click OK
43 gridwin
.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
44 xFloatWindow
= self
.xUITest
.getFloatWindow()
46 xOkBtn
= xFloatWindow
.getChild("ok")
47 xOkBtn
.executeAction("CLICK", tuple())
49 self
.assertFalse(is_row_hidden(calc_doc
, 0))
50 self
.assertFalse(is_row_hidden(calc_doc
, 1))
51 self
.assertTrue(is_row_hidden(calc_doc
, 2))
52 self
.assertFalse(is_row_hidden(calc_doc
, 3))
53 self
.assertTrue(is_row_hidden(calc_doc
, 4)) # filtered out
55 # vim: set shiftwidth=4 softtabstop=4 expandtab: