Add a filtering tool to only show only certain release group types #252

Merged
wojtek merged 14 commits from 161---add-a-filtering-tool-to-only-show-only-certain-release-group-types into main 2025-01-04 22:42:27 +01:00
Showing only changes of commit 91b671c668 - Show all commits

View File

@ -107,6 +107,7 @@ mod tests {
// Drop ownership so that filtering is truly only on type. // Drop ownership so that filtering is truly only on type.
album.tracks.clear(); album.tracks.clear();
assert_eq!(album.get_ownership(), AlbumOwnership::None);
album.meta.info.primary_type = None; album.meta.info.primary_type = None;
assert!(filter.filter_album(&album)); assert!(filter.filter_album(&album));
@ -142,10 +143,6 @@ mod tests {
assert_ne!(album.get_ownership(), AlbumOwnership::None); assert_ne!(album.get_ownership(), AlbumOwnership::None);
assert!(filter.filter_album(&album)); assert!(filter.filter_album(&album));
// Remove non-filtered type.
album.meta.info.secondary_types.remove(0);
assert!(filter.filter_album(&album));
// Add another filtered type. // Add another filtered type.
let types = &mut album.meta.info.secondary_types; let types = &mut album.meta.info.secondary_types;
types.push(AlbumSecondaryType::Soundtrack); types.push(AlbumSecondaryType::Soundtrack);
@ -155,6 +152,14 @@ mod tests {
album.tracks.clear(); album.tracks.clear();
assert_eq!(album.get_ownership(), AlbumOwnership::None); assert_eq!(album.get_ownership(), AlbumOwnership::None);
assert!(!filter.filter_album(&album)); assert!(!filter.filter_album(&album));
// Remove one of the two filtered types.
album.meta.info.secondary_types.pop();
assert!(!filter.filter_album(&album));
// Remove the second filtered type. Should now be included by primary type.
album.meta.info.secondary_types.pop();
assert!(filter.filter_album(&album));
} }
#[test] #[test]