refactor(BlockSelectionState): Refactored so selection of blocks in 2x2 grids is more intuitive and added left() and right() methods to aid this effort.

This commit is contained in:
2024-11-30 12:22:46 -07:00
parent 9b2040059d
commit f7c96d81e9
27 changed files with 472 additions and 387 deletions
+29 -15
View File
@@ -320,33 +320,46 @@ pub struct BlockSelectionState<'a, T>
where
T: Sized + Clone + Copy + Default,
{
pub blocks: &'a [T],
pub index: usize,
pub blocks: &'a [&'a [T]],
pub x: usize,
pub y: usize,
}
impl<'a, T> BlockSelectionState<'a, T>
where
T: Sized + Clone + Copy + Default,
{
pub fn new(blocks: &'a [T]) -> BlockSelectionState<'a, T> {
BlockSelectionState { blocks, index: 0 }
pub fn new(blocks: &'a [&'a [T]]) -> BlockSelectionState<'a, T> {
BlockSelectionState { blocks, x: 0, y: 0 }
}
pub fn get_active_block(&self) -> T {
self.blocks[self.index]
self.blocks[self.y][self.x]
}
pub fn next(&mut self) {
self.index = (self.index + 1) % self.blocks.len();
}
pub fn previous(&mut self) {
if self.index > 0 {
self.index -= 1;
pub fn left(&mut self) {
if self.x > 0 {
self.x -= 1;
} else {
self.index = self.blocks.len() - 1;
self.x = self.blocks[0].len() - 1;
}
}
pub fn right(&mut self) {
self.x = (self.x + 1) % self.blocks[0].len();
}
pub fn up(&mut self) {
if self.y > 0 {
self.y -= 1;
} else {
self.y = self.blocks.len() - 1;
}
}
pub fn down(&mut self) {
self.y = (self.y + 1) % self.blocks.len();
}
}
#[cfg(test)]
@@ -354,8 +367,9 @@ impl<'a, T> BlockSelectionState<'a, T>
where
T: Sized + Clone + Copy + Default,
{
pub fn set_index(&mut self, index: usize) {
self.index = index;
pub fn set_index(&mut self, x: usize, y: usize) {
self.x = x;
self.y = y;
}
}
+84 -35
View File
@@ -17,14 +17,7 @@ mod tests {
BlockSelectionState, HorizontallyScrollableText, Scrollable, ScrollableText, TabRoute, TabState,
};
const BLOCKS: [ActiveRadarrBlock; 6] = [
ActiveRadarrBlock::AddMovieSelectRootFolder,
ActiveRadarrBlock::AddMovieSelectMonitor,
ActiveRadarrBlock::AddMovieSelectMinimumAvailability,
ActiveRadarrBlock::AddMovieSelectQualityProfile,
ActiveRadarrBlock::AddMovieTagsInput,
ActiveRadarrBlock::AddMovieConfirmPrompt,
];
const BLOCKS: &[&[i32]] = &[&[11, 12], &[21, 22], &[31, 32]];
#[test]
fn test_scrollable_text_with_string() {
@@ -577,17 +570,19 @@ mod tests {
#[test]
fn test_block_selection_state_new() {
let block_selection_state = BlockSelectionState::new(&BLOCKS);
let block_selection_state = BlockSelectionState::new(BLOCKS);
assert_eq!(block_selection_state.index, 0);
assert_eq!(block_selection_state.x, 0);
assert_eq!(block_selection_state.y, 0);
}
#[test]
fn test_block_selection_state_get_active_block() {
let second_block = BLOCKS[1];
let second_block = BLOCKS[1][1];
let block_selection_state = BlockSelectionState {
blocks: &BLOCKS,
index: 1,
blocks: BLOCKS,
x: 1,
y: 1,
};
let active_block = block_selection_state.get_active_block();
@@ -596,41 +591,95 @@ mod tests {
}
#[test]
fn test_block_selection_state_next() {
let blocks = [
ActiveRadarrBlock::AddMovieSelectRootFolder,
ActiveRadarrBlock::AddMovieSelectMonitor,
];
let mut block_selection_state = BlockSelectionState::new(&blocks);
fn test_block_selection_state_down() {
let mut block_selection_state = BlockSelectionState::new(BLOCKS);
assert_eq!(block_selection_state.get_active_block(), blocks[0]);
assert_eq!(block_selection_state.get_active_block(), BLOCKS[0][0]);
block_selection_state.next();
block_selection_state.down();
assert_eq!(block_selection_state.get_active_block(), blocks[1]);
assert_eq!(block_selection_state.get_active_block(), BLOCKS[1][0]);
block_selection_state.next();
block_selection_state.down();
assert_eq!(block_selection_state.get_active_block(), blocks[0]);
assert_eq!(block_selection_state.get_active_block(), BLOCKS[2][0]);
block_selection_state.down();
assert_eq!(block_selection_state.get_active_block(), BLOCKS[0][0]);
}
#[test]
fn test_block_selection_state_previous() {
let blocks = [
ActiveRadarrBlock::AddMovieSelectRootFolder,
ActiveRadarrBlock::AddMovieSelectMonitor,
];
let mut block_selection_state = BlockSelectionState::new(&blocks);
fn test_block_selection_state_up() {
let mut block_selection_state = BlockSelectionState::new(BLOCKS);
assert_eq!(block_selection_state.get_active_block(), blocks[0]);
assert_eq!(block_selection_state.get_active_block(), BLOCKS[0][0]);
block_selection_state.previous();
block_selection_state.up();
assert_eq!(block_selection_state.get_active_block(), blocks[1]);
assert_eq!(block_selection_state.get_active_block(), BLOCKS[2][0]);
block_selection_state.previous();
block_selection_state.up();
assert_eq!(block_selection_state.get_active_block(), blocks[0]);
assert_eq!(block_selection_state.get_active_block(), BLOCKS[1][0]);
block_selection_state.up();
assert_eq!(block_selection_state.get_active_block(), BLOCKS[0][0]);
}
#[test]
fn test_block_selection_state_left() {
let mut block_selection_state = BlockSelectionState::new(BLOCKS);
assert_eq!(block_selection_state.get_active_block(), BLOCKS[0][0]);
block_selection_state.left();
assert_eq!(block_selection_state.get_active_block(), BLOCKS[0][1]);
block_selection_state.left();
assert_eq!(block_selection_state.get_active_block(), BLOCKS[0][0]);
block_selection_state.set_index(0, 1);
assert_eq!(block_selection_state.get_active_block(), BLOCKS[1][0]);
block_selection_state.left();
assert_eq!(block_selection_state.get_active_block(), BLOCKS[1][1]);
block_selection_state.left();
assert_eq!(block_selection_state.get_active_block(), BLOCKS[1][0]);
}
#[test]
fn test_block_selection_state_right() {
let mut block_selection_state = BlockSelectionState::new(BLOCKS);
assert_eq!(block_selection_state.get_active_block(), BLOCKS[0][0]);
block_selection_state.right();
assert_eq!(block_selection_state.get_active_block(), BLOCKS[0][1]);
block_selection_state.right();
assert_eq!(block_selection_state.get_active_block(), BLOCKS[0][0]);
block_selection_state.set_index(0, 1);
assert_eq!(block_selection_state.get_active_block(), BLOCKS[1][0]);
block_selection_state.right();
assert_eq!(block_selection_state.get_active_block(), BLOCKS[1][1]);
block_selection_state.right();
assert_eq!(block_selection_state.get_active_block(), BLOCKS[1][0]);
}
#[test]
+88 -58
View File
@@ -357,13 +357,13 @@ pub static ADD_MOVIE_BLOCKS: [ActiveRadarrBlock; 10] = [
ActiveRadarrBlock::AddMovieAlreadyInLibrary,
ActiveRadarrBlock::AddMovieTagsInput,
];
pub static ADD_MOVIE_SELECTION_BLOCKS: [ActiveRadarrBlock; 6] = [
ActiveRadarrBlock::AddMovieSelectRootFolder,
ActiveRadarrBlock::AddMovieSelectMonitor,
ActiveRadarrBlock::AddMovieSelectMinimumAvailability,
ActiveRadarrBlock::AddMovieSelectQualityProfile,
ActiveRadarrBlock::AddMovieTagsInput,
ActiveRadarrBlock::AddMovieConfirmPrompt,
pub const ADD_MOVIE_SELECTION_BLOCKS: &[&[ActiveRadarrBlock]] = &[
&[ActiveRadarrBlock::AddMovieSelectRootFolder],
&[ActiveRadarrBlock::AddMovieSelectMonitor],
&[ActiveRadarrBlock::AddMovieSelectMinimumAvailability],
&[ActiveRadarrBlock::AddMovieSelectQualityProfile],
&[ActiveRadarrBlock::AddMovieTagsInput],
&[ActiveRadarrBlock::AddMovieConfirmPrompt],
];
pub static EDIT_COLLECTION_BLOCKS: [ActiveRadarrBlock; 7] = [
ActiveRadarrBlock::EditCollectionPrompt,
@@ -374,13 +374,13 @@ pub static EDIT_COLLECTION_BLOCKS: [ActiveRadarrBlock; 7] = [
ActiveRadarrBlock::EditCollectionToggleSearchOnAdd,
ActiveRadarrBlock::EditCollectionToggleMonitored,
];
pub static EDIT_COLLECTION_SELECTION_BLOCKS: [ActiveRadarrBlock; 6] = [
ActiveRadarrBlock::EditCollectionToggleMonitored,
ActiveRadarrBlock::EditCollectionSelectMinimumAvailability,
ActiveRadarrBlock::EditCollectionSelectQualityProfile,
ActiveRadarrBlock::EditCollectionRootFolderPathInput,
ActiveRadarrBlock::EditCollectionToggleSearchOnAdd,
ActiveRadarrBlock::EditCollectionConfirmPrompt,
pub const EDIT_COLLECTION_SELECTION_BLOCKS: &[&[ActiveRadarrBlock]] = &[
&[ActiveRadarrBlock::EditCollectionToggleMonitored],
&[ActiveRadarrBlock::EditCollectionSelectMinimumAvailability],
&[ActiveRadarrBlock::EditCollectionSelectQualityProfile],
&[ActiveRadarrBlock::EditCollectionRootFolderPathInput],
&[ActiveRadarrBlock::EditCollectionToggleSearchOnAdd],
&[ActiveRadarrBlock::EditCollectionConfirmPrompt],
];
pub static EDIT_MOVIE_BLOCKS: [ActiveRadarrBlock; 7] = [
ActiveRadarrBlock::EditMoviePrompt,
@@ -391,13 +391,13 @@ pub static EDIT_MOVIE_BLOCKS: [ActiveRadarrBlock; 7] = [
ActiveRadarrBlock::EditMovieTagsInput,
ActiveRadarrBlock::EditMovieToggleMonitored,
];
pub static EDIT_MOVIE_SELECTION_BLOCKS: [ActiveRadarrBlock; 6] = [
ActiveRadarrBlock::EditMovieToggleMonitored,
ActiveRadarrBlock::EditMovieSelectMinimumAvailability,
ActiveRadarrBlock::EditMovieSelectQualityProfile,
ActiveRadarrBlock::EditMoviePathInput,
ActiveRadarrBlock::EditMovieTagsInput,
ActiveRadarrBlock::EditMovieConfirmPrompt,
pub const EDIT_MOVIE_SELECTION_BLOCKS: &[&[ActiveRadarrBlock]] = &[
&[ActiveRadarrBlock::EditMovieToggleMonitored],
&[ActiveRadarrBlock::EditMovieSelectMinimumAvailability],
&[ActiveRadarrBlock::EditMovieSelectQualityProfile],
&[ActiveRadarrBlock::EditMoviePathInput],
&[ActiveRadarrBlock::EditMovieTagsInput],
&[ActiveRadarrBlock::EditMovieConfirmPrompt],
];
pub static DOWNLOADS_BLOCKS: [ActiveRadarrBlock; 3] = [
ActiveRadarrBlock::Downloads,
@@ -426,10 +426,10 @@ pub static DELETE_MOVIE_BLOCKS: [ActiveRadarrBlock; 4] = [
ActiveRadarrBlock::DeleteMovieToggleDeleteFile,
ActiveRadarrBlock::DeleteMovieToggleAddListExclusion,
];
pub static DELETE_MOVIE_SELECTION_BLOCKS: [ActiveRadarrBlock; 3] = [
ActiveRadarrBlock::DeleteMovieToggleDeleteFile,
ActiveRadarrBlock::DeleteMovieToggleAddListExclusion,
ActiveRadarrBlock::DeleteMovieConfirmPrompt,
pub const DELETE_MOVIE_SELECTION_BLOCKS: &[&[ActiveRadarrBlock]] = &[
&[ActiveRadarrBlock::DeleteMovieToggleDeleteFile],
&[ActiveRadarrBlock::DeleteMovieToggleAddListExclusion],
&[ActiveRadarrBlock::DeleteMovieConfirmPrompt],
];
pub static EDIT_INDEXER_BLOCKS: [ActiveRadarrBlock; 10] = [
ActiveRadarrBlock::EditIndexerPrompt,
@@ -443,29 +443,49 @@ pub static EDIT_INDEXER_BLOCKS: [ActiveRadarrBlock; 10] = [
ActiveRadarrBlock::EditIndexerUrlInput,
ActiveRadarrBlock::EditIndexerTagsInput,
];
pub static EDIT_INDEXER_TORRENT_SELECTION_BLOCKS: [ActiveRadarrBlock; 10] = [
ActiveRadarrBlock::EditIndexerNameInput,
ActiveRadarrBlock::EditIndexerToggleEnableRss,
ActiveRadarrBlock::EditIndexerToggleEnableAutomaticSearch,
ActiveRadarrBlock::EditIndexerToggleEnableInteractiveSearch,
ActiveRadarrBlock::EditIndexerConfirmPrompt,
ActiveRadarrBlock::EditIndexerUrlInput,
ActiveRadarrBlock::EditIndexerApiKeyInput,
ActiveRadarrBlock::EditIndexerSeedRatioInput,
ActiveRadarrBlock::EditIndexerTagsInput,
ActiveRadarrBlock::EditIndexerConfirmPrompt,
pub const EDIT_INDEXER_TORRENT_SELECTION_BLOCKS: &[&[ActiveRadarrBlock]] = &[
&[
ActiveRadarrBlock::EditIndexerNameInput,
ActiveRadarrBlock::EditIndexerUrlInput,
],
&[
ActiveRadarrBlock::EditIndexerToggleEnableRss,
ActiveRadarrBlock::EditIndexerApiKeyInput,
],
&[
ActiveRadarrBlock::EditIndexerToggleEnableAutomaticSearch,
ActiveRadarrBlock::EditIndexerSeedRatioInput,
],
&[
ActiveRadarrBlock::EditIndexerToggleEnableInteractiveSearch,
ActiveRadarrBlock::EditIndexerTagsInput,
],
&[
ActiveRadarrBlock::EditIndexerConfirmPrompt,
ActiveRadarrBlock::EditIndexerConfirmPrompt,
],
];
pub static EDIT_INDEXER_NZB_SELECTION_BLOCKS: [ActiveRadarrBlock; 10] = [
ActiveRadarrBlock::EditIndexerNameInput,
ActiveRadarrBlock::EditIndexerToggleEnableRss,
ActiveRadarrBlock::EditIndexerToggleEnableAutomaticSearch,
ActiveRadarrBlock::EditIndexerToggleEnableInteractiveSearch,
ActiveRadarrBlock::EditIndexerConfirmPrompt,
ActiveRadarrBlock::EditIndexerUrlInput,
ActiveRadarrBlock::EditIndexerApiKeyInput,
ActiveRadarrBlock::EditIndexerTagsInput,
ActiveRadarrBlock::EditIndexerConfirmPrompt,
ActiveRadarrBlock::EditIndexerConfirmPrompt,
pub const EDIT_INDEXER_NZB_SELECTION_BLOCKS: &[&[ActiveRadarrBlock]] = &[
&[
ActiveRadarrBlock::EditIndexerNameInput,
ActiveRadarrBlock::EditIndexerUrlInput,
],
&[
ActiveRadarrBlock::EditIndexerToggleEnableRss,
ActiveRadarrBlock::EditIndexerApiKeyInput,
],
&[
ActiveRadarrBlock::EditIndexerToggleEnableAutomaticSearch,
ActiveRadarrBlock::EditIndexerTagsInput,
],
&[
ActiveRadarrBlock::EditIndexerToggleEnableInteractiveSearch,
ActiveRadarrBlock::EditIndexerConfirmPrompt,
],
&[
ActiveRadarrBlock::EditIndexerConfirmPrompt,
ActiveRadarrBlock::EditIndexerConfirmPrompt,
],
];
pub static INDEXER_SETTINGS_BLOCKS: [ActiveRadarrBlock; 10] = [
ActiveRadarrBlock::AllIndexerSettingsPrompt,
@@ -479,17 +499,27 @@ pub static INDEXER_SETTINGS_BLOCKS: [ActiveRadarrBlock; 10] = [
ActiveRadarrBlock::IndexerSettingsTogglePreferIndexerFlags,
ActiveRadarrBlock::IndexerSettingsWhitelistedSubtitleTagsInput,
];
pub static INDEXER_SETTINGS_SELECTION_BLOCKS: [ActiveRadarrBlock; 10] = [
ActiveRadarrBlock::IndexerSettingsMinimumAgeInput,
ActiveRadarrBlock::IndexerSettingsRetentionInput,
ActiveRadarrBlock::IndexerSettingsMaximumSizeInput,
ActiveRadarrBlock::IndexerSettingsTogglePreferIndexerFlags,
ActiveRadarrBlock::IndexerSettingsConfirmPrompt,
ActiveRadarrBlock::IndexerSettingsAvailabilityDelayInput,
ActiveRadarrBlock::IndexerSettingsRssSyncIntervalInput,
ActiveRadarrBlock::IndexerSettingsWhitelistedSubtitleTagsInput,
ActiveRadarrBlock::IndexerSettingsToggleAllowHardcodedSubs,
ActiveRadarrBlock::IndexerSettingsConfirmPrompt,
pub const INDEXER_SETTINGS_SELECTION_BLOCKS: &[&[ActiveRadarrBlock]] = &[
&[
ActiveRadarrBlock::IndexerSettingsMinimumAgeInput,
ActiveRadarrBlock::IndexerSettingsAvailabilityDelayInput,
],
&[
ActiveRadarrBlock::IndexerSettingsRetentionInput,
ActiveRadarrBlock::IndexerSettingsRssSyncIntervalInput,
],
&[
ActiveRadarrBlock::IndexerSettingsMaximumSizeInput,
ActiveRadarrBlock::IndexerSettingsWhitelistedSubtitleTagsInput,
],
&[
ActiveRadarrBlock::IndexerSettingsTogglePreferIndexerFlags,
ActiveRadarrBlock::IndexerSettingsToggleAllowHardcodedSubs,
],
&[
ActiveRadarrBlock::IndexerSettingsConfirmPrompt,
ActiveRadarrBlock::IndexerSettingsConfirmPrompt,
],
];
pub static SYSTEM_DETAILS_BLOCKS: [ActiveRadarrBlock; 5] = [
ActiveRadarrBlock::SystemLogs,
@@ -468,27 +468,27 @@ mod tests {
assert_eq!(
add_movie_block_iter.next().unwrap(),
&ActiveRadarrBlock::AddMovieSelectRootFolder
&[ActiveRadarrBlock::AddMovieSelectRootFolder]
);
assert_eq!(
add_movie_block_iter.next().unwrap(),
&ActiveRadarrBlock::AddMovieSelectMonitor
&[ActiveRadarrBlock::AddMovieSelectMonitor]
);
assert_eq!(
add_movie_block_iter.next().unwrap(),
&ActiveRadarrBlock::AddMovieSelectMinimumAvailability
&[ActiveRadarrBlock::AddMovieSelectMinimumAvailability]
);
assert_eq!(
add_movie_block_iter.next().unwrap(),
&ActiveRadarrBlock::AddMovieSelectQualityProfile
&[ActiveRadarrBlock::AddMovieSelectQualityProfile]
);
assert_eq!(
add_movie_block_iter.next().unwrap(),
&ActiveRadarrBlock::AddMovieTagsInput
&[ActiveRadarrBlock::AddMovieTagsInput]
);
assert_eq!(
add_movie_block_iter.next().unwrap(),
&ActiveRadarrBlock::AddMovieConfirmPrompt
&[ActiveRadarrBlock::AddMovieConfirmPrompt]
);
assert_eq!(add_movie_block_iter.next(), None);
}
@@ -499,27 +499,27 @@ mod tests {
assert_eq!(
edit_movie_block_iter.next().unwrap(),
&ActiveRadarrBlock::EditMovieToggleMonitored
&[ActiveRadarrBlock::EditMovieToggleMonitored]
);
assert_eq!(
edit_movie_block_iter.next().unwrap(),
&ActiveRadarrBlock::EditMovieSelectMinimumAvailability
&[ActiveRadarrBlock::EditMovieSelectMinimumAvailability]
);
assert_eq!(
edit_movie_block_iter.next().unwrap(),
&ActiveRadarrBlock::EditMovieSelectQualityProfile
&[ActiveRadarrBlock::EditMovieSelectQualityProfile]
);
assert_eq!(
edit_movie_block_iter.next().unwrap(),
&ActiveRadarrBlock::EditMoviePathInput
&[ActiveRadarrBlock::EditMoviePathInput]
);
assert_eq!(
edit_movie_block_iter.next().unwrap(),
&ActiveRadarrBlock::EditMovieTagsInput
&[ActiveRadarrBlock::EditMovieTagsInput]
);
assert_eq!(
edit_movie_block_iter.next().unwrap(),
&ActiveRadarrBlock::EditMovieConfirmPrompt
&[ActiveRadarrBlock::EditMovieConfirmPrompt]
);
assert_eq!(edit_movie_block_iter.next(), None);
}
@@ -530,27 +530,27 @@ mod tests {
assert_eq!(
edit_collection_block_iter.next().unwrap(),
&ActiveRadarrBlock::EditCollectionToggleMonitored
&[ActiveRadarrBlock::EditCollectionToggleMonitored]
);
assert_eq!(
edit_collection_block_iter.next().unwrap(),
&ActiveRadarrBlock::EditCollectionSelectMinimumAvailability
&[ActiveRadarrBlock::EditCollectionSelectMinimumAvailability]
);
assert_eq!(
edit_collection_block_iter.next().unwrap(),
&ActiveRadarrBlock::EditCollectionSelectQualityProfile
&[ActiveRadarrBlock::EditCollectionSelectQualityProfile]
);
assert_eq!(
edit_collection_block_iter.next().unwrap(),
&ActiveRadarrBlock::EditCollectionRootFolderPathInput
&[ActiveRadarrBlock::EditCollectionRootFolderPathInput]
);
assert_eq!(
edit_collection_block_iter.next().unwrap(),
&ActiveRadarrBlock::EditCollectionToggleSearchOnAdd
&[ActiveRadarrBlock::EditCollectionToggleSearchOnAdd]
);
assert_eq!(
edit_collection_block_iter.next().unwrap(),
&ActiveRadarrBlock::EditCollectionConfirmPrompt
&[ActiveRadarrBlock::EditCollectionConfirmPrompt]
);
assert_eq!(edit_collection_block_iter.next(), None);
}
@@ -561,15 +561,15 @@ mod tests {
assert_eq!(
delete_movie_block_iter.next().unwrap(),
&ActiveRadarrBlock::DeleteMovieToggleDeleteFile
&[ActiveRadarrBlock::DeleteMovieToggleDeleteFile]
);
assert_eq!(
delete_movie_block_iter.next().unwrap(),
&ActiveRadarrBlock::DeleteMovieToggleAddListExclusion
&[ActiveRadarrBlock::DeleteMovieToggleAddListExclusion]
);
assert_eq!(
delete_movie_block_iter.next().unwrap(),
&ActiveRadarrBlock::DeleteMovieConfirmPrompt
&[ActiveRadarrBlock::DeleteMovieConfirmPrompt]
);
assert_eq!(delete_movie_block_iter.next(), None);
}
@@ -581,43 +581,38 @@ mod tests {
assert_eq!(
edit_indexer_torrent_selection_block_iter.next().unwrap(),
&ActiveRadarrBlock::EditIndexerNameInput
&[
ActiveRadarrBlock::EditIndexerNameInput,
ActiveRadarrBlock::EditIndexerUrlInput,
]
);
assert_eq!(
edit_indexer_torrent_selection_block_iter.next().unwrap(),
&ActiveRadarrBlock::EditIndexerToggleEnableRss
&[
ActiveRadarrBlock::EditIndexerToggleEnableRss,
ActiveRadarrBlock::EditIndexerApiKeyInput,
]
);
assert_eq!(
edit_indexer_torrent_selection_block_iter.next().unwrap(),
&ActiveRadarrBlock::EditIndexerToggleEnableAutomaticSearch
&[
ActiveRadarrBlock::EditIndexerToggleEnableAutomaticSearch,
ActiveRadarrBlock::EditIndexerSeedRatioInput,
]
);
assert_eq!(
edit_indexer_torrent_selection_block_iter.next().unwrap(),
&ActiveRadarrBlock::EditIndexerToggleEnableInteractiveSearch
&[
ActiveRadarrBlock::EditIndexerToggleEnableInteractiveSearch,
ActiveRadarrBlock::EditIndexerTagsInput,
]
);
assert_eq!(
edit_indexer_torrent_selection_block_iter.next().unwrap(),
&ActiveRadarrBlock::EditIndexerConfirmPrompt
);
assert_eq!(
edit_indexer_torrent_selection_block_iter.next().unwrap(),
&ActiveRadarrBlock::EditIndexerUrlInput
);
assert_eq!(
edit_indexer_torrent_selection_block_iter.next().unwrap(),
&ActiveRadarrBlock::EditIndexerApiKeyInput
);
assert_eq!(
edit_indexer_torrent_selection_block_iter.next().unwrap(),
&ActiveRadarrBlock::EditIndexerSeedRatioInput
);
assert_eq!(
edit_indexer_torrent_selection_block_iter.next().unwrap(),
&ActiveRadarrBlock::EditIndexerTagsInput
);
assert_eq!(
edit_indexer_torrent_selection_block_iter.next().unwrap(),
&ActiveRadarrBlock::EditIndexerConfirmPrompt
&[
ActiveRadarrBlock::EditIndexerConfirmPrompt,
ActiveRadarrBlock::EditIndexerConfirmPrompt,
]
);
assert_eq!(edit_indexer_torrent_selection_block_iter.next(), None);
}
@@ -628,43 +623,38 @@ mod tests {
assert_eq!(
edit_indexer_nzb_selection_block_iter.next().unwrap(),
&ActiveRadarrBlock::EditIndexerNameInput
&[
ActiveRadarrBlock::EditIndexerNameInput,
ActiveRadarrBlock::EditIndexerUrlInput,
]
);
assert_eq!(
edit_indexer_nzb_selection_block_iter.next().unwrap(),
&ActiveRadarrBlock::EditIndexerToggleEnableRss
&[
ActiveRadarrBlock::EditIndexerToggleEnableRss,
ActiveRadarrBlock::EditIndexerApiKeyInput,
]
);
assert_eq!(
edit_indexer_nzb_selection_block_iter.next().unwrap(),
&ActiveRadarrBlock::EditIndexerToggleEnableAutomaticSearch
&[
ActiveRadarrBlock::EditIndexerToggleEnableAutomaticSearch,
ActiveRadarrBlock::EditIndexerTagsInput,
]
);
assert_eq!(
edit_indexer_nzb_selection_block_iter.next().unwrap(),
&ActiveRadarrBlock::EditIndexerToggleEnableInteractiveSearch
&[
ActiveRadarrBlock::EditIndexerToggleEnableInteractiveSearch,
ActiveRadarrBlock::EditIndexerConfirmPrompt,
]
);
assert_eq!(
edit_indexer_nzb_selection_block_iter.next().unwrap(),
&ActiveRadarrBlock::EditIndexerConfirmPrompt
);
assert_eq!(
edit_indexer_nzb_selection_block_iter.next().unwrap(),
&ActiveRadarrBlock::EditIndexerUrlInput
);
assert_eq!(
edit_indexer_nzb_selection_block_iter.next().unwrap(),
&ActiveRadarrBlock::EditIndexerApiKeyInput
);
assert_eq!(
edit_indexer_nzb_selection_block_iter.next().unwrap(),
&ActiveRadarrBlock::EditIndexerTagsInput
);
assert_eq!(
edit_indexer_nzb_selection_block_iter.next().unwrap(),
&ActiveRadarrBlock::EditIndexerConfirmPrompt
);
assert_eq!(
edit_indexer_nzb_selection_block_iter.next().unwrap(),
&ActiveRadarrBlock::EditIndexerConfirmPrompt
&[
ActiveRadarrBlock::EditIndexerConfirmPrompt,
ActiveRadarrBlock::EditIndexerConfirmPrompt,
]
);
assert_eq!(edit_indexer_nzb_selection_block_iter.next(), None);
}
@@ -675,43 +665,38 @@ mod tests {
assert_eq!(
indexer_settings_block_iter.next().unwrap(),
&ActiveRadarrBlock::IndexerSettingsMinimumAgeInput
&[
ActiveRadarrBlock::IndexerSettingsMinimumAgeInput,
ActiveRadarrBlock::IndexerSettingsAvailabilityDelayInput,
]
);
assert_eq!(
indexer_settings_block_iter.next().unwrap(),
&ActiveRadarrBlock::IndexerSettingsRetentionInput
&[
ActiveRadarrBlock::IndexerSettingsRetentionInput,
ActiveRadarrBlock::IndexerSettingsRssSyncIntervalInput,
]
);
assert_eq!(
indexer_settings_block_iter.next().unwrap(),
&ActiveRadarrBlock::IndexerSettingsMaximumSizeInput
&[
ActiveRadarrBlock::IndexerSettingsMaximumSizeInput,
ActiveRadarrBlock::IndexerSettingsWhitelistedSubtitleTagsInput,
]
);
assert_eq!(
indexer_settings_block_iter.next().unwrap(),
&ActiveRadarrBlock::IndexerSettingsTogglePreferIndexerFlags
&[
ActiveRadarrBlock::IndexerSettingsTogglePreferIndexerFlags,
ActiveRadarrBlock::IndexerSettingsToggleAllowHardcodedSubs,
]
);
assert_eq!(
indexer_settings_block_iter.next().unwrap(),
&ActiveRadarrBlock::IndexerSettingsConfirmPrompt
);
assert_eq!(
indexer_settings_block_iter.next().unwrap(),
&ActiveRadarrBlock::IndexerSettingsAvailabilityDelayInput
);
assert_eq!(
indexer_settings_block_iter.next().unwrap(),
&ActiveRadarrBlock::IndexerSettingsRssSyncIntervalInput
);
assert_eq!(
indexer_settings_block_iter.next().unwrap(),
&ActiveRadarrBlock::IndexerSettingsWhitelistedSubtitleTagsInput
);
assert_eq!(
indexer_settings_block_iter.next().unwrap(),
&ActiveRadarrBlock::IndexerSettingsToggleAllowHardcodedSubs
);
assert_eq!(
indexer_settings_block_iter.next().unwrap(),
&ActiveRadarrBlock::IndexerSettingsConfirmPrompt
&[
ActiveRadarrBlock::IndexerSettingsConfirmPrompt,
ActiveRadarrBlock::IndexerSettingsConfirmPrompt,
]
);
assert_eq!(indexer_settings_block_iter.next(), None);
}