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

Update existing function type rather than adding an override

This commit is contained in:
Dean Herbert 2021-06-02 16:04:53 +09:00
parent 7c6400735f
commit f8ae70e562
34 changed files with 117 additions and 129 deletions

View File

@ -10,14 +10,6 @@ trim_trailing_whitespace = true
#Roslyn naming styles #Roslyn naming styles
#PascalCase for public and protected members
dotnet_naming_style.pascalcase.capitalization = pascal_case
dotnet_naming_symbols.public_members.applicable_accessibilities = public,internal,protected,protected_internal,private_protected
dotnet_naming_symbols.public_members.applicable_kinds = property,method,field,event
dotnet_naming_rule.public_members_pascalcase.severity = error
dotnet_naming_rule.public_members_pascalcase.symbols = public_members
dotnet_naming_rule.public_members_pascalcase.style = pascalcase
#camelCase for private members #camelCase for private members
dotnet_naming_style.camelcase.capitalization = camel_case dotnet_naming_style.camelcase.capitalization = camel_case
@ -197,4 +189,4 @@ dotnet_diagnostic.IDE0069.severity = none
dotnet_diagnostic.CA2225.severity = none dotnet_diagnostic.CA2225.severity = none
# Banned APIs # Banned APIs
dotnet_diagnostic.RS0030.severity = error dotnet_diagnostic.RS0030.severity = error

View File

