sc/qa/uitest/autofilter/colorfilter.py | 60 ++++++++++++++++++++++++++++ sc/qa/uitest/data/autofilter/tdf142580.xlsx |binary 2 files changed, 60 insertions(+)
New commits: commit e2e1da3cc89942443832ea018ced68eb41e3d75a Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Tue Sep 21 13:41:07 2021 +0200 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Tue Sep 21 15:31:37 2021 +0200 tdf#142580, tdf#143103: sc: Add UItest Change-Id: I188716de98e6a9ea1c2b97c6341d578120a242b0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122388 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sc/qa/uitest/autofilter/colorfilter.py b/sc/qa/uitest/autofilter/colorfilter.py new file mode 100644 index 000000000000..a9d0d5d950aa --- /dev/null +++ b/sc/qa/uitest/autofilter/colorfilter.py @@ -0,0 +1,60 @@ +# -*- 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 uitest.uihelper.common import get_state_as_dict, get_url_for_data_file, select_pos +from libreoffice.uno.propertyvalue import mkPropertyValues +from libreoffice.calc.document import is_row_hidden + +class ColorFilterTest(UITestCase): + + def test_tdf142580(self): + with self.ui_test.load_file(get_url_for_data_file("tdf142580.xlsx")) as doc: + + xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") + xGridWin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A9"})) + + # Green Text Color rows are displayed + self.assertFalse(is_row_hidden(doc, 0)) + self.assertFalse(is_row_hidden(doc, 1)) + self.assertFalse(is_row_hidden(doc, 2)) + self.assertFalse(is_row_hidden(doc, 3)) + self.assertTrue(is_row_hidden(doc, 4)) + self.assertTrue(is_row_hidden(doc, 5)) + self.assertTrue(is_row_hidden(doc, 6)) + self.assertTrue(is_row_hidden(doc, 7)) + self.assertTrue(is_row_hidden(doc, 8)) + + with self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") as xDialog: + xField1 = xDialog.getChild("field1") + xCond1 = xDialog.getChild("cond1") + + # tdf#143103: Without the fix in place, this test would have failed with + # AssertionError: 'Text color' != '' + self.assertEqual("Text color", get_state_as_dict(xField1)['DisplayText']) + self.assertEqual("Text color", get_state_as_dict(xCond1)['DisplayText']) + + xColor1 = xDialog.getChild("color1") + + # tdf#142580: Without the fix in place, this test would have failed with + # AssertionError: '3' != '1' + self.assertEqual('3', get_state_as_dict(xColor1)["EntryCount"]) + + # Select Orange Text Color + select_pos(xColor1, "2") + + self.assertFalse(is_row_hidden(doc, 0)) + self.assertTrue(is_row_hidden(doc, 1)) + self.assertTrue(is_row_hidden(doc, 2)) + self.assertTrue(is_row_hidden(doc, 3)) + self.assertFalse(is_row_hidden(doc, 4)) + self.assertFalse(is_row_hidden(doc, 5)) + self.assertFalse(is_row_hidden(doc, 6)) + self.assertTrue(is_row_hidden(doc, 7)) + self.assertTrue(is_row_hidden(doc, 8)) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/data/autofilter/tdf142580.xlsx b/sc/qa/uitest/data/autofilter/tdf142580.xlsx new file mode 100644 index 000000000000..9dd8710fbee6 Binary files /dev/null and b/sc/qa/uitest/data/autofilter/tdf142580.xlsx differ