1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 06:47:24 +08:00

Fix test failures

This commit is contained in:
Dean Herbert 2019-12-06 19:04:55 +09:00
parent 46d055604a
commit 347373a3ba
2 changed files with 14 additions and 11 deletions

View File

@ -31,6 +31,7 @@ namespace osu.Game.Tests.Visual.UserInterface
AddStep("open", modSelect.Show);
AddAssert("button disabled", () => !modSelect.CustomiseButton.Enabled.Value);
AddUntilStep("wait for button load", () => modSelect.ButtonsLoaded);
AddStep("select mod", () => modSelect.SelectMod(testMod));
AddAssert("button enabled", () => modSelect.CustomiseButton.Enabled.Value);
AddStep("open Customisation", () => modSelect.CustomiseButton.Click());
@ -43,6 +44,8 @@ namespace osu.Game.Tests.Visual.UserInterface
public new Container ModSettingsContainer => base.ModSettingsContainer;
public new TriangleButton CustomiseButton => base.CustomiseButton;
public bool ButtonsLoaded => ModSectionsContainer.Children.All(c => c.ModIconsLoaded);
public void SelectMod(Mod mod) =>
ModSectionsContainer.Children.Single(s => s.ModType == mod.Type)
.ButtonsContainer.OfType<ModButton>().Single(b => b.Mods.Any(m => m.GetType() == mod.GetType())).SelectNext(1);

View File

@ -57,6 +57,15 @@ namespace osu.Game.Overlays.Mods
}).ToArray();
modsLoadCts?.Cancel();
if (modContainers.Length == 0)
{
ModIconsLoaded = true;
headerLabel.Hide();
Hide();
return;
}
ModIconsLoaded = false;
LoadComponentsAsync(modContainers, c =>
@ -67,17 +76,8 @@ namespace osu.Game.Overlays.Mods
buttons = modContainers.OfType<ModButton>().ToArray();
if (value.Any())
{
headerLabel.FadeIn(200);
this.FadeIn(200);
}
else
{
// transition here looks weird as mods instantly disappear.
headerLabel.Hide();
Hide();
}
headerLabel.FadeIn(200);
this.FadeIn(200);
}
}