summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorBalazs Varga <balazs.varga991@gmail.com>2021-09-06 12:02:54 +0200
committerBalazs Varga <varga.balazs3@nisz.hu>2021-09-21 11:06:35 +0200
commit51375b48378915b6e95c1ac26b2ccf8e39880f7e (patch)
tree66f4c6075f0d9b3c483971a9f71a5bcedbbf53ba /sc
parent9714f3348d972a179e73423c44a97954bf6cc534 (diff)
tdf#144253 tdf#144324 sc filter: use formatted values in filters
if the results of formulas are values. Followed up of 40acda4e78127fa9f513646ef210b074d40cf307 (Related: tdf#140968 avoid duplicated filter values) Change-Id: Ib396d2b7cc08ba41b5936a53a28b5e38bf678b3e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121715 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sc')
-rw-r--r--sc/qa/uitest/autofilter/autofilter.py23
-rw-r--r--sc/qa/uitest/data/autofilter/tdf144253.odsbin0 -> 10215 bytes
-rw-r--r--sc/source/core/data/table3.cxx2
-rw-r--r--sc/source/core/tool/cellform.cxx2
4 files changed, 25 insertions, 2 deletions
diff --git a/sc/qa/uitest/autofilter/autofilter.py b/sc/qa/uitest/autofilter/autofilter.py
index 8351e1f868a3..847aa8dcf8b6 100644
--- a/sc/qa/uitest/autofilter/autofilter.py
+++ b/sc/qa/uitest/autofilter/autofilter.py
@@ -505,4 +505,27 @@ class AutofilterTest(UITestCase):
self.assertFalse(is_row_hidden(doc, 6))
self.assertFalse(is_row_hidden(doc, 7))
+ def test_tdf144253(self):
+ with self.ui_test.load_file(get_url_for_data_file("tdf144253.ods")) as doc:
+
+ xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
+
+ xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "4", "ROW": "0"}))
+ xFloatWindow = self.xUITest.getFloatWindow()
+ xCheckListMenu = xFloatWindow.getChild("check_list_menu")
+ xTreeList = xCheckListMenu.getChild("check_list_box")
+ self.assertEqual(2, len(xTreeList.getChildren()))
+ self.assertEqual("65.43", get_state_as_dict(xTreeList.getChild('0'))['Text'])
+ self.assertEqual("83.33", get_state_as_dict(xTreeList.getChild('1'))['Text'])
+
+ xFirstEntry = xTreeList.getChild("1")
+ xFirstEntry.executeAction("CLICK", tuple())
+
+ xOkBtn = xFloatWindow.getChild("ok")
+ xOkBtn.executeAction("CLICK", tuple())
+
+ self.assertFalse(is_row_hidden(doc, 0))
+ self.assertTrue(is_row_hidden(doc, 1))
+ self.assertFalse(is_row_hidden(doc, 2))
+
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/data/autofilter/tdf144253.ods b/sc/qa/uitest/data/autofilter/tdf144253.ods
new file mode 100644
index 000000000000..d2581904d0ac
--- /dev/null
+++ b/sc/qa/uitest/data/autofilter/tdf144253.ods
Binary files differ
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index 7e1f05450c99..83d2a9cfa99f 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -2464,7 +2464,7 @@ public:
nCellVal = mrDoc.RoundValueAsShown(rCell.mfValue, nNumFmt, pContext);
break;
case CELLTYPE_FORMULA :
- nCellVal = rCell.mpFormula->GetValue();
+ nCellVal = mrDoc.RoundValueAsShown(rCell.mpFormula->GetValue(), nNumFmt, pContext);
break;
default:
nCellVal = 0.0;
diff --git a/sc/source/core/tool/cellform.cxx b/sc/source/core/tool/cellform.cxx
index 7a6b9eb38bbe..6872c0579803 100644
--- a/sc/source/core/tool/cellform.cxx
+++ b/sc/source/core/tool/cellform.cxx
@@ -134,7 +134,7 @@ void ScCellFormat::GetInputString(
if (pFC->IsEmptyDisplayedAsString())
rString = EMPTY_OUSTRING;
else if (pFC->IsValue())
- rFormatter.GetInputLineString(pFC->GetValue(), nFormat, rString);
+ rFormatter.GetInputLineString(pFC->GetValue(), nFormat, rString, bFiltering);
else
rString = pFC->GetString().getString();