diff options
Diffstat (limited to 'sc/qa/uitest')
-rw-r--r-- | sc/qa/uitest/autofilter/autofilterBugs.py | 24 | ||||
-rw-r--r-- | sc/qa/uitest/autofilter2/tdf158314_EmptyError.py | 94 | ||||
-rw-r--r-- | sc/qa/uitest/calc_tests8/navigator.py | 27 |
3 files changed, 145 insertions, 0 deletions
diff --git a/sc/qa/uitest/autofilter/autofilterBugs.py b/sc/qa/uitest/autofilter/autofilterBugs.py index 6fa029985f..849351861d 100644 --- a/sc/qa/uitest/autofilter/autofilterBugs.py +++ b/sc/qa/uitest/autofilter/autofilterBugs.py @@ -73,6 +73,30 @@ class autofilter(UITestCase): self.assertEqual(get_state_as_dict(xTreeList.getChild("4"))["Text"], "vröude") self.assertEqual(get_state_as_dict(xTreeList.getChild("5"))["Text"], "vröudᵉ") + def test_tdf158326(self): + with self.ui_test.create_doc_in_start_center("calc"): + calcDoc = self.xUITest.getTopFocusWindow() + xGridWindow = calcDoc.getChild("grid_window") + enter_text_to_cell(xGridWindow, "A1", "vröude") + enter_text_to_cell(xGridWindow, "A2", "vröudᵉ") + enter_text_to_cell(xGridWindow, "A3", "vröude") + enter_text_to_cell(xGridWindow, "A4", "vröudᵉ") + enter_text_to_cell(xGridWindow, "A5", "vröude") + enter_text_to_cell(xGridWindow, "A6", "vröudᵉ") + xGridWindow.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A6"})) + + with self.ui_test.execute_dialog_through_command(".uno:DataFilterAutoFilter", close_button="no"): + pass + + xGridWindow.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xTreeList = xFloatWindow.getChild("check_list_box") + + # Without the fix in place, there would be 5 items since they will not be removed + self.assertEqual(2, len(xTreeList.getChildren())) + self.assertEqual(get_state_as_dict(xTreeList.getChild("0"))["Text"], "vröude") + self.assertEqual(get_state_as_dict(xTreeList.getChild("1"))["Text"], "vröudᵉ") + def test_tdf94055(self): with self.ui_test.create_doc_in_start_center("calc") as document: calcDoc = self.xUITest.getTopFocusWindow() diff --git a/sc/qa/uitest/autofilter2/tdf158314_EmptyError.py b/sc/qa/uitest/autofilter2/tdf158314_EmptyError.py new file mode 100644 index 0000000000..2ced88c80d --- /dev/null +++ b/sc/qa/uitest/autofilter2/tdf158314_EmptyError.py @@ -0,0 +1,94 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# 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.calc import enter_text_to_cell +from uitest.uihelper.common import get_state_as_dict +from libreoffice.uno.propertyvalue import mkPropertyValues +from libreoffice.calc.document import is_row_hidden + +# Bug 158314 - Autofilter dropdown list always shows "Empty" entry as active + +class tdf158314_EmptyEntries(UITestCase): + def testTdf158314(self): + with self.ui_test.create_doc_in_start_center("calc") as calcDoc: + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWin = xCalcDoc.getChild("grid_window") + + # Fill the sheet with test data + enter_text_to_cell(xGridWin, "A1", "a") + enter_text_to_cell(xGridWin, "A2", "1") + enter_text_to_cell(xGridWin, "A3", "2") + enter_text_to_cell(xGridWin, "A4", "3") + enter_text_to_cell(xGridWin, "A5", "4") + + enter_text_to_cell(xGridWin, "B1", "b") + enter_text_to_cell(xGridWin, "B2", "5") + enter_text_to_cell(xGridWin, "B3", "") + enter_text_to_cell(xGridWin, "B4", "=1/0") + enter_text_to_cell(xGridWin, "B5", "8") + + # Select the data range and set autofilter + xGridWin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B5"})) + self.xUITest.executeCommand(".uno:DataFilterAutoFilter") + + # Click the autofilter dropdown in column A + xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xCheckListMenu = xFloatWindow.getChild("FilterDropDown") + xTreeList = xCheckListMenu.getChild("check_list_box") + + # Select the first entry only. Uncheck all other entries. + for i in xTreeList.getChildren(): + if i != "0": + xEntry = xTreeList.getChild(i) + xEntry.executeAction("CLICK", tuple()) + + xOkButton = xFloatWindow.getChild("ok") + xOkButton.executeAction("CLICK", tuple()) + + # Check that only row#2 is visible + self.assertFalse(is_row_hidden(calcDoc, 1)) + self.assertTrue(is_row_hidden(calcDoc, 2)) + self.assertTrue(is_row_hidden(calcDoc, 3)) + self.assertTrue(is_row_hidden(calcDoc, 4)) + + # Click the autofilter dropdown in column B + xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xCheckListMenu = xFloatWindow.getChild("FilterDropDown") + xTreeList = xCheckListMenu.getChild("check_list_box") + + # There should be at least one entry in the dropdown + # (i.e., the feature of showing inactive autofilter entries may be disabled) + self.assertEqual(True, len(xTreeList.getChildren()) >= 1) + + for i in xTreeList.getChildren(): + state = get_state_as_dict(xTreeList.getChild(i)) + # The Text of the first element should be '5' and it should be checked and active + if i == "0": + self.assertEqual("5", state["Text"]) + self.assertEqual("true", state["IsChecked"]) + self.assertEqual("true", state["IsSelected"]) + self.assertEqual("false", state["IsSemiTransparent"]) + # All other elements (including the Empty and #DIV/0!) should be unchecked and inactive + else: + self.assertEqual("false", state["IsChecked"]) + self.assertEqual("false", state["IsSelected"]) + self.assertEqual("true", state["IsSemiTransparent"]) + + # Close the popup window + xOkButton = xFloatWindow.getChild("ok") + xOkButton.executeAction("CLICK", tuple()) + + # Check again that only row#2 is visible + self.assertFalse(is_row_hidden(calcDoc, 1)) + self.assertTrue(is_row_hidden(calcDoc, 2)) + self.assertTrue(is_row_hidden(calcDoc, 3)) + self.assertTrue(is_row_hidden(calcDoc, 4)) +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/calc_tests8/navigator.py b/sc/qa/uitest/calc_tests8/navigator.py index ec8fa2ae9a..9c1769dcf4 100644 --- a/sc/qa/uitest/calc_tests8/navigator.py +++ b/sc/qa/uitest/calc_tests8/navigator.py @@ -10,6 +10,7 @@ from uitest.framework import UITestCase from libreoffice.uno.propertyvalue import mkPropertyValues from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file +from uitest.uihelper.calc import enter_text_to_cell class navigator(UITestCase): @@ -181,4 +182,30 @@ class navigator(UITestCase): self.xUITest.executeCommand(".uno:Sidebar") + + def test_tdf158652(self): + with self.ui_test.create_doc_in_start_center("calc"): + xCalcDoc = self.xUITest.getTopFocusWindow() + xGridWin = xCalcDoc.getChild("grid_window") + + self.xUITest.executeCommand(".uno:Sidebar") + + xGridWin.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "ScNavigatorPanel"})) + + xCalcDoc = self.xUITest.getTopFocusWindow() + xNavigatorPanel = xCalcDoc.getChild("NavigatorPanel") + xContentBox = xNavigatorPanel.getChild('contentbox') + enter_text_to_cell(xGridWin, "A1", "1") + + commentText = mkPropertyValues({"Text":"CommentText"}) + self.xUITest.executeCommandWithParameters(".uno:InsertAnnotation", commentText) + xComments = xContentBox.getChild("6") + self.assertEqual(len(xComments.getChildren()), 1) + + self.xUITest.executeCommand(".uno:DeleteNote") + xComments = xContentBox.getChild("6") + self.assertEqual(len(xComments.getChildren()), 0) + + self.xUITest.executeCommand(".uno:Sidebar") + # vim: set shiftwidth=4 softtabstop=4 expandtab: |