1
0
mirror of https://github.com/ppy/osu synced 2025-03-22 02:47:04 +00:00
This commit is contained in:
David Zhao 2019-03-26 11:11:27 +09:00
parent 35bf262d19
commit be9ac39f54
2 changed files with 5 additions and 20 deletions
osu.Game.Tests/Visual
osu.Game/Graphics/Containers

View File

@ -11,7 +11,6 @@ using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Testing; using osu.Framework.Testing;
using osu.Game.Configuration; using osu.Game.Configuration;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
@ -32,6 +31,7 @@ namespace osu.Game.Tests.Visual
typeof(PlayerLoader), typeof(PlayerLoader),
typeof(Player), typeof(Player),
typeof(Facade), typeof(Facade),
typeof(FacadeContainer)
}; };
[Cached] [Cached]
@ -39,9 +39,6 @@ namespace osu.Game.Tests.Visual
private readonly Bindable<float> uiScale = new Bindable<float>(); private readonly Bindable<float> uiScale = new Bindable<float>();
private TestScreen screen1;
private OsuScreen baseScreen;
public TestCaseFacadeContainer() public TestCaseFacadeContainer()
{ {
Add(logo = new OsuLogo()); Add(logo = new OsuLogo());
@ -50,30 +47,23 @@ namespace osu.Game.Tests.Visual
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuConfigManager config) private void load(OsuConfigManager config)
{ {
baseScreen = null;
config.BindWith(OsuSetting.UIScale, uiScale); config.BindWith(OsuSetting.UIScale, uiScale);
AddSliderStep("Adjust scale", 1f, 1.5f, 1f, v => uiScale.Value = v); AddSliderStep("Adjust scale", 1f, 1.5f, 1f, v => uiScale.Value = v);
} }
[SetUpSteps]
public void SetUpSteps()
{
AddStep("Null screens", () => baseScreen = null);
}
[Test] [Test]
public void IsolatedTest() public void IsolatedTest()
{ {
bool randomPositions = false; bool randomPositions = false;
AddToggleStep("Toggle move continuously", b => randomPositions = b); AddToggleStep("Toggle move continuously", b => randomPositions = b);
AddStep("Move facade to random position", () => LoadScreen(screen1 = new TestScreen(randomPositions))); AddStep("Move facade to random position", () => LoadScreen(new TestScreen(randomPositions)));
} }
[Test] [Test]
public void PlayerLoaderTest() public void PlayerLoaderTest()
{ {
AddToggleStep("Toggle mods", b => { Beatmap.Value.Mods.Value = b ? Beatmap.Value.Mods.Value.Concat(new[] { new OsuModNoFail() }) : Enumerable.Empty<Mod>(); }); AddToggleStep("Toggle mods", b => { Beatmap.Value.Mods.Value = b ? Beatmap.Value.Mods.Value.Concat(new[] { new OsuModNoFail() }) : Enumerable.Empty<Mod>(); });
AddStep("Add new playerloader", () => LoadScreen(baseScreen = new TestPlayerLoader(() => new TestPlayer AddStep("Add new playerloader", () => LoadScreen(new TestPlayerLoader(() => new TestPlayer
{ {
AllowPause = false, AllowPause = false,
AllowLeadIn = false, AllowLeadIn = false,
@ -84,7 +74,7 @@ namespace osu.Game.Tests.Visual
[Test] [Test]
public void MainMenuTest() public void MainMenuTest()
{ {
AddStep("Add new Main Menu", () => LoadScreen(baseScreen = new MainMenu())); AddStep("Add new Main Menu", () => LoadScreen(new MainMenu()));
} }
private class TestFacadeContainer : FacadeContainer private class TestFacadeContainer : FacadeContainer
@ -105,8 +95,6 @@ namespace osu.Game.Tests.Visual
{ {
private TestFacadeContainer facadeContainer; private TestFacadeContainer facadeContainer;
private FacadeFlowComponent facadeFlowComponent; private FacadeFlowComponent facadeFlowComponent;
private OsuLogo logo;
private readonly bool randomPositions; private readonly bool randomPositions;
public TestScreen(bool randomPositions = false) public TestScreen(bool randomPositions = false)
@ -114,9 +102,6 @@ namespace osu.Game.Tests.Visual
this.randomPositions = randomPositions; this.randomPositions = randomPositions;
} }
private SpriteText positionText;
private SpriteText sizeAxesText;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {

View File

@ -60,8 +60,8 @@ namespace osu.Game.Graphics.Containers
{ {
if (logo.RelativePositionAxes != Axes.None) if (logo.RelativePositionAxes != Axes.None)
{ {
logo.Position = logo.Parent.ToLocalSpace(logo.Position);
logo.RelativePositionAxes = Axes.None; logo.RelativePositionAxes = Axes.None;
logo.Position = logo.Parent.ToLocalSpace(logo.Position);
} }
if (startTime == 0) if (startTime == 0)