mirror of
https://github.com/ppy/osu
synced 2024-12-14 10:57:41 +00:00
Merge pull request #9950 from Airkek/patch2
This commit is contained in:
commit
64b22285ae
@ -60,7 +60,7 @@ namespace osu.Game.Tests.NonVisual.Filtering
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestApplyDrainRateQueries()
|
||||
public void TestApplyDrainRateQueriesByDrKeyword()
|
||||
{
|
||||
const string query = "dr>2 quite specific dr<:6";
|
||||
var filterCriteria = new FilterCriteria();
|
||||
@ -73,6 +73,20 @@ namespace osu.Game.Tests.NonVisual.Filtering
|
||||
Assert.Less(filterCriteria.DrainRate.Min, 6.1f);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestApplyDrainRateQueriesByHpKeyword()
|
||||
{
|
||||
const string query = "hp>2 quite specific hp<=6";
|
||||
var filterCriteria = new FilterCriteria();
|
||||
FilterQueryParser.ApplyQueries(filterCriteria, query);
|
||||
Assert.AreEqual("quite specific", filterCriteria.SearchText.Trim());
|
||||
Assert.AreEqual(2, filterCriteria.SearchTerms.Length);
|
||||
Assert.Greater(filterCriteria.DrainRate.Min, 2.0f);
|
||||
Assert.Less(filterCriteria.DrainRate.Min, 2.1f);
|
||||
Assert.Greater(filterCriteria.DrainRate.Max, 6.0f);
|
||||
Assert.Less(filterCriteria.DrainRate.Min, 6.1f);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestApplyBPMQueries()
|
||||
{
|
||||
|
@ -11,7 +11,7 @@ namespace osu.Game.Screens.Select
|
||||
internal static class FilterQueryParser
|
||||
{
|
||||
private static readonly Regex query_syntax_regex = new Regex(
|
||||
@"\b(?<key>stars|ar|dr|cs|divisor|length|objects|bpm|status|creator|artist)(?<op>[=:><]+)(?<value>("".*"")|(\S*))",
|
||||
@"\b(?<key>stars|ar|dr|hp|cs|divisor|length|objects|bpm|status|creator|artist)(?<op>[=:><]+)(?<value>("".*"")|(\S*))",
|
||||
RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
|
||||
internal static void ApplyQueries(FilterCriteria criteria, string query)
|
||||
@ -43,6 +43,7 @@ namespace osu.Game.Screens.Select
|
||||
break;
|
||||
|
||||
case "dr" when parseFloatWithPoint(value, out var dr):
|
||||
case "hp" when parseFloatWithPoint(value, out dr):
|
||||
updateCriteriaRange(ref criteria.DrainRate, op, dr, 0.1f / 2);
|
||||
break;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user