mirror of
https://github.com/ppy/osu.git
synced 2025-02-22 15:22:56 +08:00
Add test covering required behaviour
See https://github.com/ppy/osu/issues/30885.
This commit is contained in:
parent
58dcb25bd5
commit
2d3595f768
@ -27,18 +27,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
[SetUpSteps]
|
[SetUpSteps]
|
||||||
public void SetUpSteps()
|
public void SetUpSteps()
|
||||||
{
|
{
|
||||||
AddStep("Create control", () =>
|
recreateControl();
|
||||||
{
|
|
||||||
Child = new PlayerSettingsGroup("Some settings")
|
|
||||||
{
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
offsetControl = new BeatmapOffsetControl()
|
|
||||||
}
|
|
||||||
};
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -123,13 +112,14 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestCalibrationFromZero()
|
public void TestCalibrationFromZero()
|
||||||
{
|
{
|
||||||
|
ScoreInfo referenceScore = null!;
|
||||||
const double average_error = -4.5;
|
const double average_error = -4.5;
|
||||||
|
|
||||||
AddAssert("Offset is neutral", () => offsetControl.Current.Value == 0);
|
AddAssert("Offset is neutral", () => offsetControl.Current.Value == 0);
|
||||||
AddAssert("No calibration button", () => !offsetControl.ChildrenOfType<SettingsButton>().Any());
|
AddAssert("No calibration button", () => !offsetControl.ChildrenOfType<SettingsButton>().Any());
|
||||||
AddStep("Set reference score", () =>
|
AddStep("Set reference score", () =>
|
||||||
{
|
{
|
||||||
offsetControl.ReferenceScore.Value = new ScoreInfo
|
offsetControl.ReferenceScore.Value = referenceScore = new ScoreInfo
|
||||||
{
|
{
|
||||||
HitEvents = TestSceneHitEventTimingDistributionGraph.CreateDistributedHitEvents(average_error),
|
HitEvents = TestSceneHitEventTimingDistributionGraph.CreateDistributedHitEvents(average_error),
|
||||||
BeatmapInfo = Beatmap.Value.BeatmapInfo,
|
BeatmapInfo = Beatmap.Value.BeatmapInfo,
|
||||||
@ -143,6 +133,10 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
AddUntilStep("Button is disabled", () => !offsetControl.ChildrenOfType<SettingsButton>().Single().Enabled.Value);
|
AddUntilStep("Button is disabled", () => !offsetControl.ChildrenOfType<SettingsButton>().Single().Enabled.Value);
|
||||||
AddStep("Remove reference score", () => offsetControl.ReferenceScore.Value = null);
|
AddStep("Remove reference score", () => offsetControl.ReferenceScore.Value = null);
|
||||||
AddAssert("No calibration button", () => !offsetControl.ChildrenOfType<SettingsButton>().Any());
|
AddAssert("No calibration button", () => !offsetControl.ChildrenOfType<SettingsButton>().Any());
|
||||||
|
|
||||||
|
recreateControl();
|
||||||
|
AddStep("Set same reference score", () => offsetControl.ReferenceScore.Value = referenceScore);
|
||||||
|
AddAssert("No calibration button", () => !offsetControl.ChildrenOfType<SettingsButton>().Any());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -251,5 +245,21 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
AddStep("Remove reference score", () => offsetControl.ReferenceScore.Value = null);
|
AddStep("Remove reference score", () => offsetControl.ReferenceScore.Value = null);
|
||||||
AddAssert("No calibration button", () => !offsetControl.ChildrenOfType<SettingsButton>().Any());
|
AddAssert("No calibration button", () => !offsetControl.ChildrenOfType<SettingsButton>().Any());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void recreateControl()
|
||||||
|
{
|
||||||
|
AddStep("Create control", () =>
|
||||||
|
{
|
||||||
|
Child = new PlayerSettingsGroup("Some settings")
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
offsetControl = new BeatmapOffsetControl()
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user