diff options
author | Balazs Varga <balazs.varga.extern@allotropia.de> | 2024-12-17 20:50:31 +0100 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2024-12-19 11:35:11 +0100 |
commit | 1250c1e0f3b424cf18c378f3b21a14f6e531cbf7 (patch) | |
tree | 56ff1c31b0f453e8d9d2093a35bdc229e7b985f4 | |
parent | 97bab05d04393bf4f04ff4df17aac8b6843f1a85 (diff) |
tdf#163395 tdf#153057 - sc fix standard filter problem with formatted
values
ScQueryEntry::ByValue was removed unnecessarily in the original
patch, but it is necessary for filtering number values correctly.
Regression from commit: 1f755525189884e4b2824889a6b9dea8933402db
Change-Id: Ib013d971ad0b0809fc55949a6a2d9bf02418b516
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178690
Tested-by: Jenkins
Tested-by: Gabor Kelemen <gabor.kelemen.extern@allotropia.de>
Reviewed-by: Balazs Varga <balazs.varga.extern@allotropia.de>
Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178738
-rw-r--r-- | sc/qa/uitest/autofilter2/tdf163395.py | 40 | ||||
-rw-r--r-- | sc/qa/uitest/data/autofilter/tdf163395.ods | bin | 0 -> 12708 bytes | |||
-rw-r--r-- | sc/source/ui/dbgui/filtdlg.cxx | 6 |
3 files changed, 45 insertions, 1 deletions
diff --git a/sc/qa/uitest/autofilter2/tdf163395.py b/sc/qa/uitest/autofilter2/tdf163395.py new file mode 100644 index 000000000000..fbf7aadef925 --- /dev/null +++ b/sc/qa/uitest/autofilter2/tdf163395.py @@ -0,0 +1,40 @@ +# -*- 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.common import get_url_for_data_file, select_by_text +from libreoffice.uno.propertyvalue import mkPropertyValues +from libreoffice.calc.document import is_row_hidden + +class tdf163395(UITestCase): + + def test_tdf163395(self): + + with self.ui_test.load_file(get_url_for_data_file("tdf163395.ods")) as doc: + + xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window") + xGridWin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:B7"})) + #Choose DATA-FILTER-STANDARDFILTER + #Choose field name "Percent"/ Choose condition ">="/Enter value "23%"/Press OK button + with self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter") as xDialog: + xfield1 = xDialog.getChild("field1") + xval1 = xDialog.getChild("val1") + xcond1 = xDialog.getChild("cond1") + select_by_text(xfield1, "Percent") + select_by_text(xcond1, ">=") + xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"23%"})) + + 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.assertFalse(is_row_hidden(doc, 4)) + self.assertTrue(is_row_hidden(doc, 5)) + self.assertFalse(is_row_hidden(doc, 6)) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/data/autofilter/tdf163395.ods b/sc/qa/uitest/data/autofilter/tdf163395.ods Binary files differnew file mode 100644 index 000000000000..5d9a381057de --- /dev/null +++ b/sc/qa/uitest/data/autofilter/tdf163395.ods diff --git a/sc/source/ui/dbgui/filtdlg.cxx b/sc/source/ui/dbgui/filtdlg.cxx index 9735b15c711e..0470d00e9291 100644 --- a/sc/source/ui/dbgui/filtdlg.cxx +++ b/sc/source/ui/dbgui/filtdlg.cxx @@ -1304,7 +1304,11 @@ IMPL_LINK( ScFilterDlg, ValModifyHdl, weld::ComboBox&, rEd, void ) { rItem.maString = pDoc->GetSharedStringPool().intern(aStrVal); rItem.mfVal = 0.0; - rItem.meType = ScQueryEntry::ByString; + + sal_uInt32 nIndex = 0; + bool bNumber = pDoc->GetFormatTable()->IsNumberFormat( + rItem.maString.getString(), nIndex, rItem.mfVal); + rItem.meType = bNumber ? ScQueryEntry::ByValue : ScQueryEntry::ByString; } const sal_Int32 nField = pLbField->get_active(); |