1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 22:47:24 +08:00

Fix test failure on leap years

This commit is contained in:
Detze 2024-02-29 07:36:35 +01:00
parent d544b4dbf1
commit caad89a4dd
2 changed files with 7 additions and 7 deletions

View File

@ -538,7 +538,7 @@ namespace osu.Game.Tests.NonVisual.Filtering
Assert.That(filterCriteria.LastPlayed.Max, Is.Not.Null); Assert.That(filterCriteria.LastPlayed.Max, Is.Not.Null);
// the parser internally references `DateTimeOffset.Now`, so to not make things too annoying for tests, just assume some tolerance // the parser internally references `DateTimeOffset.Now`, so to not make things too annoying for tests, just assume some tolerance
// (irrelevant in proportion to the actual filter proscribed). // (irrelevant in proportion to the actual filter proscribed).
Assert.That(filterCriteria.LastPlayed.Min, Is.EqualTo(DateTimeOffset.Now.AddYears(-1).AddMonths(-6)).Within(TimeSpan.FromSeconds(5))); Assert.That(filterCriteria.LastPlayed.Min, Is.EqualTo(DateTimeOffset.Now.AddMonths(-6).AddYears(-1)).Within(TimeSpan.FromSeconds(5)));
Assert.That(filterCriteria.LastPlayed.Max, Is.EqualTo(DateTimeOffset.Now.AddMonths(-3)).Within(TimeSpan.FromSeconds(5))); Assert.That(filterCriteria.LastPlayed.Max, Is.EqualTo(DateTimeOffset.Now.AddMonths(-3)).Within(TimeSpan.FromSeconds(5)));
} }

View File

@ -402,19 +402,19 @@ namespace osu.Game.Screens.Select
// we'll want to flip the operator, such that `>5d` means "more than five days ago", as in "*before* five days ago", // we'll want to flip the operator, such that `>5d` means "more than five days ago", as in "*before* five days ago",
// as intended by the user. // as intended by the user.
case Operator.Less: case Operator.Less:
op = Operator.Greater;
break;
case Operator.LessOrEqual:
op = Operator.GreaterOrEqual; op = Operator.GreaterOrEqual;
break; break;
case Operator.LessOrEqual:
op = Operator.Greater;
break;
case Operator.Greater: case Operator.Greater:
op = Operator.Less; op = Operator.LessOrEqual;
break; break;
case Operator.GreaterOrEqual: case Operator.GreaterOrEqual:
op = Operator.LessOrEqual; op = Operator.Less;
break; break;
} }