mirror of
https://github.com/osukey/osukey.git
synced 2025-07-03 09:20:02 +09:00
Fix ruleset selector line not moving on first display
This commit is contained in:
@ -7,7 +7,10 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Graphics;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.MathUtils;
|
||||
using osu.Game.Rulesets;
|
||||
|
||||
namespace osu.Game.Tests.Visual.UserInterface
|
||||
{
|
||||
@ -19,17 +22,24 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
typeof(ToolbarRulesetTabButton),
|
||||
};
|
||||
|
||||
public TestSceneToolbarRulesetSelector()
|
||||
{
|
||||
ToolbarRulesetSelector selector;
|
||||
[Resolved]
|
||||
private RulesetStore rulesets { get; set; }
|
||||
|
||||
Add(new Container
|
||||
[Test]
|
||||
public void TestDisplay()
|
||||
{
|
||||
ToolbarRulesetSelector selector = null;
|
||||
|
||||
AddStep("create selector", () =>
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
AutoSizeAxes = Axes.X,
|
||||
Height = Toolbar.HEIGHT,
|
||||
Child = selector = new ToolbarRulesetSelector()
|
||||
Child = new Container
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
AutoSizeAxes = Axes.X,
|
||||
Height = Toolbar.HEIGHT,
|
||||
Child = selector = new ToolbarRulesetSelector()
|
||||
};
|
||||
});
|
||||
|
||||
AddStep("Select random", () =>
|
||||
@ -38,5 +48,32 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
});
|
||||
AddStep("Toggle disabled state", () => selector.Current.Disabled = !selector.Current.Disabled);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestNonFirstRulesetInitialState()
|
||||
{
|
||||
TestSelector selector = null;
|
||||
|
||||
AddStep("create selector", () =>
|
||||
{
|
||||
Child = new Container
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
AutoSizeAxes = Axes.X,
|
||||
Height = Toolbar.HEIGHT,
|
||||
Child = selector = new TestSelector()
|
||||
};
|
||||
|
||||
selector.Current.Value = rulesets.GetRuleset(2);
|
||||
});
|
||||
|
||||
AddAssert("mode line has moved", () => selector.ModeButtonLine.DrawPosition.X > 0);
|
||||
}
|
||||
|
||||
private class TestSelector : ToolbarRulesetSelector
|
||||
{
|
||||
public new Drawable ModeButtonLine => base.ModeButtonLine;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user