mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 16:27:26 +08:00
Merge pull request #17937 from frenzibyte/settings-filter-regression-fix-2
Fix settings overlay components not invalidating presence on filter change
This commit is contained in:
commit
21665f605a
@ -33,18 +33,21 @@ namespace osu.Game.Tests.Visual.Settings
|
||||
State = { Value = Visibility.Visible }
|
||||
});
|
||||
});
|
||||
|
||||
AddStep("reset mouse", () => InputManager.MoveMouseTo(settings));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestQuickFiltering()
|
||||
public void TestFiltering([Values] bool beforeLoad)
|
||||
{
|
||||
AddStep("set filter", () =>
|
||||
{
|
||||
settings.SectionsContainer.ChildrenOfType<SearchTextBox>().First().Current.Value = "scaling";
|
||||
});
|
||||
if (beforeLoad)
|
||||
AddStep("set filter", () => settings.SectionsContainer.ChildrenOfType<SearchTextBox>().First().Current.Value = "scaling");
|
||||
|
||||
AddUntilStep("wait for items to load", () => settings.SectionsContainer.ChildrenOfType<IFilterable>().Any());
|
||||
|
||||
if (!beforeLoad)
|
||||
AddStep("set filter", () => settings.SectionsContainer.ChildrenOfType<SearchTextBox>().First().Current.Value = "scaling");
|
||||
|
||||
AddAssert("ensure all items match filter", () => settings.SectionsContainer
|
||||
.ChildrenOfType<SettingsSection>().Where(f => f.IsPresent)
|
||||
.All(section =>
|
||||
@ -56,6 +59,15 @@ namespace osu.Game.Tests.Visual.Settings
|
||||
));
|
||||
|
||||
AddAssert("ensure section is current", () => settings.CurrentSection.Value is GraphicsSection);
|
||||
AddAssert("ensure section is placed first", () => settings.CurrentSection.Value.Y == 0);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestFilterAfterLoad()
|
||||
{
|
||||
AddUntilStep("wait for items to load", () => settings.SectionsContainer.ChildrenOfType<IFilterable>().Any());
|
||||
|
||||
AddStep("set filter", () => settings.SectionsContainer.ChildrenOfType<SearchTextBox>().First().Current.Value = "scaling");
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -193,11 +193,8 @@ namespace osu.Game.Graphics.Containers
|
||||
|
||||
protected void InvalidateScrollPosition()
|
||||
{
|
||||
Schedule(() =>
|
||||
{
|
||||
lastKnownScroll = null;
|
||||
lastClickedSection = null;
|
||||
});
|
||||
lastKnownScroll = null;
|
||||
lastClickedSection = null;
|
||||
}
|
||||
|
||||
protected override void UpdateAfterChildren()
|
||||
|
@ -100,9 +100,23 @@ namespace osu.Game.Overlays.Settings
|
||||
|
||||
public IEnumerable<string> Keywords { get; set; }
|
||||
|
||||
public override bool IsPresent => base.IsPresent && MatchingFilter;
|
||||
private bool matchingFilter = true;
|
||||
|
||||
public bool MatchingFilter { get; set; } = true;
|
||||
public bool MatchingFilter
|
||||
{
|
||||
get => matchingFilter;
|
||||
set
|
||||
{
|
||||
bool wasPresent = IsPresent;
|
||||
|
||||
matchingFilter = value;
|
||||
|
||||
if (IsPresent != wasPresent)
|
||||
Invalidate(Invalidation.Presence);
|
||||
}
|
||||
}
|
||||
|
||||
public override bool IsPresent => base.IsPresent && MatchingFilter;
|
||||
|
||||
public bool FilteringActive { get; set; }
|
||||
|
||||
|
@ -21,8 +21,6 @@ namespace osu.Game.Overlays.Settings
|
||||
protected FillFlowContainer FlowContent;
|
||||
protected override Container<Drawable> Content => FlowContent;
|
||||
|
||||
public override bool IsPresent => base.IsPresent && MatchingFilter;
|
||||
|
||||
private IBindable<SettingsSection> selectedSection;
|
||||
|
||||
private Box dim;
|
||||
@ -40,7 +38,23 @@ namespace osu.Game.Overlays.Settings
|
||||
private const int header_size = 24;
|
||||
private const int border_size = 4;
|
||||
|
||||
public bool MatchingFilter { get; set; } = true;
|
||||
private bool matchingFilter = true;
|
||||
|
||||
public bool MatchingFilter
|
||||
{
|
||||
get => matchingFilter;
|
||||
set
|
||||
{
|
||||
bool wasPresent = IsPresent;
|
||||
|
||||
matchingFilter = value;
|
||||
|
||||
if (IsPresent != wasPresent)
|
||||
Invalidate(Invalidation.Presence);
|
||||
}
|
||||
}
|
||||
|
||||
public override bool IsPresent => base.IsPresent && MatchingFilter;
|
||||
|
||||
public bool FilteringActive { get; set; }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user