mirror of
https://github.com/ppy/osu.git
synced 2024-11-06 06:57:39 +08:00
Rename is-in-any check method to a more legible name
This commit is contained in:
parent
8d899f4e77
commit
6e76e5900a
@ -29,9 +29,9 @@ namespace osu.Game.Tests.NonVisual
|
||||
var tracker = new PeriodTracker { Periods = test_single_period };
|
||||
|
||||
var period = test_single_period.Single();
|
||||
Assert.IsTrue(tracker.Contains(period.Start));
|
||||
Assert.IsTrue(tracker.Contains(getMidTime(period)));
|
||||
Assert.IsTrue(tracker.Contains(period.End));
|
||||
Assert.IsTrue(tracker.IsInAny(period.Start));
|
||||
Assert.IsTrue(tracker.IsInAny(getMidTime(period)));
|
||||
Assert.IsTrue(tracker.IsInAny(period.End));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -40,7 +40,7 @@ namespace osu.Game.Tests.NonVisual
|
||||
var tracker = new PeriodTracker { Periods = test_periods };
|
||||
|
||||
foreach (var period in test_periods)
|
||||
Assert.IsTrue(tracker.Contains(getMidTime(period)));
|
||||
Assert.IsTrue(tracker.IsInAny(getMidTime(period)));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -49,7 +49,7 @@ namespace osu.Game.Tests.NonVisual
|
||||
var tracker = new PeriodTracker { Periods = test_periods };
|
||||
|
||||
foreach (var period in test_periods.OrderBy(_ => RNG.Next()))
|
||||
Assert.IsTrue(tracker.Contains(getMidTime(period)));
|
||||
Assert.IsTrue(tracker.IsInAny(getMidTime(period)));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -64,12 +64,12 @@ namespace osu.Game.Tests.NonVisual
|
||||
}
|
||||
};
|
||||
|
||||
Assert.IsFalse(tracker.Contains(0.9), "Time before first period is being considered inside");
|
||||
Assert.IsFalse(tracker.IsInAny(0.9), "Time before first period is being considered inside");
|
||||
|
||||
Assert.IsFalse(tracker.Contains(2.1), "Time right after first period is being considered inside");
|
||||
Assert.IsFalse(tracker.Contains(2.9), "Time right before second period is being considered inside");
|
||||
Assert.IsFalse(tracker.IsInAny(2.1), "Time right after first period is being considered inside");
|
||||
Assert.IsFalse(tracker.IsInAny(2.9), "Time right before second period is being considered inside");
|
||||
|
||||
Assert.IsFalse(tracker.Contains(4.1), "Time after last period is being considered inside");
|
||||
Assert.IsFalse(tracker.IsInAny(4.1), "Time after last period is being considered inside");
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -78,10 +78,10 @@ namespace osu.Game.Tests.NonVisual
|
||||
var tracker = new PeriodTracker { Periods = test_single_period };
|
||||
|
||||
var period = test_single_period.Single();
|
||||
Assert.IsTrue(tracker.Contains(getMidTime(period)));
|
||||
Assert.IsTrue(tracker.IsInAny(getMidTime(period)));
|
||||
|
||||
tracker.Periods = null;
|
||||
Assert.IsFalse(tracker.Contains(getMidTime(period)));
|
||||
Assert.IsFalse(tracker.IsInAny(getMidTime(period)));
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -48,7 +48,7 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
var time = Clock.CurrentTime;
|
||||
|
||||
isBreakTime.Value = tracker.Contains(time)
|
||||
isBreakTime.Value = tracker.IsInAny(time)
|
||||
|| time < gameplayStartTime
|
||||
|| scoreProcessor?.HasCompleted == true;
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ namespace osu.Game.Utils
|
||||
/// Whether the provided time is in any of the added periods.
|
||||
/// </summary>
|
||||
/// <param name="time">The time value to check for.</param>
|
||||
public bool Contains(double time)
|
||||
public bool IsInAny(double time)
|
||||
{
|
||||
if (periods.Count == 0)
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user