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 68d50ad986 - Show all commits

View File

@ -66,11 +66,11 @@ mod tests {
AlbumField::PrimaryType(Some(AlbumPrimaryType::Album)),
]],
except: vec![vec![
AlbumField::Ownership(AlbumOwnership::None),
AlbumField::SecondaryType(AlbumSecondaryType::Compilation),
AlbumField::SecondaryType(AlbumSecondaryType::Soundtrack),
AlbumField::SecondaryType(AlbumSecondaryType::Live),
AlbumField::SecondaryType(AlbumSecondaryType::Demo),
AlbumField::Ownership(AlbumOwnership::None),
]],
}
}
@ -91,6 +91,7 @@ mod tests {
fn test_album() -> Album {
let mut album = Album::new(AlbumId::new("An Album"));
album.meta.info.primary_type = Some(AlbumPrimaryType::Album);
album.tracks.push(test_track());
album
}
@ -118,7 +119,29 @@ mod tests {
#[test]
fn filter_secondary_type() {
let filter = test_filter()
let filter = test_filter();
let mut album = test_album();
assert!(filter.filter_album(&album));
// Non-filtered type.
let types = &mut album.meta.info.secondary_types;
types.push(AlbumSecondaryType::AudioDrama);
assert!(filter.filter_album(&album));
// Filtered type.
let types = &mut album.meta.info.secondary_types;
types.push(AlbumSecondaryType::Live);
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.
let types = &mut album.meta.info.secondary_types;
types.push(AlbumSecondaryType::Soundtrack);
assert!(!filter.filter_album(&album));
}
#[test]