Skip to content

Commit

Permalink
fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
GyulyVGC committed Dec 10, 2023
1 parent 4a80c88 commit 9045132
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
6 changes: 2 additions & 4 deletions src/gui/pages/types/settings_page.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,13 @@ mod tests {
SettingsPage::Appearance.previous(),
SettingsPage::Notifications
);
assert_eq!(SettingsPage::Language.previous(), SettingsPage::Appearance);
assert_eq!(SettingsPage::General.previous(), SettingsPage::Language);
assert_eq!(SettingsPage::General.previous(), SettingsPage::Appearance);
}

#[test]
fn test_next_settings_page() {
assert_eq!(SettingsPage::Notifications.next(), SettingsPage::Appearance);
assert_eq!(SettingsPage::Appearance.next(), SettingsPage::Language);
assert_eq!(SettingsPage::Language.next(), SettingsPage::General);
assert_eq!(SettingsPage::Appearance.next(), SettingsPage::General);
assert_eq!(SettingsPage::General.next(), SettingsPage::Notifications);
}
}
12 changes: 6 additions & 6 deletions src/gui/types/sniffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -870,24 +870,24 @@ mod tests {
sniffer.update(Message::OpenSettings(SettingsPage::Appearance));
assert_eq!(sniffer.modal, None);
assert_eq!(sniffer.settings_page, Some(SettingsPage::Appearance));
sniffer.update(Message::OpenSettings(SettingsPage::Language));
sniffer.update(Message::OpenSettings(SettingsPage::General));
assert_eq!(sniffer.modal, None);
assert_eq!(sniffer.settings_page, Some(SettingsPage::Language));
assert_eq!(sniffer.settings_page, Some(SettingsPage::General));
// try opening modal with settings opened
sniffer.update(Message::ShowModal(MyModal::Quit));
assert_eq!(sniffer.modal, None);
assert_eq!(sniffer.settings_page, Some(SettingsPage::Language));
assert_eq!(sniffer.settings_page, Some(SettingsPage::General));
assert_eq!(sniffer.last_opened_setting, SettingsPage::Notifications);
// close settings
sniffer.update(Message::CloseSettings);
assert_eq!(sniffer.modal, None);
assert_eq!(sniffer.settings_page, None);
assert_eq!(sniffer.last_opened_setting, SettingsPage::Language);
assert_eq!(sniffer.last_opened_setting, SettingsPage::General);
// reopen settings
sniffer.update(Message::OpenLastSettings);
assert_eq!(sniffer.modal, None);
assert_eq!(sniffer.settings_page, Some(SettingsPage::Language));
assert_eq!(sniffer.last_opened_setting, SettingsPage::Language);
assert_eq!(sniffer.settings_page, Some(SettingsPage::General));
assert_eq!(sniffer.last_opened_setting, SettingsPage::General);
// switch settings page
sniffer.update(Message::OpenSettings(SettingsPage::Appearance));
assert_eq!(sniffer.modal, None);
Expand Down

0 comments on commit 9045132

Please sign in to comment.