mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 20:32:55 +08:00
Add a testcase
This commit is contained in:
parent
2933169614
commit
fe9e53e383
31
osu.Game.Tests/Visual/Online/TestSceneShowMoreButton.cs
Normal file
31
osu.Game.Tests/Visual/Online/TestSceneShowMoreButton.cs
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Game.Overlays.Profile.Sections;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
|
||||||
|
namespace osu.Game.Tests.Visual.Online
|
||||||
|
{
|
||||||
|
public class TestSceneShowMoreButton : OsuTestScene
|
||||||
|
{
|
||||||
|
private readonly ShowMoreButton button;
|
||||||
|
|
||||||
|
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||||
|
{
|
||||||
|
typeof(ShowMoreButton),
|
||||||
|
};
|
||||||
|
|
||||||
|
public TestSceneShowMoreButton()
|
||||||
|
{
|
||||||
|
Add(button = new ShowMoreButton
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
});
|
||||||
|
|
||||||
|
AddStep("switch loading state", () => button.IsLoading = !button.IsLoading);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -24,7 +24,8 @@ namespace osu.Game.Graphics.Containers
|
|||||||
{
|
{
|
||||||
Enabled.ValueChanged += e =>
|
Enabled.ValueChanged += e =>
|
||||||
{
|
{
|
||||||
if (!e.NewValue) unhover();
|
if (!e.NewValue)
|
||||||
|
unhover();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,7 +50,8 @@ namespace osu.Game.Graphics.Containers
|
|||||||
|
|
||||||
private void unhover()
|
private void unhover()
|
||||||
{
|
{
|
||||||
if (!isHovered) return;
|
if (!isHovered)
|
||||||
|
return;
|
||||||
|
|
||||||
isHovered = false;
|
isHovered = false;
|
||||||
EffectTargets.ForEach(d => d.FadeColour(IdleColour, FADE_DURATION, Easing.OutQuint));
|
EffectTargets.ForEach(d => d.FadeColour(IdleColour, FADE_DURATION, Easing.OutQuint));
|
||||||
|
@ -54,6 +54,8 @@ namespace osu.Game.Overlays.Profile.Sections
|
|||||||
},
|
},
|
||||||
MoreButton = new ShowMoreButton
|
MoreButton = new ShowMoreButton
|
||||||
{
|
{
|
||||||
|
Anchor = Anchor.TopCentre,
|
||||||
|
Origin = Anchor.TopCentre,
|
||||||
Alpha = 0,
|
Alpha = 0,
|
||||||
Margin = new MarginPadding { Top = 10 },
|
Margin = new MarginPadding { Top = 10 },
|
||||||
Action = ShowMore,
|
Action = ShowMore,
|
||||||
|
@ -51,49 +51,47 @@ namespace osu.Game.Overlays.Profile.Sections
|
|||||||
|
|
||||||
public ShowMoreButton()
|
public ShowMoreButton()
|
||||||
{
|
{
|
||||||
Anchor = Anchor.TopCentre;
|
|
||||||
Origin = Anchor.TopCentre;
|
|
||||||
AutoSizeAxes = Axes.Both;
|
AutoSizeAxes = Axes.Both;
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new CircularContainer
|
new CircularContainer
|
||||||
|
{
|
||||||
|
Masking = true,
|
||||||
|
Size = new Vector2(140, 30),
|
||||||
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
Masking = true,
|
background = new Box
|
||||||
Size = new Vector2(140, 30),
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
{
|
||||||
background = new Box
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
},
|
||||||
|
content = new FillFlowContainer
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
|
Direction = FillDirection.Horizontal,
|
||||||
|
Spacing = new Vector2(7),
|
||||||
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
new ChevronIcon(),
|
||||||
},
|
new OsuSpriteText
|
||||||
content = new FillFlowContainer
|
|
||||||
{
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
AutoSizeAxes = Axes.Both,
|
|
||||||
Direction = FillDirection.Horizontal,
|
|
||||||
Spacing = new Vector2(7),
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
{
|
||||||
new ChevronIcon(),
|
Anchor = Anchor.Centre,
|
||||||
new OsuSpriteText
|
Origin = Anchor.Centre,
|
||||||
{
|
Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold),
|
||||||
Anchor = Anchor.Centre,
|
Text = "show more".ToUpper(),
|
||||||
Origin = Anchor.Centre,
|
},
|
||||||
Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold),
|
new ChevronIcon(),
|
||||||
Text = "show more".ToUpper(),
|
}
|
||||||
},
|
},
|
||||||
new ChevronIcon(),
|
loading = new LoadingAnimation
|
||||||
}
|
{
|
||||||
},
|
Anchor = Anchor.Centre,
|
||||||
loading = new LoadingAnimation
|
Origin = Anchor.Centre,
|
||||||
{
|
Size = new Vector2(12)
|
||||||
Anchor = Anchor.Centre,
|
},
|
||||||
Origin = Anchor.Centre,
|
|
||||||
Size = new Vector2(12)
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user