Add failing test coverage of searching too fast not hiding filtered settings

This commit is contained in:
Dean Herbert 2022-04-14 20:05:13 +09:00
parent b6a2a5166e
commit 50a478ea5f

View File

@ -4,10 +4,12 @@
using System.Linq;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Testing;
using osu.Game.Graphics.UserInterface;
using osu.Game.Overlays;
using osu.Game.Overlays.Settings;
using osu.Game.Overlays.Settings.Sections;
using osu.Game.Overlays.Settings.Sections.Input;
using osuTK.Input;
@ -34,6 +36,26 @@ namespace osu.Game.Tests.Visual.Settings
});
}
[Test]
public void TestQuickFiltering()
{
AddStep("set filter", () =>
{
settings.SectionsContainer.ChildrenOfType<SearchTextBox>().First().Current.Value = "scaling";
});
AddUntilStep("wait for items to load", () => settings.SectionsContainer.ChildrenOfType<IFilterable>().Any());
AddAssert("ensure all items match filter", () => settings.SectionsContainer
.ChildrenOfType<SettingsSection>().Where(f => f.IsPresent)
.All(section =>
section.ChildrenOfType<Drawable>().Where(f => f.IsPresent)
.OfType<IFilterable>()
.Where(f => !(f is IHasFilterableChildren))
.All(f => f.FilterTerms.Any(t => t.Contains("scaling")))
));
}
[Test]
public void ToggleVisibility()
{