mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 07:33:20 +08:00
Add missing "title=" search support at song select
This commit is contained in:
parent
9b08aaf93f
commit
702266198b
@ -33,7 +33,7 @@ namespace osu.Game.Tests.NonVisual.Filtering
|
|||||||
Artist = "The Artist",
|
Artist = "The Artist",
|
||||||
ArtistUnicode = "check unicode too",
|
ArtistUnicode = "check unicode too",
|
||||||
Title = "Title goes here",
|
Title = "Title goes here",
|
||||||
TitleUnicode = "Title goes here",
|
TitleUnicode = "TitleUnicode goes here",
|
||||||
Author = { Username = "The Author" },
|
Author = { Username = "The Author" },
|
||||||
Source = "unit tests",
|
Source = "unit tests",
|
||||||
Tags = "look for tags too",
|
Tags = "look for tags too",
|
||||||
@ -204,6 +204,27 @@ namespace osu.Game.Tests.NonVisual.Filtering
|
|||||||
Assert.AreEqual(filtered, carouselItem.Filtered.Value);
|
Assert.AreEqual(filtered, carouselItem.Filtered.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
[TestCase("", false)]
|
||||||
|
[TestCase("Goes", false)]
|
||||||
|
[TestCase("GOES", false)]
|
||||||
|
[TestCase("goes", false)]
|
||||||
|
[TestCase("title goes", false)]
|
||||||
|
[TestCase("title goes AND then something else", true)]
|
||||||
|
[TestCase("titleunicode", false)]
|
||||||
|
[TestCase("unknown", true)]
|
||||||
|
public void TestCriteriaMatchingTitle(string titleName, bool filtered)
|
||||||
|
{
|
||||||
|
var exampleBeatmapInfo = getExampleBeatmap();
|
||||||
|
var criteria = new FilterCriteria
|
||||||
|
{
|
||||||
|
Title = new FilterCriteria.OptionalTextFilter { SearchTerm = titleName }
|
||||||
|
};
|
||||||
|
var carouselItem = new CarouselBeatmap(exampleBeatmapInfo);
|
||||||
|
carouselItem.Filter(criteria);
|
||||||
|
Assert.AreEqual(filtered, carouselItem.Filtered.Value);
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
[TestCase("", false)]
|
[TestCase("", false)]
|
||||||
[TestCase("The", false)]
|
[TestCase("The", false)]
|
||||||
|
@ -57,6 +57,8 @@ namespace osu.Game.Screens.Select.Carousel
|
|||||||
match &= !criteria.Creator.HasFilter || criteria.Creator.Matches(BeatmapInfo.Metadata.Author.Username);
|
match &= !criteria.Creator.HasFilter || criteria.Creator.Matches(BeatmapInfo.Metadata.Author.Username);
|
||||||
match &= !criteria.Artist.HasFilter || criteria.Artist.Matches(BeatmapInfo.Metadata.Artist) ||
|
match &= !criteria.Artist.HasFilter || criteria.Artist.Matches(BeatmapInfo.Metadata.Artist) ||
|
||||||
criteria.Artist.Matches(BeatmapInfo.Metadata.ArtistUnicode);
|
criteria.Artist.Matches(BeatmapInfo.Metadata.ArtistUnicode);
|
||||||
|
match &= !criteria.Title.HasFilter || criteria.Title.Matches(BeatmapInfo.Metadata.Title) ||
|
||||||
|
criteria.Title.Matches(BeatmapInfo.Metadata.TitleUnicode);
|
||||||
|
|
||||||
match &= !criteria.UserStarDifficulty.HasFilter || criteria.UserStarDifficulty.IsInRange(BeatmapInfo.StarRating);
|
match &= !criteria.UserStarDifficulty.HasFilter || criteria.UserStarDifficulty.IsInRange(BeatmapInfo.StarRating);
|
||||||
|
|
||||||
|
@ -31,6 +31,7 @@ namespace osu.Game.Screens.Select
|
|||||||
public OptionalRange<BeatmapOnlineStatus> OnlineStatus;
|
public OptionalRange<BeatmapOnlineStatus> OnlineStatus;
|
||||||
public OptionalTextFilter Creator;
|
public OptionalTextFilter Creator;
|
||||||
public OptionalTextFilter Artist;
|
public OptionalTextFilter Artist;
|
||||||
|
public OptionalTextFilter Title;
|
||||||
|
|
||||||
public OptionalRange<double> UserStarDifficulty = new OptionalRange<double>
|
public OptionalRange<double> UserStarDifficulty = new OptionalRange<double>
|
||||||
{
|
{
|
||||||
|
@ -73,6 +73,9 @@ namespace osu.Game.Screens.Select
|
|||||||
case "artist":
|
case "artist":
|
||||||
return TryUpdateCriteriaText(ref criteria.Artist, op, value);
|
return TryUpdateCriteriaText(ref criteria.Artist, op, value);
|
||||||
|
|
||||||
|
case "title":
|
||||||
|
return TryUpdateCriteriaText(ref criteria.Title, op, value);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return criteria.RulesetCriteria?.TryParseCustomKeywordCriteria(key, op, value) ?? false;
|
return criteria.RulesetCriteria?.TryParseCustomKeywordCriteria(key, op, value) ?? false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user