mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 10:52:53 +08:00
remove Use Current Mods
menu item
This commit is contained in:
parent
3a15783a3c
commit
c609e6345c
@ -392,50 +392,6 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
new HashSet<Mod>(this.ChildrenOfType<ModPresetPanel>().First().Preset.Value.Mods).SetEquals(mods));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestEditPresetModInContextMenu()
|
||||
{
|
||||
ModPresetColumn modPresetColumn = null!;
|
||||
var mods = new Mod[] { new OsuModHidden() };
|
||||
|
||||
AddStep("clear mods", () => SelectedMods.Value = Array.Empty<Mod>());
|
||||
AddStep("create content", () => Child = modPresetColumn = new ModPresetColumn
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
});
|
||||
|
||||
AddUntilStep("items loaded", () => modPresetColumn.IsLoaded && modPresetColumn.ItemsLoaded);
|
||||
|
||||
AddStep("right click first panel", () =>
|
||||
{
|
||||
var panel = this.ChildrenOfType<ModPresetPanel>().First();
|
||||
InputManager.MoveMouseTo(panel);
|
||||
InputManager.Click(MouseButton.Right);
|
||||
});
|
||||
AddUntilStep("wait for context menu", () => this.ChildrenOfType<OsuContextMenu>().Any());
|
||||
AddAssert("No Use Current Mods", () => this.ChildrenOfType<DrawableOsuMenuItem>().Count() == 2);
|
||||
|
||||
AddStep("select mods", () => SelectedMods.Value = mods);
|
||||
AddStep("right click second panel", () =>
|
||||
{
|
||||
var panel = this.ChildrenOfType<ModPresetPanel>().ElementAt(1);
|
||||
InputManager.MoveMouseTo(panel);
|
||||
InputManager.Click(MouseButton.Right);
|
||||
});
|
||||
|
||||
AddUntilStep("wait for context menu", () => this.ChildrenOfType<OsuContextMenu>().Any());
|
||||
AddAssert("Have Use Current Mods", () => this.ChildrenOfType<DrawableOsuMenuItem>().Count() == 3);
|
||||
AddStep("Click Use Current Mods", () =>
|
||||
{
|
||||
var editItem = this.ChildrenOfType<DrawableOsuMenuItem>().ElementAt(1);
|
||||
InputManager.MoveMouseTo(editItem);
|
||||
InputManager.Click(MouseButton.Left);
|
||||
});
|
||||
AddAssert("present mod is changed", () =>
|
||||
new HashSet<Mod>(this.ChildrenOfType<ModPresetPanel>().ElementAt(1).Preset.Value.Mods).SetEquals(mods));
|
||||
}
|
||||
|
||||
private ICollection<ModPreset> createTestPresets() => new[]
|
||||
{
|
||||
new ModPreset
|
||||
|
@ -90,24 +90,11 @@ namespace osu.Game.Overlays.Mods
|
||||
|
||||
#region IHasContextMenu
|
||||
|
||||
public MenuItem[] ContextMenuItems
|
||||
public MenuItem[] ContextMenuItems => new MenuItem[]
|
||||
{
|
||||
get
|
||||
{
|
||||
var menu = new List<MenuItem>
|
||||
{
|
||||
new OsuMenuItem(CommonStrings.ButtonsEdit, MenuItemType.Highlighted, this.ShowPopover),
|
||||
new OsuMenuItem(CommonStrings.ButtonsDelete, MenuItemType.Destructive, () => dialogOverlay?.Push(new DeleteModPresetDialog(Preset))),
|
||||
};
|
||||
|
||||
if (CheckCurrentModCanBeSave())
|
||||
{
|
||||
menu.Insert(1, new OsuMenuItem("Use Current Mods", MenuItemType.Destructive, () => SaveCurrentMod()));
|
||||
}
|
||||
|
||||
return menu.ToArray();
|
||||
}
|
||||
}
|
||||
new OsuMenuItem(CommonStrings.ButtonsEdit, MenuItemType.Highlighted, this.ShowPopover),
|
||||
new OsuMenuItem(CommonStrings.ButtonsDelete, MenuItemType.Destructive, () => dialogOverlay?.Push(new DeleteModPresetDialog(Preset))),
|
||||
};
|
||||
|
||||
#endregion
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user