mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 20:22:55 +08:00
Split tests out
This commit is contained in:
parent
a6bdf04f6b
commit
df14f473c2
@ -25,57 +25,43 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
|
|
||||||
private ModDisplay modDisplay;
|
private ModDisplay modDisplay;
|
||||||
|
|
||||||
|
private BeatmapDetailArea detailsArea;
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private RulesetStore rulesets { get; set; }
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuGameBase game, RulesetStore rulesets)
|
private void load(OsuGameBase game, RulesetStore rulesets)
|
||||||
{
|
{
|
||||||
BeatmapDetailArea detailsArea;
|
}
|
||||||
Add(detailsArea = new BeatmapDetailArea
|
|
||||||
|
[SetUp]
|
||||||
|
public void SetUp() => Schedule(() =>
|
||||||
|
{
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
detailsArea = new BeatmapDetailArea
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Size = new Vector2(550f, 450f),
|
Size = new Vector2(550f, 450f),
|
||||||
});
|
},
|
||||||
|
modDisplay = new ModDisplay
|
||||||
Add(modDisplay = new ModDisplay
|
|
||||||
{
|
{
|
||||||
Anchor = Anchor.TopRight,
|
Anchor = Anchor.TopRight,
|
||||||
Origin = Anchor.TopRight,
|
Origin = Anchor.TopRight,
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Position = new Vector2(0, 25),
|
Position = new Vector2(0, 25),
|
||||||
});
|
}
|
||||||
|
};
|
||||||
|
|
||||||
modDisplay.Current.BindTo(SelectedMods);
|
modDisplay.Current.BindTo(SelectedMods);
|
||||||
|
});
|
||||||
|
|
||||||
AddStep("all metrics", () => detailsArea.Beatmap = new TestWorkingBeatmap(new Beatmap
|
[Test]
|
||||||
|
public void TestBasicScenarios()
|
||||||
{
|
{
|
||||||
BeatmapInfo =
|
showAllMetrics();
|
||||||
{
|
|
||||||
BeatmapSet = new BeatmapSetInfo
|
|
||||||
{
|
|
||||||
Metrics = new BeatmapSetMetrics { Ratings = Enumerable.Range(0, 11).ToArray() }
|
|
||||||
},
|
|
||||||
Version = "All Metrics",
|
|
||||||
Metadata = new BeatmapMetadata
|
|
||||||
{
|
|
||||||
Source = "osu!lazer",
|
|
||||||
Tags = "this beatmap has all the metrics",
|
|
||||||
},
|
|
||||||
BaseDifficulty = new BeatmapDifficulty
|
|
||||||
{
|
|
||||||
CircleSize = 7,
|
|
||||||
DrainRate = 1,
|
|
||||||
OverallDifficulty = 5.7f,
|
|
||||||
ApproachRate = 3.5f,
|
|
||||||
},
|
|
||||||
StarDifficulty = 5.3f,
|
|
||||||
Metrics = new BeatmapMetrics
|
|
||||||
{
|
|
||||||
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
|
|
||||||
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
|
|
||||||
AddStep("all except source", () => detailsArea.Beatmap = new TestWorkingBeatmap(new Beatmap
|
AddStep("all except source", () => detailsArea.Beatmap = new TestWorkingBeatmap(new Beatmap
|
||||||
{
|
{
|
||||||
BeatmapInfo =
|
BeatmapInfo =
|
||||||
@ -178,60 +164,50 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
AddStep("null beatmap", () => detailsArea.Beatmap = null);
|
AddStep("null beatmap", () => detailsArea.Beatmap = null);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestModAdjustments()
|
||||||
|
{
|
||||||
|
showAllMetrics();
|
||||||
|
|
||||||
Ruleset ruleset = rulesets.AvailableRulesets.First().CreateInstance();
|
Ruleset ruleset = rulesets.AvailableRulesets.First().CreateInstance();
|
||||||
|
|
||||||
AddStep("with EZ mod", () =>
|
AddStep("with EZ mod", () => SelectedMods.Value = new[] { ruleset.GetAllMods().First(m => m is ModEasy) });
|
||||||
|
AddStep("with HR mod", () => SelectedMods.Value = new[] { ruleset.GetAllMods().First(m => m is ModHardRock) });
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showAllMetrics()
|
||||||
{
|
{
|
||||||
detailsArea.Beatmap = new TestWorkingBeatmap(new Beatmap
|
AddStep("all metrics", () => detailsArea.Beatmap = new TestWorkingBeatmap(new Beatmap
|
||||||
{
|
{
|
||||||
BeatmapInfo =
|
BeatmapInfo =
|
||||||
{
|
{
|
||||||
Version = "Has Easy Mod",
|
BeatmapSet = new BeatmapSetInfo
|
||||||
|
{
|
||||||
|
Metrics = new BeatmapSetMetrics { Ratings = Enumerable.Range(0, 11).ToArray() }
|
||||||
|
},
|
||||||
|
Version = "All Metrics",
|
||||||
Metadata = new BeatmapMetadata
|
Metadata = new BeatmapMetadata
|
||||||
{
|
{
|
||||||
Source = "osu!lazer",
|
Source = "osu!lazer",
|
||||||
Tags = "this beatmap has the easy mod enabled",
|
Tags = "this beatmap has all the metrics",
|
||||||
},
|
},
|
||||||
BaseDifficulty = new BeatmapDifficulty
|
BaseDifficulty = new BeatmapDifficulty
|
||||||
{
|
{
|
||||||
CircleSize = 3,
|
CircleSize = 7,
|
||||||
DrainRate = 3,
|
DrainRate = 1,
|
||||||
OverallDifficulty = 3,
|
OverallDifficulty = 5.7f,
|
||||||
ApproachRate = 3,
|
ApproachRate = 3.5f,
|
||||||
},
|
},
|
||||||
StarDifficulty = 1f,
|
StarDifficulty = 5.3f,
|
||||||
}
|
Metrics = new BeatmapMetrics
|
||||||
});
|
|
||||||
|
|
||||||
SelectedMods.Value = new[] { ruleset.GetAllMods().First(m => m is ModEasy) };
|
|
||||||
});
|
|
||||||
|
|
||||||
AddStep("with HR mod", () =>
|
|
||||||
{
|
{
|
||||||
detailsArea.Beatmap = new TestWorkingBeatmap(new Beatmap
|
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
|
||||||
{
|
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
|
||||||
BeatmapInfo =
|
|
||||||
{
|
|
||||||
Version = "Has Hard Rock Mod",
|
|
||||||
Metadata = new BeatmapMetadata
|
|
||||||
{
|
|
||||||
Source = "osu!lazer",
|
|
||||||
Tags = "this beatmap has the hard rock mod enabled",
|
|
||||||
},
|
},
|
||||||
BaseDifficulty = new BeatmapDifficulty
|
|
||||||
{
|
|
||||||
CircleSize = 3,
|
|
||||||
DrainRate = 3,
|
|
||||||
OverallDifficulty = 3,
|
|
||||||
ApproachRate = 3,
|
|
||||||
},
|
|
||||||
StarDifficulty = 1f,
|
|
||||||
}
|
}
|
||||||
});
|
}));
|
||||||
|
|
||||||
SelectedMods.Value = new[] { ruleset.GetAllMods().First(m => m is ModHardRock) };
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user