mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 03:25:11 +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 =>
|
||||
{
|
||||
if (!e.NewValue) unhover();
|
||||
if (!e.NewValue)
|
||||
unhover();
|
||||
};
|
||||
}
|
||||
|
||||
@ -49,7 +50,8 @@ namespace osu.Game.Graphics.Containers
|
||||
|
||||
private void unhover()
|
||||
{
|
||||
if (!isHovered) return;
|
||||
if (!isHovered)
|
||||
return;
|
||||
|
||||
isHovered = false;
|
||||
EffectTargets.ForEach(d => d.FadeColour(IdleColour, FADE_DURATION, Easing.OutQuint));
|
||||
|
@ -54,6 +54,8 @@ namespace osu.Game.Overlays.Profile.Sections
|
||||
},
|
||||
MoreButton = new ShowMoreButton
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Alpha = 0,
|
||||
Margin = new MarginPadding { Top = 10 },
|
||||
Action = ShowMore,
|
||||
|
@ -51,49 +51,47 @@ namespace osu.Game.Overlays.Profile.Sections
|
||||
|
||||
public ShowMoreButton()
|
||||
{
|
||||
Anchor = Anchor.TopCentre;
|
||||
Origin = Anchor.TopCentre;
|
||||
AutoSizeAxes = Axes.Both;
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new CircularContainer
|
||||
new CircularContainer
|
||||
{
|
||||
Masking = true,
|
||||
Size = new Vector2(140, 30),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
Masking = true,
|
||||
Size = new Vector2(140, 30),
|
||||
Children = new Drawable[]
|
||||
background = new Box
|
||||
{
|
||||
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,
|
||||
},
|
||||
content = new FillFlowContainer
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Direction = FillDirection.Horizontal,
|
||||
Spacing = new Vector2(7),
|
||||
Children = new Drawable[]
|
||||
new ChevronIcon(),
|
||||
new OsuSpriteText
|
||||
{
|
||||
new ChevronIcon(),
|
||||
new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold),
|
||||
Text = "show more".ToUpper(),
|
||||
},
|
||||
new ChevronIcon(),
|
||||
}
|
||||
},
|
||||
loading = new LoadingAnimation
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Size = new Vector2(12)
|
||||
},
|
||||
}
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold),
|
||||
Text = "show more".ToUpper(),
|
||||
},
|
||||
new ChevronIcon(),
|
||||
}
|
||||
},
|
||||
loading = new LoadingAnimation
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Size = new Vector2(12)
|
||||
},
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user