1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 17:47:29 +08:00

Fix test being disabled for cases which should pass

This commit is contained in:
Dean Herbert 2024-08-05 16:58:00 +09:00
parent 273bd73a99
commit 9c5e29b2c9
No known key found for this signature in database

View File

@ -21,6 +21,16 @@ namespace osu.Game.Tests.Visual.UserInterface
{ {
private TestTooltipContainer container = null!; private TestTooltipContainer container = null!;
private static readonly string[] test_case_tooltip_string =
[
"Hello!!",
string.Concat(Enumerable.Repeat("Hello ", 100)),
//TODO: o!f issue: https://github.com/ppy/osu-framework/issues/5007
//Enable after o!f fixed
// $"H{new string('e', 500)}llo",
];
[SetUp] [SetUp]
public void SetUp() => Schedule(() => public void SetUp() => Schedule(() =>
{ {
@ -50,28 +60,12 @@ namespace osu.Game.Tests.Visual.UserInterface
}; };
}); });
private static readonly string[] test_case_tooltip_string =
[
"Hello!!",
string.Concat(Enumerable.Repeat("Hello ", 100)),
$"H{new string('e', 500)}llo",
];
//TODO: o!f issue: https://github.com/ppy/osu-framework/issues/5007
//Enable after o!f fixed
[Ignore("o!f issue https://github.com/ppy/osu-framework/issues/5007")]
[Test] [Test]
public void TestTooltipBasic([Values(0, 1, 2)] int index) public void TestTooltipBasic([Values(0, 1, 2)] int index)
{ {
AddStep("Set tooltip content", () => AddStep("Set tooltip content", () => container.TooltipText = test_case_tooltip_string[index]);
{
container.TooltipText = test_case_tooltip_string[index];
});
AddStep("Move to container", () => AddStep("Move mouse to container", () => InputManager.MoveMouseTo(new Vector2(InputManager.ScreenSpaceDrawQuad.Centre.X, InputManager.ScreenSpaceDrawQuad.Centre.Y)));
{
InputManager.MoveMouseTo(new Vector2(InputManager.ScreenSpaceDrawQuad.Centre.X, InputManager.ScreenSpaceDrawQuad.Centre.Y));
});
OsuTooltipContainer.OsuTooltip? tooltip = null!; OsuTooltipContainer.OsuTooltip? tooltip = null!;
@ -81,7 +75,7 @@ namespace osu.Game.Tests.Visual.UserInterface
return tooltip != null && tooltip.Alpha == 1; return tooltip != null && tooltip.Alpha == 1;
}); });
AddAssert("Is tooltip obey 500 width limit", () => tooltip != null && tooltip.Width <= 500); AddAssert("Check tooltip is under width limit", () => tooltip != null && tooltip.Width <= 500);
} }
internal sealed partial class TestTooltipContainer : Container, IHasTooltip internal sealed partial class TestTooltipContainer : Container, IHasTooltip