mirror of https://github.com/ppy/osu
Rename is-in-any check method to a more legible name
This commit is contained in:
parent
8d899f4e77
commit
6e76e5900a
|
@ -29,9 +29,9 @@ public void TestCheckValueInsideSinglePeriod()
|
|||
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 @@ public void TestCheckValuesInsidePeriods()
|
|||
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 @@ public void TestCheckValuesInRandomOrder()
|
|||
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 @@ public void TestCheckValuesOutOfPeriods()
|
|||
}
|
||||
};
|
||||
|
||||
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 @@ public void TestNullRemovesExistingPeriods()
|
|||
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 @@ protected override void Update()
|
|||
|
||||
var time = Clock.CurrentTime;
|
||||
|
||||
isBreakTime.Value = tracker.Contains(time)
|
||||
isBreakTime.Value = tracker.IsInAny(time)
|
||||
|| time < gameplayStartTime
|
||||
|| scoreProcessor?.HasCompleted == true;
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ public IEnumerable<Period> Periods
|
|||
/// 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