mirror of
https://github.com/ppy/osu.git
synced 2025-01-06 15:02:54 +08:00
Update tests and logic
This commit is contained in:
parent
fbb7e9f12a
commit
00d7dc19cc
@ -41,6 +41,26 @@ namespace osu.Game.Tournament.Tests.Screens
|
||||
AddAssert("ensure layout width is 2", () => screen.ChildrenOfType<TournamentBeatmapPanel>().ElementAt(2).Y > 0);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestJustEnoughMaps()
|
||||
{
|
||||
AddStep("load just enough maps", () =>
|
||||
{
|
||||
Ladder.CurrentMatch.Value.Round.Value.Beatmaps.Clear();
|
||||
|
||||
for (int i = 0; i < 18; i++)
|
||||
addBeatmap();
|
||||
});
|
||||
|
||||
AddStep("reset match", () =>
|
||||
{
|
||||
Ladder.CurrentMatch.Value = new TournamentMatch();
|
||||
Ladder.CurrentMatch.Value = Ladder.Matches.First();
|
||||
});
|
||||
|
||||
AddAssert("ensure layout width is 2", () => screen.ChildrenOfType<TournamentBeatmapPanel>().ElementAt(2).Y > 0);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestManyMaps()
|
||||
{
|
||||
@ -48,7 +68,7 @@ namespace osu.Game.Tournament.Tests.Screens
|
||||
{
|
||||
Ladder.CurrentMatch.Value.Round.Value.Beatmaps.Clear();
|
||||
|
||||
for (int i = 0; i < 17; i++)
|
||||
for (int i = 0; i < 19; i++)
|
||||
addBeatmap();
|
||||
});
|
||||
|
||||
@ -61,6 +81,26 @@ namespace osu.Game.Tournament.Tests.Screens
|
||||
AddAssert("ensure layout width is 3", () => screen.ChildrenOfType<TournamentBeatmapPanel>().ElementAt(2).Y == 0);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestJustEnoughMods()
|
||||
{
|
||||
AddStep("load many maps", () =>
|
||||
{
|
||||
Ladder.CurrentMatch.Value.Round.Value.Beatmaps.Clear();
|
||||
|
||||
for (int i = 0; i < 11; i++)
|
||||
addBeatmap(i > 4 ? $"M{i}" : "NM");
|
||||
});
|
||||
|
||||
AddStep("reset match", () =>
|
||||
{
|
||||
Ladder.CurrentMatch.Value = new TournamentMatch();
|
||||
Ladder.CurrentMatch.Value = Ladder.Matches.First();
|
||||
});
|
||||
|
||||
AddAssert("ensure layout width is 2", () => screen.ChildrenOfType<TournamentBeatmapPanel>().ElementAt(2).Y > 0);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestManyMods()
|
||||
{
|
||||
@ -68,8 +108,8 @@ namespace osu.Game.Tournament.Tests.Screens
|
||||
{
|
||||
Ladder.CurrentMatch.Value.Round.Value.Beatmaps.Clear();
|
||||
|
||||
for (int i = 0; i < 13; i++)
|
||||
addBeatmap(i < 4 ? $"M{i}" : "NM");
|
||||
for (int i = 0; i < 12; i++)
|
||||
addBeatmap(i > 4 ? $"M{i}" : "NM");
|
||||
});
|
||||
|
||||
AddStep("reset match", () =>
|
||||
|
@ -211,7 +211,6 @@ namespace osu.Game.Tournament.Screens.MapPool
|
||||
private void matchChanged(ValueChangedEvent<TournamentMatch> match)
|
||||
{
|
||||
mapFlows.Clear();
|
||||
mapFlows.Padding = new MarginPadding(5) { Horizontal = 100 };
|
||||
|
||||
int totalRows = 0;
|
||||
|
||||
@ -254,9 +253,11 @@ namespace osu.Game.Tournament.Screens.MapPool
|
||||
}
|
||||
}
|
||||
|
||||
if (totalRows > 9)
|
||||
mapFlows.Padding = new MarginPadding(5)
|
||||
{
|
||||
// remove horizontal padding to increase flow width to 3 panels
|
||||
mapFlows.Padding = new MarginPadding(5);
|
||||
Horizontal = totalRows > 9 ? 0 : 100
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user