summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorAndreas Heinisch <andreas.heinisch@yahoo.de>2023-04-03 12:43:51 +0200
committerAndreas Heinisch <andreas.heinisch@yahoo.de>2023-04-04 18:13:08 +0200
commit37928bef1c23f30df04bc7e95fcbc202c8cb4299 (patch)
treecb2a5e060ecdacc24854c0976112387fe9748596 /sc
parent65710a8d0098752b1079680563a053c2770ec958 (diff)
tdf#151206 - Sc Auto Filter: filter items after search edit timeout
In addition, UI tests have been adapted to address the timeout of the search process. Change-Id: Id9d78896e45da43734346654762c3541b8c07ba2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149958 Tested-by: Andreas Heinisch <andreas.heinisch@yahoo.de> Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
Diffstat (limited to 'sc')
-rw-r--r--sc/qa/uitest/autofilter/autofilter.py2
-rw-r--r--sc/qa/uitest/autofilter2/tdf97340.py3
-rw-r--r--sc/source/ui/cctrl/checklistmenu.cxx12
-rw-r--r--sc/source/ui/inc/checklistmenu.hxx4
4 files changed, 20 insertions, 1 deletions
diff --git a/sc/qa/uitest/autofilter/autofilter.py b/sc/qa/uitest/autofilter/autofilter.py
index f792c0fdad33..8ffba26539a5 100644
--- a/sc/qa/uitest/autofilter/autofilter.py
+++ b/sc/qa/uitest/autofilter/autofilter.py
@@ -154,6 +154,7 @@ class AutofilterTest(UITestCase):
xSearchEdit = xFloatWindow.getChild("search_edit")
xSearchEdit.executeAction("TYPE", mkPropertyValues({"TEXT" : "11"}))
+ self.ui_test.wait_until_property_is_updated(xList, "Children", str(1))
self.assertEqual(1, len(xList.getChildren()))
self.assertEqual("11", get_state_as_dict(xList.getChild('0'))['Text'])
@@ -179,6 +180,7 @@ class AutofilterTest(UITestCase):
xSearchEdit = xFloatWindow.getChild("search_edit")
xSearchEdit.executeAction("TYPE", mkPropertyValues({"TEXT" : "22"}))
+ self.ui_test.wait_until_property_is_updated(xList, "Children", str(1))
self.assertEqual(1, len(xList.getChildren()))
self.assertEqual("22", get_state_as_dict(xList.getChild('0'))['Text'])
diff --git a/sc/qa/uitest/autofilter2/tdf97340.py b/sc/qa/uitest/autofilter2/tdf97340.py
index 31e41ff6c358..884caa00a5db 100644
--- a/sc/qa/uitest/autofilter2/tdf97340.py
+++ b/sc/qa/uitest/autofilter2/tdf97340.py
@@ -29,11 +29,14 @@ class tdf97340(UITestCase):
xsearchEdit = xFloatWindow.getChild("search_edit")
xsearchEdit.executeAction("TYPE", mkPropertyValues({"TEXT":" "}))
+ self.ui_test.wait_until_property_is_updated(xTreeList, "Children", str(0))
self.assertEqual(0, len(xTreeList.getChildren()))
xsearchEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "BACKSPACE"}))
#tdf#133785, without the fix in place, it would have been 0
+ self.ui_test.wait_until_property_is_updated(xTreeList, "Children", str(8))
+ # Number of children differs due to xTreeList.getChildren() returns only direct descendants
self.assertEqual(2, len(xTreeList.getChildren()))
self.assertEqual("2016", get_state_as_dict(xTreeList.getChild('0'))['Text'])
self.assertEqual("2017", get_state_as_dict(xTreeList.getChild('1'))['Text'])
diff --git a/sc/source/ui/cctrl/checklistmenu.cxx b/sc/source/ui/cctrl/checklistmenu.cxx
index a89d852e6de0..456b0fe8b76a 100644
--- a/sc/source/ui/cctrl/checklistmenu.cxx
+++ b/sc/source/ui/cctrl/checklistmenu.cxx
@@ -507,6 +507,7 @@ ScCheckListMenuControl::ScCheckListMenuControl(weld::Widget* pParent, ScViewData
, mbIsPoppedUp(false)
, maOpenTimer(this)
, maCloseTimer(this)
+ , maSearchEditTimer("ScCheckListMenuControl maSearchEditTimer")
{
mxTreeChecks->set_clicks_to_toggle(1);
mxListChecks->set_clicks_to_toggle(1);
@@ -583,6 +584,9 @@ ScCheckListMenuControl::ScCheckListMenuControl(weld::Widget* pParent, ScViewData
// bulk_insert_for_each
mxTreeChecks->set_size_request(mnCheckWidthReq, nChecksHeight);
mxListChecks->set_size_request(mnCheckWidthReq, nChecksHeight);
+
+ maSearchEditTimer.SetTimeout(EDIT_UPDATEDATA_TIMEOUT);
+ maSearchEditTimer.SetInvokeHandler(LINK(this, ScCheckListMenuControl, SearchEditTimeoutHdl));
}
void ScCheckListMenuControl::GrabFocus()
@@ -612,6 +616,7 @@ void ScCheckListMenuControl::DropPendingEvents()
ScCheckListMenuControl::~ScCheckListMenuControl()
{
+ maSearchEditTimer.Stop();
EndPopupMode();
for (auto& rMenuItem : maMenuItems)
rMenuItem.mxSubMenuWin.reset();
@@ -739,7 +744,7 @@ namespace
}
}
-IMPL_LINK_NOARG(ScCheckListMenuControl, EdModifyHdl, weld::Entry&, void)
+IMPL_LINK_NOARG(ScCheckListMenuControl, SearchEditTimeoutHdl, Timer*, void)
{
OUString aSearchText = mxEdSearch->get_text();
aSearchText = ScGlobal::getCharClass().lowercase( aSearchText );
@@ -875,6 +880,11 @@ IMPL_LINK_NOARG(ScCheckListMenuControl, EdModifyHdl, weld::Entry&, void)
}
}
+IMPL_LINK_NOARG(ScCheckListMenuControl, EdModifyHdl, weld::Entry&, void)
+{
+ maSearchEditTimer.Start();
+}
+
IMPL_LINK_NOARG(ScCheckListMenuControl, EdActivateHdl, weld::Entry&, bool)
{
if (mxBtnOk->get_sensitive())
diff --git a/sc/source/ui/inc/checklistmenu.hxx b/sc/source/ui/inc/checklistmenu.hxx
index b400a40da2ae..4ccd1574b621 100644
--- a/sc/source/ui/inc/checklistmenu.hxx
+++ b/sc/source/ui/inc/checklistmenu.hxx
@@ -233,6 +233,8 @@ private:
DECL_LINK(PopupModeEndHdl, weld::Popover&, void);
+ DECL_LINK(SearchEditTimeoutHdl, Timer*, void);
+
DECL_LINK(EdModifyHdl, weld::Entry&, void);
DECL_LINK(EdActivateHdl, weld::Entry&, bool);
@@ -321,6 +323,8 @@ private:
SubMenuItemData maOpenTimer;
SubMenuItemData maCloseTimer;
+
+ Timer maSearchEditTimer;
};
class ScListSubMenuControl final