@ -95,7 +95,7 @@ namespace osu.Game.Rulesets.Catch.Tests
CircleSize = circleSize CircleSize = circleSize
}; };
SetContents(() => SetContents(_ =>
{ {
var droppedObjectContainer = new Container<CaughtObject> var droppedObjectContainer = new Container<CaughtObject>
{ {

View File

@ -26,7 +26,7 @@ namespace osu.Game.Rulesets.Catch.Tests
{ {
scoreProcessor = new ScoreProcessor(); scoreProcessor = new ScoreProcessor();
SetContents(() => new CatchComboDisplay SetContents(_ => new CatchComboDisplay
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,

View File

@ -19,22 +19,22 @@ namespace osu.Game.Rulesets.Catch.Tests
{ {
base.LoadComplete(); base.LoadComplete();
AddStep("show pear", () => SetContents(() => createDrawableFruit(0))); AddStep("show pear", () => SetContents(_ => createDrawableFruit(0)));
AddStep("show grape", () => SetContents(() => createDrawableFruit(1))); AddStep("show grape", () => SetContents(_ => createDrawableFruit(1)));
AddStep("show pineapple / apple", () => SetContents(() => createDrawableFruit(2))); AddStep("show pineapple / apple", () => SetContents(_ => createDrawableFruit(2)));
AddStep("show raspberry / orange", () => SetContents(() => createDrawableFruit(3))); AddStep("show raspberry / orange", () => SetContents(_ => createDrawableFruit(3)));
AddStep("show banana", () => SetContents(createDrawableBanana)); AddStep("show banana", () => SetContents(_ => createDrawableBanana()));
AddStep("show droplet", () => SetContents(() => createDrawableDroplet())); AddStep("show droplet", () => SetContents(_ => createDrawableDroplet()));
AddStep("show tiny droplet", () => SetContents(createDrawableTinyDroplet)); AddStep("show tiny droplet", () => SetContents(_ => createDrawableTinyDroplet()));
AddStep("show hyperdash pear", () => SetContents(() => createDrawableFruit(0, true))); AddStep("show hyperdash pear", () => SetContents(_ => createDrawableFruit(0, true)));
AddStep("show hyperdash grape", () => SetContents(() => createDrawableFruit(1, true))); AddStep("show hyperdash grape", () => SetContents(_ => createDrawableFruit(1, true)));
AddStep("show hyperdash pineapple / apple", () => SetContents(() => createDrawableFruit(2, true))); AddStep("show hyperdash pineapple / apple", () => SetContents(_ => createDrawableFruit(2, true)));
AddStep("show hyperdash raspberry / orange", () => SetContents(() => createDrawableFruit(3, true))); AddStep("show hyperdash raspberry / orange", () => SetContents(_ => createDrawableFruit(3, true)));
AddStep("show hyperdash droplet", () => SetContents(() => createDrawableDroplet(true))); AddStep("show hyperdash droplet", () => SetContents(_ => createDrawableDroplet(true)));
} }
private Drawable createDrawableFruit(int indexInBeatmap, bool hyperdash = false) => private Drawable createDrawableFruit(int indexInBeatmap, bool hyperdash = false) =>

View File

@ -14,13 +14,13 @@ namespace osu.Game.Rulesets.Catch.Tests
protected override void LoadComplete() protected override void LoadComplete()
{ {
AddStep("fruit changes visual and hyper", () => SetContents(() => new TestDrawableCatchHitObjectSpecimen(new DrawableFruit(new Fruit AddStep("fruit changes visual and hyper", () => SetContents(_ => new TestDrawableCatchHitObjectSpecimen(new DrawableFruit(new Fruit
{ {
IndexInBeatmapBindable = { BindTarget = indexInBeatmap }, IndexInBeatmapBindable = { BindTarget = indexInBeatmap },
HyperDashBindable = { BindTarget = hyperDash }, HyperDashBindable = { BindTarget = hyperDash },
})))); }))));
AddStep("droplet changes hyper", () => SetContents(() => new TestDrawableCatchHitObjectSpecimen(new DrawableDroplet(new Droplet AddStep("droplet changes hyper", () => SetContents(_ => new TestDrawableCatchHitObjectSpecimen(new DrawableDroplet(new Droplet
{ {
HyperDashBindable = { BindTarget = hyperDash }, HyperDashBindable = { BindTarget = hyperDash },
})))); }))));

View File

@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Mania.Tests.Skinning
[SetUp] [SetUp]
public void SetUp() => Schedule(() => public void SetUp() => Schedule(() =>
{ {
SetContents(() => new FillFlowContainer SetContents(_ => new FillFlowContainer
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,

View File

@ -15,7 +15,7 @@ namespace osu.Game.Rulesets.Mania.Tests.Skinning
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
SetContents(() => new FillFlowContainer SetContents(_ => new FillFlowContainer
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,

View File

@ -15,7 +15,7 @@ namespace osu.Game.Rulesets.Mania.Tests.Skinning
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
SetContents(() => new FillFlowContainer SetContents(_ => new FillFlowContainer
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,

View File

@ -23,7 +23,7 @@ namespace osu.Game.Rulesets.Mania.Tests.Skinning
{ {
if (hitWindows.IsHitResultAllowed(result)) if (hitWindows.IsHitResultAllowed(result))
{ {
AddStep("Show " + result.GetDescription(), () => SetContents(() => AddStep("Show " + result.GetDescription(), () => SetContents(_ =>
new DrawableManiaJudgement(new JudgementResult(new HitObject { StartTime = Time.Current }, new Judgement()) new DrawableManiaJudgement(new JudgementResult(new HitObject { StartTime = Time.Current }, new Judgement())
{ {
Type = result Type = result

View File

@ -53,7 +53,7 @@ namespace osu.Game.Rulesets.Mania.Tests.Skinning
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
SetContents(() => SetContents(_ =>
{ {
var pool = new DrawablePool<PoolableHitExplosion>(5); var pool = new DrawablePool<PoolableHitExplosion>(5);
hitExplosionPools.Add(pool); hitExplosionPools.Add(pool);

View File

@ -15,7 +15,7 @@ namespace osu.Game.Rulesets.Mania.Tests.Skinning
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
SetContents(() => new FillFlowContainer SetContents(_ => new FillFlowContainer
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,

View File

@ -23,7 +23,7 @@ namespace osu.Game.Rulesets.Mania.Tests.Skinning
new StageDefinition { Columns = 2 } new StageDefinition { Columns = 2 }
}; };
SetContents(() => new ManiaPlayfield(stageDefinitions)); SetContents(_ => new ManiaPlayfield(stageDefinitions));
}); });
} }
@ -38,7 +38,7 @@ namespace osu.Game.Rulesets.Mania.Tests.Skinning
new StageDefinition { Columns = 2 } new StageDefinition { Columns = 2 }
}; };
SetContents(() => new ManiaPlayfield(stageDefinitions)); SetContents(_ => new ManiaPlayfield(stageDefinitions));
}); });
} }

View File

@ -12,7 +12,7 @@ namespace osu.Game.Rulesets.Mania.Tests.Skinning
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
SetContents(() => SetContents(_ =>
{ {
ManiaAction normalAction = ManiaAction.Key1; ManiaAction normalAction = ManiaAction.Key1;
ManiaAction specialAction = ManiaAction.Special1; ManiaAction specialAction = ManiaAction.Special1;

View File

@ -14,7 +14,7 @@ namespace osu.Game.Rulesets.Mania.Tests.Skinning
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
SetContents(() => new SkinnableDrawable(new ManiaSkinComponent(ManiaSkinComponents.StageBackground, stageDefinition: new StageDefinition { Columns = 4 }), SetContents(_ => new SkinnableDrawable(new ManiaSkinComponent(ManiaSkinComponents.StageBackground, stageDefinition: new StageDefinition { Columns = 4 }),
_ => new DefaultStageBackground()) _ => new DefaultStageBackground())
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,

View File

@ -13,7 +13,7 @@ namespace osu.Game.Rulesets.Mania.Tests.Skinning
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
SetContents(() => new SkinnableDrawable(new ManiaSkinComponent(ManiaSkinComponents.StageForeground, stageDefinition: new StageDefinition { Columns = 4 }), _ => null) SetContents(_ => new SkinnableDrawable(new ManiaSkinComponent(ManiaSkinComponents.StageForeground, stageDefinition: new StageDefinition { Columns = 4 }), _ => null)
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,

View File

@ -64,7 +64,7 @@ namespace osu.Game.Rulesets.Osu.Tests
{ {
int poolIndex = 0; int poolIndex = 0;
SetContents(() => SetContents(_ =>
{ {
DrawablePool<TestDrawableOsuJudgement> pool; DrawablePool<TestDrawableOsuJudgement> pool;

View File

@ -97,7 +97,7 @@ namespace osu.Game.Rulesets.Osu.Tests
private void loadContent(bool automated = true, Func<SkinProvidingContainer> skinProvider = null) private void loadContent(bool automated = true, Func<SkinProvidingContainer> skinProvider = null)
{ {
SetContents(() => SetContents(_ =>
{ {
var inputManager = automated ? (InputManager)new MovingCursorInputManager() : new OsuInputManager(new OsuRuleset().RulesetInfo); var inputManager = automated ? (InputManager)new MovingCursorInputManager() : new OsuInputManager(new OsuRuleset().RulesetInfo);
var skinContainer = skinProvider?.Invoke() ?? new SkinProvidingContainer(null); var skinContainer = skinProvider?.Invoke() ?? new SkinProvidingContainer(null);

View File

@ -23,18 +23,18 @@ namespace osu.Game.Rulesets.Osu.Tests
[Test] [Test]
public void TestVariousHitCircles() public void TestVariousHitCircles()
{ {
AddStep("Miss Big Single", () => SetContents(() => testSingle(2))); AddStep("Miss Big Single", () => SetContents(_ => testSingle(2)));
AddStep("Miss Medium Single", () => SetContents(() => testSingle(5))); AddStep("Miss Medium Single", () => SetContents(_ => testSingle(5)));
AddStep("Miss Small Single", () => SetContents(() => testSingle(7))); AddStep("Miss Small Single", () => SetContents(_ => testSingle(7)));
AddStep("Hit Big Single", () => SetContents(() => testSingle(2, true))); AddStep("Hit Big Single", () => SetContents(_ => testSingle(2, true)));
AddStep("Hit Medium Single", () => SetContents(() => testSingle(5, true))); AddStep("Hit Medium Single", () => SetContents(_ => testSingle(5, true)));
AddStep("Hit Small Single", () => SetContents(() => testSingle(7, true))); AddStep("Hit Small Single", () => SetContents(_ => testSingle(7, true)));
AddStep("Miss Big Stream", () => SetContents(() => testStream(2))); AddStep("Miss Big Stream", () => SetContents(_ => testStream(2)));
AddStep("Miss Medium Stream", () => SetContents(() => testStream(5))); AddStep("Miss Medium Stream", () => SetContents(_ => testStream(5)));
AddStep("Miss Small Stream", () => SetContents(() => testStream(7))); AddStep("Miss Small Stream", () => SetContents(_ => testStream(7)));
AddStep("Hit Big Stream", () => SetContents(() => testStream(2, true))); AddStep("Hit Big Stream", () => SetContents(_ => testStream(2, true)));
AddStep("Hit Medium Stream", () => SetContents(() => testStream(5, true))); AddStep("Hit Medium Stream", () => SetContents(_ => testStream(5, true)));
AddStep("Hit Small Stream", () => SetContents(() => testStream(7, true))); AddStep("Hit Small Stream", () => SetContents(_ => testStream(7, true)));
} }
private Drawable testSingle(float circleSize, bool auto = false, double timeOffset = 0, Vector2? positionOffset = null) private Drawable testSingle(float circleSize, bool auto = false, double timeOffset = 0, Vector2? positionOffset = null)

View File

@ -30,54 +30,54 @@ namespace osu.Game.Rulesets.Osu.Tests
[Test] [Test]
public void TestVariousSliders() public void TestVariousSliders()
{ {
AddStep("Big Single", () => SetContents(() => testSimpleBig())); AddStep("Big Single", () => SetContents(_ => testSimpleBig()));
AddStep("Medium Single", () => SetContents(() => testSimpleMedium())); AddStep("Medium Single", () => SetContents(_ => testSimpleMedium()));
AddStep("Small Single", () => SetContents(() => testSimpleSmall())); AddStep("Small Single", () => SetContents(_ => testSimpleSmall()));
AddStep("Big 1 Repeat", () => SetContents(() => testSimpleBig(1))); AddStep("Big 1 Repeat", () => SetContents(_ => testSimpleBig(1)));
AddStep("Medium 1 Repeat", () => SetContents(() => testSimpleMedium(1))); AddStep("Medium 1 Repeat", () => SetContents(_ => testSimpleMedium(1)));
AddStep("Small 1 Repeat", () => SetContents(() => testSimpleSmall(1))); AddStep("Small 1 Repeat", () => SetContents(_ => testSimpleSmall(1)));
AddStep("Big 2 Repeats", () => SetContents(() => testSimpleBig(2))); AddStep("Big 2 Repeats", () => SetContents(_ => testSimpleBig(2)));
AddStep("Medium 2 Repeats", () => SetContents(() => testSimpleMedium(2))); AddStep("Medium 2 Repeats", () => SetContents(_ => testSimpleMedium(2)));
AddStep("Small 2 Repeats", () => SetContents(() => testSimpleSmall(2))); AddStep("Small 2 Repeats", () => SetContents(_ => testSimpleSmall(2)));
AddStep("Slow Slider", () => SetContents(testSlowSpeed)); // slow long sliders take ages already so no repeat steps AddStep("Slow Slider", () => SetContents(_ => testSlowSpeed())); // slow long sliders take ages already so no repeat steps
AddStep("Slow Short Slider", () => SetContents(() => testShortSlowSpeed())); AddStep("Slow Short Slider", () => SetContents(_ => testShortSlowSpeed()));
AddStep("Slow Short Slider 1 Repeats", () => SetContents(() => testShortSlowSpeed(1))); AddStep("Slow Short Slider 1 Repeats", () => SetContents(_ => testShortSlowSpeed(1)));
AddStep("Slow Short Slider 2 Repeats", () => SetContents(() => testShortSlowSpeed(2))); AddStep("Slow Short Slider 2 Repeats", () => SetContents(_ => testShortSlowSpeed(2)));
AddStep("Fast Slider", () => SetContents(() => testHighSpeed())); AddStep("Fast Slider", () => SetContents(_ => testHighSpeed()));
AddStep("Fast Slider 1 Repeat", () => SetContents(() => testHighSpeed(1))); AddStep("Fast Slider 1 Repeat", () => SetContents(_ => testHighSpeed(1)));
AddStep("Fast Slider 2 Repeats", () => SetContents(() => testHighSpeed(2))); AddStep("Fast Slider 2 Repeats", () => SetContents(_ => testHighSpeed(2)));
AddStep("Fast Short Slider", () => SetContents(() => testShortHighSpeed())); AddStep("Fast Short Slider", () => SetContents(_ => testShortHighSpeed()));
AddStep("Fast Short Slider 1 Repeat", () => SetContents(() => testShortHighSpeed(1))); AddStep("Fast Short Slider 1 Repeat", () => SetContents(_ => testShortHighSpeed(1)));
AddStep("Fast Short Slider 2 Repeats", () => SetContents(() => testShortHighSpeed(2))); AddStep("Fast Short Slider 2 Repeats", () => SetContents(_ => testShortHighSpeed(2)));
AddStep("Fast Short Slider 6 Repeats", () => SetContents(() => testShortHighSpeed(6))); AddStep("Fast Short Slider 6 Repeats", () => SetContents(_ => testShortHighSpeed(6)));
AddStep("Perfect Curve", () => SetContents(() => testPerfect())); AddStep("Perfect Curve", () => SetContents(_ => testPerfect()));
AddStep("Perfect Curve 1 Repeat", () => SetContents(() => testPerfect(1))); AddStep("Perfect Curve 1 Repeat", () => SetContents(_ => testPerfect(1)));
AddStep("Perfect Curve 2 Repeats", () => SetContents(() => testPerfect(2))); AddStep("Perfect Curve 2 Repeats", () => SetContents(_ => testPerfect(2)));
AddStep("Linear Slider", () => SetContents(() => testLinear())); AddStep("Linear Slider", () => SetContents(_ => testLinear()));
AddStep("Linear Slider 1 Repeat", () => SetContents(() => testLinear(1))); AddStep("Linear Slider 1 Repeat", () => SetContents(_ => testLinear(1)));
AddStep("Linear Slider 2 Repeats", () => SetContents(() => testLinear(2))); AddStep("Linear Slider 2 Repeats", () => SetContents(_ => testLinear(2)));
AddStep("Bezier Slider", () => SetContents(() => testBezier())); AddStep("Bezier Slider", () => SetContents(_ => testBezier()));
AddStep("Bezier Slider 1 Repeat", () => SetContents(() => testBezier(1))); AddStep("Bezier Slider 1 Repeat", () => SetContents(_ => testBezier(1)));
AddStep("Bezier Slider 2 Repeats", () => SetContents(() => testBezier(2))); AddStep("Bezier Slider 2 Repeats", () => SetContents(_ => testBezier(2)));
AddStep("Linear Overlapping", () => SetContents(() => testLinearOverlapping())); AddStep("Linear Overlapping", () => SetContents(_ => testLinearOverlapping()));
AddStep("Linear Overlapping 1 Repeat", () => SetContents(() => testLinearOverlapping(1))); AddStep("Linear Overlapping 1 Repeat", () => SetContents(_ => testLinearOverlapping(1)));
AddStep("Linear Overlapping 2 Repeats", () => SetContents(() => testLinearOverlapping(2))); AddStep("Linear Overlapping 2 Repeats", () => SetContents(_ => testLinearOverlapping(2)));
AddStep("Catmull Slider", () => SetContents(() => testCatmull())); AddStep("Catmull Slider", () => SetContents(_ => testCatmull()));
AddStep("Catmull Slider 1 Repeat", () => SetContents(() => testCatmull(1))); AddStep("Catmull Slider 1 Repeat", () => SetContents(_ => testCatmull(1)));
AddStep("Catmull Slider 2 Repeats", () => SetContents(() => testCatmull(2))); AddStep("Catmull Slider 2 Repeats", () => SetContents(_ => testCatmull(2)));
AddStep("Big Single, Large StackOffset", () => SetContents(() => testSimpleBigLargeStackOffset())); AddStep("Big Single, Large StackOffset", () => SetContents(_ => testSimpleBigLargeStackOffset()));
AddStep("Big 1 Repeat, Large StackOffset", () => SetContents(() => testSimpleBigLargeStackOffset(1))); AddStep("Big 1 Repeat, Large StackOffset", () => SetContents(_ => testSimpleBigLargeStackOffset(1)));
AddStep("Distance Overflow", () => SetContents(() => testDistanceOverflow())); AddStep("Distance Overflow", () => SetContents(_ => testDistanceOverflow()));
AddStep("Distance Overflow 1 Repeat", () => SetContents(() => testDistanceOverflow(1))); AddStep("Distance Overflow 1 Repeat", () => SetContents(_ => testDistanceOverflow(1)));
} }
[Test] [Test]

View File

@ -29,15 +29,15 @@ namespace osu.Game.Rulesets.Osu.Tests
public void TestVariousSpinners(bool autoplay) public void TestVariousSpinners(bool autoplay)
{ {
string term = autoplay ? "Hit" : "Miss"; string term = autoplay ? "Hit" : "Miss";
AddStep($"{term} Big", () => SetContents(() => testSingle(2, autoplay))); AddStep($"{term} Big", () => SetContents(_ => testSingle(2, autoplay)));
AddStep($"{term} Medium", () => SetContents(() => testSingle(5, autoplay))); AddStep($"{term} Medium", () => SetContents(_ => testSingle(5, autoplay)));
AddStep($"{term} Small", () => SetContents(() => testSingle(7, autoplay))); AddStep($"{term} Small", () => SetContents(_ => testSingle(7, autoplay)));
} }
[Test] [Test]
public void TestSpinningSamplePitchShift() public void TestSpinningSamplePitchShift()
{ {
AddStep("Add spinner", () => SetContents(() => testSingle(5, true, 4000))); AddStep("Add spinner", () => SetContents(_ => testSingle(5, true, 4000)));
AddUntilStep("Pitch starts low", () => getSpinningSample().Frequency.Value < 0.8); AddUntilStep("Pitch starts low", () => getSpinningSample().Frequency.Value < 0.8);
AddUntilStep("Pitch increases", () => getSpinningSample().Frequency.Value > 0.8); AddUntilStep("Pitch increases", () => getSpinningSample().Frequency.Value > 0.8);
@ -48,7 +48,7 @@ namespace osu.Game.Rulesets.Osu.Tests
[TestCase(true)] [TestCase(true)]
public void TestLongSpinner(bool autoplay) public void TestLongSpinner(bool autoplay)
{ {
AddStep("Very long spinner", () => SetContents(() => testSingle(5, autoplay, 4000))); AddStep("Very long spinner", () => SetContents(_ => testSingle(5, autoplay, 4000)));
AddUntilStep("Wait for completion", () => drawableSpinner.Result.HasResult); AddUntilStep("Wait for completion", () => drawableSpinner.Result.HasResult);
AddUntilStep("Check correct progress", () => drawableSpinner.Progress == (autoplay ? 1 : 0)); AddUntilStep("Check correct progress", () => drawableSpinner.Progress == (autoplay ? 1 : 0));
} }
@ -57,7 +57,7 @@ namespace osu.Game.Rulesets.Osu.Tests
[TestCase(true)] [TestCase(true)]
public void TestSuperShortSpinner(bool autoplay) public void TestSuperShortSpinner(bool autoplay)
{ {
AddStep("Very short spinner", () => SetContents(() => testSingle(5, autoplay, 200))); AddStep("Very short spinner", () => SetContents(_ => testSingle(5, autoplay, 200)));
AddUntilStep("Wait for completion", () => drawableSpinner.Result.HasResult); AddUntilStep("Wait for completion", () => drawableSpinner.Result.HasResult);
AddUntilStep("Short spinner implicitly completes", () => drawableSpinner.Progress == 1); AddUntilStep("Short spinner implicitly completes", () => drawableSpinner.Progress == 1);
} }

View File

@ -28,7 +28,7 @@ namespace osu.Game.Rulesets.Taiko.Tests.Skinning
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
AddStep("Bar line", () => SetContents(() => AddStep("Bar line", () => SetContents(_ =>
{ {
ScrollingHitObjectContainer hoc; ScrollingHitObjectContainer hoc;
@ -54,7 +54,7 @@ namespace osu.Game.Rulesets.Taiko.Tests.Skinning
return cont; return cont;
})); }));
AddStep("Bar line (major)", () => SetContents(() => AddStep("Bar line (major)", () => SetContents(_ =>
{ {
ScrollingHitObjectContainer hoc; ScrollingHitObjectContainer hoc;

View File

@ -26,7 +26,7 @@ namespace osu.Game.Rulesets.Taiko.Tests.Skinning
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
AddStep("Drum roll", () => SetContents(() => AddStep("Drum roll", () => SetContents(_ =>
{ {
var hoc = new ScrollingHitObjectContainer(); var hoc = new ScrollingHitObjectContainer();
@ -40,7 +40,7 @@ namespace osu.Game.Rulesets.Taiko.Tests.Skinning
return hoc; return hoc;
})); }));
AddStep("Drum roll (strong)", () => SetContents(() => AddStep("Drum roll (strong)", () => SetContents(_ =>
{ {
var hoc = new ScrollingHitObjectContainer(); var hoc = new ScrollingHitObjectContainer();

View File

@ -17,25 +17,25 @@ namespace osu.Game.Rulesets.Taiko.Tests.Skinning
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
AddStep("Centre hit", () => SetContents(() => new DrawableHit(createHitAtCurrentTime()) AddStep("Centre hit", () => SetContents(_ => new DrawableHit(createHitAtCurrentTime())
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
})); }));
AddStep("Centre hit (strong)", () => SetContents(() => new DrawableHit(createHitAtCurrentTime(true)) AddStep("Centre hit (strong)", () => SetContents(_ => new DrawableHit(createHitAtCurrentTime(true))
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
})); }));
AddStep("Rim hit", () => SetContents(() => new DrawableHit(createHitAtCurrentTime()) AddStep("Rim hit", () => SetContents(_ => new DrawableHit(createHitAtCurrentTime())
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
})); }));
AddStep("Rim hit (strong)", () => SetContents(() => new DrawableHit(createHitAtCurrentTime(true)) AddStep("Rim hit (strong)", () => SetContents(_ => new DrawableHit(createHitAtCurrentTime(true))
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,

View File

@ -54,16 +54,16 @@ namespace osu.Game.Rulesets.Taiko.Tests.Skinning
{ {
AddStep("set beatmap", () => setBeatmap()); AddStep("set beatmap", () => setBeatmap());
AddStep("clear state", () => SetContents(() => new TaikoMascotAnimation(TaikoMascotAnimationState.Clear))); AddStep("clear state", () => SetContents(_ => new TaikoMascotAnimation(TaikoMascotAnimationState.Clear)));
AddStep("idle state", () => SetContents(() => new TaikoMascotAnimation(TaikoMascotAnimationState.Idle))); AddStep("idle state", () => SetContents(_ => new TaikoMascotAnimation(TaikoMascotAnimationState.Idle)));
AddStep("kiai state", () => SetContents(() => new TaikoMascotAnimation(TaikoMascotAnimationState.Kiai))); AddStep("kiai state", () => SetContents(_ => new TaikoMascotAnimation(TaikoMascotAnimationState.Kiai)));
AddStep("fail state", () => SetContents(() => new TaikoMascotAnimation(TaikoMascotAnimationState.Fail))); AddStep("fail state", () => SetContents(_ => new TaikoMascotAnimation(TaikoMascotAnimationState.Fail)));
} }
[Test] [Test]
public void TestInitialState() public void TestInitialState()
{ {
AddStep("create mascot", () => SetContents(() => new DrawableTaikoMascot { RelativeSizeAxes = Axes.Both })); AddStep("create mascot", () => SetContents(_ => new DrawableTaikoMascot { RelativeSizeAxes = Axes.Both }));
AddAssert("mascot initially idle", () => allMascotsIn(TaikoMascotAnimationState.Idle)); AddAssert("mascot initially idle", () => allMascotsIn(TaikoMascotAnimationState.Idle));
} }
@ -73,7 +73,7 @@ namespace osu.Game.Rulesets.Taiko.Tests.Skinning
{ {
AddStep("set beatmap", () => setBeatmap()); AddStep("set beatmap", () => setBeatmap());
AddStep("create mascot", () => SetContents(() => new DrawableTaikoMascot { RelativeSizeAxes = Axes.Both })); AddStep("create mascot", () => SetContents(_ => new DrawableTaikoMascot { RelativeSizeAxes = Axes.Both }));
AddStep("set clear state", () => mascots.ForEach(mascot => mascot.State.Value = TaikoMascotAnimationState.Clear)); AddStep("set clear state", () => mascots.ForEach(mascot => mascot.State.Value = TaikoMascotAnimationState.Clear));
AddStep("miss", () => mascots.ForEach(mascot => mascot.LastResult.Value = new JudgementResult(new Hit(), new TaikoJudgement()) { Type = HitResult.Miss })); AddStep("miss", () => mascots.ForEach(mascot => mascot.LastResult.Value = new JudgementResult(new Hit(), new TaikoJudgement()) { Type = HitResult.Miss }));
@ -181,7 +181,7 @@ namespace osu.Game.Rulesets.Taiko.Tests.Skinning
{ {
Beatmap.Value.Track.Start(); Beatmap.Value.Track.Start();
SetContents(() => SetContents(_ =>
{ {
var ruleset = new TaikoRuleset(); var ruleset = new TaikoRuleset();
return new DrawableTaikoRuleset(ruleset, Beatmap.Value.GetPlayableBeatmap(ruleset.RulesetInfo)); return new DrawableTaikoRuleset(ruleset, Beatmap.Value.GetPlayableBeatmap(ruleset.RulesetInfo));

View File

@ -22,16 +22,16 @@ namespace osu.Game.Rulesets.Taiko.Tests.Skinning
[Test] [Test]
public void TestNormalHit() public void TestNormalHit()
{ {
AddStep("Great", () => SetContents(() => getContentFor(createHit(HitResult.Great)))); AddStep("Great", () => SetContents(_ => getContentFor(createHit(HitResult.Great))));
AddStep("Ok", () => SetContents(() => getContentFor(createHit(HitResult.Ok)))); AddStep("Ok", () => SetContents(_ => getContentFor(createHit(HitResult.Ok))));
AddStep("Miss", () => SetContents(() => getContentFor(createHit(HitResult.Miss)))); AddStep("Miss", () => SetContents(_ => getContentFor(createHit(HitResult.Miss))));
} }
[TestCase(HitResult.Great)] [TestCase(HitResult.Great)]
[TestCase(HitResult.Ok)] [TestCase(HitResult.Ok)]
public void TestStrongHit(HitResult type) public void TestStrongHit(HitResult type)
{ {
AddStep("create hit", () => SetContents(() => getContentFor(createStrongHit(type)))); AddStep("create hit", () => SetContents(_ => getContentFor(createStrongHit(type))));
AddStep("visualise second hit", AddStep("visualise second hit",
() => this.ChildrenOfType<HitExplosion>() () => this.ChildrenOfType<HitExplosion>()
.ForEach(e => e.VisualiseSecondHit(new JudgementResult(new HitObject { StartTime = Time.Current }, new Judgement())))); .ForEach(e => e.VisualiseSecondHit(new JudgementResult(new HitObject { StartTime = Time.Current }, new Judgement()))));

View File

@ -17,7 +17,7 @@ namespace osu.Game.Rulesets.Taiko.Tests.Skinning
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
SetContents(() => new TaikoInputManager(new TaikoRuleset().RulesetInfo) SetContents(_ => new TaikoInputManager(new TaikoRuleset().RulesetInfo)
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Child = new Container Child = new Container

View File

@ -15,8 +15,8 @@ namespace osu.Game.Rulesets.Taiko.Tests.Skinning
[Test] [Test]
public void TestKiaiHits() public void TestKiaiHits()
{ {
AddStep("rim hit", () => SetContents(() => getContentFor(createHit(HitType.Rim)))); AddStep("rim hit", () => SetContents(_ => getContentFor(createHit(HitType.Rim))));
AddStep("centre hit", () => SetContents(() => getContentFor(createHit(HitType.Centre)))); AddStep("centre hit", () => SetContents(_ => getContentFor(createHit(HitType.Centre))));
} }
private Drawable getContentFor(DrawableTestHit hit) private Drawable getContentFor(DrawableTestHit hit)

View File

@ -37,7 +37,7 @@ namespace osu.Game.Rulesets.Taiko.Tests.Skinning
Beatmap.Value.Track.Start(); Beatmap.Value.Track.Start();
}); });
AddStep("Load playfield", () => SetContents(() => new TaikoPlayfield(new ControlPointInfo()) AddStep("Load playfield", () => SetContents(_ => new TaikoPlayfield(new ControlPointInfo())
{ {
Anchor = Anchor.CentreLeft, Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft, Origin = Anchor.CentreLeft,

View File

@ -20,7 +20,7 @@ namespace osu.Game.Rulesets.Taiko.Tests.Skinning
public TestSceneTaikoScroller() public TestSceneTaikoScroller()
{ {
AddStep("Load scroller", () => SetContents(() => AddStep("Load scroller", () => SetContents(_ =>
new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.Scroller), _ => Empty()) new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.Scroller), _ => Empty())
{ {
Clock = new FramedClock(clock), Clock = new FramedClock(clock),

View File

@ -29,8 +29,7 @@ namespace osu.Game.Tests.Visual.Gameplay
AddStep("allow skin lookup", () => storyboard.UseSkinSprites = false); AddStep("allow skin lookup", () => storyboard.UseSkinSprites = false);
AddStep("create sprites", () => SetContents( AddStep("create sprites", () => SetContents(_ => createSprite(lookup_name, Anchor.TopLeft, Vector2.Zero)));
() => createSprite(lookup_name, Anchor.TopLeft, Vector2.Zero)));
assertSpritesFromSkin(false); assertSpritesFromSkin(false);
} }
@ -42,8 +41,7 @@ namespace osu.Game.Tests.Visual.Gameplay
AddStep("allow skin lookup", () => storyboard.UseSkinSprites = true); AddStep("allow skin lookup", () => storyboard.UseSkinSprites = true);
AddStep("create sprites", () => SetContents( AddStep("create sprites", () => SetContents(_ => createSprite(lookup_name, Anchor.Centre, Vector2.Zero)));
() => createSprite(lookup_name, Anchor.Centre, Vector2.Zero)));
assertSpritesFromSkin(true); assertSpritesFromSkin(true);
} }

View File

@ -14,7 +14,7 @@ namespace osu.Game.Tests.Visual.Gameplay
[Test] [Test]
public void TestToggleEditor() public void TestToggleEditor()
{ {
AddStep("show available components", () => SetContents(() => new SkinComponentToolbox(300) AddStep("show available components", () => SetContents(_ => new SkinComponentToolbox(300)
{ {
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,

View File

@ -27,7 +27,7 @@ namespace osu.Game.Tests.Visual.Gameplay
{ {
AddStep("create editor overlay", () => AddStep("create editor overlay", () =>
{ {
SetContents(() => SetContents(_ =>
{ {
var ruleset = new OsuRuleset(); var ruleset = new OsuRuleset();
var mods = new[] { ruleset.GetAutoplayMod() }; var mods = new[] { ruleset.GetAutoplayMod() };

View File

@ -77,7 +77,7 @@ namespace osu.Game.Tests.Visual.Gameplay
{ {
AddStep("create overlay", () => AddStep("create overlay", () =>
{ {
SetContents(() => SetContents(_ =>
{ {
hudOverlay = new HUDOverlay(null, Array.Empty<Mod>()); hudOverlay = new HUDOverlay(null, Array.Empty<Mod>());

View File

@ -52,9 +52,7 @@ namespace osu.Game.Tests.Visual
private readonly List<Drawable> createdDrawables = new List<Drawable>(); private readonly List<Drawable> createdDrawables = new List<Drawable>();
public void SetContents(Func<Drawable> creationFunction) => SetContents(_ => creationFunction?.Invoke()); protected void SetContents(Func<ISkin, Drawable> creationFunction)
public void SetContents(Func<ISkin, Drawable> creationFunction)
{ {
createdDrawables.Clear(); createdDrawables.Clear();