mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 07:42:57 +08:00
Made Operator.Equal not parse for date filter and added corresponding test
This commit is contained in:
parent
df170517a8
commit
c2f225f025
@ -381,6 +381,15 @@ namespace osu.Game.Tests.NonVisual.Filtering
|
|||||||
Assert.AreEqual(false, filterCriteria.LastPlayed.Min == null);
|
Assert.AreEqual(false, filterCriteria.LastPlayed.Min == null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestEqualDateQuery()
|
||||||
|
{
|
||||||
|
const string query = "played=50";
|
||||||
|
var filterCriteria = new FilterCriteria();
|
||||||
|
FilterQueryParser.ApplyQueries(filterCriteria, query);
|
||||||
|
Assert.AreEqual(false, filterCriteria.LastPlayed.HasFilter);
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestOutofrangeDateQuery()
|
public void TestOutofrangeDateQuery()
|
||||||
{
|
{
|
||||||
|
@ -376,6 +376,9 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
private static bool tryUpdateDateRange(ref FilterCriteria.OptionalRange<DateTimeOffset> dateRange, Operator op, string val)
|
private static bool tryUpdateDateRange(ref FilterCriteria.OptionalRange<DateTimeOffset> dateRange, Operator op, string val)
|
||||||
{
|
{
|
||||||
|
if (op == Operator.Equal)
|
||||||
|
return false;
|
||||||
|
|
||||||
GroupCollection? match = null;
|
GroupCollection? match = null;
|
||||||
|
|
||||||
match ??= tryMatchRegex(val, @"^((?<years>\d+(\.\d+)?)y)?((?<months>\d+(\.\d+)?)M)?((?<days>\d+(\.\d+)?)d)?((?<hours>\d+(\.\d+)?)h)?((?<minutes>\d+(\.\d+)?)m)?((?<seconds>\d+(\.\d+)?)s)?$");
|
match ??= tryMatchRegex(val, @"^((?<years>\d+(\.\d+)?)y)?((?<months>\d+(\.\d+)?)M)?((?<days>\d+(\.\d+)?)d)?((?<hours>\d+(\.\d+)?)h)?((?<minutes>\d+(\.\d+)?)m)?((?<seconds>\d+(\.\d+)?)s)?$");
|
||||||
|
Loading…
Reference in New Issue
Block a user