1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 13:22:55 +08:00

Fix SkinnableTestScene's autosize propagation

Regressed with recent DrawableHitObject changes (moving of
RelativeSizeAxes specifications out of constructors).
This commit is contained in:
Dean Herbert 2020-11-05 16:37:47 +09:00
parent c26fd4dc3d
commit 2d0c62dce2

View File

@ -65,17 +65,15 @@ namespace osu.Game.Tests.Visual
private Drawable createProvider(Skin skin, Func<Drawable> creationFunction, IBeatmap beatmap)
{
var created = creationFunction();
createdDrawables.Add(created);
var autoSize = created.RelativeSizeAxes == Axes.None;
SkinProvidingContainer mainProvider;
Container childContainer;
OutlineBox outlineBox;
SkinProvidingContainer skinProvider;
var mainProvider = new SkinProvidingContainer(skin)
{
RelativeSizeAxes = !autoSize ? Axes.Both : Axes.None,
AutoSizeAxes = autoSize ? Axes.Both : Axes.None,
};
return new Container
var children = new Container
{
RelativeSizeAxes = Axes.Both,
BorderColour = Color4.White,
@ -96,27 +94,38 @@ namespace osu.Game.Tests.Visual
Scale = new Vector2(1.5f),
Padding = new MarginPadding(5),
},
new Container
childContainer = new Container
{
RelativeSizeAxes = !autoSize ? Axes.Both : Axes.None,
AutoSizeAxes = autoSize ? Axes.Both : Axes.None,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Children = new Drawable[]
{
new OutlineBox { Alpha = autoSize ? 1 : 0 },
mainProvider.WithChild(
new SkinProvidingContainer(Ruleset.Value.CreateInstance().CreateLegacySkinProvider(mainProvider, beatmap))
outlineBox = new OutlineBox(),
(mainProvider = new SkinProvidingContainer(skin)).WithChild(
skinProvider = new SkinProvidingContainer(Ruleset.Value.CreateInstance().CreateLegacySkinProvider(mainProvider, beatmap))
{
Child = created,
RelativeSizeAxes = !autoSize ? Axes.Both : Axes.None,
AutoSizeAxes = autoSize ? Axes.Both : Axes.None,
}
)
}
},
}
};
Schedule(() =>
{
var autoSize = created.RelativeSizeAxes == Axes.None;
foreach (var c in new[] { mainProvider, childContainer, skinProvider })
{
c.RelativeSizeAxes = !autoSize ? Axes.Both : Axes.None;
c.AutoSizeAxes = autoSize ? Axes.Both : Axes.None;
}
outlineBox.Alpha = autoSize ? 1 : 0;
});
return children;
}
/// <summary>