diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2021-02-02 19:55:19 +0100 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2021-02-03 08:49:35 +0100 |
commit | 14d064cee7b76e8a2a2201d4da423336f68fe624 (patch) | |
tree | 4b33dbdf88a4c0eb1320b8216edd58ebc4d42934 /sc | |
parent | 404f14ce91b3c8abdd59c017298923b71fa5cef0 (diff) |
tdf#92767: sc: Add UItest
Change-Id: I9f1d82d81364ee0ee833b4505e6925cce5e3e787
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110332
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/qa/uitest/autofilter/tdf92767.py | 58 | ||||
-rw-r--r-- | sc/qa/uitest/data/autofilter/tdf92767.ods | bin | 0 -> 17349 bytes |
2 files changed, 58 insertions, 0 deletions
diff --git a/sc/qa/uitest/autofilter/tdf92767.py b/sc/qa/uitest/autofilter/tdf92767.py new file mode 100644 index 000000000000..859620b73a8a --- /dev/null +++ b/sc/qa/uitest/autofilter/tdf92767.py @@ -0,0 +1,58 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +from uitest.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues +from libreoffice.calc.document import get_row +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file + +def is_row_hidden(doc, index): + row = get_row(doc, index) + val = row.getPropertyValue("IsVisible") + return not val + +class tdf92767(UITestCase): + + def test_tdf92767(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf92767.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + for i in range(0,25): + self.assertFalse(is_row_hidden(calc_doc, i)) + + gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xTreeList = xFloatWindow.getChild("check_tree_box") + xFirstEntry = xTreeList.getChild("0") + self.assertEqual('2015', get_state_as_dict(xFirstEntry)["Text"]) + self.assertEqual('7', get_state_as_dict(xFirstEntry)["Children"]) + + # Deselect all the options but the last one + for i in range(6): + xChild = xFirstEntry.getChild(str(i)) + xChild.executeAction("CLICK", tuple()) + self.assertEqual('false', get_state_as_dict(xChild)['IsChecked']) + + xLastChild = xFirstEntry.getChild('6') + self.assertEqual('true', get_state_as_dict(xLastChild)['IsChecked']) + self.assertEqual('July', get_state_as_dict(xLastChild)['Text']) + + xOkBtn = xFloatWindow.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) + + for i in range(1,22): + self.assertTrue(is_row_hidden(calc_doc, i)) + + # Without the fix in place, this test would have failed here + self.assertFalse(is_row_hidden(calc_doc, 23)) + self.assertFalse(is_row_hidden(calc_doc, 24)) + self.assertFalse(is_row_hidden(calc_doc, 25)) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/data/autofilter/tdf92767.ods b/sc/qa/uitest/data/autofilter/tdf92767.ods Binary files differnew file mode 100644 index 000000000000..34dfb002e2d0 --- /dev/null +++ b/sc/qa/uitest/data/autofilter/tdf92767.ods |