1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 06:47:24 +08:00

Place HTML messages in a TextFlowContainer

Add missing accessibility modifier in ClickableText test case and fix disposal
This commit is contained in:
HoutarouOreki 2018-07-22 14:44:11 +02:00
parent 59cbc58edd
commit 2b7f657f2c
2 changed files with 19 additions and 27 deletions

View File

@ -12,29 +12,18 @@ namespace osu.Game.Tests.Visual
{
public override IReadOnlyList<Type> RequiredTypes => new[] { typeof(ClickableText), typeof(FillFlowContainer) };
ClickableText text;
protected override void LoadComplete()
public TestCaseClickableText() => Child = new FillFlowContainer
{
using (var fillFlowContainer = new FillFlowContainer<ClickableText>
Children = new[]
{
Direction = FillDirection.Vertical,
Children = new[]
{
new ClickableText{ Text = "Default", },
new ClickableText{ IsEnabled = false, Text = "Disabled", },
new ClickableText{ Text = "Without sounds", IsMuted = true, },
new ClickableText{ Text = "Without click sounds", IsClickMuted = true, },
new ClickableText{ Text = "Without hover sounds", IsHoverMuted = true, },
text = new ClickableText{ Text = "Disables after click (Action)", },
new ClickableText{ Text = "Has tooltip", TooltipText = "Yep", }
}
})
{
Add(fillFlowContainer);
new ClickableText { Text = "Default", },
new ClickableText { IsEnabled = false, Text = "Disabled", },
new ClickableText { Text = "Without sounds", IsMuted = true, },
new ClickableText { Text = "Without click sounds", IsClickMuted = true, },
new ClickableText { Text = "Without hover sounds", IsHoverMuted = true, },
new ClickableText { Text = "Disables after click (Action)", },
new ClickableText { Text = "Has tooltip", TooltipText = "Yep", },
}
text.Action = () => text.IsEnabled = false;
base.LoadComplete();
}
};
}
}

View File

@ -156,6 +156,7 @@ namespace osu.Game.Overlays.Changelog
Font = @"Exo2.0-Light",
Colour = StreamColour.FromStreamName(build.UpdateStream.Name),
Action = () => BuildRequested(),
IsClickMuted = true,
},
}
},
@ -211,7 +212,7 @@ namespace osu.Game.Overlays.Changelog
Direction = FillDirection.Full,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
LineSpacing = 0.25f,
Margin = new MarginPadding{ Vertical = 5, },
});
title.AddIcon(FontAwesome.fa_check, t => { t.TextSize = 12; t.Padding = new MarginPadding { Left = -17, Right = 5 }; });
title.AddText(entry.Title, t => { t.TextSize = 18; }); //t.Padding = new MarginPadding(10); });
@ -224,15 +225,17 @@ namespace osu.Game.Overlays.Changelog
});
}
title.AddText($" by {entry.GithubUser.DisplayName}", t => t.TextSize = 14); //web: 12;
ChangelogEntries.Add(new SpriteText
TextFlowContainer messageContainer;
ChangelogEntries.Add(messageContainer = new OsuTextFlowContainer
{
TextSize = 14, // web: 12,
Colour = new Color4(235, 184, 254, 255),
Text = $"{entry.MessageHtml?.Replace("<p>", "").Replace("</p>", "")}\n",
Margin = new MarginPadding { Bottom = 10, },
AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X,
});
messageContainer.AddText($"{entry.MessageHtml?.Replace("<p>", "").Replace("</p>", "")}\n", t =>
{
t.TextSize = 14; // web: 12,
t.Colour = new Color4(235, 184, 254, 255);
});
}
}
}