sc/qa/uitest/autofilter/tdf46184.py | 86 ++++++++++++++++++++++++++++++++++++ sc/source/ui/view/gridwin.cxx | 35 ++++++++++---- 2 files changed, 111 insertions(+), 10 deletions(-)
New commits: commit 92dbfa5415bfae55e0770609b9e81e4c409f1c80 Author: Tünde Tóth <[email protected]> AuthorDate: Thu Jul 8 10:04:53 2021 +0200 Commit: Xisco Fauli <[email protected]> CommitDate: Tue Jul 20 17:55:20 2021 +0200 tdf#46184 sc AutoFilter: reset filter options to default values when the old filter entries are removed in auto-filter rules, because these options are not visible from the AutoFilter. E.g. now using AutoFilter doesn't apply copying of the previous standard filtering, changing also the active sheet etc. This fixes regression from LibreOffice 3.5 or more. Change-Id: I26b272dc738f3918ff5b2ca7e8fee3481d21460a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118603 Tested-by: László Németh <[email protected]> Reviewed-by: László Németh <[email protected]> Signed-off-by: Xisco Fauli <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119272 Tested-by: Jenkins diff --git a/sc/qa/uitest/autofilter/tdf46184.py b/sc/qa/uitest/autofilter/tdf46184.py new file mode 100755 index 000000000000..0bc013b0966c --- /dev/null +++ b/sc/qa/uitest/autofilter/tdf46184.py @@ -0,0 +1,86 @@ +# -*- 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.calc import enter_text_to_cell +from uitest.uihelper.common import select_by_text, get_state_as_dict +from libreoffice.uno.propertyvalue import mkPropertyValues +from libreoffice.calc.document import get_row + +#Bug 46184 - [Calc] [AutoFilter] Option "Copy results to ..." remains activated in AutoFilter + +class tdf46184(UITestCase): + def test_tdf46184_copy_results_to(self): + self.ui_test.create_doc_in_start_center("calc") + calcDoc = self.xUITest.getTopFocusWindow() + gridwin = calcDoc.getChild("grid_window") + + enter_text_to_cell(gridwin, "A1", "A") + enter_text_to_cell(gridwin, "A2", "1") + enter_text_to_cell(gridwin, "A3", "2") + enter_text_to_cell(gridwin, "A4", "3") + + gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:A4"})) + + self.xUITest.executeCommand(".uno:DataFilterAutoFilter") + + gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + #Choose Standard Filter... button + xMenu = xFloatWindow.getChild("menu") + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"})) + self.assertEqual("Standard Filter...", get_state_as_dict(xMenu)['SelectEntryText']) + xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"})) + + xDialog = self.xUITest.getTopFocusWindow() + xfield1 = xDialog.getChild("field1") + xcond1 = xDialog.getChild("cond1") + xval1 = xDialog.getChild("val1") + xcopyresult = xDialog.getChild("copyresult") + xedcopyarea = xDialog.getChild("edcopyarea") + xdestpers = xDialog.getChild("destpers") + + select_by_text(xfield1, "A") + select_by_text(xcond1, ">") + xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"1"})) + xcopyresult.executeAction("CLICK", tuple()) + xedcopyarea.executeAction("TYPE", mkPropertyValues({"TEXT":"A6"})) + if get_state_as_dict(xdestpers)['Selected'] == 'false': + xdestpers.executeAction("CLICK", tuple()) + self.assertEqual('true', get_state_as_dict(xcopyresult)['Selected']) + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + document = self.ui_test.get_component() + row1 = get_row(document, 1) + row2 = get_row(document, 2) + row3 = get_row(document, 3) + self.assertTrue(row1.getPropertyValue("IsVisible")) + self.assertTrue(row2.getPropertyValue("IsVisible")) + self.assertTrue(row3.getPropertyValue("IsVisible")) + + gridwin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"})) + xFloatWindow = self.xUITest.getFloatWindow() + xCheckListMenu = xFloatWindow.getChild("check_list_menu") + xTreeList = xCheckListMenu.getChild("check_list_box") + xEntry = xTreeList.getChild("1") + xEntry.executeAction("CLICK", tuple()) + xOkBtn = xFloatWindow.getChild("ok") + xOkBtn.executeAction("CLICK", tuple()) + + self.assertTrue(row1.getPropertyValue("IsVisible")) + self.assertFalse(row2.getPropertyValue("IsVisible")) + self.assertTrue(row3.getPropertyValue("IsVisible")) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index 42e982275ce3..7fb89c3f435f 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -833,20 +833,19 @@ void ScGridWindow::UpdateAutoFilterFromMenu(AutoFilterMode eMode) mrViewData.GetViewShell()->UISort(aSortParam); return; } + case AutoFilterMode::Custom: + { + ScRange aRange; + pDBData->GetArea(aRange); + mrViewData.GetView()->MarkRange(aRange); + mrViewData.GetView()->SetCursor(rPos.Col(), rPos.Row()); + mrViewData.GetDispatcher().Execute(SID_FILTER, SfxCallMode::SLOT | SfxCallMode::RECORD); + return; + } default: ; } - if (eMode == AutoFilterMode::Custom) - { - ScRange aRange; - pDBData->GetArea(aRange); - mrViewData.GetView()->MarkRange(aRange); - mrViewData.GetView()->SetCursor(rPos.Col(), rPos.Row()); - mrViewData.GetDispatcher().Execute(SID_FILTER, SfxCallMode::SLOT|SfxCallMode::RECORD); - return; - } - ScQueryParam aParam; pDBData->GetQueryParam(aParam); @@ -877,8 +876,16 @@ void ScGridWindow::UpdateAutoFilterFromMenu(AutoFilterMode eMode) // Remove old entries in auto-filter rules if (!bColorMode) + { aParam.RemoveAllEntriesByField(rPos.Col()); + // tdf#46184 reset filter options to default values + aParam.eSearchType = utl::SearchParam::SearchType::Normal; + aParam.bCaseSens = false; + aParam.bDuplicate = true; + aParam.bInplace = true; + } + if (eMode != AutoFilterMode::Clear && !(eMode == AutoFilterMode::Normal && rControl.isAllSelected())) { @@ -960,8 +967,16 @@ void ScGridWindow::UpdateAutoFilterFromMenu(AutoFilterMode eMode) // Disable color filter when active color was selected if (nSelected == nActive) + { aParam.RemoveAllEntriesByField(rPos.Col()); + // tdf#46184 reset filter options to default values + aParam.eSearchType = utl::SearchParam::SearchType::Normal; + aParam.bCaseSens = false; + aParam.bDuplicate = true; + aParam.bInplace = true; + } + // Get selected color from set std::set<Color>::iterator it = aColors.begin(); std::advance(it, nSelected - 1); _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
